Skip to content

Commit

Permalink
fix: bump database versions in tests and fix app-login e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
alnr committed Aug 27, 2024
1 parent 6603f46 commit 872581e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 20 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- sdk-generate
services:
postgres:
image: postgres:11.8
image: postgres:14
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: test
Expand Down Expand Up @@ -111,15 +111,15 @@ jobs:
- sdk-generate
services:
postgres:
image: postgres:11.8
image: postgres:14
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: test
POSTGRES_USER: test
ports:
- 5432:5432
mysql:
image: mysql:5.7
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: test
ports:
Expand Down Expand Up @@ -222,15 +222,15 @@ jobs:
- sdk-generate
services:
postgres:
image: postgres:11.8
image: postgres:14
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: test
POSTGRES_USER: test
ports:
- 5432:5432
mysql:
image: mysql:5.7
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: test
ports:
Expand Down
4 changes: 2 additions & 2 deletions quickstart-mysql.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: "3.7"

services:
kratos-migrate:
Expand All @@ -10,7 +10,7 @@ services:
- DSN=mysql://root:secret@tcp(mysqld:3306)/mysql?max_conns=20&max_idle_conns=4

mysqld:
image: mysql:5.7
image: mysql:8.0
ports:
- "3306:3306"
environment:
Expand Down
4 changes: 2 additions & 2 deletions quickstart-postgres.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: "3.7"

services:
kratos-migrate:
Expand All @@ -10,7 +10,7 @@ services:
- DSN=postgres://kratos:secret@postgresd:5432/kratos?sslmode=disable&max_conns=20&max_idle_conns=4

postgresd:
image: postgres:11.8
image: postgres:14
ports:
- "5432:5432"
environment:
Expand Down
8 changes: 4 additions & 4 deletions script/testenv.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

docker rm -f kratos_test_database_mysql kratos_test_database_postgres kratos_test_database_cockroach kratos_test_hydra || true
docker run --platform linux/amd64 --name kratos_test_database_mysql -p 3444:3306 -e MYSQL_ROOT_PASSWORD=secret -d mysql:8.0.34
docker run --platform linux/amd64 --name kratos_test_database_postgres -p 3445:5432 -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=postgres -d postgres:11.8 postgres -c log_statement=all
docker run --platform linux/amd64 --name kratos_test_database_cockroach -p 3446:26257 -p 3447:8080 -d cockroachdb/cockroach:v22.2.6 start-single-node --insecure
docker run --platform linux/amd64 --name kratos_test_hydra -p 4444:4444 -p 4445:4445 -d -e DSN=memory -e URLS_SELF_ISSUER=http://localhost:4444/ -e URLS_LOGIN=http://localhost:4446/login -e URLS_CONSENT=http://localhost:4446/consent oryd/hydra:v2.0.2 serve all --dev
docker run --name kratos_test_database_mysql -p 3444:3306 -e MYSQL_ROOT_PASSWORD=secret -d mysql:8.0
docker run --name kratos_test_database_postgres -p 3445:5432 -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=postgres -d postgres:14 postgres -c log_statement=all
docker run --name kratos_test_database_cockroach -p 3446:26257 -p 3447:8080 -d cockroachdb/cockroach:v22.2.6 start-single-node --insecure
docker run --name kratos_test_hydra -p 4444:4444 -p 4445:4445 -d -e DSN=memory -e URLS_SELF_ISSUER=http://localhost:4444/ -e URLS_LOGIN=http://localhost:4446/login -e URLS_CONSENT=http://localhost:4446/consent oryd/hydra:v2.0.2 serve all --dev

source script/test-envs.sh
9 changes: 4 additions & 5 deletions test/e2e/playwright/tests/mobile/app_login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async function performOidcLogin(popup: Page, username: string) {
async function rejectOidcLogin(popup: Page) {
await popup.waitForLoadState()
await popup.getByRole("button", { name: "reject" }).click()
await expect(popup.getByText("login rejected request").first()).toBeVisible()
await popup.close()
}

Expand Down Expand Up @@ -65,14 +66,13 @@ test.describe("Registration", () => {
await page.goto("Registration")

let popupPromise = page.waitForEvent("popup")
await page.getByText(/sign (up|in) with ory/i).click()
await page.getByText(/sign up with ory/i).click()
let popup = await popupPromise

await rejectOidcLogin(popup)

await expect(page.getByText("login rejected request")).toBeVisible()
popupPromise = page.waitForEvent("popup")
await page.getByText(/continue/i).click()
await page.getByText(/sign up with ory/i).click()
popup = await popupPromise
await performOidcLogin(popup, "[email protected]")

Expand All @@ -99,12 +99,11 @@ test.describe("Login", () => {
await page.goto("Login")

let popupPromise = page.waitForEvent("popup")
await page.getByText(/sign (up|in) with ory/i).click()
await page.getByText(/sign in with ory/i).click()
let popup = await popupPromise

await rejectOidcLogin(popup)

await expect(page.getByText("login rejected request")).toBeVisible()
popupPromise = page.waitForEvent("popup")
await page.getByText(/sign in with ory/i).click()
popup = await popupPromise
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ prepare() {

if [ -z ${TEST_DATABASE_POSTGRESQL+x} ]; then
docker rm -f kratos_test_database_mysql kratos_test_database_postgres kratos_test_database_cockroach || true
docker run --platform linux/amd64 --name kratos_test_database_mysql -p 3444:3306 -e MYSQL_ROOT_PASSWORD=secret -d mysql:5.7
docker run --name kratos_test_database_postgres -p 3445:5432 -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=postgres -d postgres:9.6 postgres -c log_statement=all
docker run --name kratos_test_database_mysql -p 3444:3306 -e MYSQL_ROOT_PASSWORD=secret -d mysql:8.0
docker run --name kratos_test_database_postgres -p 3445:5432 -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=postgres -d postgres:14 postgres -c log_statement=all
docker run --name kratos_test_database_cockroach -p 3446:26257 -d cockroachdb/cockroach:v22.2.6 start-single-node --insecure

export TEST_DATABASE_MYSQL="mysql://root:secret@(localhost:3444)/mysql?parseTime=true&multiStatements=true"
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/shared/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ export type SelfServiceOIDCProvider = SelfServiceOIDCProvider1 & {
organization_id?: OrganizationID
additional_id_token_audiences?: AdditionalClientIdsAllowedWhenUsingIDTokenSubmission
claims_source?: ClaimsSource
pkce?: PKCE
}
export type SelfServiceOIDCProvider1 = {
[k: string]: unknown | undefined
Expand Down Expand Up @@ -293,6 +294,10 @@ export type AdditionalClientIdsAllowedWhenUsingIDTokenSubmission = string[]
* Can be either `userinfo` (calls the userinfo endpoint to get the claims) or `id_token` (takes the claims from the id token). It defaults to `id_token`
*/
export type ClaimsSource = "id_token" | "userinfo"
/**
* Controls if the OpenID Connect OAuth2 flow should use PKCE (Proof Key for Code Exchange). Defaults to `auto` (PKCE is used if the provider advertises support for it). IMPORTANT: If you set this to `force`, you must whitelist a different return URL for your OAuth2 client in the provider's configuration. Instead of <base-url>/self-service/methods/oidc/callback/<provider>, you must use <base-url>/self-service/methods/oidc/callback
*/
export type PKCE = "auto" | "never" | "force"
/**
* A list and configuration of OAuth2 and OpenID Connect providers Ory Kratos should integrate with.
*/
Expand Down

0 comments on commit 872581e

Please sign in to comment.