mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-19 05:25:42 +00:00
[PUI] Session authentication (#6970)
* Adjust backend cookie settings * Allow CORS requests to /accounts/ * Refactor frontend code - Remove API token functions - Simplify cookie approach - Add isLoggedIn method * Adjust REST_AUTH settings * Cleanup auth functions in auth.tsx * Adjust CSRF_COOKIE_SAMESITE value * Fix login request * Prevent session auth on login view - Existing (invalid) session token causes 403 * Refactor ApiImage - Point to the right host - Simplify code - Now we use session cookies, so it *Just Works* * Fix download for attachment table - Now works with remote host * Cleanup settings.py * Refactor login / logout notifications * Update API version * Update src/frontend/src/components/items/AttachmentLink.tsx Co-authored-by: Lukas <76838159+wolflu05@users.noreply.github.com> * fix assert url * Remove comment * Add explicit page to logout user * Change tests to first logout * Prune dead code * Adjust tests * Cleanup * Direct to login view * Trying something * Update CUI test * Fix basic tests * Refactoring * Fix basic checks * Fix for PUI command tests * More test updates * Add speciifc test for quick login * More cleanup of playwright tests * Add some missing icons * Fix typo * Ignore coverage report for playwright test * Remove coveralls upload task --------- Co-authored-by: Lukas <76838159+wolflu05@users.noreply.github.com> Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
@ -1,26 +1,14 @@
|
||||
import { expect, systemKey, test } from './baseFixtures.js';
|
||||
import { user } from './defaults.js';
|
||||
import { systemKey, test } from './baseFixtures.js';
|
||||
import { baseUrl } from './defaults.js';
|
||||
import { doQuickLogin } from './login.js';
|
||||
|
||||
test('PUI - Quick Command', async ({ page }) => {
|
||||
await page.goto(
|
||||
`./platform/login/?login=${user.username}&password=${user.password}`
|
||||
);
|
||||
await page.waitForURL('**/platform/*');
|
||||
await page.goto('./platform/');
|
||||
|
||||
await expect(page).toHaveTitle('InvenTree');
|
||||
await page.waitForURL('**/platform/');
|
||||
await page
|
||||
.getByRole('heading', { name: 'Welcome to your Dashboard,' })
|
||||
.click();
|
||||
await page.waitForTimeout(500);
|
||||
await doQuickLogin(page);
|
||||
|
||||
// Open Spotlight with Keyboard Shortcut
|
||||
await page.locator('body').press(`${systemKey}+k`);
|
||||
await page.waitForTimeout(200);
|
||||
await page
|
||||
.getByRole('button', { name: 'Dashboard Go to the InvenTree dashboard' })
|
||||
.click();
|
||||
await page.getByRole('tab', { name: 'Dashboard' }).click();
|
||||
await page
|
||||
.locator('div')
|
||||
.filter({ hasText: /^Dashboard$/ })
|
||||
@ -44,15 +32,8 @@ test('PUI - Quick Command', async ({ page }) => {
|
||||
await page.waitForURL('**/platform/dashboard');
|
||||
});
|
||||
|
||||
test('PUI - Quick Command - no keys', async ({ page }) => {
|
||||
await page.goto(
|
||||
`./platform/login/?login=${user.username}&password=${user.password}`
|
||||
);
|
||||
await page.waitForURL('**/platform/*');
|
||||
await page.goto('./platform/');
|
||||
|
||||
// wait for the page to load
|
||||
await page.waitForTimeout(200);
|
||||
test('PUI - Quick Command - No Keys', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
// Open Spotlight with Button
|
||||
await page.getByRole('button', { name: 'Open spotlight' }).click();
|
||||
@ -118,7 +99,7 @@ test('PUI - Quick Command - no keys', async ({ page }) => {
|
||||
await page.waitForURL('https://docs.inventree.org/**');
|
||||
|
||||
// Test addition of new actions
|
||||
await page.goto('./platform/playground');
|
||||
await page.goto(`${baseUrl}/playground`);
|
||||
await page
|
||||
.locator('div')
|
||||
.filter({ hasText: /^Playground$/ })
|
||||
|
Reference in New Issue
Block a user