mirror of
https://github.com/immich-app/immich.git
synced 2025-06-16 21:38:28 +02:00
refactor: server auth e2e (#7203)
This commit is contained in:
parent
59f8a886e7
commit
a03b37ca86
17 changed files with 2897 additions and 374 deletions
e2e/src/web/specs
82
e2e/src/web/specs/auth.e2e-spec.ts
Normal file
82
e2e/src/web/specs/auth.e2e-spec.ts
Normal file
|
@ -0,0 +1,82 @@
|
|||
import { test, expect } from '@playwright/test';
|
||||
import { apiUtils, dbUtils, webUtils } from 'src/utils';
|
||||
|
||||
test.describe('Registration', () => {
|
||||
test.beforeEach(async () => {
|
||||
await dbUtils.reset();
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await dbUtils.teardown();
|
||||
});
|
||||
|
||||
test('admin registration', async ({ page }) => {
|
||||
// welcome
|
||||
await page.goto('/');
|
||||
await page.getByRole('button', { name: 'Getting Started' }).click();
|
||||
|
||||
// register
|
||||
await expect(page).toHaveTitle(/Admin Registration/);
|
||||
await page.getByLabel('Admin Email').fill('admin@immich.app');
|
||||
await page.getByLabel('Admin Password', { exact: true }).fill('password');
|
||||
await page.getByLabel('Confirm Admin Password').fill('password');
|
||||
await page.getByLabel('Name').fill('Immich Admin');
|
||||
await page.getByRole('button', { name: 'Sign up' }).click();
|
||||
|
||||
// login
|
||||
await expect(page).toHaveTitle(/Login/);
|
||||
await page.goto('/auth/login');
|
||||
await page.getByLabel('Email').fill('admin@immich.app');
|
||||
await page.getByLabel('Password').fill('password');
|
||||
await page.getByRole('button', { name: 'Login' }).click();
|
||||
|
||||
// onboarding
|
||||
await expect(page).toHaveURL('/auth/onboarding');
|
||||
await page.getByRole('button', { name: 'Theme' }).click();
|
||||
await page.getByRole('button', { name: 'Storage Template' }).click();
|
||||
await page.getByRole('button', { name: 'Done' }).click();
|
||||
|
||||
// success
|
||||
await expect(page).toHaveURL('/photos');
|
||||
});
|
||||
|
||||
test('user registration', async ({ context, page }) => {
|
||||
const loginResponse = await apiUtils.adminSetup();
|
||||
await webUtils.setAuthCookies(context, loginResponse);
|
||||
|
||||
// create user
|
||||
await page.goto('/admin/user-management');
|
||||
await expect(page).toHaveTitle(/User Management/);
|
||||
await page.getByRole('button', { name: 'Create user' }).click();
|
||||
await page.getByLabel('Email').fill('user@immich.cloud');
|
||||
await page.getByLabel('Password', { exact: true }).fill('password');
|
||||
await page.getByLabel('Confirm Password').fill('password');
|
||||
await page.getByLabel('Name').fill('Immich User');
|
||||
await page.getByRole('button', { name: 'Create', exact: true }).click();
|
||||
|
||||
// logout
|
||||
await context.clearCookies();
|
||||
|
||||
// login
|
||||
await page.goto('/auth/login');
|
||||
await page.getByLabel('Email').fill('user@immich.cloud');
|
||||
await page.getByLabel('Password').fill('password');
|
||||
await page.getByRole('button', { name: 'Login' }).click();
|
||||
|
||||
// change password
|
||||
expect(page.getByRole('heading')).toHaveText('Change Password');
|
||||
await expect(page).toHaveURL('/auth/change-password');
|
||||
await page.getByLabel('New Password').fill('new-password');
|
||||
await page.getByLabel('Confirm Password').fill('new-password');
|
||||
await page.getByRole('button', { name: 'Change password' }).click();
|
||||
|
||||
// login with new password
|
||||
await expect(page).toHaveURL('/auth/login');
|
||||
await page.getByLabel('Email').fill('user@immich.cloud');
|
||||
await page.getByLabel('Password').fill('new-password');
|
||||
await page.getByRole('button', { name: 'Login' }).click();
|
||||
|
||||
// success
|
||||
await expect(page).toHaveURL(/\/photos/);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue