From 32fa9c0ae565014c8207e8d6bd490bff2038ffde Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Mon, 29 Sep 2025 12:30:54 -0700 Subject: [PATCH] Revert "feat: add --agents option for initializing agents (#160)" This reverts commit 3e9c75971ee520a65f1ec896d0f6566e65a968e2. --- assets/seed.spec.js | 8 ------- assets/seed.spec.ts | 7 ------ package-lock.json | 46 +++++++++++++++++++------------------- package.json | 4 ++-- src/{program.ts => cli.ts} | 3 +-- src/generator.ts | 15 ------------- tests/integration.spec.ts | 40 --------------------------------- 7 files changed, 26 insertions(+), 97 deletions(-) delete mode 100644 assets/seed.spec.js delete mode 100644 assets/seed.spec.ts rename src/{program.ts => cli.ts} (93%) diff --git a/assets/seed.spec.js b/assets/seed.spec.js deleted file mode 100644 index 8efb001..0000000 --- a/assets/seed.spec.js +++ /dev/null @@ -1,8 +0,0 @@ -// @ts-check -import { test, expect } from '@playwright/test'; - -test.describe('Test group', () => { - test('seed', async ({ page }) => { - // generate code here. - }); -}); diff --git a/assets/seed.spec.ts b/assets/seed.spec.ts deleted file mode 100644 index ef5ce4c..0000000 --- a/assets/seed.spec.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test.describe('Test group', () => { - test('seed', async ({ page }) => { - // generate code here. - }); -}); diff --git a/package-lock.json b/package-lock.json index 0a6fe83..6a4b60f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "create-playwright": "index.js" }, "devDependencies": { - "@playwright/test": "1.56.0-alpha-1758839353000", + "@playwright/test": "^1.49.1", "@types/ini": "^4.1.1", "@types/node": "^18.19.33", "ansi-colors": "^4.1.1", @@ -452,13 +452,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.56.0-alpha-1758839353000", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.56.0-alpha-1758839353000.tgz", - "integrity": "sha512-DvUSQPACJudnTIHi+SsVmOa/VzM1f5UfvJpRnYxr9zpgiir4lh4yrle8eNS1+rjzCup4Kp0sQwOQDTHyAKBmNA==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.49.1.tgz", + "integrity": "sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.56.0-alpha-1758839353000" + "playwright": "1.49.1" }, "bin": { "playwright": "cli.js" @@ -579,13 +579,13 @@ } }, "node_modules/playwright": { - "version": "1.56.0-alpha-1758839353000", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.0-alpha-1758839353000.tgz", - "integrity": "sha512-DXPQnUD2E+ZNg/zX5lJgaBJwC2+X86kaRncami0SRXAHspvp+N3pt9PmbqnqmLduFnKnpf8t1tvxZ7A3S+ETfQ==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.49.1.tgz", + "integrity": "sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.56.0-alpha-1758839353000" + "playwright-core": "1.49.1" }, "bin": { "playwright": "cli.js" @@ -598,9 +598,9 @@ } }, "node_modules/playwright-core": { - "version": "1.56.0-alpha-1758839353000", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.0-alpha-1758839353000.tgz", - "integrity": "sha512-9Z6ZiYO7fOHzIdXVMqzYmsmsM8dmlbsIeVoLwbq8PiHyGl3Kwk0Jl4JCMBwT9Q+mOTbki8Cd+zins4ASDYNZAg==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.49.1.tgz", + "integrity": "sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==", "dev": true, "license": "Apache-2.0", "bin": { @@ -807,12 +807,12 @@ "optional": true }, "@playwright/test": { - "version": "1.56.0-alpha-1758839353000", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.56.0-alpha-1758839353000.tgz", - "integrity": "sha512-DvUSQPACJudnTIHi+SsVmOa/VzM1f5UfvJpRnYxr9zpgiir4lh4yrle8eNS1+rjzCup4Kp0sQwOQDTHyAKBmNA==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.49.1.tgz", + "integrity": "sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==", "dev": true, "requires": { - "playwright": "1.56.0-alpha-1758839353000" + "playwright": "1.49.1" } }, "@types/ini": { @@ -898,19 +898,19 @@ "dev": true }, "playwright": { - "version": "1.56.0-alpha-1758839353000", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.0-alpha-1758839353000.tgz", - "integrity": "sha512-DXPQnUD2E+ZNg/zX5lJgaBJwC2+X86kaRncami0SRXAHspvp+N3pt9PmbqnqmLduFnKnpf8t1tvxZ7A3S+ETfQ==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.49.1.tgz", + "integrity": "sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==", "dev": true, "requires": { "fsevents": "2.3.2", - "playwright-core": "1.56.0-alpha-1758839353000" + "playwright-core": "1.49.1" } }, "playwright-core": { - "version": "1.56.0-alpha-1758839353000", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.0-alpha-1758839353000.tgz", - "integrity": "sha512-9Z6ZiYO7fOHzIdXVMqzYmsmsM8dmlbsIeVoLwbq8PiHyGl3Kwk0Jl4JCMBwT9Q+mOTbki8Cd+zins4ASDYNZAg==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.49.1.tgz", + "integrity": "sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==", "dev": true }, "typescript": { diff --git a/package.json b/package.json index ec66e56..518ef55 100644 --- a/package.json +++ b/package.json @@ -19,14 +19,14 @@ }, "license": "Apache-2.0", "scripts": { - "build": "esbuild --bundle src/program.ts --outfile=lib/index.js --platform=node --target=ES2019", + "build": "esbuild --bundle src/cli.ts --outfile=lib/index.js --platform=node --target=ES2019", "clean": "rm -rf lib", "watch": "npm run build -- --watch", "test": "playwright test", "prepublish": "npm run build" }, "devDependencies": { - "@playwright/test": "1.56.0-alpha-1758839353000", + "@playwright/test": "^1.49.1", "@types/ini": "^4.1.1", "@types/node": "^18.19.33", "ansi-colors": "^4.1.1", diff --git a/src/program.ts b/src/cli.ts similarity index 93% rename from src/program.ts rename to src/cli.ts index f7d2bf1..278d6b9 100644 --- a/src/program.ts +++ b/src/cli.ts @@ -33,9 +33,9 @@ program .option('--ct', 'install Playwright Component testing') .option('--quiet', 'do not ask for interactive input prompts') .option('--gha', 'install GitHub Actions') - .option('--agents ', 'initialize repository agents for the specified agentic loop provider (vscode, claude or opencode)') .option('--lang ', 'language to use (js, TypeScript)', 'TypeScript') .action(async (rootDir, options) => { + const cliOptions: CliOptions = { browser: options.browser, noBrowsers: !options.browsers, @@ -46,7 +46,6 @@ program ct: options.ct, quiet: options.quiet, gha: options.gha, - agents: options.agents, lang: options.lang, }; const resolvedRootDir = path.resolve(process.cwd(), rootDir || '.'); diff --git a/src/generator.ts b/src/generator.ts index f1b6275..178d37e 100644 --- a/src/generator.ts +++ b/src/generator.ts @@ -45,7 +45,6 @@ export type CliOptions = { ct?: boolean; quiet?: boolean; gha?: boolean; - agents?: string; }; export class Generator { @@ -176,7 +175,6 @@ export class Generator { let ctPackageName; let installExamples = !this.options.noExamples; - if (answers.framework) { ctPackageName = `@playwright/experimental-ct-${answers.framework}`; installExamples = false; @@ -190,11 +188,6 @@ export class Generator { }, sections)); } - if (this.options.agents) { - installExamples = false; - files.set(path.join(answers.testDir, `seed.spec.${fileExtension}`), this._readAsset(`seed.spec.${fileExtension}`)); - } - if (answers.installGitHubActions) { const npmrcExists = fs.existsSync(path.join(this.rootDir, '.npmrc')); const packageLockDisabled = npmrcExists && ini.parse(fs.readFileSync(path.join(this.rootDir, '.npmrc'), 'utf-8'))['package-lock'] === false; @@ -263,14 +256,6 @@ export class Generator { }); } - if (this.options.agents) { - commands.push({ - name: 'Initializing Playwright agents', - command: this.packageManager.npx('playwright', `init-agents --loop=${this.options.agents}`), - phase: 'post', - }); - } - return { files, commands }; } diff --git a/tests/integration.spec.ts b/tests/integration.spec.ts index c091d47..35153ec 100644 --- a/tests/integration.spec.ts +++ b/tests/integration.spec.ts @@ -185,44 +185,4 @@ test('is proper yarn berry', async ({ packageManager, exec }) => { test.skip(packageManager !== 'yarn-berry'); const result = await exec('yarn --version', [], { cwd: test.info().outputDir, shell: true }); expect(result.stdout).toMatch(/^4\./); -}); - -test('should create seed.spec.ts file when --agents=vscode is specified', async ({ run, dir, packageManager }) => { - test.skip(packageManager !== 'npm'); - - await run(['--agents=vscode', '--next'], { installGitHubActions: false, testDir: 'tests', language: 'TypeScript', installPlaywrightDependencies: false, installPlaywrightBrowsers: false }); - - expect(fs.existsSync(path.join(dir, 'tests/seed.spec.ts'))).toBeTruthy(); - - const seedSpecContent = fs.readFileSync(path.join(dir, 'tests/seed.spec.ts'), 'utf8'); - expect(seedSpecContent).toContain('test(\'seed\', async ({ page }) => {'); - expect(seedSpecContent).toContain('// generate code here.'); - - // Verify that example.spec.ts is NOT created when agents option is used - expect(fs.existsSync(path.join(dir, 'tests/example.spec.ts'))).toBeFalsy(); - - // Verify other expected files are still created - expect(fs.existsSync(path.join(dir, 'package.json'))).toBeTruthy(); - expect(fs.existsSync(path.join(dir, 'playwright.config.ts'))).toBeTruthy(); -}); - -test('should create seed.spec.js file when --agents=vscode is specified with JavaScript', async ({ run, dir, packageManager }) => { - test.skip(packageManager !== 'npm'); - - await run(['--agents=vscode', '--next'], { installGitHubActions: false, testDir: 'tests', language: 'JavaScript', installPlaywrightDependencies: false, installPlaywrightBrowsers: false }); - - // Verify that seed.spec.js file is still created before the command fails - expect(fs.existsSync(path.join(dir, 'tests/seed.spec.js'))).toBeTruthy(); - - // Verify that the seed.spec.js file has the expected content - const seedSpecContent = fs.readFileSync(path.join(dir, 'tests/seed.spec.js'), 'utf8'); - expect(seedSpecContent).toContain('test(\'seed\', async ({ page }) => {'); - expect(seedSpecContent).toContain('// generate code here.'); - - // Verify that example.spec.js is NOT created when agents option is used - expect(fs.existsSync(path.join(dir, 'tests/example.spec.js'))).toBeFalsy(); - - // Verify other expected files are still created - expect(fs.existsSync(path.join(dir, 'package.json'))).toBeTruthy(); - expect(fs.existsSync(path.join(dir, 'playwright.config.js'))).toBeTruthy(); }); \ No newline at end of file