Skip to content

Commit c6e3fe5

Browse files
MaxKlessclaude
andcommitted
test(vscode-e2e): reuse built-in e2e project, exact-match project row
Drop the pre-launch workspace seed that was breaking the runner startup. Use the react-standalone fixture's built-in `e2e` project as the non-default project for the projects-view case instead. Tighten the projects-view row locator to exact `aria-label=` match so the `e2e` project name doesn't collide with the isolated workspace's `e2e#######` directory name via substring matching. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c692718 commit c6e3fe5

3 files changed

Lines changed: 6 additions & 33 deletions

File tree

apps/vscode-e2e/base-test.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ export interface LaunchOptions {
2525
workspacePath?: string;
2626
}
2727

28-
export const SEEDED_PROJECT_NAME = 'extra-project';
29-
3028
const RECORD_VSCODE_VIDEO =
3129
process.env.PLAYWRIGHT_VSCODE_VIDEO === '1' ||
3230
process.env.PLAYWRIGHT_VSCODE_VIDEO === 'true';
@@ -100,31 +98,6 @@ function getVideoRecordingOptions(
10098
};
10199
}
102100

103-
function seedProjectsViewTestProject(workspacePath: string): void {
104-
const projectRoot = join(workspacePath, SEEDED_PROJECT_NAME);
105-
106-
mkdirSync(join(projectRoot, 'src'), { recursive: true });
107-
writeFileSync(
108-
join(projectRoot, 'src', 'index.ts'),
109-
'export const extraProject = "extra-project";\n',
110-
);
111-
writeFileSync(
112-
join(projectRoot, 'project.json'),
113-
JSON.stringify(
114-
{
115-
$schema: '../node_modules/nx/schemas/project-schema.json',
116-
name: SEEDED_PROJECT_NAME,
117-
projectType: 'library',
118-
root: SEEDED_PROJECT_NAME,
119-
sourceRoot: `${SEEDED_PROJECT_NAME}/src`,
120-
targets: {},
121-
},
122-
null,
123-
2,
124-
),
125-
);
126-
}
127-
128101
export const test = base.extend<
129102
{ nxConsole: NxConsolePage },
130103
{
@@ -176,7 +149,6 @@ export const test = base.extend<
176149
options: simpleReactWorkspaceOptions,
177150
});
178151
const workspacePath = join(e2eCwd, workspaceName);
179-
seedProjectsViewTestProject(workspacePath);
180152
const { recordVideo, savedVideoPath } = getVideoRecordingOptions(
181153
workerInfo.workerIndex,
182154
workspaceName,

apps/vscode-e2e/page-objects/nx-console-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class NxConsolePage extends VSCodePage {
6060

6161
getProject(name: string): Locator {
6262
return this.projectsSection.locator(
63-
`.monaco-list-row[aria-label*="${name}"]`,
63+
`.monaco-list-row[aria-label=${JSON.stringify(name)}]`,
6464
);
6565
}
6666

apps/vscode-e2e/specs/generate-ui-entry-points.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { posix } from 'node:path';
2-
import { SEEDED_PROJECT_NAME, test, expect } from '../base-test';
2+
import { test, expect } from '../base-test';
33

44
const GENERATE_UI_COMMAND_LABEL = 'Nx: Generate (UI)';
55
const GENERATOR_LABEL = '@nx/react - component';
6+
const PROJECT_VIEW_PROJECT_NAME = 'e2e';
67
const TARGET_FILE_PATH = 'src/main.tsx';
78

89
test('Generate UI opens from the command palette', async ({ nxConsole }) => {
@@ -25,10 +26,10 @@ test('Generate UI opens from the projects view project action', async ({
2526
}) => {
2627
const { workspaceName } = await getWorkspaceContext(nxConsole);
2728

28-
expect(SEEDED_PROJECT_NAME).not.toBe(workspaceName);
29+
expect(PROJECT_VIEW_PROJECT_NAME).not.toBe(workspaceName);
2930

3031
await nxConsole.resetUI();
31-
await nxConsole.openGenerateUiFromProjectTreeItem(SEEDED_PROJECT_NAME);
32+
await nxConsole.openGenerateUiFromProjectTreeItem(PROJECT_VIEW_PROJECT_NAME);
3233
await nxConsole.quickPick.selectItem(GENERATOR_LABEL);
3334

3435
await expectGenerateUiToBeOpen(nxConsole);
@@ -37,7 +38,7 @@ test('Generate UI opens from the projects view project action', async ({
3738
.not.toBe(workspaceName);
3839
await expect
3940
.poll(() => nxConsole.getGenerateUiFieldValue('project'))
40-
.toBe(SEEDED_PROJECT_NAME);
41+
.toBe(PROJECT_VIEW_PROJECT_NAME);
4142
});
4243

4344
test('Generate UI opens from the Explorer file context menu', async ({

0 commit comments

Comments
 (0)