chore: fixes to tests

This commit is contained in:
Stefan Benz
2024-11-19 11:33:42 +01:00
parent adaf3e56df
commit 18e3d3ba87
4 changed files with 39 additions and 116 deletions

View File

@@ -1,28 +1,6 @@
import { test as base } from "@playwright/test";
import dotenv from "dotenv";
import path from "path";
import { OtpType, PasswordUserWithOTP } from "./user";
import { test } from "@playwright/test";
// 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.email,
});
await user.ensure(page);
await use(user);
},
});
test("username, password and email otp login, enter code manually", async ({ user, page }) => {
test("username, password and email otp login, enter code manually", async ({ 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
@@ -32,7 +10,7 @@ test("username, password and email otp login, enter code manually", async ({ use
// User is redirected to the app (default redirect url)
});
test("username, password and email otp login, click link in email", async ({ user, page }) => {
test("username, password and email otp login, click link in email", async ({ 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
@@ -42,7 +20,7 @@ test("username, password and email otp login, click link in email", async ({ use
// User is redirected to the app (default redirect url)
});
test("username, password and email otp login, resend code", async ({ user, page }) => {
test("username, password and email otp login, resend code", async ({ 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
@@ -54,7 +32,7 @@ test("username, password and email otp login, resend code", async ({ user, page
// User is redirected to the app (default redirect url)
});
test("username, password and email otp login, wrong code", async ({ user, page }) => {
test("username, password and email otp login, wrong code", async ({ 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
@@ -64,7 +42,7 @@ test("username, password and email otp login, wrong code", async ({ user, page }
// Error message - "Invalid code" is shown
});
test("username, password and email otp login, multiple mfa options", async ({ user, page }) => {
test("username, password and email otp login, multiple mfa options", async ({ 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

View File

@@ -1,43 +1,32 @@
/*
test("username, password and otp login", async ({ user, page }) => {
//const server = startSink()
await loginWithPassword(page, user.getUsername(), user.getPassword());
import { test } from "@playwright/test";
await loginScreenExpect(page, user.getFullName());
//server.close()
test("username, password and sms otp login", async ({ 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 (default redirect url)
});
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 (default redirect url)
test("username, password and sms otp login, resend code", async ({ 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 (default redirect url)
});
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 (default redirect url)
test("username, password and sms otp login, wrong code", async ({ 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
});
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
});
*/

View File

@@ -1,28 +1,6 @@
import { test as base } from "@playwright/test";
import dotenv from "dotenv";
import path from "path";
import { OtpType, PasswordUserWithOTP } from "./user";
import { test } from "@playwright/test";
// 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 totp login", async ({ user, page }) => {
test("username, password and totp login", async ({ page }) => {
// Given totp is enabled on the organizaiton of the user
// Given the user has only totp configured as second factor
// User enters username
@@ -32,7 +10,7 @@ test("username, password and totp login", async ({ user, page }) => {
// User is redirected to the app (default redirect url)
});
test("username, password and totp otp login, wrong code", async ({ user, page }) => {
test("username, password and totp otp login, wrong code", async ({ page }) => {
// Given totp is enabled on the organizaiton of the user
// Given the user has only totp configured as second factor
// User enters username
@@ -42,7 +20,7 @@ test("username, password and totp otp login, wrong code", async ({ user, page })
// Error message - "Invalid code" is shown
});
test("username, password and totp login, multiple mfa options", async ({ user, page }) => {
test("username, password and totp login, multiple mfa options", async ({ page }) => {
// Given totp and email otp is enabled on the organizaiton of the user
// Given the user has totp and email otp configured as second factor
// User enters username

View File

@@ -1,28 +1,6 @@
import { test as base } from "@playwright/test";
import dotenv from "dotenv";
import path from "path";
import { OtpType, PasswordUserWithOTP } from "./user";
import { test } from "@playwright/test";
// 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 u2f login", async ({ user, page }) => {
test("username, password and u2f login", async ({ page }) => {
// Given u2f is enabled on the organizaiton of the user
// Given the user has only u2f configured as second factor
// User enters username
@@ -32,7 +10,7 @@ test("username, password and u2f login", async ({ user, page }) => {
// User is redirected to the app (default redirect url)
});
test("username, password and u2f login, multiple mfa options", async ({ user, page }) => {
test("username, password and u2f login, multiple mfa options", async ({ page }) => {
// Given u2f and semailms otp is enabled on the organizaiton of the user
// Given the user has u2f and email otp configured as second factor
// User enters username