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): start tests on atomic-commerce-facets #4071

Merged
merged 28 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
16b41fb
WIP
olamothe Jun 7, 2024
e88882d
test(atomic): start tests on atomic-commerce-facets
olamothe Jun 10, 2024
1e190bb
cleanup
olamothe Jun 10, 2024
1110783
more cleanup
olamothe Jun 10, 2024
a69a26f
missing await
olamothe Jun 10, 2024
2bc635c
remove wait for
olamothe Jun 10, 2024
f474855
fix(atomic): fix collapse-facets-after support for atomic-commerce-fa…
olamothe Jun 10, 2024
b485727
Merge branch 'master' into KIT-3256
olamothe Jun 10, 2024
70af9b8
Merge branch 'KIT-3300' into KIT-3256
olamothe Jun 10, 2024
45b3769
Merge branch 'master' into KIT-3256
olamothe Jun 11, 2024
98d975c
Merge branch 'KIT-3256' of https://github.com/coveo/ui-kit into KIT-3256
olamothe Jun 11, 2024
c6dfc83
WIP
olamothe Jun 11, 2024
849f449
fix(atomic): fix facet and product list loading state
olamothe Jun 11, 2024
478320a
merge
olamothe Jun 11, 2024
1eb381d
Merge branch 'master' into KIT-3256
olamothe Jun 11, 2024
e3c26ce
Merge branch 'KIT-3311' into KIT-3256
olamothe Jun 11, 2024
b2917fb
wip
olamothe Jun 11, 2024
8832bd3
merge
olamothe Jun 13, 2024
96c3980
fix merge
olamothe Jun 13, 2024
9b41053
merge
olamothe Jun 13, 2024
dab5a6e
cleanup
olamothe Jun 13, 2024
655d758
cleanup
olamothe Jun 13, 2024
9228422
Merge branch 'master' into KIT-3256
olamothe Jun 17, 2024
1a23556
merge
olamothe Jun 17, 2024
c47968c
Merge branch 'KIT-3256' of https://github.com/coveo/ui-kit into KIT-3256
olamothe Jun 17, 2024
26e6061
fix loading state
olamothe Jun 17, 2024
949df64
fix story id
olamothe Jun 18, 2024
ff3363b
fix story id
olamothe Jun 18, 2024
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
29 changes: 29 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ AtomicAutomaticFacetGenerator,
AtomicBreadbox,
AtomicCategoryFacet,
AtomicColorFacet,
AtomicCommerceFacets,
AtomicCommerceLoadMoreProducts,
AtomicCommerceSearchBox,
AtomicComponentError,
Expand Down Expand Up @@ -110,6 +111,7 @@ AtomicAutomaticFacetGenerator,
AtomicBreadbox,
AtomicCategoryFacet,
AtomicColorFacet,
AtomicCommerceFacets,
AtomicCommerceLoadMoreProducts,
AtomicCommerceSearchBox,
AtomicComponentError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,28 @@ export class AtomicColorFacet {
export declare interface AtomicColorFacet extends Components.AtomicColorFacet {}


@ProxyCmp({
inputs: ['collapseFacetsAfter']
})
@Component({
selector: 'atomic-commerce-facets',
changeDetection: ChangeDetectionStrategy.OnPush,
template: '<ng-content></ng-content>',
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
inputs: ['collapseFacetsAfter'],
})
export class AtomicCommerceFacets {
protected el: HTMLElement;
constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
c.detach();
this.el = r.nativeElement;
}
}


export declare interface AtomicCommerceFacets extends Components.AtomicCommerceFacets {}


@ProxyCmp({
})
@Component({
Expand Down
1 change: 1 addition & 0 deletions packages/atomic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"@storybook/core-server": "8.1.5",
"@storybook/jest": "^0.2.3",
"@storybook/manager-api": "8.1.5",
"@storybook/router": "8.1.6",
"@storybook/test": "8.1.5",
"@storybook/test-runner": "0.18.2",
"@storybook/testing-library": "^0.2.2",
Expand Down
42 changes: 42 additions & 0 deletions packages/atomic/playwright-utils/base-page-object.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import type {Page} from '@playwright/test';
import {buildArgsParam} from '@storybook/router';
import {JSX} from '../dist/types/components';
olamothe marked this conversation as resolved.
Show resolved Hide resolved

export class BasePageObject<
TagName extends keyof JSX.IntrinsicElements,
Component = JSX.IntrinsicElements[TagName],
> {
constructor(
public page: Page,
public tag: TagName
) {}

get hydrated() {
return this.page.locator(`${this.tag}[class*="hydrated"]`);
}

get urlRoot() {
return 'http://localhost:4400/iframe.html';
}

async load(args?: Component, story: string = 'default') {
if (args) {
await this.page.goto(
`${this.urlRoot}?id=${this.tag}--${story}&args=${buildArgsParam(undefined, this.camelToKebab(args))}`
);
} else {
await this.page.goto(`${this.urlRoot}?id=${this.tag}--${story}`);
}
}

private camelToKebab(args: Component) {
const toKebab: Record<string, unknown> = {};
Object.entries(args as Record<string, unknown>).forEach(([key, value]) => {
toKebab[
`attributes-${key.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase()}`
] = value;
});

return toKebab;
}
}
4 changes: 4 additions & 0 deletions packages/atomic/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ export namespace Components {
/**
* The `atomic-commerce-facets` component automatically renders commerce facets based on the Commerce API response.
* Unlike regular facets, which require explicit definition and request in the query, the `atomic-commerce-facets` component dynamically generates facets.
* @alpha
*/
interface AtomicCommerceFacets {
/**
Expand Down Expand Up @@ -3503,6 +3504,7 @@ declare global {
/**
* The `atomic-commerce-facets` component automatically renders commerce facets based on the Commerce API response.
* Unlike regular facets, which require explicit definition and request in the query, the `atomic-commerce-facets` component dynamically generates facets.
* @alpha
*/
interface HTMLAtomicCommerceFacetsElement extends Components.AtomicCommerceFacets, HTMLStencilElement {
}
Expand Down Expand Up @@ -5726,6 +5728,7 @@ declare namespace LocalJSX {
/**
* The `atomic-commerce-facets` component automatically renders commerce facets based on the Commerce API response.
* Unlike regular facets, which require explicit definition and request in the query, the `atomic-commerce-facets` component dynamically generates facets.
* @alpha
*/
interface AtomicCommerceFacets {
/**
Expand Down Expand Up @@ -8793,6 +8796,7 @@ declare module "@stencil/core" {
/**
* The `atomic-commerce-facets` component automatically renders commerce facets based on the Commerce API response.
* Unlike regular facets, which require explicit definition and request in the query, the `atomic-commerce-facets` component dynamically generates facets.
* @alpha
*/
"atomic-commerce-facets": LocalJSX.AtomicCommerceFacets & JSXBase.HTMLAttributes<HTMLAtomicCommerceFacetsElement>;
"atomic-commerce-interface": LocalJSX.AtomicCommerceInterface & JSXBase.HTMLAttributes<HTMLAtomicCommerceInterfaceElement>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export class AtomicCommerceInterface
private summary!: SearchSummary | ListingSummary;
private context!: Context;
private unsubscribeUrlManager: Unsubscribe = () => {};
private unsubscribeSearchStatus: Unsubscribe = () => {};
private unsubscribeSummary: Unsubscribe = () => {};
private initialized = false;
private store: AtomicCommerceStore;
Expand Down Expand Up @@ -226,7 +225,6 @@ export class AtomicCommerceInterface

public disconnectedCallback() {
this.unsubscribeUrlManager();
this.unsubscribeSearchStatus();
this.unsubscribeSummary();
window.removeEventListener('hashchange', this.onHashChange);
}
Expand Down Expand Up @@ -373,15 +371,6 @@ export class AtomicCommerceInterface
this.type === 'product-listing'
? buildProductListing(this.engine!)
: buildSearch(this.engine!);

this.unsubscribeSearchStatus = this.searchOrListing.subscribe(() => {
if (
!this.searchOrListing.state.isLoading &&
this.store.hasLoadingFlag(FirstSearchExecutedFlag)
) {
this.store.unsetLoadingFlag(FirstSearchExecutedFlag);
}
});
}

private initSummary() {
Expand All @@ -406,6 +395,10 @@ export class AtomicCommerceInterface
firstSearchExecutedSelector,
firstSearchExecuted
);

if (firstSearchExecuted) {
this.store.unsetLoadingFlag(FirstSearchExecutedFlag);
}
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type {Page} from '@playwright/test';
import {BasePageObject} from '../../../../../playwright-utils/base-page-object';

export class AtomicCommerceLoadMoreProductsLocators {
private page: Page;
export class LoadMoreProductsPageObject extends BasePageObject<'atomic-commerce-load-more-products'> {
constructor(page: Page) {
this.page = page;
super(page, 'atomic-commerce-load-more-products');
}

summary({index, total}: {index?: number; total?: number} = {}) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import {test, expect} from './fixture';

Check failure on line 1 in packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts

View workflow job for this annotation

GitHub Actions / Run Playwright tests for Atomic

[chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:183:7 › with a facet & clear-filters set to true › clicking the submit button should clear the facet value

1) [chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:183:7 › with a facet & clear-filters set to true › clicking the submit button should clear the facet value Test timeout of 30000ms exceeded.

Check failure on line 1 in packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts

View workflow job for this annotation

GitHub Actions / Run Playwright tests for Atomic

[chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:183:7 › with a facet & clear-filters set to true › clicking the submit button should clear the facet value

1) [chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:183:7 › with a facet & clear-filters set to true › clicking the submit button should clear the facet value Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Test timeout of 30000ms exceeded.

Check failure on line 1 in packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts

View workflow job for this annotation

GitHub Actions / Run Playwright tests for Atomic

[chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:183:7 › with a facet & clear-filters set to true › clicking the submit button should clear the facet value

1) [chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:183:7 › with a facet & clear-filters set to true › clicking the submit button should clear the facet value Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Test timeout of 30000ms exceeded.

Check failure on line 1 in packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts

View workflow job for this annotation

GitHub Actions / Run Playwright tests for Atomic

[chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:199:7 › with a facet & clear-filters set to false › clicking the submit button should not clear the facet value

2) [chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:199:7 › with a facet & clear-filters set to false › clicking the submit button should not clear the facet value Test timeout of 30000ms exceeded.

Check failure on line 1 in packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts

View workflow job for this annotation

GitHub Actions / Run Playwright tests for Atomic

[chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:199:7 › with a facet & clear-filters set to false › clicking the submit button should not clear the facet value

2) [chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:199:7 › with a facet & clear-filters set to false › clicking the submit button should not clear the facet value Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Test timeout of 30000ms exceeded.

test.describe('default', () => {
test.beforeEach(async ({page}) => {
await page.goto(
'http://localhost:4400/iframe.html?id=atomic-commerce-search-box--default&viewMode=story&args=attributes-suggestion-timeout:5000'
);
test.beforeEach(async ({searchBox}) => {
await searchBox.load({suggestionTimeout: 5000});
});

test('should have an enabled search button', async ({searchBox}) => {
Expand Down Expand Up @@ -50,10 +48,8 @@
});

test.describe('with instant results & query suggestions', () => {
test.beforeEach(async ({page}) => {
await page.goto(
'http://localhost:4400/iframe.html?id=atomic-commerce-search-box--rich-search-box&viewMode=story&args=attributes-suggestion-timeout:5000'
);
test.beforeEach(async ({searchBox}) => {
await searchBox.load({suggestionTimeout: 5000}, 'rich-search-box');
});

test.describe('after clicking the searchbox input', () => {
Expand Down Expand Up @@ -82,10 +78,12 @@
});

test.describe('with disable-search=true and minimum-query-length=1', () => {
test.beforeEach(async ({page}) => {
await page.goto(
'http://localhost:4400/iframe.html?id=atomic-commerce-search-box--default&viewMode=story&args=attributes-disable-search:!true;attributes-minimum-query-length:1;attributes-suggestion-timeout:5000'
);
test.beforeEach(async ({searchBox}) => {
await searchBox.load({
suggestionTimeout: 5000,
disableSearch: true,
minimumQueryLength: 1,
});
});

const testCases = () => {
Expand Down Expand Up @@ -124,10 +122,8 @@
});

test.describe('with minimum-query-length=4', () => {
test.beforeEach(async ({page}) => {
await page.goto(
'http://localhost:4400/iframe.html?id=atomic-commerce-search-box--default&viewMode=story&args=attributes-minimum-query-length:4;attributes-suggestion-timeout:5000'
);
test.beforeEach(async ({searchBox}) => {
await searchBox.load({minimumQueryLength: 4, suggestionTimeout: 5000});
});

const testCases = () => {
Expand Down Expand Up @@ -180,17 +176,15 @@
});

test.describe('with a facet & clear-filters set to true', () => {
test.beforeEach(async ({page}) => {
await page.goto(
'http://localhost:4400/iframe.html?id=atomic-commerce-search-box--in-page&args=attributes-clear-filters:!true;attributes-suggestion-timeout:5000'
);
test.beforeEach(async ({searchBox}) => {
await searchBox.load({clearFilters: true, suggestionTimeout: 5000});
});

test('clicking the submit button should clear the facet value', async ({
facets,
searchBox,
}) => {
await facets.inclusionFilters.first().click();

Check failure on line 187 in packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts

View workflow job for this annotation

GitHub Actions / Run Playwright tests for Atomic

[chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:183:7 › with a facet & clear-filters set to true › clicking the submit button should clear the facet value

1) [chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:183:7 › with a facet & clear-filters set to true › clicking the submit button should clear the facet value Error: locator.click: Test timeout of 30000ms exceeded. Call log: - waiting for getByLabel(/Inclusion filter/).first() 185 | searchBox, 186 | }) => { > 187 | await facets.inclusionFilters.first().click(); | ^ 188 | await facets.clearFilters().waitFor({state: 'visible'}); 189 | await searchBox.submitButton.click(); 190 | await expect(facets.clearFilters()).not.toBeVisible(); at /home/runner/work/ui-kit/ui-kit/packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:187:43

Check failure on line 187 in packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts

View workflow job for this annotation

GitHub Actions / Run Playwright tests for Atomic

[chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:183:7 › with a facet & clear-filters set to true › clicking the submit button should clear the facet value

1) [chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:183:7 › with a facet & clear-filters set to true › clicking the submit button should clear the facet value Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Test timeout of 30000ms exceeded. Call log: - waiting for getByLabel(/Inclusion filter/).first() 185 | searchBox, 186 | }) => { > 187 | await facets.inclusionFilters.first().click(); | ^ 188 | await facets.clearFilters().waitFor({state: 'visible'}); 189 | await searchBox.submitButton.click(); 190 | await expect(facets.clearFilters()).not.toBeVisible(); at /home/runner/work/ui-kit/ui-kit/packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:187:43

Check failure on line 187 in packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts

View workflow job for this annotation

GitHub Actions / Run Playwright tests for Atomic

[chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:183:7 › with a facet & clear-filters set to true › clicking the submit button should clear the facet value

1) [chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:183:7 › with a facet & clear-filters set to true › clicking the submit button should clear the facet value Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Test timeout of 30000ms exceeded. Call log: - waiting for getByLabel(/Inclusion filter/).first() 185 | searchBox, 186 | }) => { > 187 | await facets.inclusionFilters.first().click(); | ^ 188 | await facets.clearFilters().waitFor({state: 'visible'}); 189 | await searchBox.submitButton.click(); 190 | await expect(facets.clearFilters()).not.toBeVisible(); at /home/runner/work/ui-kit/ui-kit/packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:187:43
await facets.clearFilters().waitFor({state: 'visible'});
await searchBox.submitButton.click();
await expect(facets.clearFilters()).not.toBeVisible();
Expand All @@ -198,37 +192,17 @@
});

test.describe('with a facet & clear-filters set to false', () => {
test.beforeEach(async ({page}) => {
await page.goto(
'http://localhost:4400/iframe.html?id=atomic-commerce-search-box--in-page&args=attributes-clear-filters:!false;attributes-suggestion-timeout:5000'
);
test.beforeEach(async ({searchBox}) => {
await searchBox.load({clearFilters: false, suggestionTimeout: 5000});
});

test('clicking the submit button should not clear the facet value', async ({
facets,
searchBox,
}) => {
await facets.inclusionFilters.first().click();

Check failure on line 203 in packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts

View workflow job for this annotation

GitHub Actions / Run Playwright tests for Atomic

[chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:199:7 › with a facet & clear-filters set to false › clicking the submit button should not clear the facet value

2) [chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:199:7 › with a facet & clear-filters set to false › clicking the submit button should not clear the facet value Error: locator.click: Test timeout of 30000ms exceeded. Call log: - waiting for getByLabel(/Inclusion filter/).first() 201 | searchBox, 202 | }) => { > 203 | await facets.inclusionFilters.first().click(); | ^ 204 | await facets.clearFilters().waitFor({state: 'visible'}); 205 | await searchBox.submitButton.click(); 206 | await expect(facets.clearFilters()).toBeVisible(); at /home/runner/work/ui-kit/ui-kit/packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:203:43

Check failure on line 203 in packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts

View workflow job for this annotation

GitHub Actions / Run Playwright tests for Atomic

[chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:199:7 › with a facet & clear-filters set to false › clicking the submit button should not clear the facet value

2) [chromium] › components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:199:7 › with a facet & clear-filters set to false › clicking the submit button should not clear the facet value Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Test timeout of 30000ms exceeded. Call log: - waiting for getByLabel(/Inclusion filter/).first() 201 | searchBox, 202 | }) => { > 203 | await facets.inclusionFilters.first().click(); | ^ 204 | await facets.clearFilters().waitFor({state: 'visible'}); 205 | await searchBox.submitButton.click(); 206 | await expect(facets.clearFilters()).toBeVisible(); at /home/runner/work/ui-kit/ui-kit/packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts:203:43
await facets.clearFilters().waitFor({state: 'visible'});
await searchBox.submitButton.click();
await expect(facets.clearFilters()).toBeVisible();
});
});

test.describe('with enable-query-syntax=true', () => {
test.beforeEach(async ({page}) => {
await page.goto(
'http://localhost:4400/iframe.html?id=atomic-commerce-search-box--in-page&viewMode=story&args=attributes-enable-query-syntax:!true;attributes-suggestion-timeout:5000'
);
});

test('should use query syntax', async ({loadMore, searchBox, page}) => {
await loadMore.loadMoreButton.waitFor({state: 'visible'});
await searchBox.searchInput
// eslint-disable-next-line @cspell/spellchecker
.fill('@urihash=bzo5fpM1vf8Xñds1');
await searchBox.submitButton.click();
await expect(loadMore.summary({total: 1})).toBeVisible();
await expect(page.getByText('WiLife Life Jacket WiLife')).toBeVisible();
});
});
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import {test as base} from '@playwright/test';
import {
AxeFixture,
makeAxeBuilder,
} from '@coveo/atomic/playwrightUtils/base-fixture';
import {test as base} from '@playwright/test';
import {AtomicCommerceLoadMoreProductsLocators as LoadMore} from '../../atomic-commerce-load-more-products/e2e/page-object';
import {AtomicCommerceFacetsLocators as Facets} from '../../facets/atomic-commerce-facets/e2e/page-object';
import {AtomicCommerceSearchBoxLocators as SearchBox} from './page-object';
} from '../../../../../playwright-utils/base-fixture';
import {LoadMoreProductsPageObject} from '../../atomic-commerce-load-more-products/e2e/page-object';
import {FacetsPageObject} from '../../facets/atomic-commerce-facets/e2e/page-object';
import {SearchBoxPageObject} from './page-object';

type MyFixtures = {
searchBox: SearchBox;
facets: Facets;
loadMore: LoadMore;
searchBox: SearchBoxPageObject;
facets: FacetsPageObject;
loadMore: LoadMoreProductsPageObject;
};

export const test = base.extend<MyFixtures & AxeFixture>({
makeAxeBuilder,
searchBox: async ({page}, use) => {
await use(new SearchBox(page));
await use(new SearchBoxPageObject(page));
},
facets: async ({page}, use) => {
await use(new Facets(page));
await use(new FacetsPageObject(page));
},
loadMore: async ({page}, use) => {
await use(new LoadMore(page));
await use(new LoadMoreProductsPageObject(page));
},
});
export {expect} from '@playwright/test';
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type {Page} from '@playwright/test';
import {BasePageObject} from '../../../../../playwright-utils/base-page-object';

export class AtomicCommerceSearchBoxLocators {
private page: Page;
export class SearchBoxPageObject extends BasePageObject<'atomic-commerce-search-box'> {
constructor(page: Page) {
this.page = page;
super(page, 'atomic-commerce-search-box');
}

get submitButton() {
Expand Down Expand Up @@ -38,10 +38,6 @@ export class AtomicCommerceSearchBoxLocators {
);
}

get hydrated() {
return this.page.locator('atomic-commerce-search-box[class*="hydrated"]');
}

private listSideAffix(listSide?: 'Left' | 'Right') {
return listSide ? ` In ${listSide} list\\.` : '';
}
Expand Down
Loading
Loading