-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add testcontainers to project Signed-off-by: Mirko Mollik <[email protected]> * tmp Signed-off-by: Mirko Mollik <[email protected]> * remove coverage Signed-off-by: Mirko Mollik <[email protected]> * fix: add tests for app Signed-off-by: Mirko Mollik <[email protected]> * fix: move test deps to a dedicated module Signed-off-by: Mirko Mollik <[email protected]> * fix: fix project file Signed-off-by: Mirko Mollik <[email protected]> * fix: testing package Signed-off-by: Mirko Mollik <[email protected]> * fix tests Signed-off-by: Mirko Mollik <[email protected]> * fix: demo app Signed-off-by: Mirko Mollik <[email protected]> * fix: run e2e in the cloud Signed-off-by: Mirko Mollik <[email protected]> * fix: install browsers Signed-off-by: Mirko Mollik <[email protected]> * fix: testing in ci Signed-off-by: Mirko Mollik <[email protected]> * build keycloak in the ci step Signed-off-by: Mirko Mollik <[email protected]> * add docker login Signed-off-by: Mirko Mollik <[email protected]> * move keycloak image to cd Signed-off-by: Mirko Mollik <[email protected]> * add testcontainer token Signed-off-by: Mirko Mollik <[email protected]> * remove testcontainers run Signed-off-by: Mirko Mollik <[email protected]> * write token directly into the ci Signed-off-by: Mirko Mollik <[email protected]> * fix: add domain name Signed-off-by: Mirko Mollik <[email protected]> * fix: add logging to the test Signed-off-by: Mirko Mollik <[email protected]> * fix: just run the e2e test Signed-off-by: Mirko Mollik <[email protected]> * remove tc Signed-off-by: Mirko Mollik <[email protected]> * add verbose option Signed-off-by: Mirko Mollik <[email protected]> * call it with npx Signed-off-by: Mirko Mollik <[email protected]> * set start timeout instead of healthcheck Signed-off-by: Mirko Mollik <[email protected]> * use another port Signed-off-by: Mirko Mollik <[email protected]> * set logger on keycloak level Signed-off-by: Mirko Mollik <[email protected]> * fix: build keycloak Signed-off-by: Mirko Mollik <[email protected]> * fix: ci Signed-off-by: Mirko Mollik <[email protected]> * debug failing test Signed-off-by: Mirko Mollik <[email protected]> * add container step Signed-off-by: Mirko Mollik <[email protected]> * login into registry Signed-off-by: Mirko Mollik <[email protected]> * fix typo Signed-off-by: Mirko Mollik <[email protected]> * fix: tests Signed-off-by: Mirko Mollik <[email protected]> * remove logging in error Signed-off-by: Mirko Mollik <[email protected]> * fix: catch error Signed-off-by: Mirko Mollik <[email protected]> * ci Signed-off-by: Mirko Mollik <[email protected]> --------- Signed-off-by: Mirko Mollik <[email protected]>
- Loading branch information
Showing
73 changed files
with
1,646 additions
and
203 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
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 |
---|---|---|
@@ -1,8 +1,5 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('has title', async ({ page }) => { | ||
await page.goto('/'); | ||
|
||
// Expect h1 to contain a substring. | ||
expect(await page.locator('h1').innerText()).toContain('Welcome'); | ||
expect(true).toBeTruthy(); | ||
}); |
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
{ | ||
"backendUrlPP": "http://localhost:3001", | ||
"credentialId": "Identity", | ||
"oidcUrl": "http://host.docker.internal:8080/realms/wallet", | ||
"oidcClientId": "relying-party", | ||
"oidcClientSecret": "hA0mbfpKl8wdMrUxr2EjKtL5SGsKFW5D" | ||
} |
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,7 @@ | ||
{ | ||
"backendUrl": "http://localhost:3002", | ||
"credentialId": "Identity", | ||
"oidcUrl": "http://host.docker.internal:8080/realms/wallet", | ||
"oidcClientId": "relying-party", | ||
"oidcClientSecret": "hA0mbfpKl8wdMrUxr2EjKtL5SGsKFW5D" | ||
} |
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
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 was deleted.
Oops, something went wrong.
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,141 @@ | ||
import { | ||
Keycloak, | ||
HolderBackend, | ||
KeycloakGlobalThis, | ||
BackendGlobalThis, | ||
HolderFrontend, | ||
} from '@credhub/testing'; | ||
import { test, expect } from '@playwright/test'; | ||
|
||
const username = '[email protected]'; | ||
const password = 'mirko'; | ||
let keycloak: Keycloak; | ||
let backend: HolderBackend; | ||
let frontend: HolderFrontend; | ||
let hostname: string; | ||
|
||
test.beforeAll(async () => { | ||
//start keycloak | ||
keycloak = await Keycloak.init(); | ||
(globalThis as KeycloakGlobalThis).keycloak = keycloak; | ||
|
||
//start backend | ||
backend = await HolderBackend.init(); | ||
(globalThis as BackendGlobalThis).backend = backend; | ||
|
||
//start frontend | ||
frontend = await HolderFrontend.init(); | ||
|
||
hostname = `http://localhost:${frontend.instance.getMappedPort(80)}`; | ||
|
||
const testUserEmail = '[email protected]'; | ||
const testUserPassword = 'password'; | ||
// create a new user | ||
await keycloak.createUser( | ||
`http://localhost:${keycloak.instance.getMappedPort(8080)}`, | ||
'wallet', | ||
testUserEmail, | ||
testUserPassword | ||
); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await frontend.stop(); | ||
await backend.stop(); | ||
await keycloak.stop(); | ||
}); | ||
|
||
test('register', async ({ page }) => { | ||
await page.goto(hostname); | ||
|
||
//click on the button | ||
await page.click('text=Login'); | ||
|
||
await page.click('text=Register'); | ||
|
||
//fill the form | ||
await page.fill('input[name=email]', username); | ||
await page.fill('input[name=password]', password); | ||
await page.fill('input[name=password-confirm]', password); | ||
await page.click('input[type=submit]'); | ||
|
||
await page.waitForSelector('text=Credentials'); | ||
expect(true).toBeTruthy(); | ||
}); | ||
|
||
test('login', async ({ page }) => { | ||
await page.goto(hostname); | ||
|
||
//click on the button | ||
await page.click('text=Login'); | ||
|
||
//login into keycloak | ||
await page.fill('input[name=username]', username); | ||
await page.fill('input[name=password]', password); | ||
await page.click('id=kc-login'); | ||
|
||
//wait for the password input field | ||
// await page.waitForSelector('input[name=password]'); | ||
// await page.click('text=Sign In'); | ||
|
||
await page.waitForSelector('text=Credentials'); | ||
|
||
expect(true).toBeTruthy(); | ||
}); | ||
|
||
test('logout', async ({ page }) => { | ||
await page.goto(hostname); | ||
|
||
//click on the button | ||
await page.click('text=Login'); | ||
|
||
//login into keycloak | ||
await page.fill('input[name=username]', username); | ||
await page.fill('input[name=password]', password); | ||
await page.click('id=kc-login'); | ||
|
||
await page.waitForSelector('text=Credentials'); | ||
await page.goto(`${hostname}/settings`); | ||
|
||
await page.click('id=logout'); | ||
|
||
await page.waitForSelector('text=Login'); | ||
//expect to see the login button | ||
expect(true).toBeTruthy(); | ||
}); | ||
|
||
//TODO: does not work yet | ||
// test('delete account', async ({ page }) => { | ||
// await page.goto('http://localhost:4200'); | ||
|
||
// page.on('dialog', async (dialog) => dialog.accept()); | ||
|
||
// //click on the button | ||
// await page.click('text=Login'); | ||
|
||
// //login into keycloak | ||
// await page.fill('input[name=username]', username); | ||
// await page.fill('input[name=password]', password); | ||
// await page.click('id=kc-login'); | ||
|
||
// await page.waitForSelector('text=Credentials'); | ||
// await page.goto('http://localhost:4200/settings'); | ||
|
||
// await page.waitForSelector('id=delete-account'); | ||
|
||
// await page.click('id=delete-account'); | ||
|
||
// await page.waitForSelector('text=Login'); | ||
|
||
// //click on the button | ||
// await page.click('text=Login'); | ||
|
||
// //login into keycloak | ||
// await page.fill('input[name=username]', username); | ||
// await page.fill('input[name=password]', password); | ||
// await page.click('id=kc-login'); | ||
|
||
// //Invalid username or password. should be seen as an error | ||
// await page.waitForSelector('text=Invalid username or password.'); | ||
// expect(true).toBeTruthy(); | ||
// }); |
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
Oops, something went wrong.