mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-05 05:00:58 +00:00
feat(backend): Add user profile (#9116)
* Add user profile * fix choice set * ensure primary_group is valid * add missing migrations * fix tests * merge migrations * add migration test * add new model to ruleset * ensure changed to the m2m conenction also validate primary grups * move signals * fix import? * patch user language through * use set methods correctly * bump api * refactoring to make debugging and extending easier * fix dum recurrsion problem * fix user pk lookup * rename migration * add user and group page * cleanup * add hoverCard for user / owner / group render * include owner_model in owner responses * move user serializers to users * add profile to list * add brief serializer for profiles * ensure profile is present in most apis * extend rendered data * store and observe langauge in profile * reduce unneeded complexity * enable access to full profle (including internal fields) in me serializer * move theme to a single object * persist theme settings * fix radius lookup * remove debug message * fix filter * remove unused field * remove image fields * add setting to control showing profiles * fix settings * update test * fix theme reload * Add contact UI * Add profile edit screen * fix test * Add testing for user theme panel * fix var name * complete coverage of theme * Add test for new pages * make test more reliable in strict mode * remove step * fix ref * add verbose names * fix used setting * extend tests * fix permissions * fix lookup * use lookup to enuse ursls stay valid * update migrations * Add position field * fix permissions
This commit is contained in:
26
src/frontend/tests/pages/pui_core.spec.ts
Normal file
26
src/frontend/tests/pages/pui_core.spec.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { test } from '../baseFixtures.js';
|
||||
import { loadTab, navigate } from '../helpers.js';
|
||||
import { doQuickLogin } from '../login.js';
|
||||
|
||||
test('Core User/Group/Contact', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
// groups
|
||||
await navigate(page, '/core');
|
||||
await page.getByText('System Overview', { exact: true }).click();
|
||||
await loadTab(page, 'Groups');
|
||||
await page.getByRole('cell', { name: 'all access' }).click();
|
||||
await page.getByText('Group: all access', { exact: true }).click();
|
||||
await page.getByLabel('breadcrumb-1-groups').click();
|
||||
|
||||
// users
|
||||
await loadTab(page, 'Users');
|
||||
await page.getByRole('cell', { name: 'admin' }).click();
|
||||
await page.getByText('User: admin', { exact: true }).waitFor();
|
||||
await page.getByLabel('User Details').waitFor();
|
||||
await page.getByLabel('breadcrumb-1-users').click();
|
||||
|
||||
// contacts
|
||||
await loadTab(page, 'Contacts');
|
||||
await page.getByRole('cell', { name: 'Adrian Briggs' }).waitFor();
|
||||
});
|
@ -83,8 +83,8 @@ test('Login - Change Password', async ({ page }) => {
|
||||
|
||||
// Navigate to the 'change password' page
|
||||
await navigate(page, 'settings/user/account');
|
||||
await page.getByLabel('action-menu-user-actions').click();
|
||||
await page.getByLabel('action-menu-user-actions-change-password').click();
|
||||
await page.getByLabel('action-menu-account-actions').click();
|
||||
await page.getByLabel('action-menu-account-actions-change-password').click();
|
||||
|
||||
// First attempt with some errors
|
||||
await page.getByLabel('password', { exact: true }).fill('youshallnotpass');
|
||||
|
@ -42,6 +42,51 @@ test('Settings - Language / Color', async ({ page }) => {
|
||||
await page.waitForURL('**/platform/home');
|
||||
});
|
||||
|
||||
test('Settings - User theme', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
await page.getByRole('button', { name: 'Ally Access' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Account settings' }).click();
|
||||
|
||||
// loader
|
||||
await page.getByRole('textbox', { name: 'Loader Type Selector' }).click();
|
||||
await page.getByRole('option', { name: 'Oval' }).click();
|
||||
await page.getByRole('textbox', { name: 'Loader Type Selector' }).click();
|
||||
await page.getByRole('option', { name: 'Bars' }).click();
|
||||
|
||||
// dark / light mode
|
||||
await page
|
||||
.getByRole('row', { name: 'Color Mode' })
|
||||
.getByRole('button')
|
||||
.click();
|
||||
await page
|
||||
.getByRole('row', { name: 'Color Mode' })
|
||||
.getByRole('button')
|
||||
.click();
|
||||
|
||||
// colors
|
||||
await testColorPicker(page, 'Color Picker White');
|
||||
await testColorPicker(page, 'Color Picker Black');
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
await page.getByLabel('Reset Black Color').click();
|
||||
await page.getByLabel('Reset White Color').click();
|
||||
|
||||
// radius
|
||||
await page
|
||||
.locator('div')
|
||||
.filter({ hasText: /^xssmmdlgxl$/ })
|
||||
.nth(2)
|
||||
.click();
|
||||
|
||||
// primary
|
||||
await page.getByLabel('#fab005').click();
|
||||
await page.getByLabel('#228be6').click();
|
||||
|
||||
// language
|
||||
await page.getByRole('button', { name: 'Use pseudo language' }).click();
|
||||
});
|
||||
|
||||
test('Settings - Admin', async ({ page }) => {
|
||||
// Note here we login with admin access
|
||||
await doQuickLogin(page, 'admin', 'inventree');
|
||||
@ -227,3 +272,10 @@ test('Settings - Auth - Email', async ({ page }) => {
|
||||
|
||||
await page.waitForTimeout(2500);
|
||||
});
|
||||
async function testColorPicker(page, ref: string) {
|
||||
const element = page.getByLabel(ref);
|
||||
await element.click();
|
||||
const box = (await element.boundingBox())!;
|
||||
await page.mouse.click(box.x + box.width / 2, box.y + box.height + 25);
|
||||
await page.getByText('Color Mode').click();
|
||||
}
|
||||
|
Reference in New Issue
Block a user