Skip to content

Commit

Permalink
test: update thank you page selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
KrupaPammi committed Jul 4, 2024
1 parent 75f370a commit 02cfcf3
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion playwright-staging/tests/submit/erp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test('Verify giftaid submit ERP data @regression', async ({ page }) => {
]);

// Check for the thank you message to confirm successful submission
await expect(page.locator('div > h1')).toHaveText(`Thank you, ${contactInfo.firstName}!`);
await expect(page.locator('div.success-wrapper--inner h1')).toHaveText(`Thank you, ${contactInfo.firstName}!`);

// ERP Steps
const giftaidSubmit = await erpTester.findOne('Gift Aid Declaration', {
Expand Down
2 changes: 1 addition & 1 deletion playwright-staging/tests/submit/formValidation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ test.describe('Form validation @sanity @nightly-sanity', () => {
await page.locator('#field-input--lastname').fill('');
await commands.populateFormFields(page);
await page.locator('button[type=submit]').click();
await expect(page.locator('div > h1')).toHaveText('Thank you, test!');
await expect(page.locator('div.success-wrapper--inner h1')).toHaveText('Thank you, test!');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test.describe('International addresses validation @sanity @nightly-sanity', () =
// Submit the form and ensure no errors are shown for international address
await commands.selectMarketingPrefs(page); // Assuming this handles checkbox interactions
await page.click('button[type=submit]');
await expect(page.locator('div > h1')).toContainText('Thank you, test!');
await expect(page.locator('div.success-wrapper--inner h1')).toContainText('Thank you, test!');

await page.close();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test('Verify giftaid marketing preferences data in contact-store @sanity @nightl
await page.locator('button[type=submit]').click();

// Verify success message
await expect(page.locator('div > h1')).toHaveText(`Thank you, ${firstName}!`);
await expect(page.locator('div.success-wrapper--inner h1')).toHaveText(`Thank you, ${firstName}!`);

// Retrieve and verify marketing preferences data
const mpData = await MarketingPrefsVerify.get(email);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test.describe('Marketing preferences validation @sanity @nightly-sanity', () =>

// Submit the form
await page.click('button[type=submit]');
await expect(page.locator('div > h1')).toHaveText('Thank you, test!');
await expect(page.locator('div.success-wrapper--inner h1')).toHaveText('Thank you, test!');
});

test('Validate email marketing preference field', async ({ page }) => {
Expand All @@ -53,7 +53,7 @@ test.describe('Marketing preferences validation @sanity @nightly-sanity', () =>
// Re-enter valid email and submit
await page.fill('input#field-input--email', email);
await page.click('button[type=submit]');
await expect(page.locator('div > h1')).toHaveText('Thank you, test!');
await expect(page.locator('div.success-wrapper--inner h1')).toHaveText('Thank you, test!');
});

test('Validate phone marketing preference field', async ({ page }) => {
Expand All @@ -71,6 +71,6 @@ test.describe('Marketing preferences validation @sanity @nightly-sanity', () =>
// Re-enter valid phone number and submit
await page.fill('input#field-input--phone', phone);
await page.click('button[type=submit]');
await expect(page.locator('div > h1')).toHaveText('Thank you, test!');
await expect(page.locator('div.success-wrapper--inner h1')).toHaveText('Thank you, test!');
});
});
2 changes: 1 addition & 1 deletion playwright-staging/tests/submit/postcodeLookup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test.describe('Postcode validation @sanity @nightly-sanity', () => {
}

await page.click('button[type=submit]');
await expect(page.locator('div > h1')).toContainText('Thank you,\n' + 'test!');
await expect(page.locator('div.success-wrapper--inner h1')).toContainText('Thank you,\n' + 'test!');

await page.close();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test('Valid giftaid submission @sanity @nightly-sanity', async ({ page }) => {
]);

// Check for the thank you message to confirm successful submission
await expect(page.locator('div > h1')).toHaveText('Thank you, test!');
await expect(page.locator('div.success-wrapper--inner h1')).toHaveText('Thank you, test!');

await page.close();
});
2 changes: 1 addition & 1 deletion playwright-staging/tests/update/erp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test('Verify giftaid update ERP data @regression', async ({ page }) => {

// Submit the form and validate the thank you message
await page.locator('button[type=submit]').click();
await expect(page.locator('div > h1')).toContainText(`Thank you, ${contactInfo.firstName}!`);
await expect(page.locator('div.success-wrapper--inner h1')).toContainText(`Thank you, ${contactInfo.firstName}!`);

// ERP Steps
const giftaidUpdate = await erpTester.findOne('Gift Aid Declaration', {
Expand Down
10 changes: 5 additions & 5 deletions playwright-staging/tests/update/formValidation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test.describe('Giftaid Update form validation @sanity @nightly-sanity', () => {
await page.click('#giftAidClaimChoice>div:nth-child(2)>label'); // Select yes for declaration
await page.click('button[type=submit]'); // Submit the form

await expect(page.locator('div > h1')).toHaveText('Thank you, John!');
await expect(page.locator('div.success-wrapper--inner h1')).toHaveText('Thank you, John!');
await page.close();
});

Expand Down Expand Up @@ -89,7 +89,7 @@ test.describe('Giftaid Update form validation @sanity @nightly-sanity', () => {
await page.click('#giftAidClaimChoice>div:nth-child(3)>label'); // Select no for declaration
await page.click('button[type=submit]'); // Submit the form

await expect(page.locator('div > h1')).toHaveText('Thanks for letting us know');
await expect(page.locator('div.success-wrapper--inner h1')).toHaveText('Thanks for letting us know');
await page.close();
});

Expand Down Expand Up @@ -119,11 +119,11 @@ test.describe('Giftaid Update form validation @sanity @nightly-sanity', () => {

// Validate correct mobile number
await page.locator('#field-input--mobile').fill(''); // Ensure the field is cleared and filled with valid data
await commands.populateUpdateFormFields(page, { mobile: mobile });
await commands.populateUpdateFormFields(page, { lastName: 'test', mobile: mobile });
await page.click('#giftAidClaimChoice>div:nth-child(2)>label'); // Select yes for declaration
await page.click('button[type=submit]'); // Submit the form

await expect(page.locator('div > h1')).toHaveText('Thank you, test!');
await expect(page.locator('div.success-wrapper--inner h1')).toHaveText('Thank you, test!');
});

test('Postcode validation and form submission', async ({ page }) => {
Expand Down Expand Up @@ -170,7 +170,7 @@ test.describe('Giftaid Update form validation @sanity @nightly-sanity', () => {
await page.click('#giftAidClaimChoice>div:nth-child(2)>label'); // Select yes for declaration
await page.click('button[type=submit]'); // Submit the form

await expect(page.locator('div > h1')).toHaveText('Thank you, test!');
await expect(page.locator('div.success-wrapper--inner h1')).toHaveText('Thank you, test!');
await page.close();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test('Validate Giftaid declaration claim selections @sanity @nightly-sanity', as
expect(await page.locator('#giftAidClaimChoice>div:nth-child(2)>input').isChecked()).toBeFalsy();

await page.locator('button[type=submit]').click();
await expect(page.locator('div > h1')).toHaveText('Thanks for letting us know');
await expect(page.locator('div.success-wrapper--inner h1')).toHaveText('Thanks for letting us know');

await page.close();
});
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test.describe('International addresses validation on update form @sanity @nightl
await page.locator('button[type=submit]').click();

// Thank you message on success page
await expect(page.locator('div > h1')).toContainText('Thank you, test!');
await expect(page.locator('div.success-wrapper--inner h1')).toContainText('Thank you, test!');

await page.close();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test('Valid giftaid update submission @sanity @nightly-sanity', async ({ page })

// Submit the form and validate the thank you message
await page.locator('button[type=submit]').click();
await expect(page.locator('div > h1')).toContainText('Thank you, test!');
await expect(page.locator('div.success-wrapper--inner h1')).toContainText('Thank you, test!');

await page.close();
});

0 comments on commit 02cfcf3

Please sign in to comment.