-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
add retry for slot test
1 parent
4fc2b15
commit 20ed97b
Showing
1 changed file
with
33 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,39 @@ | ||
import {test, expect, Page} from '@playwright/test'; | ||
|
||
test('web components - slot', async ({page}) => { | ||
await page.goto('http://localhost:32123/web_component/slot/slot_app'); | ||
// Make sure the page has loaded: | ||
expect(page.getByRole('button', {name: 'Decrement'})).toBeVisible(); | ||
test.describe(() => { | ||
// All tests in this describe group will get 2 retry attempts. | ||
test.describe.configure({retries: 2}); | ||
test('web components - slot', async ({page}) => { | ||
await page.goto('http://localhost:32123/web_component/slot/slot_app'); | ||
// Make sure the page has loaded: | ||
expect(page.getByRole('button', {name: 'Decrement'})).toBeVisible(); | ||
|
||
assertValue(10); | ||
await page.getByRole('button', {name: 'increment'}).click(); | ||
assertValue(11); | ||
await page.getByRole('button', {name: 'increment'}).click(); | ||
assertValue(12); | ||
await page.getByRole('button', {name: 'Decrement'}).click(); | ||
assertValue(11); | ||
await page.getByRole('button', {name: 'Decrement'}).click(); | ||
assertValue(10); | ||
assertValue(10); | ||
await page.getByRole('button', {name: 'increment'}).click(); | ||
assertValue(11); | ||
await page.getByRole('button', {name: 'increment'}).click(); | ||
assertValue(12); | ||
await page.getByRole('button', {name: 'Decrement'}).click(); | ||
assertValue(11); | ||
await page.getByRole('button', {name: 'Decrement'}).click(); | ||
assertValue(10); | ||
|
||
async function assertValue(value: number) { | ||
// Check that the outer component is displaying the right value. | ||
expect( | ||
await page | ||
.locator('div') | ||
.filter({hasText: `Value: ${value} increment Start of`}) | ||
.textContent(), | ||
).toContain(value.toString()); | ||
async function assertValue(value: number) { | ||
// Check that the outer component is displaying the right value. | ||
expect( | ||
await page | ||
.locator('div') | ||
.filter({hasText: `Value: ${value} increment Start of`}) | ||
.textContent(), | ||
).toContain(value.toString()); | ||
|
||
// Check that the inner component is displaying the right value. | ||
expect( | ||
await page | ||
.locator('slot-counter-component') | ||
.getByText('Value:') | ||
.textContent(), | ||
).toContain(value.toString()); | ||
} | ||
// Check that the inner component is displaying the right value. | ||
expect( | ||
await page | ||
.locator('slot-counter-component') | ||
.getByText('Value:') | ||
.textContent(), | ||
).toContain(value.toString()); | ||
} | ||
}); | ||
}); |