Skip to content

Commit

Permalink
fix: use more specific locators for dialog buttons in playwright tests
Browse files Browse the repository at this point in the history
Contributed on behalf of STMicroelectronics

Signed-off-by: Olaf Lessenich <[email protected]>
  • Loading branch information
xai committed Aug 29, 2023
1 parent a5b5d28 commit ad81bb8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/playwright/src/tests/theia-electron-app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ test.describe('Theia Electron Application', () => {
await (await menuBar.openMenu('File')).clickMenuItem('Open File...');
const fileDialog = await app.page.waitForSelector('div[class="dialogBlock"]');
expect(await fileDialog.isVisible()).toBe(true);
await app.page.getByRole('button', { name: 'Cancel' }).click();
await app.page.locator('#theia-dialog-shell').getByRole('button', { name: 'Cancel' }).click();
expect(await fileDialog.isVisible()).toBe(false);
});

Expand All @@ -79,7 +79,7 @@ test.describe('Theia Electron Application', () => {

const fileEntry = app.page.getByText('sample.txt');
await fileEntry.click();
await app.page.getByRole('button', { name: 'Open' }).click();
await app.page.locator('#theia-dialog-shell').getByRole('button', { name: 'Open' }).click();

const span = await app.page.waitForSelector('span:has-text("content line 2")');
expect(await span.isVisible()).toBe(true);
Expand Down
2 changes: 1 addition & 1 deletion examples/playwright/src/tests/theia-workspace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test.describe('Theia Workspace', () => {

const fileEntry = app.page.getByText('sample.txt');
await fileEntry.click();
await app.page.getByRole('button', { name: 'Open' }).click();
await app.page.locator('#theia-dialog-shell').getByRole('button', { name: 'Open' }).click();

const span = await app.page.waitForSelector('span:has-text("content line 2")');
expect(await span.isVisible()).toBe(true);
Expand Down

0 comments on commit ad81bb8

Please sign in to comment.