Skip to content
Snippets Groups Projects
Unverified Commit 81cee2eb authored by Guilherme Gazzo's avatar Guilherme Gazzo Committed by GitHub
Browse files

Chore: improve some e2e selectors (#27936)

parent 91600e13
No related merge requests found
......@@ -34,21 +34,6 @@ export default async function (): Promise<void> {
await page.waitForTimeout(1000);
if (page.url().includes('setup-wizard')) {
await page.locator('[name="organizationName"]').type('any_name');
await page.locator('[name="organizationType"]').click();
await page.locator('.rcx-options .rcx-option:first-child >> text="Community"').click();
await page.locator('[name="organizationIndustry"]').click();
await page.locator('.rcx-options .rcx-option:first-child >> text="Aerospace & Defense"').click();
await page.locator('[name="organizationSize"]').click();
await page.locator('.rcx-options .rcx-option:first-child >> text="1-10 people"').click();
await page.locator('[name="country"]').click();
await page.locator('.rcx-options .rcx-option:first-child >> text="Afghanistan"').click();
await page.locator('.rcx-button--primary.rcx-button >> text="Next"').click();
await page.locator('a.rcx-box.rcx-box--full >> text="Continue as standalone"').click();
await page.locator('.rcx-button--primary.rcx-button >> text="Confirm"').click();
}
await page.context().storageState({ path: `admin-session.json` });
await browser.close();
......
......@@ -14,10 +14,47 @@ export default async function injectInitialData() {
),
);
await connection
.db()
.collection('rocketchat_settings')
.updateOne({ _id: 'API_Enable_Rate_Limiter_Dev' }, { $set: { value: false } });
await Promise.all(
[
{
_id: 'API_Enable_Rate_Limiter_Dev',
value: false,
},
{
_id: 'Show_Setup_Wizard',
value: 'completed',
},
{
_id: 'Country',
value: 'brazil',
},
{
_id: 'Organization_Type',
value: 'community',
},
{
_id: 'Industry',
value: 'aerospaceDefense',
},
{
_id: 'Size',
value: 0,
},
{
_id: 'Organization_Name',
value: 'any_name',
},
{
_id: 'API_Enable_Rate_Limiter_Dev',
value: false,
},
].map((setting) =>
connection
.db()
.collection('rocketchat_settings')
.updateOne({ _id: setting._id }, { $set: { value: setting.value } }),
),
);
return { usersFixtures };
}
......@@ -16,7 +16,7 @@ test.describe.serial('message-mentions', () => {
await poHomeChannel.sidenav.openChat('general');
await poHomeChannel.content.inputMessage.type('@');
await expect(poHomeChannel.content.messagePopUpItems.locator('strong >> text=all')).toBeVisible();
await expect(poHomeChannel.content.messagePopUpItems.locator('strong >> text=here')).toBeVisible();
await expect(poHomeChannel.content.messagePopUpItems.locator('strong >> text="all"')).toBeVisible();
await expect(poHomeChannel.content.messagePopUpItems.locator('strong >> text="here"')).toBeVisible();
});
});
......@@ -198,7 +198,7 @@ export class HomeContent {
}
get resumeOnHoldOmnichannelChatButton(): Locator {
return this.page.locator('button.rcx-button--primary >> text=Resume');
return this.page.locator('button.rcx-button--primary >> text="Resume"');
}
get btnOnHold(): Locator {
......
......@@ -16,6 +16,6 @@ export class HomeFlextabChannels {
}
get btnAdd(): Locator {
return this.page.locator('#modal-root button:has-text("Add")');
return this.page.locator('role=dialog >> role=group >> role=button[name=Add]');
}
}
......@@ -28,6 +28,6 @@ export class HomeTeam {
}
get btnTeamCreate(): Locator {
return this.page.locator('#modal-root button:has-text("Create")');
return this.page.locator('role=dialog >> role=group >> role=button[name=Create]');
}
}
......@@ -20,6 +20,6 @@ export class Utils {
}
get btnModalConfirmDelete() {
return this.page.locator('.rcx-modal >> button >> text=Delete');
return this.page.locator('.rcx-modal >> button >> text="Delete"');
}
}
......@@ -51,7 +51,7 @@ test.describe.serial('settings-account-profile', () => {
await poAccountProfile.inputToken.type(token);
await poAccountProfile.btnTokensAdd.click();
await expect(poAccountProfile.tokenAddedModal).toBeVisible();
await page.locator('button:has-text("Ok")').click();
await page.locator('role=button[name=Ok]').click();
});
await test.step('expect not allow add new personal token with same name', async () => {
......@@ -64,7 +64,7 @@ test.describe.serial('settings-account-profile', () => {
await poAccountProfile.tokenInTable(token).locator('button >> nth=0').click();
await poAccountProfile.btnRegenerateTokenModal.click();
await expect(poAccountProfile.tokenAddedModal).toBeVisible();
await page.locator('button:has-text("Ok")').click();
await page.locator('role=button[name=Ok]').click();
});
await test.step('expect delete personal token', async () => {
......
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