Skip to content

Commit 73c6ce5

Browse files
Update tests now that regex has changed
1 parent cf164f0 commit 73c6ce5

4 files changed

Lines changed: 5 additions & 21 deletions

File tree

playwright-local/tests/submit/postcodeLookup.spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ test.describe('Postcode validation', () => {
1616
test('Postcode formatting errors', async ({ page }) => {
1717
const postcodes = [
1818
{ code: 'S E 1 7 T P', message: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' },
19-
{ code: 'se17tp', message: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' },
20-
{ code: 'SE17TP', message: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' },
2119
{ code: 'SE$%TP', message: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' }
2220
];
2321

playwright-local/tests/update/formValidation.spec.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -216,21 +216,11 @@ test.describe('Giftaid update form validation', () => {
216216
await page.close();
217217
});
218218

219-
test('postcode entered in lowercase should show error message', async ({ page }) => {
220-
221-
await page.locator('input#field-input--postcode').type('se17tp');
222-
await expect(page.locator('div#field-error--postcode > span')).toBeVisible();
223-
await expect(page.locator('div#field-error--postcode > span')).toContainText('Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.');
224-
225-
await page.close();
226-
});
227-
228-
test('postcode entered with no spaces should show error message', async ({ page }) => {
229-
230-
await page.locator('input#field-input--postcode').type('SE17TP');
231-
await expect(page.locator('div#field-error--postcode > span')).toBeVisible();
232-
await expect(page.locator('div#field-error--postcode > span')).toContainText('Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.');
233-
219+
test('compact lowercase and no-space UK postcodes do not show format error (aligned with data-models / postcode)', async ({ page }) => {
220+
await page.locator('input#field-input--postcode').fill('se17tp');
221+
await expect(page.locator('div#field-error--postcode > span')).not.toBeVisible();
222+
await page.locator('input#field-input--postcode').fill('SE17TP');
223+
await expect(page.locator('div#field-error--postcode > span')).not.toBeVisible();
234224
await page.close();
235225
});
236226

playwright-staging/tests/submit/postcodeLookup.spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ test.describe('Postcode validation @sanity @nightly-sanity', () => {
1616
test('Postcode formatting errors', async ({ page }) => {
1717
const postcodes = [
1818
{ code: 'S E 1 7 T P', message: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' },
19-
{ code: 'se17tp', message: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' },
20-
{ code: 'SE17TP', message: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' },
2119
{ code: 'SE$%TP', message: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' }
2220
];
2321

playwright-staging/tests/update/formValidation.spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ test.describe('Giftaid Update form validation @sanity @nightly-sanity', () => {
136136
// Define postcodes and expected error messages
137137
const postcodes = [
138138
{ input: 'S E 1 7 T P', error: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' },
139-
{ input: 'se17tp', error: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' },
140-
{ input: 'SE17TP', error: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' },
141139
{ input: 'SE$%TP', error: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' },
142140
{ input: 'cro 7tp', error: 'Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below.' }
143141
];

0 commit comments

Comments
 (0)