Skip to content

Commit

Permalink
Merge pull request #6304 from Sage/FE-6102_card-pw-refactor
Browse files Browse the repository at this point in the history
test(card): migrate tests from cypress to playwright - FE-6102
  • Loading branch information
DipperTheDan authored Sep 26, 2023
2 parents 8718b65 + 78ebe9b commit a085ab1
Show file tree
Hide file tree
Showing 6 changed files with 619 additions and 275 deletions.
274 changes: 0 additions & 274 deletions cypress/components/card/card.cy.tsx

This file was deleted.

22 changes: 22 additions & 0 deletions playwright/components/card/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Page } from "@playwright/test";
import {
CARD,
CARD_COLUMN,
CARD_DRAGGABLE_ELEMENT,
CARD_FOOTER,
DRAGGABLE_CARD_AT_IDEX,
DRAGGABLE_CONTAINER_AT_INDEX,
} from "./locators";

// component preview locators
export const card = (page: Page) => page.locator(CARD);

export const draggableCard = (page: Page, index: number) =>
page.locator(DRAGGABLE_CARD_AT_IDEX(index)).locator(CARD_DRAGGABLE_ELEMENT);

export const draggableContainer = (page: Page, index: number) =>
page.locator(DRAGGABLE_CONTAINER_AT_INDEX(index));

export const columnCard = (page: Page) => page.locator(CARD_COLUMN);

export const footerCard = (page: Page) => page.locator(CARD_FOOTER);
11 changes: 11 additions & 0 deletions playwright/components/card/locators.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// component preview locators
export const CARD = '[data-component="card"]';
export const CARD_DRAGGABLE_ELEMENT = '[data-element="drag"]';
export const CARD_COLUMN = '[data-element="card-column"]';
export const CARD_FOOTER = '[data-element="card-footer"]';

export const DRAGGABLE_CARD_AT_IDEX = (index: number) =>
`[data-element="draggable-card-${index}"]`;

export const DRAGGABLE_CONTAINER_AT_INDEX = (index: number) =>
`[data-element="draggable-container-${index}"]`;
2 changes: 1 addition & 1 deletion playwright/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ export const label = (page: Page) => {

export const legendSpan = (page: Page) => {
return page.locator("legend > span");
};
};
Loading

0 comments on commit a085ab1

Please sign in to comment.