Skip to content

Commit dc4a995

Browse files
4manasamanasatumms2021389
authored
fixed the failed playwrights (#521)
* fixed the failed playwrights --------- Co-authored-by: manasa <[email protected]> Co-authored-by: tumms2021389 <[email protected]>
1 parent 14a48b9 commit dc4a995

File tree

9 files changed

+101
-87
lines changed

9 files changed

+101
-87
lines changed

packages/react-sdk-components/src/components/field/RadioButtons/RadioButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export default function RadioButtons(props: RadioButtonsProps) {
108108
return (
109109
<div>
110110
<h4 style={{ marginTop: 0, marginBottom: 0 }}>{label}</h4>
111-
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(min(200px, 100%), 1fr))', gap: '1rem' }}>
111+
<div id='selectable-card' style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(min(200px, 100%), 1fr))', gap: '1rem' }}>
112112
<SelectableCard
113113
hideFieldLabels={hideFieldLabels}
114114
additionalProps={additionalProps}

packages/react-sdk-components/tests/e2e/Digv2/ComplexFields/CaseReference.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ test.describe('E2E test', () => {
125125
await page.locator('button:has-text("Next")').click();
126126

127127
const assignment = page.locator('div[id="Assignment"]');
128-
await expect(assignment.locator(`div >> span >> text="${caseID[0]}"`)).toBeVisible();
128+
await expect(assignment.locator(`button:has-text("${caseID[0]}")`)).toBeVisible();
129129

130130
await page.locator('button:has-text("Previous")').click();
131131

packages/react-sdk-components/tests/e2e/Digv2/ComplexFields/DataReference.spec.js

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,49 @@ test.describe('E2E test', () => {
2828

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

31+
/** Testing Advanced Search */
32+
let selectedSubCategory = page.locator('div[data-test-id="9463d5f18a8924b3200b56efaad63bda"]');
33+
await selectedSubCategory.click();
34+
await page.locator('li:has-text("DataPatterns")').click();
35+
36+
let selectedTestName = page.locator('div[data-test-id="6f64b45d01d11d8efd1693dfcb63b735"]');
37+
await selectedTestName.click();
38+
await page.locator('li:has-text("Advanced search")').click();
39+
40+
await page.locator('button:has-text("Search")').click();
41+
42+
const productName = page.locator('input[data-test-id="85c72bcef3da32c2abc605764537c6a1"]');
43+
await productName.fill('item');
44+
45+
await page.locator('button:has-text("Search")').click();
46+
47+
let table = page.locator('div[id="list-view"] >> nth = 0');
48+
let tableCell = table.locator('tbody >> tr >> td >> nth=1');
49+
50+
const selectedRow = await table.locator('tbody >> tr >> td >> span >> input[type="radio"] >> nth=0');
51+
await selectedRow.click();
52+
53+
await expect(await tableCell.textContent()).toContain('Item');
54+
55+
const radiobutton = await page.locator('div[role="radiogroup"]');
56+
const requiredDateInput = await radiobutton.locator('label >> span >> input >> nth=1');
57+
await requiredDateInput.click();
58+
59+
await page.locator('button:has-text("Discard")').click();
60+
61+
const price = await page.locator('input[data-test-id="3601146c4e948c32b6424d2c0a7f0118"]');
62+
await price.fill('12');
63+
64+
await page.locator('button:has-text("Search")').click();
65+
3166
/** Display subcategory tests */
3267

3368
/** Autocomplete display type test */
34-
let selectedSubCategory = page.locator('div[data-test-id="9463d5f18a8924b3200b56efaad63bda"]');
69+
selectedSubCategory = page.locator('div[data-test-id="9463d5f18a8924b3200b56efaad63bda"]');
3570
await selectedSubCategory.click();
3671
await page.locator('li:has-text("Display")').click();
3772

38-
let selectedTestName = page.locator('div[data-test-id="6f64b45d01d11d8efd1693dfcb63b735"]');
73+
selectedTestName = page.locator('div[data-test-id="6f64b45d01d11d8efd1693dfcb63b735"]');
3974
await selectedTestName.click();
4075
await page.locator('li:has-text("Autocomplete")').click();
4176

@@ -88,7 +123,8 @@ test.describe('E2E test', () => {
88123

89124
selectedTestName = page.locator('div[data-test-id="6f64b45d01d11d8efd1693dfcb63b735"]');
90125
await selectedTestName.click();
91-
await page.locator('li:has-text("Table")').click();
126+
127+
await page.getByRole('option', { name: 'Table', exact: true }).click();
92128

93129
selectedProduct = page.locator('tr:has-text("Basic Product")');
94130
const selectedProductRow = selectedProduct.locator('input[type="radio"]');
@@ -267,7 +303,7 @@ test.describe('E2E test', () => {
267303
await selectedTestName.click();
268304
await page.locator('li:has-text("Readonly")').click();
269305

270-
selectedProduct = page.locator('div[id="semantic-link-grid"] >> span >> text="Basic Product"');
306+
selectedProduct = page.locator('button:has-text("Basic Product")');
271307
await expect(selectedProduct).toBeVisible();
272308

273309
await page.locator('button:has-text("Next")').click();
@@ -292,8 +328,8 @@ test.describe('E2E test', () => {
292328

293329
await page.locator('span:has-text("Product Name")').click();
294330

295-
let table = page.locator('div[id="list-view"]');
296-
let tableCell = table.locator('tbody >> tr >> td >> nth=1');
331+
table = page.locator('div[id="list-view"]');
332+
tableCell = table.locator('tbody >> tr >> td >> nth=1');
297333
// "---" should come at the top in the ascending order, since it's a Falsy value
298334
await expect(await tableCell.textContent()).toBe('---');
299335

@@ -313,38 +349,6 @@ test.describe('E2E test', () => {
313349

314350
await page.locator('button:has-text("Previous")').click();
315351

316-
/** Testing Advanced Search */
317-
selectedSubCategory = page.locator('div[data-test-id="9463d5f18a8924b3200b56efaad63bda"]');
318-
await selectedSubCategory.click();
319-
await page.locator('li:has-text("DataPatterns")').click();
320-
321-
selectedTestName = page.locator('div[data-test-id="6f64b45d01d11d8efd1693dfcb63b735"]');
322-
await selectedTestName.click();
323-
await page.locator('li:has-text("Advanced search")').click();
324-
325-
await page.locator('button:has-text("Search")').click();
326-
327-
const productName = page.locator('input[data-test-id="85c72bcef3da32c2abc605764537c6a1"]');
328-
await productName.fill('item');
329-
330-
await page.locator('button:has-text("Search")').click();
331-
332-
table = page.locator('div[id="list-view"] >> nth = 0');
333-
tableCell = table.locator('tbody >> tr >> td >> nth=1');
334-
335-
await expect(await tableCell.textContent()).toContain('Item');
336-
337-
const radiobutton = page.locator('div[role="radiogroup"]');
338-
const requiredDateInput = radiobutton.locator('label >> span >> input >> nth=1');
339-
await requiredDateInput.click();
340-
341-
await page.locator('button:has-text("Discard")').click();
342-
343-
const price = page.locator('input[data-test-id="3601146c4e948c32b6424d2c0a7f0118"]');
344-
await price.fill('12');
345-
346-
await page.locator('button:has-text("Search")').click();
347-
348352
/** Submitting the case */
349353
await page.locator('button:has-text("Next")').click();
350354
}, 10000);

packages/react-sdk-components/tests/e2e/Digv2/ComplexFields/EmbeddedData.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ test.describe('E2E test', () => {
216216

217217
await page.locator('button[id="delete-button"] >> nth=0').click();
218218

219+
await page.locator('button:has-text("Next")').click();
220+
await page.locator('button:has-text("Previous")').click();
221+
219222
/** Table Edit Modal tests */
220223
selectEditMode = page.locator('div[data-test-id="80c1db3a7b228760228004b1a532c71e"]');
221224
await selectEditMode.click();

packages/react-sdk-components/tests/e2e/Digv2/FormFields/Email.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ test.describe('E2E test', () => {
9898
const editableEmail = page.locator('input[data-test-id="c75f8a926bb5e08fd8342f7fe45dc344"]');
9999
await editableEmail.fill('Johndoe.com');
100100
await editableEmail.blur();
101-
await expect(page.locator('p:has-text("Invalid")')).toBeVisible();
101+
await expect(page.locator('p:has-text("Enter a valid email address")')).toBeVisible();
102102
editableEmail.fill('[email protected]');
103103
await editableEmail.blur();
104-
await expect(page.locator('p:has-text("Invalid")')).toBeHidden();
104+
await expect(page.locator('p:has-text("Enter a valid email address")')).toBeHidden();
105105

106106
attributes = await common.getAttributes(editableEmail);
107107
await expect(attributes.includes('readonly')).toBeFalsy();

packages/react-sdk-components/tests/e2e/Digv2/FormFields/Location.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ test.describe('E2E test for Location component', () => {
4040
/** Required field test */
4141
const requiredLocationField = page.locator('input[data-test-id="5d234240d150ee2ad896ca0be0e01fd3"]');
4242
await requiredLocationField.type('Hitech City, Hyderabad');
43-
await page.waitForSelector('.pac-container .pac-item', { timeout: 5000 });
43+
await page.waitForSelector('.pac-container .pac-item', { timeout: 50000 });
4444
await page.locator('.pac-container .pac-item').nth(1).click();
4545

4646
await expect(requiredLocationField).not.toHaveValue('');

packages/react-sdk-components/tests/e2e/Digv2/FormFields/URL.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ test.describe('E2E test', () => {
8383
await expect(attributes.includes('readonly')).toBeFalsy();
8484

8585
/** Validation tests */
86-
const validationMsg = 'Please enter a valid URL including the protocol (http://, https://, ftp://, etc.)';
86+
const validationMsg = 'Enter a valid url';
8787
await editableURL.fill('InvalidUrl');
8888
await editableURL.blur();
8989
await expect(page.locator(`p:has-text("${validationMsg}")`)).toBeVisible();

packages/react-sdk-components/tests/e2e/MediaCo/embedded.spec.js

Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,87 @@
1-
const { test } = require('@playwright/test');
1+
const { test, expect } = require('@playwright/test');
22

33
const common = require('../../common');
44

55
test.beforeEach(common.launchEmbedded);
66

77
test.describe('E2E test', () => {
8-
test('Embedded: should launch, select a service plan and fill details', async ({ page }) => {
9-
const silverPlan = page.locator('button:has-text("shop now") >> nth=1');
10-
await silverPlan.click();
8+
test('Embedded: should launch, select a phone and purchase the phone', async ({ page }) => {
9+
const selectPhone = page.locator('button:has-text("Buy now") >> nth=1');
10+
await selectPhone.click();
11+
12+
const storageSelectableCard = await page.locator('div[id="selectable-card"] >> nth=1');
13+
await storageSelectableCard.locator('label >> span >> input >> nth=1').click();
14+
15+
const colorSelectableCard = await page.locator('div[id="selectable-card"] >> nth=2');
16+
await colorSelectableCard.locator('label >> span >> input >> nth=1').click();
17+
18+
await page.locator('button:has-text("next")').click();
19+
20+
const phonenumber = page.locator('div[role="radiogroup"] >> nth=0');
21+
const requiredInput = phonenumber.locator('label >> span >> input >> nth=1');
22+
await requiredInput.click();
23+
24+
const tradeIn = page.locator('div[role="radiogroup"] >> nth=1');
25+
const tradeInInput = tradeIn.locator('label >> span >> input >> nth=1');
26+
await tradeInInput.click();
27+
28+
const paymentOptionsSelectableCard = await page.locator('div[id="selectable-card"] >> nth=0');
29+
await paymentOptionsSelectableCard.locator('label >> span >> input >> nth=1').click();
30+
31+
await page.locator('button:has-text("next")').click();
1132

1233
const firstNameInput = page.locator('input[data-test-id="BC910F8BDF70F29374F496F05BE0330C"]');
1334
await firstNameInput.click();
1435
await firstNameInput.fill('John');
1536

16-
const middleNameInput = page.locator('input[data-test-id="D3691D297D95C48EF1A2B7D6523EF3F0"]');
17-
await middleNameInput.click();
18-
await middleNameInput.fill('');
19-
2037
const lastNameInput = page.locator('input[data-test-id="77587239BF4C54EA493C7033E1DBF636"]');
2138
await lastNameInput.click();
2239
await lastNameInput.fill('Doe');
2340

24-
const suffix = page.locator('div[data-test-id="56E6DDD1CB6CEC596B433440DFB21C17"]');
25-
await suffix.locator('button[title="Open"]').click();
26-
await page.locator('li:has-text("Jr")').click();
27-
28-
const emailInput = page.locator('input[data-test-id="CE8AE9DA5B7CD6C3DF2929543A9AF92D"]');
41+
const emailInput = page.locator('input[data-test-id="643a860f992333b8600ea264aca7c4fc"]');
2942
await emailInput.click();
3043
await emailInput.fill('[email protected]');
3144

45+
const phone = page.locator('div[data-test-id="1e4dbc7eaa78468a3bc1448a3d68d906"]');
46+
const countrySelector = phone.locator('button');
47+
await countrySelector.click();
48+
await page.locator('text=United States+1 >> nth=0').click();
49+
await common.enterPhoneNumber(phone, '6175551212');
50+
51+
await page.locator('button:has-text("next")').click();
52+
53+
const nameOnCard = page.locator('input[data-test-id="c2b63e85bd5e4dc9b6cf5a4693847e06"]');
54+
await nameOnCard.click();
55+
await nameOnCard.fill('John Doe');
56+
3257
await page.locator('button:has-text("next")').click();
3358

3459
const streetInput = page.locator('input[data-test-id="D61EBDD8A0C0CD57C22455E9F0918C65"]');
3560
await streetInput.click();
3661
await streetInput.fill('Main St');
3762

38-
await page.locator('button:has-text("previous")').click();
39-
40-
await page.locator('h6:has-text("Customer Info")').click();
41-
42-
await page.locator('button:has-text("next")').click();
43-
44-
await page.locator('h6:has-text("Customer Address")').click();
63+
const apartmentInput = page.locator('input[data-test-id="73786cb2bc433cfb06603ab61f15e04e"]');
64+
await apartmentInput.click();
65+
await apartmentInput.fill('Glenalmond Avenue');
4566

4667
const cityInput = page.locator('input[data-test-id="57D056ED0984166336B7879C2AF3657F"]');
4768
await cityInput.click();
4869
await cityInput.fill('Cambridge');
4970

50-
const state = page.locator('div[data-test-id="46A2A41CC6E552044816A2D04634545D"]');
51-
const stateSelector = state.locator('div[role="combobox"]');
52-
await stateSelector.click();
53-
await page.locator('li[data-value="MA"]').click();
71+
const stateInput = page.locator('input[data-test-id="46A2A41CC6E552044816A2D04634545D"]');
72+
await stateInput.click();
73+
await stateInput.fill('Indiana');
5474

5575
const postalCodeInput = page.locator('input[data-test-id="572ED696F21038E6CC6C86BB272A3222"]');
5676
await postalCodeInput.click();
5777
await postalCodeInput.fill('02142');
5878

59-
const phone = page.locator('div[data-test-id="1F8261D17452A959E013666C5DF45E07"]');
60-
const countrySelector = phone.locator('button');
61-
await countrySelector.click();
62-
await page.locator('text=United States+1 >> nth=0').click();
63-
await common.enterPhoneNumber(phone, '6175551212');
64-
65-
await page.locator('button:has-text("next")').click();
66-
67-
const dataServiceBeginDate = page.locator('div[data-test-id="1321FA74451B96BC02663B0EF96CCBB9"]');
68-
const dataServiceBeginDateInput = dataServiceBeginDate.locator('input');
69-
await dataServiceBeginDateInput.click();
70-
const futureDate = common.getFutureDate();
71-
await dataServiceBeginDateInput.pressSequentially(futureDate);
72-
73-
await page.locator('button:has-text("next")').click();
74-
7579
await page.locator('button:has-text("submit")').click();
7680

77-
await page.locator('text=Thanks for selecting a package with us. ').click();
81+
await expect(page.locator('p:has-text("Oceonix 25 Max")')).toBeVisible();
82+
await expect(page.locator('p:has-text("[email protected]")')).toBeVisible();
83+
84+
await page.locator('a:has-text("Done")').click();
7885
}, 10000);
7986
});
8087

packages/react-sdk-components/tests/e2e/MediaCo/portal.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ test.describe('E2E test', () => {
5656
firstNameInput = caseSummary.locator('input').first();
5757
await expect(firstNameInput).toHaveValue('John');
5858

59-
lastNameInput = caseSummary.locator('input').nth(2);
59+
lastNameInput = caseSummary.locator('input').nth(1);
6060
await expect(lastNameInput).toHaveValue('Doe');
6161

62-
emailInput = caseSummary.locator('input').nth(3);
62+
emailInput = caseSummary.locator('input').nth(2);
6363
await expect(emailInput).toHaveValue('[email protected]');
6464

6565
const streetInput = page.locator('input[data-test-id="D61EBDD8A0C0CD57C22455E9F0918C65"]');

0 commit comments

Comments
 (0)