Skip to content

Commit 31659d0

Browse files
authored
Updated playwright tests (#492)
1 parent 2d12e69 commit 31659d0

File tree

10 files changed

+6452
-6018
lines changed

10 files changed

+6452
-6018
lines changed

package-lock.json

Lines changed: 6426 additions & 5985 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@
5858
"@material-ui/icons": "^4.11.2",
5959
"@material-ui/lab": "^4.0.0-alpha.60",
6060
"@material-ui/pickers": "^3.3.10",
61-
"@pega/auth": "^0.2.12",
61+
"@pega/auth": "^0.2.13",
6262
"@pega/cosmos-react-condition-builder": "^4.2.0",
6363
"@pega/cosmos-react-core": "^4.2.0",
6464
"@pega/cosmos-react-work": "^4.2.0",
65-
"@pega/react-sdk-components": "~0.24.2",
65+
"@pega/react-sdk-components": "~0.24.4",
6666
"@storybook/react-webpack5": "^7.6.7",
6767
"@tinymce/tinymce-react": "^4.3.2",
6868
"@types/styled-components": "^5.1.34",
@@ -89,13 +89,13 @@
8989
"@kooneko/livereload-webpack-plugin": "^1.2.1",
9090
"@loadable/component": "^5.16.3",
9191
"@pega/configs": "^0.6.0",
92-
"@pega/constellationjs": "24.1.0-test-20240610",
92+
"@pega/constellationjs": "24.1.0",
9393
"@pega/cspell-config": "^0.7.1",
9494
"@pega/dx-component-builder-sdk": "~0.24.2",
9595
"@pega/eslint-config": "^0.7.1",
9696
"@pega/pcore-pconnect-typedefs": "~3.0.0",
9797
"@pega/prettier-config": "^0.6.0",
98-
"@pega/react-sdk-overrides": "~0.24.2",
98+
"@pega/react-sdk-overrides": "~0.24.4",
9999
"@pega/stylelint-config": "^0.7.1",
100100
"@pega/tsconfig": "^0.7.1",
101101
"@playwright/test": "^1.40.1",

tests/common.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,19 @@ const closePage = async page => {
5050
await page.close();
5151
};
5252

53+
const enterPhoneNumber = async (phone, number) => {
54+
const phoneInput = phone.locator('input');
55+
await phoneInput.click();
56+
await phoneInput.pressSequentially(number);
57+
};
58+
5359
module.exports = {
5460
launchPortal,
5561
launchEmbedded,
5662
launchSelfServicePortal,
5763
login,
5864
getAttributes,
5965
getFutureDate,
60-
closePage
66+
closePage,
67+
enterPhoneNumber
6168
};

tests/e2e/Digv2/ComplexFields/DataReference.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ test.describe('E2E test', () => {
217217
await selectProducts.click();
218218
await page.locator('li:has-text("Mobile")').click();
219219
await page.locator('li:has-text("Telivision")').click();
220-
await expect(selectProducts).toBeVisible();
220+
await selectProducts.click();
221221

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

tests/e2e/Digv2/ComplexFields/EmbeddedData.spec.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ test.describe('E2E test', () => {
127127
await phone.locator('button').click();
128128
/** Selecting the country code */
129129
await page.locator('text=United States+1 >> nth=0').click();
130-
await phone.locator('input').click();
131-
await phone.locator('input').pressSequentially('6175551212');
130+
await common.enterPhoneNumber(phone, '6175551212');
132131

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

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

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

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

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

361356
countryName = page.locator('div[data-test-id="59716c97497eb9694541f7c3d37b1a4d"] >> nth=1');
362357
await countryName.click();

tests/e2e/Digv2/FormFields/Phone.spec.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,15 @@ test.describe('E2E test', () => {
9393
await countrySelector.click();
9494
await page.locator('text=United States+1 >> nth=0').click();
9595
const editablePhoneInput = editablePhone.locator('input');
96-
await editablePhoneInput.click();
97-
await editablePhoneInput.pressSequentially('6175551212');
96+
await common.enterPhoneNumber(editablePhone, '6175551212');
9897

9998
/** Validation tests */
10099
const validationMsg = 'Enter a valid phone number';
101100
await editablePhoneInput.clear();
102101
await countrySelector.click();
103102
await page.locator('text=United States+1 >> nth=0').click();
104-
await editablePhoneInput.click();
105103
/** Entering an invalid Phone number */
106-
await editablePhoneInput.pressSequentially('61');
104+
await common.enterPhoneNumber(editablePhone, '61');
107105
await editablePhoneInput.blur();
108106
/** Expecting an error for Invalid phone number */
109107
await expect(page.locator(`p:has-text("${validationMsg}")`)).toBeVisible();
@@ -112,8 +110,7 @@ test.describe('E2E test', () => {
112110
await editablePhoneInput.clear();
113111
await countrySelector.click();
114112
await page.locator('text=United States+1 >> nth=0').click();
115-
await editablePhoneInput.click();
116-
await editablePhoneInput.pressSequentially('6175551212');
113+
await common.enterPhoneNumber(editablePhone, '6175551212');
117114

118115
await editablePhoneInput.blur();
119116
/** Expecting the invalid Phone number error be no longer present */

tests/e2e/Digv2/Localization/Localization.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const config = require('../../../config');
44
const common = require('../../../common');
55

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

123123
const outputDir = './test-reports/e2e/DigV2/Localization/Localization';
124-
test.afterEach(async ({ page }) => await common.calculateCoverage(page, outputDir));
124+
test.afterEach(async ({ page }) => common.closePage(page));

tests/e2e/Digv2/ViewTemplates/Confirmation.spec.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ test.describe('E2E test', () => {
4747
const countrySelector = phone.locator('button');
4848
await countrySelector.click();
4949
await page.locator('text=United States+1 >> nth=0').click();
50-
const phoneInput = phone.locator('input');
51-
await phoneInput.click();
52-
await phoneInput.pressSequentially('6175551212');
50+
await common.enterPhoneNumber(phone, '6175551212');
5351

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

tests/e2e/MediaCo/embedded.spec.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ test.describe('E2E test', () => {
6060
const countrySelector = phone.locator('button');
6161
await countrySelector.click();
6262
await page.locator('text=United States+1 >> nth=0').click();
63-
const phoneInput = phone.locator('input');
64-
await phoneInput.click();
65-
await phoneInput.pressSequentially('6175551212');
63+
await common.enterPhoneNumber(phone, '6175551212');
6664

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

tests/e2e/MediaCo/portal.spec.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ test.describe('E2E test', () => {
7272
const countrySelector = phone.locator('button');
7373
await countrySelector.click();
7474
await page.locator('text=United States+1 >> nth=0').click();
75-
const phoneInput = phone.locator('input');
76-
await phoneInput.click();
77-
await phoneInput.pressSequentially('6175551212');
75+
await common.enterPhoneNumber(phone, '6175551212');
7876

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

0 commit comments

Comments
 (0)