mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-11 21:12:16 +00:00
add test flows for login ui
This commit is contained in:
@@ -24,3 +24,25 @@ test("username and passkey login", async ({user, page}) => {
|
||||
await loginWithPasskey(page, user.getAuthenticatorId(), user.getUsername())
|
||||
await loginScreenExpect(page, user.getFullName());
|
||||
});
|
||||
|
||||
test("username and passkey login, if passkey enabled", async ({user, page}) => {
|
||||
// Given passkey is enabled on the organization of the user
|
||||
// Given the user has only passkey enabled as authentication
|
||||
|
||||
// enter username
|
||||
// passkey popup is directly shown
|
||||
// user verifies passkey
|
||||
// user is redirected to app
|
||||
});
|
||||
|
||||
test("username and passkey login, multiple auth methods", async ({user, page}) => {
|
||||
// Given passkey and password is enabled on the organization of the user
|
||||
// Given the user has password and passkey registered
|
||||
|
||||
// enter username
|
||||
// passkey popup is directly shown
|
||||
// user aborts passkey authentication
|
||||
// user switches to password authentication
|
||||
// user enters password
|
||||
// user is redirected to app
|
||||
});
|
||||
|
||||
87
acceptance/tests/username-password-otp_email.spec.ts
Normal file
87
acceptance/tests/username-password-otp_email.spec.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import {test as base} from "@playwright/test";
|
||||
import {OtpType, PasswordUserWithOTP} from './user';
|
||||
import path from 'path';
|
||||
import dotenv from 'dotenv';
|
||||
import {loginScreenExpect, loginWithPassword} from "./login";
|
||||
import {startSink} from "./otp";
|
||||
|
||||
// Read from ".env" file.
|
||||
dotenv.config({path: path.resolve(__dirname, '.env.local')});
|
||||
|
||||
const test = base.extend<{ user: PasswordUserWithOTP }>({
|
||||
user: async ({page}, use) => {
|
||||
const user = new PasswordUserWithOTP({
|
||||
email: "otp_sms@example.com",
|
||||
firstName: "first",
|
||||
lastName: "last",
|
||||
password: "Password1!",
|
||||
organization: "",
|
||||
type: OtpType.sms,
|
||||
});
|
||||
|
||||
await user.ensure(page);
|
||||
await use(user);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
test("username, password and email otp login, enter code manually", async ({user, page}) => {
|
||||
// Given email otp is enabled on the organizaiton of the user
|
||||
// Given the user has only email otp configured as second factor
|
||||
|
||||
// User enters username
|
||||
// User enters password
|
||||
// User receives an email with a verification code
|
||||
// User enters the code into the ui
|
||||
// User is redirected to the app
|
||||
});
|
||||
|
||||
|
||||
test("username, password and email otp login, click link in email", async ({user, page}) => {
|
||||
// Given email otp is enabled on the organizaiton of the user
|
||||
// Given the user has only email otp configured as second factor
|
||||
|
||||
// User enters username
|
||||
// User enters password
|
||||
// User receives an email with a verification code
|
||||
// User clicks link in the email
|
||||
// User is redirected to the app
|
||||
});
|
||||
|
||||
test("username, password and email otp login, resend code", async ({user, page}) => {
|
||||
// Given email otp is enabled on the organizaiton of the user
|
||||
// Given the user has only email otp configured as second factor
|
||||
|
||||
// User enters username
|
||||
// User enters password
|
||||
// User receives an email with a verification code
|
||||
// User clicks resend code
|
||||
// User receives a new email with a verification code
|
||||
// User enters the new code in the ui
|
||||
// User is redirected to the app
|
||||
});
|
||||
|
||||
|
||||
test("username, password and email otp login, wrong code", async ({user, page}) => {
|
||||
// Given email otp is enabled on the organizaiton of the user
|
||||
// Given the user has only email otp configured as second factor
|
||||
|
||||
// User enters username
|
||||
// User enters password
|
||||
// User receives an email with a verification code
|
||||
// User enters a wrond code
|
||||
// Error message - "Invalid code" is shown
|
||||
});
|
||||
|
||||
test("username, password and email otp login, multiple mfa options", async ({user, page}) => {
|
||||
// Given email otp and sms otp is enabled on the organizaiton of the user
|
||||
// Given the user has email and sms otp configured as second factor
|
||||
|
||||
// User enters username
|
||||
// User enters password
|
||||
// User receives an email with a verification code
|
||||
// User clicks button to use sms otp as second factor
|
||||
// User receives an sms with a verification code
|
||||
// User enters code in ui
|
||||
// User is redirected to the app
|
||||
});
|
||||
@@ -34,3 +34,38 @@ test("username, password and otp login", async ({user, page}) => {
|
||||
});
|
||||
|
||||
|
||||
test("username, password and sms otp login", async ({user, page}) => {
|
||||
// Given sms otp is enabled on the organizaiton of the user
|
||||
// Given the user has only sms otp configured as second factor
|
||||
|
||||
// User enters username
|
||||
// User enters password
|
||||
// User receives an sms with a verification code
|
||||
// User enters the code into the ui
|
||||
// User is redirected to the app
|
||||
});
|
||||
|
||||
|
||||
test("username, password and sms otp login, resend code", async ({user, page}) => {
|
||||
// Given sms otp is enabled on the organizaiton of the user
|
||||
// Given the user has only sms otp configured as second factor
|
||||
|
||||
// User enters username
|
||||
// User enters password
|
||||
// User receives an sms with a verification code
|
||||
// User clicks resend code
|
||||
// User receives a new sms with a verification code
|
||||
// User is redirected to the app
|
||||
});
|
||||
|
||||
|
||||
test("username, password and sms otp login, wrong code", async ({user, page}) => {
|
||||
// Given sms otp is enabled on the organizaiton of the user
|
||||
// Given the user has only sms otp configured as second factor
|
||||
|
||||
// User enters username
|
||||
// User enters password
|
||||
// User receives an sms with a verification code
|
||||
// User enters a wrond code
|
||||
// Error message - "Invalid code" is shown
|
||||
});
|
||||
|
||||
@@ -43,3 +43,53 @@ test("username and password login, wrong password", async ({user, page}) => {
|
||||
await password(page, "wrong")
|
||||
await passwordScreenExpect(page, "wrong")
|
||||
});
|
||||
|
||||
test("username and password login, wrong username, ignore unknown usernames", async ({user, page}) => {
|
||||
// Given user doesn't exist but ignore unknown usernames setting is set to true
|
||||
// Given username password login is enabled on the users organization
|
||||
|
||||
// enter login name
|
||||
// enter password
|
||||
// redirect to loginname page --> error message username or password wrong
|
||||
});
|
||||
|
||||
test("username and password login, initial password change", async ({user, page}) => {
|
||||
// Given user is created and has changePassword set to true
|
||||
// Given username password login is enabled on the users organization
|
||||
|
||||
// enter login name
|
||||
// enter password
|
||||
// create new password
|
||||
});
|
||||
|
||||
test("username and password login, reset password - enter code manually", async ({user, page}) => {
|
||||
// Given user has forgotten password and clicks the forgot password button
|
||||
// Given username password login is enabled on the users organization
|
||||
|
||||
// enter login name
|
||||
// click password forgotten
|
||||
// enter code from email
|
||||
// user is redirected to app
|
||||
});
|
||||
|
||||
test("username and password login, reset password - click link", async ({user, page}) => {
|
||||
// Given user has forgotten password and clicks the forgot password button, and then the link in the email
|
||||
// Given username password login is enabled on the users organization
|
||||
|
||||
// enter login name
|
||||
// click password forgotten
|
||||
// click link in email
|
||||
// set new password
|
||||
// redirect to app
|
||||
});
|
||||
|
||||
test("username and password login, reset password, resend code", async ({user, page}) => {
|
||||
// Given user has forgotten password and clicks the forgot password button and then resend code
|
||||
// Given username password login is enabled on the users organization
|
||||
|
||||
// enter login name
|
||||
// click password forgotten
|
||||
// click resend code
|
||||
// enter code from second email
|
||||
// user is authenticated
|
||||
});
|
||||
Reference in New Issue
Block a user