-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(tests): Use new e2e testing lib for imports + move some system-e2e tests to apps #16387
Closed
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
8cfd178
Update Playwright version
d24425e
Add utils to testing/e2e lib
979d24a
Add .gitignore and @nx/playwright
2881992
Add mockoon mocks and cleanup in libs/testing/e2e
d4eca4b
Merge branch 'main' into feat/use-new-e2e-test-lib-imports
42cf9de
Fix yarn file after merging main
e3def33
chore: nx format:write update dirty files
andes-it 360d052
Update
6478106
Merge branch 'main' into feat/use-new-e2e-test-lib-imports
0f9fa6c
Debug next config
AndesKrrrrrrrrrrr 07a2373
Disable tracing
AndesKrrrrrrrrrrr 10b0174
Return _something_ on liveness
AndesKrrrrrrrrrrr d9351c1
Not output from proxies
AndesKrrrrrrrrrrr f30955f
Replace proxies
AndesKrrrrrrrrrrr 40621b6
Debug & stuff in bootstrap
AndesKrrrrrrrrrrr 2c9d5ed
Debug & linting in infra-express-server
AndesKrrrrrrrrrrr 9df5a01
Fewer use
AndesKrrrrrrrrrrr 3177c6f
Revert scripts
AndesKrrrrrrrrrrr c6d442d
Merge branch 'main' into fix/nextjs-crash-startup
AndesKrrrrrrrrrrr 58f4025
Revert almost all to main
AndesKrrrrrrrrrrr ae84746
Only keep handler error handling
AndesKrrrrrrrrrrr 5759714
Re-add removed comments
AndesKrrrrrrrrrrr 1f6e4a5
Update libs/infra-next-server/src/lib/health.ts
AndesKrrrrrrrrrrr e7351c8
Add Application System and Endorsement System
f0926a1
Revert yarn version
9b560fe
Merge branch 'main' into feat/use-new-e2e-test-lib-imports
b41538e
Yarn fixes after merge
2a73e65
chore: nx format:write update dirty files
andes-it 53b5678
Update
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,3 +98,8 @@ apps/**/index.html | |
|
||
.nx/ | ||
.zed/ | ||
|
||
# E2E outputs | ||
test-results/ | ||
playwright-report/ | ||
tmp-sessions/ |
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
97 changes: 97 additions & 0 deletions
97
apps/application-system/form/e2e/acceptance/announcement-of-death.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,97 @@ | ||
import { | ||
test as base, | ||
expect, | ||
Page, | ||
disableI18n, | ||
disablePreviousApplications, | ||
disableObjectKey, | ||
session, | ||
} from '@island.is/testing/e2e' | ||
|
||
const homeUrl = '/umsoknir/andlatstilkynningar' | ||
|
||
const applicationTest = base.extend<{ applicationPage: Page }>({ | ||
applicationPage: async ({ browser }, use) => { | ||
const applicationContext = await session({ | ||
browser, | ||
homeUrl, | ||
phoneNumber: '0102399', | ||
idsLoginOn: true, | ||
}) | ||
|
||
const applicationPage = await applicationContext.newPage() | ||
await disableObjectKey(applicationPage, 'existingApplication') | ||
await disablePreviousApplications(applicationPage) | ||
await disableI18n(applicationPage) | ||
await applicationPage.goto(homeUrl) | ||
await expect(applicationPage).toBeApplication() | ||
await use(applicationPage) | ||
|
||
await applicationPage.close() | ||
await applicationContext.close() | ||
}, | ||
}) | ||
|
||
applicationTest.describe('Announcement of Death', () => { | ||
applicationTest('test', async ({ applicationPage }) => { | ||
const page = applicationPage | ||
await expect(page).toBeApplication() | ||
|
||
// Custom continue button | ||
const submitButton = page.getByRole('button', { name: 'Halda áfram' }) | ||
const nextButton = page.getByTestId('proceed') | ||
|
||
// Data Providers | ||
await page.getByTestId('agree-to-data-providers').click() | ||
await page.getByTestId('proceed').click() | ||
|
||
// Accept handling the announcement | ||
await page.locator('input[value=continue]').click() | ||
await submitButton.click() | ||
|
||
// Relations screen | ||
// TODO improve selectability in this screen | ||
await page.locator('text=Veldu tengsl').click() | ||
await page.locator('div:text("Systir")').click() | ||
await page.locator('input[name=applicantPhone]').fill('500-5000') | ||
await page.locator('input[name=applicantEmail]').fill('e@mail.com') | ||
await nextButton.click() | ||
|
||
// Other wills and prenup screen | ||
await page.locator('label[for=knowledgeOfOtherWills-1]').click() | ||
await nextButton.click() | ||
|
||
// Heirs -> add a new heir | ||
await page.getByText('Bæta við erfingja').click() | ||
await page.getByLabel('Kennitala').last().fill('010130-5069') | ||
await page.getByLabel('Tengsl').last().click() | ||
await page.locator('div:text("Systir")').last().click() | ||
await expect(page.getByLabel('Nafn').last()).not.toBeEmpty() | ||
await nextButton.click() | ||
|
||
// Assets | ||
const foreignAssets = page.getByLabel('Eignir erlendis') | ||
await foreignAssets.check() | ||
await foreignAssets.uncheck() | ||
await nextButton.click() | ||
|
||
// Recipients of documents | ||
const dropdowns = page.getByLabel('Enginn viðtakandi') //locator('label[for=certificateOfDeathAnnouncement]') | ||
for (const dropdown of await dropdowns.all()) { | ||
await dropdown.click() | ||
await dropdown.getByText('Gervimaður').first().click() | ||
} | ||
await nextButton.click() | ||
|
||
// Overview screen | ||
await page.getByLabel('Upplýsingar').fill('test test þæö') | ||
await page | ||
.getByRole('button', { name: 'Staðfesta andlátstilkynningu' }) | ||
.click() | ||
|
||
// Confirmation screen | ||
await expect( | ||
page.getByRole('heading', { name: 'Tilkynning móttekin' }), | ||
).toBeVisible() | ||
}) | ||
}) |
119 changes: 119 additions & 0 deletions
119
apps/application-system/form/e2e/acceptance/car-recycling.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,119 @@ | ||
import { carRecyclingMessages } from '@island.is/application/templates/car-recycling' | ||
import { | ||
test as base, | ||
expect, | ||
Page, | ||
disableI18n, | ||
disablePreviousApplications, | ||
session, | ||
label, | ||
helpers, | ||
} from '@island.is/testing/e2e' | ||
import { coreMessages } from '@island.is/application/core' | ||
|
||
const homeUrl = '/umsoknir/skilavottord' | ||
|
||
const applicationTest = base.extend<{ applicationPage: Page }>({ | ||
applicationPage: async ({ browser }, use) => { | ||
const applicationContext = await session({ | ||
browser, | ||
homeUrl, | ||
phoneNumber: '0102989', | ||
idsLoginOn: true, | ||
}) | ||
|
||
const applicationPage = await applicationContext.newPage() | ||
await disablePreviousApplications(applicationPage) | ||
await disableI18n(applicationPage) | ||
await applicationPage.goto(homeUrl) | ||
await expect(applicationPage).toBeApplication() | ||
await use(applicationPage) | ||
|
||
await applicationPage.close() | ||
await applicationContext.close() | ||
}, | ||
}) | ||
|
||
applicationTest.describe('Car recycling', () => { | ||
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(carRecyclingMessages.pre.externalDataSubSection), | ||
}), | ||
).toBeVisible() | ||
await page.getByTestId('agree-to-data-providers').click() | ||
|
||
await page | ||
.getByRole('button', { | ||
name: label(coreMessages.buttonNext), | ||
}) | ||
.click() | ||
}) | ||
|
||
await applicationTest.step('Unregister for recycling', async () => { | ||
await expect( | ||
page.getByRole('heading', { | ||
name: label(carRecyclingMessages.cars.sectionTitle), | ||
}), | ||
).toBeVisible() | ||
|
||
await page | ||
.getByRole('region', { | ||
name: label(carRecyclingMessages.cars.sectionTitle), | ||
}) | ||
.getByRole('button', { | ||
name: label(carRecyclingMessages.cars.recycle), | ||
}) | ||
.first() | ||
.click() | ||
await expect( | ||
page.getByRole('heading', { | ||
name: label(carRecyclingMessages.cars.selectedTitle), | ||
}), | ||
).toBeVisible() | ||
|
||
const mileage = page.getByRole('textbox', { | ||
name: label(carRecyclingMessages.cars.mileage), | ||
}) | ||
|
||
await mileage.selectText() | ||
await mileage.type('12345') | ||
|
||
await proceed() | ||
}) | ||
|
||
await applicationTest.step('Submit application', async () => { | ||
await expect( | ||
page | ||
.locator('form') | ||
.getByRole('paragraph') | ||
.filter({ | ||
hasText: label(carRecyclingMessages.review.confirmSectionTitle), | ||
}), | ||
).toBeVisible() | ||
await page | ||
.getByRole('button', { | ||
name: label(carRecyclingMessages.review.confirmSectionTitle), | ||
}) | ||
.click() | ||
}) | ||
|
||
await applicationTest.step( | ||
'Check that conclusion screen header is visible and proceed to view the application', | ||
async () => { | ||
await expect( | ||
page.getByRole('heading', { | ||
name: label(carRecyclingMessages.conclusionScreen.title), | ||
}), | ||
).toBeVisible() | ||
}, | ||
) | ||
}, | ||
) | ||
}) |
99 changes: 99 additions & 0 deletions
99
apps/application-system/form/e2e/acceptance/criminal-record.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,99 @@ | ||
import { m } from '@island.is/application/templates/criminal-record/messages' | ||
import { | ||
test as base, | ||
expect, | ||
Page, | ||
disableI18n, | ||
session, | ||
label, | ||
createApplication, | ||
} from '@island.is/testing/e2e' | ||
|
||
const homeUrl = '/umsoknir/sakavottord' | ||
|
||
const applicationTest = base.extend<{ applicationPage: Page }>({ | ||
applicationPage: async ({ browser }, use) => { | ||
const applicationContext = await session({ | ||
browser, | ||
homeUrl, | ||
phoneNumber: '0103019', | ||
idsLoginOn: true, | ||
}) | ||
|
||
const applicationPage = await applicationContext.newPage() | ||
await disableI18n(applicationPage) | ||
await applicationPage.goto(homeUrl) | ||
await use(applicationPage) | ||
|
||
await applicationPage.close() | ||
await applicationContext.close() | ||
}, | ||
}) | ||
|
||
applicationTest.describe('Criminal record application payment test', () => { | ||
applicationTest( | ||
'Should be able to proceed through payment', | ||
async ({ applicationPage }) => { | ||
const page = applicationPage | ||
|
||
const buttonStaðfesta = label(m.confirm) | ||
const buttonBætaViðKorti = 'Bæta við korti' | ||
const buttonGreiða = 'Greiða' | ||
const buttonTextSubmit3DData = 'Submit 3D data' | ||
const textGervimaðurAfríka = 'Gervimaður Afríka' | ||
const textGreiðslaTókst = 'Greiðsla tókst' | ||
const textUmsóknStaðfest = label(m.successTitle) | ||
const textAfgreidd = label(m.actionCardDone) | ||
|
||
await applicationTest.step( | ||
'Create and proceed with application', | ||
async () => { | ||
await createApplication(page) | ||
await page.getByTestId('agree-to-data-providers').check() | ||
await page.getByTestId('proceed').click() | ||
await expect(page.getByText(textGervimaðurAfríka)).toBeVisible() | ||
}, | ||
) | ||
|
||
await applicationTest.step('Confirm application', async () => { | ||
await page.getByRole('button', { name: buttonStaðfesta }).click() | ||
await page.waitForURL('https://uat.arkid.is/quickpay/card') | ||
}) | ||
|
||
await applicationTest.step('Add a card', async () => { | ||
await page.getByRole('button', { name: buttonBætaViðKorti }).click() | ||
await page.getByPlaceholder('Nafn korthafa').fill('Valitortestfyrirtgr') | ||
await page.getByPlaceholder('Kortanúmer').fill('2223000010246699') | ||
await page.getByPlaceholder('Öryggiskóði').fill('123') | ||
|
||
const date = new Date() | ||
const month = String(date.getMonth() + 1).padStart(2, '0') | ||
const year = String(date.getFullYear()).slice(-2) | ||
await page.getByPlaceholder('MM/ÁÁ').fill(`${month}${year}`) | ||
}) | ||
|
||
await applicationTest.step('Complete payment', async () => { | ||
await page.getByRole('button', { name: buttonGreiða }).click() | ||
await page.getByRole('button', { name: buttonTextSubmit3DData }).click() | ||
await page.getByText(textGreiðslaTókst).isVisible() | ||
}) | ||
|
||
await applicationTest.step( | ||
'Verify payment completion on screen and overview', | ||
async () => { | ||
await page | ||
.getByRole('heading', { | ||
name: textUmsóknStaðfest, | ||
}) | ||
.isVisible() | ||
|
||
await page.goto(`${homeUrl}`, { waitUntil: 'networkidle' }) | ||
await page.getByTestId('application-card').first().isVisible() | ||
expect(await page.getByText(textAfgreidd).first().isVisible()).toBe( | ||
true, | ||
) | ||
}, | ||
) | ||
}, | ||
) | ||
}) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve inconsistent port numbers in development configuration
There's an inconsistency in the development configuration where two different ports are used for baseApiUrl:
This could lead to confusion and potential issues if different parts of the application expect different ports.
Consider using the same port or environment variables for consistency:
Also applies to: 26-26