Skip to content
Snippets Groups Projects
Unverified Commit 865a5aac authored by Júlia Jaeger Foresti's avatar Júlia Jaeger Foresti Committed by GitHub
Browse files

tests: rewrite `getByRole` buttons to match exact string (#32652)

parent d3c493b6
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ test.describe.serial('channel-management', () => {
await page.keyboard.press('ArrowRight');
await page.keyboard.press('ArrowRight');
await expect(poHomeChannel.roomHeaderToolbar.getByRole('button', { name: 'Threads' })).toBeFocused();
await expect(poHomeChannel.roomHeaderToolbar.getByRole('button', { name: 'Threads', exact: true })).toBeFocused();
});
test('should move the focus away from toolbar using tab key', async ({ page }) => {
......
......@@ -224,7 +224,7 @@ export class Admin {
}
get btnUsersInRole(): Locator {
return this.page.getByRole('dialog').getByRole('button', { name: 'Users in role' });
return this.page.getByRole('dialog').getByRole('button', { name: 'Users in role', exact: true });
}
get inputRoom(): Locator {
......@@ -236,7 +236,7 @@ export class Admin {
}
get btnAdd(): Locator {
return this.page.getByRole('button', { name: 'Add' });
return this.page.getByRole('button', { name: 'Add', exact: true });
}
getUserRowByUsername(username: string): Locator {
......@@ -244,19 +244,19 @@ export class Admin {
}
get btnBack(): Locator {
return this.page.getByRole('button', { name: 'Back' });
return this.page.getByRole('button', { name: 'Back', exact: true });
}
get btnNew(): Locator {
return this.page.getByRole('button', { name: 'New' });
return this.page.getByRole('button', { name: 'New', exact: true });
}
get btnDelete(): Locator {
return this.page.getByRole('button', { name: 'Delete' });
return this.page.getByRole('button', { name: 'Delete', exact: true });
}
get btnInstructions(): Locator {
return this.page.getByRole('button', { name: 'Instructions' });
return this.page.getByRole('button', { name: 'Instructions', exact: true });
}
get inputName(): Locator {
......@@ -284,11 +284,11 @@ export class Admin {
}
getAccordionBtnByName(name: string): Locator {
return this.page.getByRole('button', { name });
return this.page.getByRole('button', { name, exact: true });
}
get btnFullScreen(): Locator {
return this.page.getByRole('button', { name: 'Full Screen' });
return this.page.getByRole('button', { name: 'Full Screen', exact: true });
}
async dropdownFilterRoomType(text = 'All rooms'): Promise<Locator> {
......
......@@ -98,7 +98,7 @@ export class HomeContent {
await this.page.locator('[data-qa-type="message"]').last().hover();
await this.page.locator('role=button[name="Forward message"]').click();
await this.page.getByRole('textbox', { name: 'Person or Channel' }).click();
await this.page.getByRole('textbox', { name: 'Person or Channel', exact: true }).click();
await this.page.keyboard.type(chatName);
await this.page.locator('#position-container').getByText(chatName).waitFor();
await this.page.locator('#position-container').getByText(chatName).click();
......@@ -192,7 +192,7 @@ export class HomeContent {
}
get btnMenuMoreActions() {
return this.page.getByRole('button', { name: 'More actions' });
return this.page.getByRole('button', { name: 'More actions', exact: true });
}
get userCard(): Locator {
......@@ -236,7 +236,7 @@ export class HomeContent {
}
get imageGallery(): Locator {
return this.page.getByRole('dialog', { name: 'Image gallery' });
return this.page.getByRole('dialog', { name: 'Image gallery', exact: true });
}
get imageGalleryImage(): Locator {
......
......@@ -44,7 +44,7 @@ export class HomeFlextabRoom {
}
get pruneAccordion(): Locator {
return this.page.getByRole('dialog').getByRole('button', { name: 'Prune' });
return this.page.getByRole('dialog').getByRole('button', { name: 'Prune', exact: true });
}
getMaxAgeLabel(maxAge = '30') {
......
......@@ -38,7 +38,7 @@ export class HomeSidenav {
}
get userProfileMenu(): Locator {
return this.page.getByRole('button', { name: 'User menu' });
return this.page.getByRole('button', { name: 'User menu', exact: true });
}
get sidebarChannelsList(): Locator {
......@@ -50,7 +50,7 @@ export class HomeSidenav {
}
async setDisplayMode(mode: 'Extended' | 'Medium' | 'Condensed'): Promise<void> {
await this.sidebarToolbar.getByRole('button', { name: 'Display' }).click();
await this.sidebarToolbar.getByRole('button', { name: 'Display', exact: true }).click();
await this.sidebarToolbar.getByRole('menuitemcheckbox', { name: mode }).click();
await this.sidebarToolbar.click();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment