Skip to content
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

chore: acceptance test suite #256

Merged
merged 40 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9af39ac
chore: add basic acceptance tests
stebenz Oct 28, 2024
9c041cc
chore: add data-testid's and some additional testing
stebenz Oct 30, 2024
be4a20b
chore: passkey register
stebenz Oct 31, 2024
350c645
chore: more acceptance tests
stebenz Nov 13, 2024
726d97f
chore: clean up unused functions
stebenz Nov 14, 2024
d79ee0f
chore: otp starting
stebenz Nov 15, 2024
7e4285b
chore: merge back origin/main
stebenz Nov 15, 2024
96f1db9
chore: fixes to tests
stebenz Nov 15, 2024
9073c6e
Merge branch 'main' into acceptance-test-suite
peintnermax Nov 15, 2024
f5c7a17
missing deps
peintnermax Nov 15, 2024
bdd0357
lint
peintnermax Nov 15, 2024
c9eb18a
lint
peintnermax Nov 15, 2024
1bc174f
node fetch, rel path
peintnermax Nov 15, 2024
fd45c07
fix: axios, user, zitadel
peintnermax Nov 15, 2024
26e423a
chore: fixes to tests
stebenz Nov 15, 2024
88620ad
double print env
peintnermax Nov 15, 2024
39335c3
format
peintnermax Nov 15, 2024
3654d5e
chore: fixes to tests
stebenz Nov 15, 2024
e3d7ff0
chore: fixes to tests
stebenz Nov 15, 2024
42e65a9
chore: fixes to tests
stebenz Nov 15, 2024
1379ff4
chore: fixes to tests
stebenz Nov 15, 2024
10c9d64
add test flows for login ui
hifabienne Nov 18, 2024
81c6e44
add more user test flows
hifabienne Nov 18, 2024
c354ba2
google idp test criteria
hifabienne Nov 18, 2024
3a22045
add test spec for all idps
hifabienne Nov 18, 2024
bbc8d05
add more test scenarios
hifabienne Nov 18, 2024
c077b7f
Update acceptance/tests/idp-apple.spec.ts
peintnermax Nov 18, 2024
8033fa7
Update acceptance/tests/idp-apple.spec.ts
peintnermax Nov 18, 2024
054cb46
Update acceptance/tests/login-configuration-possiblities.spec.ts
peintnermax Nov 18, 2024
d7be98e
Update acceptance/tests/login-configuration-possiblities.spec.ts
peintnermax Nov 18, 2024
c9fe0d9
Update acceptance/tests/idp-apple.spec.ts
peintnermax Nov 18, 2024
7f0c707
Update acceptance/tests/idp-apple.spec.ts
peintnermax Nov 18, 2024
2c918dd
Merge branch 'acceptance-test-suite' into test_definitions
peintnermax Nov 18, 2024
875f53b
Merge pull request #280 from zitadel/test_definitions
peintnermax Nov 18, 2024
57d6f68
test scenarios cleanup
peintnermax Nov 18, 2024
a506745
chore: fixes to tests
stebenz Nov 19, 2024
ab96a8e
Merge remote-tracking branch 'origin/acceptance-test-suite' into acce…
stebenz Nov 19, 2024
adaf3e5
chore: fixes to tests
stebenz Nov 19, 2024
18e3d3b
chore: fixes to tests
stebenz Nov 19, 2024
64beeab
chore: fixes to tests
stebenz Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on: pull_request

jobs:
quality:
env:
ZITADEL_IMAGE: ghcr.io/zitadel/zitadel:v2.65.0
POSTGRES_IMAGE: postgres:17.0-alpine3.19

name: Ensure Quality

runs-on: ubuntu-latest
Expand Down
6 changes: 4 additions & 2 deletions acceptance/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
zitadel:
user: "${ZITADEL_DEV_UID}"
image: "${ZITADEL_IMAGE:-ghcr.io/zitadel/zitadel:latest}"
image: ghcr.io/zitadel/zitadel:v2.65.0
command: 'start-from-init --masterkey "MasterkeyNeedsToHave32Characters" --tlsMode disabled --config /zitadel.yaml --steps /zitadel.yaml'
ports:
- "8080:8080"
Expand All @@ -14,7 +14,7 @@ services:

db:
restart: "always"
image: "${POSTGRES_IMAGE:-postgres:latest}"
image: postgres:17.0-alpine3.19
environment:
- POSTGRES_USER=zitadel
- PGUSER=zitadel
Expand Down Expand Up @@ -44,9 +44,11 @@ services:
PAT_FILE: /pat/zitadel-admin-sa.pat
ZITADEL_API_INTERNAL_URL: http://zitadel:8080
WRITE_ENVIRONMENT_FILE: /apps/login/.env.local
WRITE_TEST_ENVIRONMENT_FILE: /acceptance/tests/.env.local
volumes:
- "./pat:/pat"
- "../apps/login:/apps/login"
- "../acceptance/tests:/acceptance/tests"
depends_on:
wait_for_zitadel:
condition: "service_completed_successfully"
8 changes: 6 additions & 2 deletions acceptance/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ fi

WRITE_ENVIRONMENT_FILE=${WRITE_ENVIRONMENT_FILE:-$(dirname "$0")/../apps/login/.env.local}
echo "Writing environment file to ${WRITE_ENVIRONMENT_FILE} when done."
WRITE_TEST_ENVIRONMENT_FILE=${WRITE_TEST_ENVIRONMENT_FILE:-$(dirname "$0")/../acceptance/tests/.env.local}
echo "Writing environment file to ${WRITE_TEST_ENVIRONMENT_FILE} when done."

echo "ZITADEL_API_URL=${ZITADEL_API_URL}
ZITADEL_SERVICE_USER_ID=${ZITADEL_SERVICE_USER_ID}
ZITADEL_SERVICE_USER_TOKEN=${PAT}
DEBUG=true" > ${WRITE_ENVIRONMENT_FILE}

DEBUG=true"| tee "${WRITE_ENVIRONMENT_FILE}" "${WRITE_TEST_ENVIRONMENT_FILE}" > /dev/null
echo "Wrote environment file ${WRITE_ENVIRONMENT_FILE}"
cat ${WRITE_ENVIRONMENT_FILE}

echo "Wrote environment file ${WRITE_TEST_ENVIRONMENT_FILE}"
cat ${WRITE_TEST_ENVIRONMENT_FILE}

DEFAULTORG_RESPONSE_RESULTS=0
# waiting for default organization
until [ ${DEFAULTORG_RESPONSE_RESULTS} -eq 1 ]
Expand Down
7 changes: 7 additions & 0 deletions acceptance/tests/admin.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { test } from "@playwright/test";
import { loginScreenExpect, loginWithPassword } from "./login";

test("admin login", async ({ page }) => {
await loginWithPassword(page, "[email protected]", "Password1!");
await loginScreenExpect(page, "ZITADEL Admin");
});
94 changes: 94 additions & 0 deletions acceptance/tests/idp-apple.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Note for all tests, in case Apple doesn't deliver all relevant information per default
// We should add an action in the needed cases

import test from "@playwright/test";

test("login with Apple IDP", async ({ page }) => {
// Given an Apple IDP is configured on the organization
// Given the user has an Apple added as auth method
// User authenticates with Apple
// User is redirected back to login
// User is redirected to the app
});

test("login with Apple IDP - error", async ({ page }) => {
// Given an Apple IDP is configured on the organization
// Given the user has an Apple added as auth method
// User is redirected to Apple
// User authenticates with Apple and gets an error
// User is redirect back to login
// An error is shown to the user "Something went wrong in Apple Login"
});

test("login with Apple IDP, no user existing - auto register", async ({ page }) => {
// Given idp Apple is configure on the organization as only authencation method
// Given idp Apple is configure with account creation alloweed, and automatic creation enabled
// Given no user exists yet
// User is automatically redirected to Apple
// User authenticates in Apple
// User is redirect to ZITADEL login
// User is created in ZITADEL
// User is redirected to the app (default redirect url)
});

test("login with Apple IDP, no user existing - auto register not possible", async ({ page }) => {
// Given idp Apple is configure on the organization as only authencation method
// Given idp Apple is configure with account creation alloweed, and automatic creation enabled
// Given no user exists yet
// User is automatically redirected to Apple
// User authenticates in Apple
// User is redirect to ZITADEL login
// Because of missing informaiton on the user auto creation is not possible
// User will see the registration page with pre filled user information
// User fills missing information
// User clicks register button
// User is created in ZITADEL
// User is redirected to the app (default redirect url)
});

test("login with Apple IDP, no user existing - auto register enabled - manual creation disabled, creation not possible", async ({
page,
}) => {
// Given idp Apple is configure on the organization as only authencation method
// Given idp Apple is configure with account creation not allowed, and automatic creation enabled
// Given no user exists yet
// User is automatically redirected to Apple
// User authenticates in Apple
// User is redirect to ZITADEL login
// Because of missing informaiton on the user auto creation is not possible
// Error message is shown, that registration of the user was not possible due to missing information
});

test("login with Apple IDP, no user linked - auto link", async ({ page }) => {
// Given idp Apple is configure on the organization as only authencation method
// Given idp Apple is configure with account linking allowed, and linking set to existing email
// Given user with email address [email protected] exists
// User is automatically redirected to Apple
// User authenticates in Apple with [email protected]
// User is redirect to ZITADEL login
// User is linked with existing user in ZITADEL
// User is redirected to the app (default redirect url)
});

test("login with Apple IDP, no user linked, linking not possible", async ({ page }) => {
// Given idp Apple is configure on the organization as only authencation method
// Given idp Apple is configure with manually account linking not allowed, and linking set to existing email
// Given user with email address [email protected] doesn't exists
// User is automatically redirected to Apple
// User authenticates in Apple with [email protected]
// User is redirect to ZITADEL login
// User with email address [email protected] can not be found
// User will get an error message that account linking wasn't possible
});

test("login with Apple IDP, no user linked, user link successful", async ({ page }) => {
// Given idp Apple is configure on the organization as only authencation method
// Given idp Apple is configure with manually account linking allowed, and linking set to existing email
// Given user with email address [email protected] doesn't exists
// User is automatically redirected to Apple
// User authenticates in Apple with [email protected]
// User is redirect to ZITADEL login
// User with email address [email protected] can not be found
// User is prompted to link the account manually
// User is redirected to the app (default redirect url)
});
91 changes: 91 additions & 0 deletions acceptance/tests/idp-generic-jwt.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import test from "@playwright/test";

test("login with Generic JWT IDP", async ({ page }) => {
// Given a Generic JWT IDP is configured on the organization
// Given the user has Generic JWT IDP added as auth method
// User authenticates with the Generic JWT IDP
// User is redirected back to login
// User is redirected to the app
});

test("login with Generic JWT IDP - error", async ({ page }) => {
// Given the Generic JWT IDP is configured on the organization
// Given the user has Generic JWT IDP added as auth method
// User is redirected to the Generic JWT IDP
// User authenticates with the Generic JWT IDP and gets an error
// User is redirected back to login
// An error is shown to the user "Something went wrong"
});

test("login with Generic JWT IDP, no user existing - auto register", async ({ page }) => {
// Given idp Generic JWT is configure on the organization as only authencation method
// Given idp Generic JWT is configure with account creation alloweed, and automatic creation enabled
// Given no user exists yet
// User is automatically redirected to Generic JWT
// User authenticates in Generic JWT
// User is redirect to ZITADEL login
// User is created in ZITADEL
// User is redirected to the app (default redirect url)
});

test("login with Generic JWT IDP, no user existing - auto register not possible", async ({ page }) => {
// Given idp Generic JWT is configure on the organization as only authencation method
// Given idp Generic JWT is configure with account creation alloweed, and automatic creation enabled
// Given no user exists yet
// User is automatically redirected to Generic JWT
// User authenticates in Generic JWT
// User is redirect to ZITADEL login
// Because of missing informaiton on the user auto creation is not possible
// User will see the registration page with pre filled user information
// User fills missing information
// User clicks register button
// User is created in ZITADEL
// User is redirected to the app (default redirect url)
});

test("login with Generic JWT IDP, no user existing - auto register enabled - manual creation disabled, creation not possible", async ({
page,
}) => {
// Given idp Generic JWT is configure on the organization as only authencation method
// Given idp Generic JWT is configure with account creation not allowed, and automatic creation enabled
// Given no user exists yet
// User is automatically redirected to Generic JWT
// User authenticates in Generic JWT
// User is redirect to ZITADEL login
// Because of missing informaiton on the user auto creation is not possible
// Error message is shown, that registration of the user was not possible due to missing information
});

test("login with Generic JWT IDP, no user linked - auto link", async ({ page }) => {
// Given idp Generic JWT is configure on the organization as only authencation method
// Given idp Generic JWT is configure with account linking allowed, and linking set to existing email
// Given user with email address [email protected] exists
// User is automatically redirected to Generic JWT
// User authenticates in Generic JWT with [email protected]
// User is redirect to ZITADEL login
// User is linked with existing user in ZITADEL
// User is redirected to the app (default redirect url)
});

test("login with Generic JWT IDP, no user linked, linking not possible", async ({ page }) => {
// Given idp Generic JWT is configure on the organization as only authencation method
// Given idp Generic JWT is configure with manually account linking not allowed, and linking set to existing email
// Given user with email address [email protected] doesn't exists
// User is automatically redirected to Generic JWT
// User authenticates in Generic JWT with [email protected]
// User is redirect to ZITADEL login
// User with email address [email protected] can not be found
// User will get an error message that account linking wasn't possible
});

test("login with Generic JWT IDP, no user linked, linking successful", async ({ page }) => {
// Given idp Generic JWT is configure on the organization as only authencation method
// Given idp Generic JWT is configure with manually account linking allowed, and linking set to existing email
// Given user with email address [email protected] doesn't exists
// User is automatically redirected to Generic JWT
// User authenticates in Generic JWT with [email protected]
// User is redirect to ZITADEL login
// User with email address [email protected] can not be found
// User is prompted to link the account manually
// User is redirected to the app (default redirect url)
});
91 changes: 91 additions & 0 deletions acceptance/tests/idp-generic-oauth.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import test from "@playwright/test";

test("login with Generic OAuth IDP", async ({ page }) => {
// Given a Generic OAuth IDP is configured on the organization
// Given the user has Generic OAuth IDP added as auth method
// User authenticates with the Generic OAuth IDP
// User is redirected back to login
// User is redirected to the app
});

test("login with Generic OAuth IDP - error", async ({ page }) => {
// Given the Generic OAuth IDP is configured on the organization
// Given the user has Generic OAuth IDP added as auth method
// User is redirected to the Generic OAuth IDP
// User authenticates with the Generic OAuth IDP and gets an error
// User is redirected back to login
// An error is shown to the user "Something went wrong"
});

test("login with Generic OAuth IDP, no user existing - auto register", async ({ page }) => {
// Given idp Generic OAuth is configure on the organization as only authencation method
// Given idp Generic OAuth is configure with account creation alloweed, and automatic creation enabled
// Given no user exists yet
// User is automatically redirected to Generic OAuth
// User authenticates in Generic OAuth
// User is redirect to ZITADEL login
// User is created in ZITADEL
// User is redirected to the app (default redirect url)
});

test("login with Generic OAuth IDP, no user existing - auto register not possible", async ({ page }) => {
// Given idp Generic OAuth is configure on the organization as only authencation method
// Given idp Generic OAuth is configure with account creation alloweed, and automatic creation enabled
// Given no user exists yet
// User is automatically redirected to Generic OAuth
// User authenticates in Generic OAuth
// User is redirect to ZITADEL login
// Because of missing informaiton on the user auto creation is not possible
// User will see the registration page with pre filled user information
// User fills missing information
// User clicks register button
// User is created in ZITADEL
// User is redirected to the app (default redirect url)
});

test("login with Generic OAuth IDP, no user existing - auto register enabled - manual creation disabled, creation not possible", async ({
page,
}) => {
// Given idp Generic OAuth is configure on the organization as only authencation method
// Given idp Generic OAuth is configure with account creation not allowed, and automatic creation enabled
// Given no user exists yet
// User is automatically redirected to Generic OAuth
// User authenticates in Generic OAuth
// User is redirect to ZITADEL login
// Because of missing informaiton on the user auto creation is not possible
// Error message is shown, that registration of the user was not possible due to missing information
});

test("login with Generic OAuth IDP, no user linked - auto link", async ({ page }) => {
// Given idp Generic OAuth is configure on the organization as only authencation method
// Given idp Generic OAuth is configure with account linking allowed, and linking set to existing email
// Given user with email address [email protected] exists
// User is automatically redirected to Generic OAuth
// User authenticates in Generic OAuth with [email protected]
// User is redirect to ZITADEL login
// User is linked with existing user in ZITADEL
// User is redirected to the app (default redirect url)
});

test("login with Generic OAuth IDP, no user linked, linking not possible", async ({ page }) => {
// Given idp Generic OAuth is configure on the organization as only authencation method
// Given idp Generic OAuth is configure with manually account linking not allowed, and linking set to existing email
// Given user with email address [email protected] doesn't exists
// User is automatically redirected to Generic OAuth
// User authenticates in Generic OAuth with [email protected]
// User is redirect to ZITADEL login
// User with email address [email protected] can not be found
// User will get an error message that account linking wasn't possible
});

test("login with Generic OAuth IDP, no user linked, linking successful", async ({ page }) => {
// Given idp Generic OAuth is configure on the organization as only authencation method
// Given idp Generic OAuth is configure with manually account linking allowed, and linking set to existing email
// Given user with email address [email protected] doesn't exists
// User is automatically redirected to Generic OAuth
// User authenticates in Generic OAuth with [email protected]
// User is redirect to ZITADEL login
// User with email address [email protected] can not be found
// User is prompted to link the account manually
// User is redirected to the app (default redirect url)
});
Loading
Loading