Skip to content

Commit

Permalink
Merge pull request #6258 from Sage/playwright_refactor_advancedcolorp…
Browse files Browse the repository at this point in the history
…icker

test(advanced-color-picker): Playwright refactor
  • Loading branch information
stephenogorman authored Aug 23, 2023
2 parents 0183a35 + bb3c347 commit 68fb6c0
Show file tree
Hide file tree
Showing 8 changed files with 563 additions and 330 deletions.
329 changes: 0 additions & 329 deletions cypress/components/advanced-color-picker/advanced-color-picker.cy.tsx

This file was deleted.

50 changes: 50 additions & 0 deletions playwright/components/advanced-color-picker/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import type { Page } from "@playwright/test";
import {
ADVANCED_COLOR_PICKER_CELL,
CURRENT_COLOR_DESCRIPTION,
SIMPLE_COLOR,
SIMPLE_COLOR_PICKER,
ADVANCED_COLOR_PREVIEW,
} from "./locators";

const simpleColorPickerInput = (page: Page, index: number) => {
return page.locator(SIMPLE_COLOR).locator("input").nth(index);
};

const simpleColorPicker = (page: Page, index: number) => {
return page
.locator(SIMPLE_COLOR_PICKER)
.locator(SIMPLE_COLOR)
.nth(index)
.locator("input");
};

const currentColorDescription = (page: Page) => {
return page.locator(CURRENT_COLOR_DESCRIPTION);
};

const advancedColorPickerCell = (page: Page) => {
return page.locator(ADVANCED_COLOR_PICKER_CELL);
};

const advancedColorPicker = (page: Page, index: number) => {
return page.locator(SIMPLE_COLOR).nth(index);
};

const simpleColorPickerComponent = (page: Page) => {
return page.locator(SIMPLE_COLOR_PICKER);
};

const advancedColorPickerPreview = (page: Page) => {
return page.locator(ADVANCED_COLOR_PREVIEW);
};

export {
simpleColorPickerInput,
simpleColorPicker,
currentColorDescription,
advancedColorPickerCell,
advancedColorPicker,
simpleColorPickerComponent,
advancedColorPickerPreview,
};
7 changes: 7 additions & 0 deletions playwright/components/advanced-color-picker/locators.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// component preview locators
export const ADVANCED_COLOR_PICKER_CELL = '[data-element="color-picker-cell"]';
export const CURRENT_COLOR_DESCRIPTION =
'[data-element="current-color-description"]';
export const SIMPLE_COLOR = '[data-component="simple-color"]';
export const SIMPLE_COLOR_PICKER = '[data-component="simple-color-picker"]';
export const ADVANCED_COLOR_PREVIEW = '[data-element="color-picker-preview"]';
Loading

0 comments on commit 68fb6c0

Please sign in to comment.