-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TS-156] e2e tests (Pension-supplement)
- Loading branch information
1 parent
a8137ca
commit 8e1bec7
Showing
3 changed files
with
231 additions
and
0 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
206 changes: 206 additions & 0 deletions
206
apps/system-e2e/src/tests/islandis/application-system/acceptance/pension-supplement.spec.ts
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,206 @@ | ||
import { expect, test as base, Page } from '@playwright/test' | ||
import { | ||
disableI18n, | ||
disablePreviousApplications, | ||
} from '../../../../support/disablers' | ||
import { session } from '../../../../support/session' | ||
import { helpers } from '../../../../support/locator-helpers' | ||
import { pensionSupplementFormMessage } from '@island.is/application/templates/social-insurance-administration/pension-supplement' | ||
import { label } from '../../../../support/i18n' | ||
import { socialInsuranceAdministrationMessage } from '@island.is/application/templates/social-insurance-administration-core/lib/messages' | ||
import { setupXroadMocks } from './setup-xroad.mocks' | ||
|
||
const homeUrl = '/umsoknir/uppbot-a-lifeyri' | ||
|
||
const applicationTest = base.extend<{ applicationPage: Page }>({ | ||
applicationPage: async ({ browser }, use) => { | ||
const applicationContext = await session({ | ||
browser, | ||
homeUrl, | ||
phoneNumber: '0103019', // Gervimaður Afríka | ||
idsLoginOn: true, | ||
}) | ||
|
||
const applicationPage = await applicationContext.newPage() | ||
await disablePreviousApplications(applicationPage) | ||
await disableI18n(applicationPage) | ||
await applicationPage.goto(homeUrl) | ||
await expect(applicationPage).toBeApplication('uppbot-a-lifeyri') | ||
await setupXroadMocks() | ||
await use(applicationPage) | ||
|
||
await applicationPage.close() | ||
await applicationContext.close() | ||
}, | ||
}) | ||
|
||
applicationTest.describe('Pension Supplement', () => { | ||
applicationTest( | ||
'Should be able to create application', | ||
async ({ applicationPage }) => { | ||
const page = applicationPage | ||
const { proceed } = helpers(page) | ||
|
||
await applicationTest.step('Agree to data providers', async () => { | ||
await expect( | ||
page.getByRole('heading', { | ||
name: label( | ||
socialInsuranceAdministrationMessage.pre.externalDataSection, | ||
), | ||
}), | ||
).toBeVisible() | ||
await page.getByTestId('agree-to-data-providers').click() | ||
await page | ||
.getByRole('button', { | ||
name: label( | ||
socialInsuranceAdministrationMessage.pre.startApplication, | ||
), | ||
}) | ||
.click() | ||
}) | ||
|
||
await applicationTest.step('Fill in applicant info', async () => { | ||
await expect( | ||
page.getByRole('heading', { | ||
name: label( | ||
socialInsuranceAdministrationMessage.info.infoSubSectionTitle, | ||
), | ||
}), | ||
).toBeVisible() | ||
|
||
const phoneNumber = page.getByRole('textbox', { | ||
name: label( | ||
socialInsuranceAdministrationMessage.info.applicantPhonenumber, | ||
), | ||
}) | ||
await phoneNumber.selectText() | ||
await phoneNumber.fill('6555555') | ||
await proceed() | ||
}) | ||
|
||
await applicationTest.step('Fill in payment information', async () => { | ||
await expect( | ||
page.getByRole('heading', { | ||
name: label(socialInsuranceAdministrationMessage.payment.title), | ||
}), | ||
).toBeVisible() | ||
const paymentBank = page.getByRole('textbox', { | ||
name: label(socialInsuranceAdministrationMessage.payment.bank), | ||
}) | ||
await paymentBank.selectText() | ||
await paymentBank.fill('051226054678') | ||
await proceed() | ||
}) | ||
|
||
await applicationTest.step('Select application reason', async () => { | ||
await expect( | ||
page.getByRole('heading', { | ||
name: label(pensionSupplementFormMessage.applicationReason.title), | ||
}), | ||
).toBeVisible() | ||
|
||
await page | ||
.getByRole('region', { | ||
name: label(pensionSupplementFormMessage.applicationReason.title), | ||
}) | ||
.getByRole('checkbox', { | ||
name: label( | ||
pensionSupplementFormMessage.applicationReason.medicineCost, | ||
), | ||
}) | ||
.click() | ||
|
||
await proceed() | ||
}) | ||
|
||
await applicationTest.step('Select period', async () => { | ||
await expect( | ||
page.getByRole('heading', { | ||
name: label(socialInsuranceAdministrationMessage.period.title), | ||
}), | ||
).toBeVisible() | ||
await page.getByTestId('select-period.year').click() | ||
await page.keyboard.press('Enter') | ||
|
||
// TODO: Need to look into this, it may happen that a month is not valid | ||
await page.getByTestId('select-period.month').click() | ||
await page.keyboard.press('ArrowUp') | ||
await page.keyboard.press('Enter') | ||
await proceed() | ||
}) | ||
|
||
await applicationTest.step( | ||
'Check that additional documents header is visible', | ||
async () => { | ||
await expect( | ||
page.getByRole('heading', { | ||
name: label( | ||
socialInsuranceAdministrationMessage.fileUpload | ||
.additionalFileTitle, | ||
), | ||
}), | ||
).toBeVisible() | ||
await proceed() | ||
}, | ||
) | ||
|
||
await applicationTest.step('Write comment', async () => { | ||
await expect( | ||
page.getByRole('heading', { | ||
name: label( | ||
socialInsuranceAdministrationMessage.additionalInfo | ||
.commentSection, | ||
), | ||
}), | ||
).toBeVisible() | ||
await page | ||
.getByPlaceholder( | ||
label( | ||
socialInsuranceAdministrationMessage.additionalInfo | ||
.commentPlaceholder, | ||
), | ||
) | ||
.fill( | ||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vehicula malesuada augue, sit amet pulvinar tortor pellentesque at. Nulla facilisi. Nunc vel mi ac mi commodo rhoncus sit amet ut neque.', | ||
) | ||
await proceed() | ||
}) | ||
|
||
await applicationTest.step('Submit application', async () => { | ||
await expect( | ||
page | ||
.locator('form') | ||
.getByRole('paragraph') | ||
.filter({ | ||
hasText: label( | ||
socialInsuranceAdministrationMessage.confirm.overviewTitle, | ||
), | ||
}), | ||
).toBeVisible() | ||
await page | ||
.getByRole('button', { | ||
name: label( | ||
socialInsuranceAdministrationMessage.confirm.submitButton, | ||
), | ||
}) | ||
.click() | ||
}) | ||
|
||
await applicationTest.step( | ||
'Check that conclusion screen header is visible to view the application', | ||
async () => { | ||
await expect( | ||
page | ||
.getByRole('heading', { | ||
name: label( | ||
socialInsuranceAdministrationMessage.conclusionScreen | ||
.receivedTitle, | ||
), | ||
}) | ||
.first(), | ||
).toBeVisible() | ||
}, | ||
) | ||
}, | ||
) | ||
}) |
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