2024-02-29 11:26:55 -05:00
|
|
|
import { expect, test } from '@playwright/test';
|
2024-03-07 10:14:36 -05:00
|
|
|
import { utils } from 'src/utils';
|
2024-02-13 13:08:49 -05:00
|
|
|
|
|
|
|
|
test.describe('Registration', () => {
|
2024-02-19 17:25:57 -05:00
|
|
|
test.beforeAll(() => {
|
2024-05-17 16:48:29 -04:00
|
|
|
utils.initSdk();
|
2024-02-19 17:25:57 -05:00
|
|
|
});
|
|
|
|
|
|
2024-02-16 16:31:22 -05:00
|
|
|
test.beforeEach(async () => {
|
2024-03-07 10:14:36 -05:00
|
|
|
await utils.resetDatabase();
|
2024-02-13 13:08:49 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('admin registration', async ({ page }) => {
|
|
|
|
|
// welcome
|
|
|
|
|
await page.goto('/');
|
2024-07-29 16:36:10 +02:00
|
|
|
await page.getByRole('link', { name: 'Getting Started' }).click();
|
2024-02-13 13:08:49 -05:00
|
|
|
|
|
|
|
|
// 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();
|
2024-08-13 19:01:30 +02:00
|
|
|
await page.getByRole('button', { name: 'Privacy' }).click();
|
2024-02-13 13:08:49 -05:00
|
|
|
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 }) => {
|
2024-03-07 10:14:36 -05:00
|
|
|
const admin = await utils.adminSetup();
|
|
|
|
|
await utils.setAuthCookies(context, admin.accessToken);
|
2024-02-13 13:08:49 -05:00
|
|
|
|
|
|
|
|
// 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
|
2024-02-29 11:26:55 -05:00
|
|
|
await expect(page.getByRole('heading')).toHaveText('Change Password');
|
2024-02-13 13:08:49 -05:00
|
|
|
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/);
|
|
|
|
|
});
|
|
|
|
|
});
|