mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-08 08:18:50 +00:00
* bump pre-commit * add biome * autofixes * use number functions * fix string usage * use specific variable definition * fix missing translations * reduce alerts * add missing keys * fix index creation * fix more strings * fix types * fix function * add missing keys * fiy array access * fix string functions * do not redefine var * extend exlcusions * reduce unnecessary operators * simplify request * use number functions * fix missing translation * add missing type * fix filter * use newer func * remove unused fragment * fix confusing assigment * pass children as elements * add missing translation * fix imports * fix import * auto-fix problems * add autfix for unused imports * fix SAST error * fix useSelfClosingElements * fix useTemplate * add codespell exception * Update pui_printing.spec.ts * Update pui_printing.spec.ts * add vscode defaults
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { expect } from './baseFixtures.js';
|
|
import { baseUrl, logoutUrl, user } from './defaults';
|
|
|
|
/*
|
|
* Perform form based login operation from the "login" URL
|
|
*/
|
|
export const doLogin = async (page, username?: string, password?: string) => {
|
|
username = username ?? user.username;
|
|
password = password ?? user.password;
|
|
|
|
await page.goto(logoutUrl);
|
|
await expect(page).toHaveTitle(/^InvenTree.*$/);
|
|
await page.waitForURL('**/platform/login');
|
|
await page.getByLabel('username').fill(username);
|
|
await page.getByLabel('password').fill(password);
|
|
await page.getByRole('button', { name: 'Log in' }).click();
|
|
await page.waitForURL('**/platform/home');
|
|
await page.waitForTimeout(250);
|
|
};
|
|
|
|
/*
|
|
* Perform a quick login based on passing URL parameters
|
|
*/
|
|
export const doQuickLogin = async (
|
|
page,
|
|
username?: string,
|
|
password?: string,
|
|
url?: string
|
|
) => {
|
|
username = username ?? user.username;
|
|
password = password ?? user.password;
|
|
url = url ?? baseUrl;
|
|
|
|
await page.goto(`${url}/login/?login=${username}&password=${password}`);
|
|
await page.waitForURL('**/platform/home');
|
|
|
|
await page.getByText(/InvenTree Demo Server/).waitFor();
|
|
};
|
|
|
|
export const doLogout = async (page) => {
|
|
await page.goto(`${baseUrl}/logout/`);
|
|
await page.waitForURL('**/platform/login');
|
|
};
|