mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-08-07 07:16:17 +00:00
55f883a566
Trivy / Trivy Scan (push) Has been cancelled
Build / Build and Test msrv (push) Has been cancelled
Build / Build and Test rust-toolchain (push) Has been cancelled
Check templates / Validate docker templates (push) Has been cancelled
Hadolint / Validate Dockerfile syntax (push) Has been cancelled
Code Spell Checking / Run typos spell checking (push) Has been cancelled
Security Analysis with zizmor / Run zizmor (push) Has been cancelled
Release / Build Vaultwarden containers (amd64, alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (amd64, debian) (push) Has been cancelled
Release / Build Vaultwarden containers (arm/v6, alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (arm/v6, debian) (push) Has been cancelled
Release / Build Vaultwarden containers (arm/v7, alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (arm/v7, debian) (push) Has been cancelled
Release / Build Vaultwarden containers (arm64, alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (arm64, debian) (push) Has been cancelled
Release / Merge manifests (alpine) (push) Has been cancelled
Release / Merge manifests (debian) (push) Has been cancelled
* Config server setting suppressOnboardingInterstitials * Backport fix playwright tests --------- Co-authored-by: Timshel <timshel@users.noreply.github.com>
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { test, expect, type Page, type TestInfo } from '@playwright/test';
|
|
import * as OTPAuth from "otpauth";
|
|
|
|
import * as utils from "../global-utils";
|
|
import { createAccount, logUser } from './setups/user';
|
|
import { activateTOTP, disableTOTP } from './setups/2fa';
|
|
|
|
let users = utils.loadEnv();
|
|
let totp;
|
|
|
|
test.beforeAll('Setup', async ({ browser }, testInfo: TestInfo) => {
|
|
await utils.startVault(browser, testInfo, {});
|
|
});
|
|
|
|
test.afterAll('Teardown', async ({}) => {
|
|
utils.stopVault();
|
|
});
|
|
|
|
test('Account creation', async ({ page }) => {
|
|
await createAccount(test, page, users.user1);
|
|
});
|
|
|
|
test('Master password login', async ({ page }) => {
|
|
await logUser(test, page, users.user1);
|
|
});
|
|
|
|
test('Authenticator 2fa', async ({ page }) => {
|
|
await logUser(test, page, users.user1);
|
|
|
|
let totp = await activateTOTP(test, page, users.user1);
|
|
|
|
await utils.logout(test, page, users.user1);
|
|
|
|
await test.step('login', async () => {
|
|
let timestamp = Date.now(); // Needed to use the next token
|
|
timestamp = timestamp + (totp.period - (Math.floor(timestamp / 1000) % totp.period) + 1) * 1000;
|
|
|
|
await page.getByLabel(/Email address/).fill(users.user1.email);
|
|
await page.getByRole('button', { name: 'Continue' }).click();
|
|
await page.getByRole('textbox', { name: 'Master password * (required)', exact: true }).fill(users.user1.password);
|
|
await page.getByRole('button', { name: 'Log in', exact: true }).click();
|
|
|
|
await expect(page.getByRole('heading', { name: 'Verify your Identity' })).toBeVisible();
|
|
await page.getByLabel(/Verification code/).fill(totp.generate({timestamp}));
|
|
await page.getByRole('button', { name: 'Continue' }).click();
|
|
|
|
await expect(page).toHaveTitle(/Vaultwarden Web/);
|
|
});
|
|
|
|
await disableTOTP(test, page, users.user1);
|
|
});
|