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

test(atomic): fix flaky atomic-external tests #4515

Merged
merged 2 commits into from
Oct 10, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
import {test, expect} from './fixture';

test.describe('External Test Suite', () => {
test.describe('when modifying state of a component (search box) that is a child of an atomic-external component', () => {
test.beforeEach(async ({external}) => {
await external.load();
test.describe('when modifying state of a component (search box) that is a child of an atomic-external component', () => {
test.beforeEach(async ({external, page}) => {
await external.load();
await external.hydrated.waitFor();

await external.searchBox
.locator('[part="textarea"]')
.fill('hello', {timeout: 1000});
await page
.locator('atomic-external')
.getByLabel('Search field with suggestions')
.waitFor({state: 'visible', timeout: 5000});

await external.searchBox.press('Enter');
});
await page
.locator('atomic-external')
.getByLabel('Search field with suggestions')
.fill('hello');

test("other components' state under the same atomic-external should be affected", async ({
external,
}) => {
await expect(external.querySummary).toHaveText(/hello/);
});
await external.searchBox.press('Enter');
});

test("other components' state under the same atomic-external should be affected", async ({
external,
}) => {
await expect(external.querySummary).toHaveText(/hello/);
});

test("other components' state under the linked atomic-search-interface should be affected", async ({
page,
}) => {
const querySummary = page.locator(
'atomic-search-interface#interface-2 > atomic-query-summary'
);
await expect(querySummary).toHaveText(/hello/);
});
test("other components' state under the linked atomic-search-interface should be affected", async ({
page,
}) => {
const querySummary = page.locator(
'atomic-search-interface#interface-2 > atomic-query-summary'
);
await expect(querySummary).toHaveText(/hello/);
});

test("other components' state under a different atomic-search-interface should not be affected", async ({
page,
}) => {
const querySummary = page.locator(
'atomic-search-interface#interface-1 > atomic-query-summary'
);
await expect(querySummary).not.toHaveText(/hello/);
});
test("other components' state under a different atomic-search-interface should not be affected", async ({
page,
}) => {
const querySummary = page.locator(
'atomic-search-interface#interface-1 > atomic-query-summary'
);
await expect(querySummary).not.toHaveText(/hello/);
});
});
Loading