Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(pie-monorepo): WCP-000 update playwright #2136

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@
"@justeattakeaway/stylelint-config-pie": "0.8.0",
"@percy/cli": "1.29.3",
"@percy/playwright": "1.0.6",
"@playwright/experimental-ct-react": "1.41.0",
"@playwright/test": "1.41.0",
"@playwright/experimental-ct-react": "1.49.1",
"@playwright/test": "1.49.1",
"@rollup/plugin-node-resolve": "15.1.0",
"@sand4rt/experimental-ct-web": "1.41.0",
"@sand4rt/experimental-ct-web": "1.49.1",
"@types/node": "20.4.8",
"@types/react": "18.3.11",
"@typescript-eslint/eslint-plugin": "5.62.0",
Expand Down Expand Up @@ -139,6 +139,6 @@
"resolutions": {
"lit": "3.2.0",
"tar": "6.2.1",
"@playwright/experimental-ct-core": "1.41.0"
"@playwright/experimental-ct-core": "1.49.1"
}
}
32 changes: 18 additions & 14 deletions packages/components/pie-modal/test/component/pie-modal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@ import {
import { ModalComponent } from 'test/helpers/page-object/pie-modal.page.ts';
import { PieButton } from '@justeattakeaway/pie-button';
import { PieTextInput } from '@justeattakeaway/pie-text-input';
import { createScrollablePageHTML, renderTestPieModal } from '../helpers/index.ts';
import { renderTestPieModal } from '../helpers/index.ts';

import { PieModal } from '../../src/index.ts';
import {
ON_MODAL_BACK_EVENT,
ON_MODAL_CLOSE_EVENT,
ON_MODAL_LEADING_ACTION_CLICK,
ON_MODAL_SUPPORTING_ACTION_CLICK,
headingLevels,
} from '../../src/defs.ts';
import { headingLevels } from '../../src/defs.ts';

let modalComponent: ModalComponent;

const createScrollablePageHTML = () => `<div>
<h1>Test Page</h1>
<p>Top of page copy</p>
<p> Test copy </p>
<ol>
${'<li>List item</li>'.repeat(200)}
<li>Bottom of page copy</li>
</ol>
</div>`;

test.describe('modal', () => {
test.beforeEach(async ({ page, mount }) => {
modalComponent = new ModalComponent(page);
Expand Down Expand Up @@ -98,7 +102,7 @@ test.describe('modal', () => {
isDismissible: true,
},
on: {
[ON_MODAL_CLOSE_EVENT]: (event: Event) => events.push(event),
'pie-modal-close': (event: Event) => events.push(event),
},
},
);
Expand Down Expand Up @@ -140,7 +144,7 @@ test.describe('modal', () => {
hasBackButton: true,
},
on: {
[ON_MODAL_BACK_EVENT]: (event: Event) => events.push(event),
'pie-modal-back': (event: Event) => events.push(event),
},
},
);
Expand All @@ -164,7 +168,7 @@ test.describe('modal', () => {
isDismissible: true,
},
on: {
[ON_MODAL_CLOSE_EVENT]: (event: Event) => events.push(event),
'pie-modal-close': (event: Event) => events.push(event),
},
});

Expand Down Expand Up @@ -654,8 +658,8 @@ test.describe('modal', () => {
},
},
on: {
[ON_MODAL_LEADING_ACTION_CLICK]: (event: Event) => events.push({ eventObject: event, eventName: 'leading' }),
[ON_MODAL_SUPPORTING_ACTION_CLICK]: (event: Event) => events.push({ eventObject: event, eventName: 'supporting' }),
'pie-modal-leading-action-click': (event: Event) => events.push({ eventObject: event, eventName: 'leading' }),
'pie-modal-supporting-action-click': (event: Event) => events.push({ eventObject: event, eventName: 'supporting' }),
},
});

Expand Down Expand Up @@ -840,7 +844,7 @@ test.describe('modal', () => {
});

// Act
await page.locator('[data-test-id="submit-button"]').click();
await page.getByTestId('submit-button').click();
const isModalVisible = await modalComponent.isModalVisible();

// Assert
Expand Down
11 changes: 0 additions & 11 deletions packages/components/pie-modal/test/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,3 @@ export const renderTestPieModal = ({
${returnFocusAfterCloseSelector ? `returnFocusAfterCloseSelector=${returnFocusAfterCloseSelector}` : ''}
size="${size}">
</pie-modal>`;

// Creates some test page markup to test scroll locking
export const createScrollablePageHTML = () => `<div>
<h1>Test Page</h1>
<p>Top of page copy</p>
<p> Test copy </p>
<ol>
${'<li>List item</li>'.repeat(200)}
<li>Bottom of page copy</li>
</ol>
</div>`;
Loading
Loading