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

Updated playwright tests #492

Merged
merged 1 commit into from
Jul 5, 2024
Merged
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
12,411 changes: 6,426 additions & 5,985 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60",
"@material-ui/pickers": "^3.3.10",
"@pega/auth": "^0.2.12",
"@pega/auth": "^0.2.13",
"@pega/cosmos-react-condition-builder": "^4.2.0",
"@pega/cosmos-react-core": "^4.2.0",
"@pega/cosmos-react-work": "^4.2.0",
"@pega/react-sdk-components": "~0.24.2",
"@pega/react-sdk-components": "~0.24.4",
"@storybook/react-webpack5": "^7.6.7",
"@tinymce/tinymce-react": "^4.3.2",
"@types/styled-components": "^5.1.34",
Expand All @@ -89,13 +89,13 @@
"@kooneko/livereload-webpack-plugin": "^1.2.1",
"@loadable/component": "^5.16.3",
"@pega/configs": "^0.6.0",
"@pega/constellationjs": "24.1.0-test-20240610",
"@pega/constellationjs": "24.1.0",
"@pega/cspell-config": "^0.7.1",
"@pega/dx-component-builder-sdk": "~0.24.2",
"@pega/eslint-config": "^0.7.1",
"@pega/pcore-pconnect-typedefs": "~3.0.0",
"@pega/prettier-config": "^0.6.0",
"@pega/react-sdk-overrides": "~0.24.2",
"@pega/react-sdk-overrides": "~0.24.4",
"@pega/stylelint-config": "^0.7.1",
"@pega/tsconfig": "^0.7.1",
"@playwright/test": "^1.40.1",
Expand Down
9 changes: 8 additions & 1 deletion tests/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,19 @@ const closePage = async page => {
await page.close();
};

const enterPhoneNumber = async (phone, number) => {
const phoneInput = phone.locator('input');
await phoneInput.click();
await phoneInput.pressSequentially(number);
};

module.exports = {
launchPortal,
launchEmbedded,
launchSelfServicePortal,
login,
getAttributes,
getFutureDate,
closePage
closePage,
enterPhoneNumber
};
2 changes: 1 addition & 1 deletion tests/e2e/Digv2/ComplexFields/DataReference.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ test.describe('E2E test', () => {
await selectProducts.click();
await page.locator('li:has-text("Mobile")').click();
await page.locator('li:has-text("Telivision")').click();
await expect(selectProducts).toBeVisible();
await selectProducts.click();

await page.locator('button:has-text("Next")').click();

Expand Down
15 changes: 5 additions & 10 deletions tests/e2e/Digv2/ComplexFields/EmbeddedData.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ test.describe('E2E test', () => {
await phone.locator('button').click();
/** Selecting the country code */
await page.locator('text=United States+1 >> nth=0').click();
await phone.locator('input').click();
await phone.locator('input').pressSequentially('6175551212');
await common.enterPhoneNumber(phone, '6175551212');

/** Creating second row by clicking on `+Add` button */
await page.locator('a:has-text("+ Add")').click();
Expand All @@ -143,8 +142,7 @@ test.describe('E2E test', () => {
await phone.locator('button').click();
/** Selecting the country code */
await page.locator('text=United States+1 >> nth=0').click();
await phone.locator('input').click();
await phone.locator('input').pressSequentially('6175451212');
await common.enterPhoneNumber(phone, '6175451212');

await page.locator('button:has-text("Next")').click();

Expand Down Expand Up @@ -241,8 +239,7 @@ test.describe('E2E test', () => {
await phone.locator('button').click();
/** Selecting the country code */
await page.locator('text=United States+1 >> nth=0').click();
await phone.locator('input').click();
await phone.locator('input').pressSequentially('6175551212');
await common.enterPhoneNumber(phone, '6175551212');

const country = modal.locator('div[data-test-id="59716c97497eb9694541f7c3d37b1a4d"]');
await country.click();
Expand Down Expand Up @@ -335,8 +332,7 @@ test.describe('E2E test', () => {
await phone.locator('button').click();
/** Selecting the country code */
await page.locator('text=United States+1 >> nth=0').click();
await phone.locator('input').click();
await phone.locator('input').pressSequentially('6175551212');
await common.enterPhoneNumber(phone, '6175551212');

let countryName = page.locator('div[data-test-id="59716c97497eb9694541f7c3d37b1a4d"]');
await countryName.click();
Expand All @@ -355,8 +351,7 @@ test.describe('E2E test', () => {
await phone.locator('button').click();
/** Selecting the country code */
await page.locator('text=United States+1 >> nth=0').click();
await phone.locator('input').click();
await phone.locator('input').pressSequentially('6175451212');
await common.enterPhoneNumber(phone, '6175451212');

countryName = page.locator('div[data-test-id="59716c97497eb9694541f7c3d37b1a4d"] >> nth=1');
await countryName.click();
Expand Down
9 changes: 3 additions & 6 deletions tests/e2e/Digv2/FormFields/Phone.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,15 @@ test.describe('E2E test', () => {
await countrySelector.click();
await page.locator('text=United States+1 >> nth=0').click();
const editablePhoneInput = editablePhone.locator('input');
await editablePhoneInput.click();
await editablePhoneInput.pressSequentially('6175551212');
await common.enterPhoneNumber(editablePhone, '6175551212');

/** Validation tests */
const validationMsg = 'Enter a valid phone number';
await editablePhoneInput.clear();
await countrySelector.click();
await page.locator('text=United States+1 >> nth=0').click();
await editablePhoneInput.click();
/** Entering an invalid Phone number */
await editablePhoneInput.pressSequentially('61');
await common.enterPhoneNumber(editablePhone, '61');
await editablePhoneInput.blur();
/** Expecting an error for Invalid phone number */
await expect(page.locator(`p:has-text("${validationMsg}")`)).toBeVisible();
Expand All @@ -112,8 +110,7 @@ test.describe('E2E test', () => {
await editablePhoneInput.clear();
await countrySelector.click();
await page.locator('text=United States+1 >> nth=0').click();
await editablePhoneInput.click();
await editablePhoneInput.pressSequentially('6175551212');
await common.enterPhoneNumber(editablePhone, '6175551212');

await editablePhoneInput.blur();
/** Expecting the invalid Phone number error be no longer present */
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/Digv2/Localization/Localization.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const config = require('../../../config');
const common = require('../../../common');

test.beforeEach(common.launchPortal);
/** Added tests for french locale (fr-FR) */
/** Added tests for spanish(Latin America) locale (es-XL) */
test.describe('E2E test', () => {
test('should login, create case and test the localized values', async ({ page }) => {
await common.login(config.config.apps.digv2.localizedUser.username, config.config.apps.digv2.localizedUser.password, page);
Expand Down Expand Up @@ -121,4 +121,4 @@ test.describe('E2E test', () => {
});

const outputDir = './test-reports/e2e/DigV2/Localization/Localization';
test.afterEach(async ({ page }) => await common.calculateCoverage(page, outputDir));
test.afterEach(async ({ page }) => common.closePage(page));
4 changes: 1 addition & 3 deletions tests/e2e/Digv2/ViewTemplates/Confirmation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ test.describe('E2E test', () => {
const countrySelector = phone.locator('button');
await countrySelector.click();
await page.locator('text=United States+1 >> nth=0').click();
const phoneInput = phone.locator('input');
await phoneInput.click();
await phoneInput.pressSequentially('6175551212');
await common.enterPhoneNumber(phone, '6175551212');

await page.locator('button:has-text("submit")').click();

Expand Down
4 changes: 1 addition & 3 deletions tests/e2e/MediaCo/embedded.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ test.describe('E2E test', () => {
const countrySelector = phone.locator('button');
await countrySelector.click();
await page.locator('text=United States+1 >> nth=0').click();
const phoneInput = phone.locator('input');
await phoneInput.click();
await phoneInput.pressSequentially('6175551212');
await common.enterPhoneNumber(phone, '6175551212');

await page.locator('button:has-text("next")').click();

Expand Down
4 changes: 1 addition & 3 deletions tests/e2e/MediaCo/portal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ test.describe('E2E test', () => {
const countrySelector = phone.locator('button');
await countrySelector.click();
await page.locator('text=United States+1 >> nth=0').click();
const phoneInput = phone.locator('input');
await phoneInput.click();
await phoneInput.pressSequentially('6175551212');
await common.enterPhoneNumber(phone, '6175551212');

await page.locator('button:has-text("submit")').click();

Expand Down
Loading