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

feat: Accessibility testing across all US SDK messages #1125

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
69a9969
GB, IT, ES, AU, FR, DE modals
erikacolette29 Aug 19, 2024
4a5e8fc
tests arragement
erikacolette29 Aug 19, 2024
8e34f04
de update
erikacolette29 Aug 20, 2024
9f21a2b
tests updated all passing
erikacolette29 Aug 20, 2024
15651ca
fixture us
erikacolette29 Aug 20, 2024
3ded905
lint
erikacolette29 Aug 20, 2024
00d131d
adust tests for broswer context
erikacolette29 Aug 20, 2024
ea69b2f
comma missing
erikacolette29 Aug 20, 2024
0cb3948
lint
erikacolette29 Aug 21, 2024
710e7b0
refactor
erikacolette29 Aug 21, 2024
c2da469
comment out
erikacolette29 Aug 21, 2024
459f4c8
lint page
erikacolette29 Aug 21, 2024
af9a062
navigate url update
erikacolette29 Aug 21, 2024
d4302f6
removal navigate page
erikacolette29 Aug 21, 2024
e4fd3f7
update yml
perco12 Aug 23, 2024
303ee4e
update yml
perco12 Aug 23, 2024
3789177
seperate tests
perco12 Aug 23, 2024
28ffc36
run tests in background
perco12 Aug 23, 2024
38106a8
update tests
perco12 Aug 23, 2024
2637213
update test
perco12 Aug 23, 2024
32ec4d2
update config
perco12 Aug 24, 2024
cbaa424
debug yml
perco12 Aug 24, 2024
c9889ea
remove seperate tests and parallel
perco12 Aug 25, 2024
2bc2365
update yml
perco12 Aug 25, 2024
e2462e0
Merge branch 'pr/1121' into long-legged-lizards-leap-lazily
perco12 Aug 25, 2024
daf932e
update yml
perco12 Aug 25, 2024
572f8ec
remove the other test files
perco12 Aug 25, 2024
241244c
add more tests
perco12 Aug 25, 2024
c4c2916
remove tests
perco12 Aug 25, 2024
7ecb97e
uncomment tests
perco12 Aug 25, 2024
c53f65c
update tests
perco12 Aug 25, 2024
e37baf7
added timeout to tests
perco12 Aug 25, 2024
6037ccf
remove short term pl2go
perco12 Aug 25, 2024
9c4e2b9
robust error handling
perco12 Aug 25, 2024
f1bcc9f
comment out test
perco12 Aug 25, 2024
c41e341
comment out test
perco12 Aug 25, 2024
83ff723
refactor tests
perco12 Aug 26, 2024
d8602c4
seperate shortTerm longTerm and added AU
perco12 Aug 26, 2024
972f594
comment out former modal tests
perco12 Aug 26, 2024
ce938d6
add multi test file
perco12 Aug 26, 2024
b4b97f4
update test time
perco12 Aug 26, 2024
80b2557
add parallel mode
perco12 Aug 26, 2024
81426b6
remove extra tests and added two new fixtures
perco12 Aug 26, 2024
1076395
update and seperate fixtures for modals
perco12 Aug 26, 2024
1ffd89b
remove axecorescanner
perco12 Aug 26, 2024
0ab7de3
add messages
perco12 Aug 26, 2024
d04a8e6
update amount of workers
perco12 Aug 26, 2024
707c5c7
reduce messaging tests
perco12 Aug 26, 2024
02e0df8
only do shortterm
perco12 Aug 26, 2024
b36c14e
update short term test
perco12 Aug 26, 2024
9e57fae
run only against chromium
perco12 Aug 26, 2024
c11bef7
seperate test calls
perco12 Aug 26, 2024
9d53e3a
remove pl2go
perco12 Aug 26, 2024
6a0608a
update and use all browsers
perco12 Aug 27, 2024
8ad5213
remove old test
perco12 Aug 27, 2024
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
9 changes: 7 additions & 2 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ jobs:
run: npm i
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- name: Run server
run: |
./.github/scripts/runServerV2.sh
- name: Run Playwright Modals
run: npx playwright test tests/playwright/tests/sdk/modals
- name: Run Playwright Messages
run: npx playwright test tests/playwright/tests/sdk/messages
- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
15 changes: 5 additions & 10 deletions playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@ const { defineConfig, devices } = require('@playwright/test');
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
testDir: './tests/playwright/practice-tests',
/* Run tests in files in parallel */
fullyParallel: true,
testDir: './tests/playwright/tests',
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
// retries: 1,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 5 : undefined,
workers: 80,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
timeout: 5 * 60000,
/* Configure projects for major browsers */
projects: [
{
Expand Down Expand Up @@ -84,11 +80,10 @@ module.exports = defineConfig({
}
],
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'https://localhost.paypal.com:8080',
ignoreHTTPSErrors: true,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
bypassCSP: true
bypassCSP: true,
headless: !!process.env.CI || undefined
}
});
34 changes: 34 additions & 0 deletions tests/playwright/pages/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// modalsFixture.js
import { test as base, expect } from '@playwright/test';
import { AxeBuilder } from '@axe-core/playwright';

// Function to generate URL based on parameters
export const generateUrl = (baseUrl, { account, amount, offer }) => {
let url = `${baseUrl}?account=${account}`;
if (amount !== undefined) {
url += `&amount=${amount}`;
}
if (offer !== undefined && offer !== '') {
url += `&offer=${offer}`;
}
return url;
};

// Extend Playwright base test with custom fixtures
export const baseTest = base.extend({
navigatePage: async ({ page }, use) => {
const navigate = async (baseurl, { account, amount, offer }) => {
const url = generateUrl(baseurl, { account, amount, offer });
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });
};
await use(navigate);
},
// Fixture for running Axe accessibility checks
runAxeCoreScan: async ({ page }, use) => {
const runAxeCoreScan = async (element, tags = []) => {
const results = await new AxeBuilder({ page }).include(element).withTags(tags).analyze();
expect(results.violations).toEqual([]);
};
await use(runAxeCoreScan);
}
});
35 changes: 35 additions & 0 deletions tests/playwright/pages/messages_fixture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// modalsFixture.js
import { baseTest } from './base';
import { selectors } from '../util/selectors';

// Extend Playwright base test with custom fixtures
export const messageTest = baseTest.extend({
navigatePage: async ({ navigatePage }, use) => {
const messageUrl = '/snapshot/v2/sdk.html';
const navigate = async ({ account, amount, offer }) => {
await navigatePage(messageUrl, { account, amount, offer });
};
await use(navigate);
},

// Fixture for loading the modal
loadMessage: async ({ page }, use) => {
const loadMessage = async () => {
const messageIframe = await page.waitForSelector(selectors.message.messageIframe, {
state: 'visible',
timeout: 300000
});
if (!messageIframe) {
throw new Error('Message Iframe not found');
}

const messageFrame = await messageIframe.contentFrame();
await messageFrame.locator(selectors.message.messageMessaging).waitFor({
state: 'visible',
timeout: 300000
});
return messageIframe;
};
await use(loadMessage);
}
});
40 changes: 40 additions & 0 deletions tests/playwright/pages/modals_fixture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// modalsFixture.js
import { baseTest } from './base';
import { selectors } from '../util/selectors';

// Extend Playwright base test with custom fixtures
export const modalTest = baseTest.extend({
navigatePage: async ({ navigatePage }, use) => {
const modalUrl = '/snapshot/v2/standalone-modal.html';
const navigate = async ({ account, amount, offer }) => {
await navigatePage(modalUrl, { account, amount, offer });
};
await use(navigate);
},

// Fixture for loading the modal
loadModal: async ({ page }, use) => {
const loadModal = async () => {
const messageButton = await page.waitForSelector(selectors.standaloneLearnMore, {
state: 'visible',
timeout: 300000
});
if (!messageButton) {
throw new Error('Button not found');
}
await messageButton.click();

const modalIframe = await page.waitForSelector(selectors.modal.iframe, {
state: 'attached',
timeout: 300000
});
const modalFrame = await modalIframe.contentFrame();
await modalFrame.locator(selectors.modal.contentWrapper).waitFor({
state: 'visible',
timeout: 300000
});
return modalIframe;
};
await use(loadModal);
}
});
43 changes: 0 additions & 43 deletions tests/playwright/practice-tests/accessibility.spec.js

This file was deleted.

19 changes: 0 additions & 19 deletions tests/playwright/practice-tests/example.spec.js

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading