-
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.
test(quantic): SFINT-5832 Sort E2E tests migrate from Cypress to Play…
…wright (#4777) https://coveord.atlassian.net/browse/SFINT-5832 **IN THIS PR:** - Added Playwright E2E tests for the quantic-sort component **UNIT TESTS:** - No need, as UTs already there **E2E PLAYWRIGHT TESTS:** - Playwright for Sort component --------- Co-authored-by: mmitiche <[email protected]> Co-authored-by: Etienne Rocheleau <[email protected]> Co-authored-by: Simon Milord <[email protected]>
- Loading branch information
1 parent
fa6a88d
commit 9c846ba
Showing
5 changed files
with
466 additions
and
41 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
61 changes: 61 additions & 0 deletions
61
packages/quantic/force-app/main/default/lwc/quanticSort/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,61 @@ | ||
import {SortObject} from './pageObject'; | ||
import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture'; | ||
import {SearchObject} from '../../../../../../playwright/page-object/searchObject'; | ||
import { | ||
searchRequestRegex, | ||
insightSearchRequestRegex, | ||
} from '../../../../../../playwright/utils/requests'; | ||
import {InsightSetupObject} from '../../../../../../playwright/page-object/insightSetupObject'; | ||
import {useCaseEnum} from '../../../../../../playwright/utils/useCase'; | ||
|
||
const sortUrl = 's/quantic-sort'; | ||
|
||
interface SortOptions {} | ||
|
||
type QuanticSortE2EFixtures = { | ||
sort: SortObject; | ||
search: SearchObject; | ||
options: Partial<SortOptions>; | ||
}; | ||
|
||
type QuanticSortE2ESearchFixtures = QuanticSortE2EFixtures & { | ||
urlHash: string; | ||
}; | ||
|
||
type QuanticSortE2EInsightFixtures = QuanticSortE2EFixtures & { | ||
insightSetup: InsightSetupObject; | ||
}; | ||
|
||
export const testSearch = quanticBase.extend<QuanticSortE2ESearchFixtures>({ | ||
options: {}, | ||
urlHash: '', | ||
search: async ({page}, use) => { | ||
await use(new SearchObject(page, searchRequestRegex)); | ||
}, | ||
sort: async ({page, options, configuration, search, urlHash}, use) => { | ||
await page.goto(urlHash ? `${sortUrl}#${urlHash}` : sortUrl); | ||
configuration.configure(options); | ||
await search.waitForSearchResponse(); | ||
await use(new SortObject(page)); | ||
}, | ||
}); | ||
|
||
export const testInsight = quanticBase.extend<QuanticSortE2EInsightFixtures>({ | ||
options: {}, | ||
search: async ({page}, use) => { | ||
await use(new SearchObject(page, insightSearchRequestRegex)); | ||
}, | ||
insightSetup: async ({page}, use) => { | ||
await use(new InsightSetupObject(page)); | ||
}, | ||
sort: async ({page, options, search, configuration, insightSetup}, use) => { | ||
await page.goto(sortUrl); | ||
configuration.configure({...options, useCase: useCaseEnum.insight}); | ||
await insightSetup.waitForInsightInterfaceInitialization(); | ||
await search.performSearch(); | ||
await search.waitForSearchResponse(); | ||
await use(new SortObject(page)); | ||
}, | ||
}); | ||
|
||
export {expect} from '@playwright/test'; |
Oops, something went wrong.