forked from opencrvs/opencrvs-countryconfig
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Testcase 6 setup and made first test * Tests for marriage details page * Changed the error text selector to id since the review page has many exactly the same error messages. * Changed the error message catch for test 1.4. * Fix(1.4.): Fixed the invalid marriageDate test * fix(1.4.): Changed the text selctor to be id * Removed comment * Added goToSection helper method * Removed witness-2 test file * Update e2e/testcases/marriage/details-page-validation.spec.ts Co-authored-by: Jamil <[email protected]> --------- Co-authored-by: Jamil <[email protected]>
- Loading branch information
Showing
2 changed files
with
158 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
import { expect, test } from '@playwright/test' | ||
import { createPIN, goToSection, login } from '../../helpers' | ||
|
||
test.describe('6. Validate Marriage details page', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await login(page, 'k.mweene', 'test') | ||
await createPIN(page) | ||
await page.click('#header_new_event') | ||
await page.getByText('Marriage', { exact: true }).click() | ||
await page.getByText('Continue', { exact: true }).click() | ||
await page.getByText('Continue', { exact: true }).click() | ||
await page.getByPlaceholder('dd').fill('02') | ||
await page.getByPlaceholder('mm').fill('03') | ||
await page.getByPlaceholder('yyyy').fill('1995') | ||
await page.getByText('Continue', { exact: true }).click() | ||
await page.getByPlaceholder('dd').fill('01') | ||
await page.getByPlaceholder('mm').fill('05') | ||
await page.getByPlaceholder('yyyy').fill('1993') | ||
await page.getByText('Continue', { exact: true }).click() | ||
}) | ||
|
||
test('1.1. Enter date Less than the current date But after Groom and Bride DOB', async ({ | ||
page | ||
}) => { | ||
const pastDate = new Date() | ||
pastDate.setDate(new Date().getDate() - 2) | ||
const [yyyy, mm, dd] = pastDate.toISOString().split('T')[0].split('-') | ||
|
||
await page.getByPlaceholder('dd').fill(dd) | ||
await page.getByPlaceholder('mm').fill(mm) | ||
await page.getByPlaceholder('yyyy').fill(yyyy) | ||
await expect( | ||
page.getByText('Illegal age of marriage', { exact: true }) | ||
).toBeHidden() | ||
await expect( | ||
page.getByText('Required for registration. Enter a valid date', { | ||
exact: true | ||
}) | ||
).toBeHidden() | ||
}) | ||
|
||
test('1.2. 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.locator('#typeOfMarriage').click() | ||
await expect(page.locator('#marriageDate_error')).toHaveText( | ||
'Required for registration. Enter a valid date' | ||
) | ||
}) | ||
test('1.3. Keep field as null', async ({ page }) => { | ||
await goToSection(page, 'preview') | ||
await expect( | ||
page.locator('#required_label_marriageEvent_marriageDate') | ||
).toBeVisible() | ||
}) | ||
test('1.4. Enter date Less than the current date But before Groom and Bride DOB', async ({ | ||
page | ||
}) => { | ||
await page.getByPlaceholder('dd').fill('01') | ||
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() | ||
}) | ||
|
||
test('2.1. Select any country from the "Country" dropdown field, Default value is Farajaland', async ({ | ||
page | ||
}) => { | ||
await expect(page.getByText('Farajaland', { exact: true })).toBeVisible() | ||
await page.locator('#countryPlaceofmarriage').click() | ||
await page.getByText('Estonia', { exact: true }).click() | ||
await expect( | ||
page.getByText('Estonia', { | ||
exact: true | ||
}) | ||
).toBeVisible() | ||
}) | ||
test('2.2. Select any Province from "Province" dropdown field, Default value is Central', async ({ | ||
page | ||
}) => { | ||
await expect(page.getByText('Central', { exact: true })).toBeVisible() | ||
await page.locator('#statePlaceofmarriage').click() | ||
await page.getByText('Sulaka', { exact: true }).click() | ||
await expect( | ||
page.getByText('Sulaka', { | ||
exact: true | ||
}) | ||
).toBeVisible() | ||
}) | ||
test('2.3. Select any district from "District" dropdown field, Default value is Ibombo', async ({ | ||
page | ||
}) => { | ||
await expect(page.getByText('Ibombo', { exact: true })).toBeVisible() | ||
await page.locator('#districtPlaceofmarriage').click() | ||
await page.getByText('Isamba', { exact: true }).click() | ||
await expect( | ||
page.getByText('Isamba', { | ||
exact: true | ||
}) | ||
).toBeVisible() | ||
}) | ||
test('2.4. Select Urban address', async ({ page }) => { | ||
const townValue = 'My town' | ||
const residentalAreaValue = 'My residential area' | ||
const streetValue = 'My street' | ||
const phoneValue = '09123456' | ||
const postalCodeValue = '00120' | ||
await page.locator("[name='cityPlaceofmarriage']").fill(townValue) | ||
await page | ||
.locator("[name='addressLine1UrbanOptionPlaceofmarriage']") | ||
.fill(residentalAreaValue) | ||
await page | ||
.locator("[name='addressLine2UrbanOptionPlaceofmarriage']") | ||
.fill(streetValue) | ||
await page | ||
.locator("[name='addressLine3UrbanOptionPlaceofmarriage']") | ||
.fill(phoneValue) | ||
await page | ||
.locator("[name='postalCodePlaceofmarriage']") | ||
.fill(postalCodeValue) | ||
}) | ||
test('2.5. Select Rural address', async ({ page }) => { | ||
await page.getByText('Rural', { exact: true }).click() | ||
await page | ||
.locator('#addressLine1RuralOptionPlaceofmarriage') | ||
.fill('My village') | ||
}) | ||
test('3 Select any of the following options from Type of marriage dropdown', async ({ | ||
page | ||
}) => { | ||
await page.locator('#typeOfMarriage').click() | ||
await page.getByText('Polygamous', { exact: true }).click() | ||
await expect(page.getByText('Polygamous', { exact: true })).toBeVisible() | ||
await page.getByText('Continue', { exact: true }).click() | ||
await expect( | ||
page.getByText('Witness 1 details', { exact: true }) | ||
).toBeVisible() | ||
}) | ||
}) |