Skip to content

Commit

Permalink
Test changing up expect awaits
Browse files Browse the repository at this point in the history
  • Loading branch information
StasTserk committed Dec 21, 2024
1 parent bb0be7f commit 245cdf7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
8 changes: 4 additions & 4 deletions tests/fixtures/bwFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ class RollDialog {
constructor(private readonly page: Page) {}

async expectOpened(skill: string) {
expect(
await this.page.locator('h4').filter({ hasText: `${skill} Test` })
await expect(
this.page.locator('h4').filter({ hasText: `${skill} Test` })
).toBeVisible();
}

async close(skill: string) {
await this.page
.locator(`a:text("Close"):near(h4:text("${skill} Test"))`)
.click();
expect(
await this.page.locator('h4').filter({ hasText: `${skill} Test` })
await expect(
this.page.locator('h4').filter({ hasText: `${skill} Test` })
).not.toBeVisible();
}
}
Expand Down
10 changes: 4 additions & 6 deletions tests/fixtures/gameFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export class GameFixture {
await test.step('clean up some page basics', async () => {
await this.page.getByLabel(/clear chat log/i).click();
await expect(
await this.page.getByRole('heading', { name: 'Flush Chat Log' })
this.page.getByRole('heading', { name: 'Flush Chat Log' })
).toBeVisible();
await this.page.getByRole('button', { name: /yes/i }).click();
await expect(
await this.page.getByRole('heading', { name: 'Flush Chat Log' })
this.page.getByRole('heading', { name: 'Flush Chat Log' })
).not.toBeVisible();
});
}
Expand All @@ -57,14 +57,12 @@ export class GameFixture {
await this.openTab('Actors');
await test.step(`Open actor named '${name}'`, async () => {
await this.page.getByText(name).click();
await expect(
await this.page.locator('div.app.bw-app')
).toBeVisible();
await expect(this.page.locator('div.app.bw-app')).toBeVisible();
});
}

async getSelectedValue(select: Locator) {
return await select.locator('option[selected]').innerText();
return select.locator('option[selected]').innerText();
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/setupFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SetupPage {
async navigateToLoginPage() {
await setupFixture.step('dismiss tour notifications', async () => {
await expect(
await this.page.getByText(/backups overview/i)
this.page.getByText(/backups overview/i)
).toBeVisible();
await this.page.waitForTimeout(250); // let animations settle
await this.page.locator('i.close.fas.fa-times-circle').click();
Expand All @@ -17,7 +17,7 @@ class SetupPage {
.getByRole('button')
.dispatchEvent('click');
await expect(
await this.page.getByText(/backups overview/i)
this.page.getByText(/backups overview/i)
).not.toBeVisible();
});
await setupFixture.step('navigate to login page', async () => {
Expand Down

0 comments on commit 245cdf7

Please sign in to comment.