-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6255 from Sage/FE-6091-accordion-playwright
test(accordion): migrate component tests to playwright
- Loading branch information
Showing
11 changed files
with
1,415 additions
and
668 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,22 +1,5 @@ | ||
import { | ||
ACCORDION_PREVIEW, | ||
ACCORDION_TITLE_CONTAINER, | ||
ACCORDION_ICON, | ||
ACCORDION_CONTENT, | ||
} from "./locators"; | ||
import { ACCORDION_TITLE_CONTAINER } from "./locators"; | ||
|
||
// locators | ||
export const accordionTitleContainer = () => | ||
cy.get(ACCORDION_PREVIEW).find(ACCORDION_TITLE_CONTAINER); | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const accordionDefaultTitle = () => cy.get(ACCORDION_TITLE_CONTAINER); | ||
export const accordionTitleContainerByPosition = (index) => | ||
cy | ||
.get(ACCORDION_PREVIEW) | ||
.find(ACCORDION_TITLE_CONTAINER) | ||
.eq(index) | ||
.children(); | ||
export const accordionIcon = () => | ||
accordionTitleContainer().find(ACCORDION_ICON); | ||
export const accordionContent = () => | ||
cy.get(ACCORDION_PREVIEW).find(ACCORDION_CONTENT); | ||
export const accordion = () => cy.get(ACCORDION_PREVIEW); |
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 |
---|---|---|
@@ -1,8 +1,4 @@ | ||
// component preview locators | ||
export const ACCORDION_PREVIEW = '[data-component="accordion"]'; | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const ACCORDION_TITLE_CONTAINER = | ||
'[data-element="accordion-title-container"]'; | ||
export const ACCORDION_ICON = '[data-component="icon"]'; | ||
export const ACCORDION_CONTENT = '[data-element="accordion-content"]'; | ||
export const ACCORDION_ADD_CONTENT = "add-content"; | ||
export const ACCORDION_REMOVE_CONTENT = "remove-content"; |
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,43 @@ | ||
import type { Page } from "@playwright/test"; | ||
import { | ||
ACCORDION_PREVIEW, | ||
ACCORDION_TITLE_CONTAINER, | ||
ACCORDION_ICON, | ||
ACCORDION_CONTENT, | ||
} from "./locators"; | ||
|
||
// locators | ||
const accordionTitleContainer = (page: Page) => { | ||
return page.locator(ACCORDION_PREVIEW).locator(ACCORDION_TITLE_CONTAINER); | ||
}; | ||
|
||
const accordionDefaultTitle = (page: Page) => { | ||
return page.locator(ACCORDION_TITLE_CONTAINER); | ||
}; | ||
|
||
const accordionTitleContainerByPosition = (page: Page, index: number) => { | ||
return page | ||
.locator(ACCORDION_PREVIEW) | ||
.locator(`${ACCORDION_TITLE_CONTAINER}:nth-child(${index + 1}) > *`); | ||
}; | ||
|
||
const accordionIcon = (page: Page) => { | ||
return accordionTitleContainer(page).locator(ACCORDION_ICON); | ||
}; | ||
|
||
const accordionContent = (page: Page) => { | ||
return page.locator(ACCORDION_PREVIEW).locator(ACCORDION_CONTENT); | ||
}; | ||
|
||
const accordion = (page: Page) => { | ||
return page.locator(ACCORDION_PREVIEW); | ||
}; | ||
|
||
export { | ||
accordionTitleContainer, | ||
accordionDefaultTitle, | ||
accordionTitleContainerByPosition, | ||
accordionIcon, | ||
accordionContent, | ||
accordion, | ||
}; |
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,8 @@ | ||
// component preview locators | ||
export const ACCORDION_PREVIEW = '[data-component="accordion"]'; | ||
export const ACCORDION_TITLE_CONTAINER = | ||
'[data-element="accordion-title-container"]'; | ||
export const ACCORDION_ICON = '[data-component="icon"]'; | ||
export const ACCORDION_CONTENT = '[data-element="accordion-content"]'; | ||
export const ACCORDION_ADD_CONTENT = "add-content"; | ||
export const ACCORDION_REMOVE_CONTENT = "remove-content"; |
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import type { Page } from "@playwright/test"; | ||
import { ICON } from "./locators"; | ||
|
||
const icon = (page: Page) => { | ||
export const icon = (page: Page) => { | ||
return page.locator(ICON); | ||
}; | ||
|
||
export default icon; | ||
export const getDataElementByValue = (page: Page, element: string) => { | ||
return page.locator(`[data-element="${element}"]`); | ||
}; |
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
Oops, something went wrong.