Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Budget more time for playwright tests & disable retries #607

Merged
merged 3 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 33 additions & 29 deletions mesop/tests/e2e/web_components/slot_test.ts
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());
}
});
});
4 changes: 2 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {defineConfig, devices} from '@playwright/test';
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
timeout: process.env.CI ? 30000 : 15000, // Budget more time for CI since tests run slower there.
timeout: process.env.CI ? 50000 : 25000, // Budget more time for CI since tests run slower there.
testDir: '.',
// Use a custom snapshot path template because Playwright's default
// is platform-specific which isn't necessary for Mesop e2e tests
Expand All @@ -24,7 +24,7 @@ export default defineConfig({
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
retries: 0,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
Expand Down
Loading