-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efb9039
commit 42ccc5b
Showing
6 changed files
with
90 additions
and
1 deletion.
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
12 changes: 12 additions & 0 deletions
12
packages/atomic/src/components/search/atomic-refine-modal/e2e/page-object.ts
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type {Page} from '@playwright/test'; | ||
import {BasePageObject} from '../../../../../playwright-utils/base-page-object'; | ||
|
||
export class RefineModalPageObject extends BasePageObject<'atomic-refine-toggle'> { | ||
constructor(page: Page) { | ||
super(page, 'atomic-refine-toggle'); | ||
} | ||
|
||
get modal() { | ||
return this.page.getByRole('dialog', {name: 'Sort & Filter'}); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
packages/atomic/src/components/search/atomic-refine-toggle/e2e/atomic-refine-toggle.e2e.ts
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {test, expect} from './fixture'; | ||
|
||
test.describe('atomic-refine-toggle', () => { | ||
test.beforeEach(async ({refineToggle, page}) => { | ||
await refineToggle.load({ | ||
story: 'with-atomic-externals', | ||
}); | ||
await page.setViewportSize({width: 400, height: 845}); | ||
}); | ||
test.describe('when the button is clicked', () => { | ||
test.beforeEach(async ({refineToggle}) => { | ||
await refineToggle.button.click(); | ||
}); | ||
|
||
test('should open the refine modal', async ({refineModal}) => { | ||
await expect(refineModal.modal).toBeVisible(); | ||
}); | ||
|
||
test('should display the facets in the right order', async ({facet}) => { | ||
await expect(facet.expandButtons).toHaveText([ | ||
'facet1', | ||
'facet2', | ||
'facet3', | ||
'facet4', | ||
'facet5', | ||
'facet6', | ||
'facet7', | ||
'facet8', | ||
'facet9', | ||
]); | ||
}); | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
packages/atomic/src/components/search/atomic-refine-toggle/e2e/fixture.ts
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {test as base} from '@playwright/test'; | ||
import { | ||
AxeFixture, | ||
makeAxeBuilder, | ||
} from '../../../../../playwright-utils/base-fixture'; | ||
import {RefineModalPageObject} from '../../atomic-refine-modal/e2e/page-object'; | ||
import {AtomicFacetPageObject} from '../../facets/atomic-facet/e2e/page-object'; | ||
import {RefineTogglePageObject} from './page-object'; | ||
|
||
type MyFixtures = { | ||
refineToggle: RefineTogglePageObject; | ||
refineModal: RefineModalPageObject; | ||
facet: AtomicFacetPageObject; | ||
}; | ||
|
||
export const test = base.extend<MyFixtures & AxeFixture>({ | ||
makeAxeBuilder, | ||
refineToggle: async ({page}, use) => { | ||
await use(new RefineTogglePageObject(page)); | ||
}, | ||
refineModal: async ({page}, use) => { | ||
await use(new RefineModalPageObject(page)); | ||
}, | ||
facet: async ({page}, use) => { | ||
await use(new AtomicFacetPageObject(page)); | ||
}, | ||
}); | ||
|
||
export {expect} from '@playwright/test'; |
11 changes: 11 additions & 0 deletions
11
packages/atomic/src/components/search/atomic-refine-toggle/e2e/page-object.ts
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type {Page} from '@playwright/test'; | ||
import {BasePageObject} from '../../../../../playwright-utils/base-page-object'; | ||
|
||
export class RefineTogglePageObject extends BasePageObject<'atomic-refine-toggle'> { | ||
constructor(page: Page) { | ||
super(page, 'atomic-refine-toggle'); | ||
} | ||
get button() { | ||
return this.page.getByRole('button', {name: 'Sort & Filter'}); | ||
} | ||
} |
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