From 168063dd9408d3503da08cd87ac3519c59dcd0c8 Mon Sep 17 00:00:00 2001 From: Eezi Date: Sat, 24 Aug 2024 08:21:58 +0300 Subject: [PATCH 1/8] Fixed broken tests --- .../5-validate-bride-details-page.spec.ts | 315 ++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 e2e/testcases/marriage/5-validate-bride-details-page.spec.ts diff --git a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts new file mode 100644 index 000000000..7530b6771 --- /dev/null +++ b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts @@ -0,0 +1,315 @@ +import { test, expect } from '@playwright/test' +import { createPIN, goToSection, login } from '../../helpers' + +test.describe("4. Validate the groom's details page", () => { + test.beforeEach(async ({ page }) => { + await login(page, 'k.mweene', 'test') + await createPIN(page) + + await page.click('#header_new_event') + + await expect(page.getByText('New Declaration')).toBeVisible() + await expect(page.getByText('Event type')).toBeVisible() + await expect(page.getByLabel('Marriage')).toBeVisible() + + await page.getByLabel('Marriage').click() + // goToSection(page, 'bride') + await page.getByRole('button', { name: 'Continue' }).click() + await page.getByRole('button', { name: 'Continue' }).click() + await page.getByRole('button', { name: 'Continue' }).click() + + await expect(page.getByText("Bride's details")).toBeVisible() + }) + + test.describe('1 Validate the "Nationality" drop-down field.', async () => { + test('1. Select any drop-down value from the drop-down', async ({ + page + }) => { + await expect(page.locator('#countryPrimaryBride')).toHaveText( + 'Farajaland' + ) + await page.locator('#countryPrimaryBride').click() + await page.getByText('Estonia', { exact: true }).click() + await expect( + page.getByText('Estonia', { + exact: true + }) + ).toBeVisible() + }) + }) + + test.describe('2 Validate the National ID field', async () => { + test('2.1. Enter numerical value less than 9 digit', async ({ page }) => { + const shortValue = '12345' + await page.locator('#brideIdType').click() + await page.getByText('National ID', { exact: true }).click() + await page.locator('#brideNationalId').fill(shortValue) + await page.getByText("Bride's details").click() + + await expect(page.locator('#brideNationalId_error')).toHaveText( + 'The National ID can only be numeric and must be 10 digits long' + ) + }) + + test('2.2 Set the field as NULL', async ({ page }) => { + await page.locator('#brideIdType').click() + await page.getByText('National ID', { exact: true }).click() + await page.locator('#brideNationalId').click() + await page.getByText("Bride's details").click() + await expect(page.locator('#brideNationalId_error')).toHaveText( + 'Required for registration' + ) + goToSection(page, 'preview') + + await expect( + page.locator('#required_label_bride_brideNationalId') + ).toHaveText('Required for registration') + }) + + test('2.3 Enter numerical value 9 digit', async ({ page }) => { + const correctValue = '0912312222' + + await page.locator('#brideIdType').click() + await page.getByText('National ID', { exact: true }).click() + await page.locator('#brideNationalId').fill(correctValue) + await page.getByText("Bride's details").click() + + await expect(page.locator('#brideNationalId_error')).toBeHidden() + }) + + test('2.4 Enter numerical value above 9 digit', async ({ page }) => { + const tooLongValue = '091231222222' + await page.locator('#brideIdType').click() + await page.getByText('National ID', { exact: true }).click() + await page.locator('#brideNationalId').fill(tooLongValue) + await page.getByText("Bride's details").click() + + await expect(page.locator('#brideNationalId_error')).toHaveText( + 'The National ID can only be numeric and must be 10 digits long' + ) + }) + test('2.5 Enter the same 9 digit value of informant', async ({ page }) => { + const sameNumbersValue = '222222222' + await page.locator('#brideIdType').click() + await page.getByText('National ID', { exact: true }).click() + await page.locator('#brideNationalId').fill(sameNumbersValue) + await page.getByText("Bride's details").click() + + await expect(page.locator('#brideNationalId_error')).toHaveText( + 'The National ID can only be numeric and must be 10 digits long' + ) + }) + }) + + test.describe('2.1 Validate "First Name(s)" text field', async () => { + test.describe('2.1.1 Enter Non-English characters', async () => { + test('Using name: Richard the 3rd', async ({ page }) => { + await page.locator('#firstNamesEng').fill('Richard the 3rd') + await page.getByText("Bride's details").click() + + /* + * Expected result: should accept the input and not throw any error + */ + await expect(page.locator('#firstNamesEng_error')).toBeHidden() + }) + + test('Using name: John_Peter', async ({ page }) => { + await page.locator('#firstNamesEng').fill('John_Peter') + await page.getByText("Bride's details").click() + + /* + * Expected result: should accept the input and not throw any error + */ + await expect(page.locator('#firstNamesEng_error')).toBeHidden() + }) + + test('Using name: John-Peter', async ({ page }) => { + await page.locator('#firstNamesEng').fill('John-Peter') + await page.getByText("Bride's details").click() + + /* + * Expected result: should accept the input and not throw any error + */ + await expect(page.locator('#firstNamesEng_error')).toBeHidden() + }) + + test("Using name: O'Neill", async ({ page }) => { + await page.locator('#firstNamesEng').fill("O'Neill") + await page.getByText("Bride's details").click() + + /* + * Expected result: should accept the input and not throw any error + */ + await expect(page.locator('#firstNamesEng_error')).toBeHidden() + }) + + test('Using name: &er$on', async ({ page }) => { + await page.locator('#firstNamesEng').fill('&er$on') + await page.getByText("Bride's details").click() + + /* + * Expected result: should accept the input and not throw any error + */ + await expect(page.locator('#firstNamesEng_error')).toBeVisible() + }) + + test.skip('Using name: X Æ A-Xii', async ({ page }) => { + await page.locator('#firstNamesEng').fill('X Æ A-Xii') + await page.getByText("Bride's details").click() + + /* + * Expected result: should throw error: + * - Input contains invalid characters. Please use only letters (a-z), numbers (0-9), hyphens (-), and underscores (_) + */ + await expect(page.locator('#firstNamesEng_error')).toBeVisible() + }) + }) + + test('2.1.2 Enter less than 33 English characters', async ({ page }) => { + await page.locator('#firstNamesEng').fill('Rakibul Islam') + await page.getByText("Bride's details").click() + + /* + * Expected result: should accept the input and not throw any error + */ + await expect(page.locator('#firstNamesEng_error')).toBeHidden() + }) + + test('2.1.3 Enter Field as NULL', async ({ page }) => { + goToSection(page, 'preview') + + /* + * Expected result: should throw error in application review page: + * - Required for registration + */ + await expect( + page.locator('#required_label_bride_firstNamesEng') + ).toBeVisible() + }) + + test('2.1.4 Enter more than 32 English characters', async ({ page }) => { + const LONG_NAME = 'Ovuvuevuevue Enyetuenwuevue Ugbemugbem Osas' + await page.locator('#firstNamesEng').fill(LONG_NAME) + await page.getByText("Bride's details").click() + + /* + * Expected result: should clip the name to first 32 character + */ + await expect(page.locator('#firstNamesEng')).toHaveValue( + LONG_NAME.slice(0, 32) + ) + }) + }) + + test.describe('3 Validate the "DOB" field', async () => { + test('3.1. Enter date Less than the current date and focus out from the field ', async ({ + page + }) => { + const yyyy = '1996' + const mm = '03' + const dd = '12' + + await page.getByPlaceholder('dd').fill(dd) + await page.getByPlaceholder('mm').fill(mm) + await page.getByPlaceholder('yyyy').fill(yyyy) + await page.getByText("Bride's details").click() + + /* + * Expected result: should accept the date + */ + await expect(page.locator('#brideBirthDate_error')).toBeHidden() + }) + + test('3.2. Enter invalid date', async ({ page }) => { + await page.getByPlaceholder('dd').fill('0') + await page.getByPlaceholder('mm').fill('0') + await page.getByPlaceholder('yyyy').fill('0') + await page.getByText("Bride's details").click() + + /* + * Expected result: should not accept the invalid date and show error: + * - Must be a valid birth date + */ + await expect(page.locator('#brideBirthDate_error')).toHaveText( + 'Required for registration. Enter a valid date' + ) + }) + + test('2.3 Set the field as null', async ({ page }) => { + goToSection(page, 'preview') + + /* + * Expected result: should throw error in application review page: + * - Required for registration + */ + await expect( + page.locator('#required_label_bride_brideBirthDate') + ).toHaveText('Required for registration. Enter a valid date') + }) + + test('2.4. Enter future date', async ({ page }) => { + const futureDate = new Date() + futureDate.setDate(new Date().getDate() + 5) + const [yyyy, mm, dd] = futureDate.toISOString().split('T')[0].split('-') + + await page.getByPlaceholder('dd').fill(dd) + await page.getByPlaceholder('mm').fill(mm) + await page.getByPlaceholder('yyyy').fill(yyyy) + await page.getByText("Bride's details").click() + + /* + * Expected result: should not accept the future date and show error: + * - Must be a valid birth date + */ + await expect(page.locator('#brideBirthDate_error')).toHaveText( + 'Must be a valid birth date' + ) + }) + }) + test.describe('4 Validate the Residence section', async () => { + test('4.1. Select any country from the "Country" dropdown field, Default value is Farajaland ', async ({ + page + }) => { + await expect(page.locator('#countryPrimaryBride')).toHaveText( + 'Farajaland' + ) + await page.locator('#countryPrimaryBride').click() + await page.getByText('Estonia', { exact: true }).click() + await page.getByText("Bride's details").click() + await expect(page.locator('#countryPrimaryBride')).toHaveText('Estonia') + }) + + test('4.2. Select any Province from "Province" dropdown field, Default value is Central', async ({ + page + }) => { + await page.locator('#statePrimaryBride').click() + await page.getByText('Sulaka', { exact: true }).click() + await page.getByText("Bride's details").click() + await expect(page.locator('#statePrimaryBride')).toHaveText('Sulaka') + }) + + test('4.3 Select any district from "District" dropdown field, Default value is Ibombo', async ({ + page + }) => { + await page.locator('#districtPrimaryBride').click() + await page.getByText('Isamba', { exact: true }).click() + await page.getByText("Bride's details").click() + await expect(page.locator('#districtPrimaryBride')).toHaveText('Isamba') + }) + + test('4.4. Select Urban address', async ({ page }) => { + await page.getByLabel('Urban').check() + await page.getByText("Bride's details").click() + await expect(page.getByLabel('Urban')).toBeChecked() + }) + test('4.5. Select Rural address', async ({ page }) => { + await page.getByLabel('Rural').check() + await page.getByText("Bride's details").click() + await expect(page.getByLabel('Rural')).toBeChecked() + }) + test('4.6. Click the continue button', async ({ page }) => { + await page.getByRole('button', { name: 'Continue' }).click() + await expect(page.getByText('Marriage details')).toBeVisible() + }) + }) +}) From ebcc3e6598b7dc47ca971d8c7b38c786e840f06a Mon Sep 17 00:00:00 2001 From: Eezi Date: Sat, 24 Aug 2024 08:27:00 +0300 Subject: [PATCH 2/8] Added correct test describe name --- e2e/testcases/marriage/5-validate-bride-details-page.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts index 7530b6771..8686c23ef 100644 --- a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts +++ b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from '@playwright/test' import { createPIN, goToSection, login } from '../../helpers' -test.describe("4. Validate the groom's details page", () => { +test.describe("4. Validate the bride's details page", () => { test.beforeEach(async ({ page }) => { await login(page, 'k.mweene', 'test') await createPIN(page) From e84e9ed2a6257307b08fc7dac95d62837e08e126 Mon Sep 17 00:00:00 2001 From: Eezi Date: Tue, 3 Sep 2024 20:08:13 +0300 Subject: [PATCH 3/8] Fixed error text check --- e2e/testcases/marriage/6-details-page-validation.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/e2e/testcases/marriage/6-details-page-validation.spec.ts b/e2e/testcases/marriage/6-details-page-validation.spec.ts index b15e8a19b..fe45e4959 100644 --- a/e2e/testcases/marriage/6-details-page-validation.spec.ts +++ b/e2e/testcases/marriage/6-details-page-validation.spec.ts @@ -65,7 +65,9 @@ test.describe('6. Validate Marriage details page', () => { await page.getByPlaceholder('mm').fill('05') await page.getByPlaceholder('yyyy').fill('1960') await page.getByText('Marriage details').click() - await expect(page.locator('#marriageDate_error')).toBeVisible() + await expect(page.locator('#marriageDate_error')).toHaveText( + 'Must be a valid date of marriage' + ) }) test('2.1. Select any country from the "Country" dropdown field, Default value is Farajaland', async ({ From ea83e08042eeb22ba53d8481d59c78e083a2701f Mon Sep 17 00:00:00 2001 From: Tomi Salo <54830004+Eezi@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:44:44 +0200 Subject: [PATCH 4/8] Update e2e/testcases/marriage/5-validate-bride-details-page.spec.ts Co-authored-by: Jamil --- e2e/testcases/marriage/5-validate-bride-details-page.spec.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts index 8686c23ef..1bbfb955a 100644 --- a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts +++ b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts @@ -13,10 +13,7 @@ test.describe("4. Validate the bride's details page", () => { await expect(page.getByLabel('Marriage')).toBeVisible() await page.getByLabel('Marriage').click() - // goToSection(page, 'bride') - await page.getByRole('button', { name: 'Continue' }).click() - await page.getByRole('button', { name: 'Continue' }).click() - await page.getByRole('button', { name: 'Continue' }).click() + await goToSection(page, 'bride') await expect(page.getByText("Bride's details")).toBeVisible() }) From a50443a8fb754b57a4e19c0064e3dc5e1f2db131 Mon Sep 17 00:00:00 2001 From: Tomi Salo <54830004+Eezi@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:44:51 +0200 Subject: [PATCH 5/8] Update e2e/testcases/marriage/5-validate-bride-details-page.spec.ts Co-authored-by: Jamil --- e2e/testcases/marriage/5-validate-bride-details-page.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts index 1bbfb955a..ba23c49f3 100644 --- a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts +++ b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts @@ -56,7 +56,7 @@ test.describe("4. Validate the bride's details page", () => { await expect(page.locator('#brideNationalId_error')).toHaveText( 'Required for registration' ) - goToSection(page, 'preview') + await goToSection(page, 'preview') await expect( page.locator('#required_label_bride_brideNationalId') From 48523f722290a1616a587961d66423b4a229ba00 Mon Sep 17 00:00:00 2001 From: Tomi Salo <54830004+Eezi@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:45:07 +0200 Subject: [PATCH 6/8] Update e2e/testcases/marriage/5-validate-bride-details-page.spec.ts Co-authored-by: Jamil --- e2e/testcases/marriage/5-validate-bride-details-page.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts index ba23c49f3..35dffc9d5 100644 --- a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts +++ b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts @@ -173,7 +173,7 @@ test.describe("4. Validate the bride's details page", () => { }) test('2.1.3 Enter Field as NULL', async ({ page }) => { - goToSection(page, 'preview') + await goToSection(page, 'preview') /* * Expected result: should throw error in application review page: From af9226a261cbf8d4b6803bf72fb5f860c5d1a6f8 Mon Sep 17 00:00:00 2001 From: Tomi Salo <54830004+Eezi@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:45:14 +0200 Subject: [PATCH 7/8] Update e2e/testcases/marriage/5-validate-bride-details-page.spec.ts Co-authored-by: Jamil --- e2e/testcases/marriage/5-validate-bride-details-page.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts index 35dffc9d5..24194502d 100644 --- a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts +++ b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts @@ -233,7 +233,7 @@ test.describe("4. Validate the bride's details page", () => { }) test('2.3 Set the field as null', async ({ page }) => { - goToSection(page, 'preview') + await goToSection(page, 'preview') /* * Expected result: should throw error in application review page: From 84c53671234a37ee74aebbace089e50cf84cc84c Mon Sep 17 00:00:00 2001 From: Tomi Salo <54830004+Eezi@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:45:24 +0200 Subject: [PATCH 8/8] Update e2e/testcases/marriage/5-validate-bride-details-page.spec.ts Co-authored-by: Jamil --- e2e/testcases/marriage/5-validate-bride-details-page.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts index 24194502d..698201c08 100644 --- a/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts +++ b/e2e/testcases/marriage/5-validate-bride-details-page.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from '@playwright/test' import { createPIN, goToSection, login } from '../../helpers' -test.describe("4. Validate the bride's details page", () => { +test.describe("5. Validate the bride's details page", () => { test.beforeEach(async ({ page }) => { await login(page, 'k.mweene', 'test') await createPIN(page)