mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-05 05:00:58 +00:00
[PUI] Switch linting to biome (#8317)
* 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
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
import * as crypto from 'node:crypto';
|
||||
import * as fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import * as path from 'node:path';
|
||||
import { test as baseTest } from '@playwright/test';
|
||||
import * as crypto from 'crypto';
|
||||
import * as fs from 'fs';
|
||||
import os from 'os';
|
||||
import * as path from 'path';
|
||||
|
||||
const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output');
|
||||
let platform = os.platform();
|
||||
let systemKeyVar;
|
||||
const platform = os.platform();
|
||||
let systemKeyVar: string;
|
||||
if (platform === 'darwin') {
|
||||
systemKeyVar = 'Meta';
|
||||
} else {
|
||||
|
@ -6,7 +6,7 @@ test('CUI - Index', async ({ page }) => {
|
||||
await page.goto(`${classicUrl}/api/`);
|
||||
await page.goto(`${classicUrl}/index/`, { timeout: 10000 });
|
||||
console.log('Page title:', await page.title());
|
||||
await expect(page).toHaveTitle(RegExp('^InvenTree.*Sign In$'));
|
||||
await expect(page).toHaveTitle(/^InvenTree.*Sign In$/);
|
||||
await expect(page.getByRole('heading', { name: 'Sign In' })).toBeVisible();
|
||||
|
||||
await page.getByLabel('username').fill(user.username);
|
||||
|
@ -9,7 +9,7 @@ export const doLogin = async (page, username?: string, password?: string) => {
|
||||
password = password ?? user.password;
|
||||
|
||||
await page.goto(logoutUrl);
|
||||
await expect(page).toHaveTitle(RegExp('^InvenTree.*$'));
|
||||
await expect(page).toHaveTitle(/^InvenTree.*$/);
|
||||
await page.waitForURL('**/platform/login');
|
||||
await page.getByLabel('username').fill(username);
|
||||
await page.getByLabel('password').fill(password);
|
||||
|
@ -108,7 +108,7 @@ test('Pages - Build Order - Build Outputs', async ({ page }) => {
|
||||
let sn = 1;
|
||||
|
||||
if (!!placeholder && placeholder.includes('Next serial number')) {
|
||||
sn = parseInt(placeholder.split(':')[1].trim());
|
||||
sn = Number.parseInt(placeholder.split(':')[1].trim());
|
||||
}
|
||||
|
||||
// Generate some new serial numbers
|
||||
@ -234,11 +234,11 @@ test('Pages - Build Order - Allocation', async ({ page }) => {
|
||||
|
||||
// Check for expected rows
|
||||
for (let idx = 0; idx < data.length; idx++) {
|
||||
let item = data[idx];
|
||||
const item = data[idx];
|
||||
|
||||
let cell = await page.getByRole('cell', { name: item.name });
|
||||
let row = await cell.locator('xpath=ancestor::tr').first();
|
||||
let progress = `${item.allocated} / ${item.required}`;
|
||||
const cell = await page.getByRole('cell', { name: item.name });
|
||||
const row = await cell.locator('xpath=ancestor::tr').first();
|
||||
const progress = `${item.allocated} / ${item.required}`;
|
||||
|
||||
await row.getByRole('cell', { name: item.ipn }).first().waitFor();
|
||||
await row.getByRole('cell', { name: item.available }).first().waitFor();
|
||||
@ -246,8 +246,8 @@ test('Pages - Build Order - Allocation', async ({ page }) => {
|
||||
}
|
||||
|
||||
// Check for expected buttons on Red Widget
|
||||
let redWidget = await page.getByRole('cell', { name: 'Red Widget' });
|
||||
let redRow = await redWidget.locator('xpath=ancestor::tr').first();
|
||||
const redWidget = await page.getByRole('cell', { name: 'Red Widget' });
|
||||
const redRow = await redWidget.locator('xpath=ancestor::tr').first();
|
||||
|
||||
await redRow.getByLabel(/row-action-menu-/i).click();
|
||||
await page
|
||||
|
@ -194,7 +194,7 @@ test('Parts - Pricing (Nothing, BOM)', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'BOM Pricing' }).isEnabled();
|
||||
|
||||
// Overview Graph
|
||||
let graph = page.getByLabel('pricing-overview-chart');
|
||||
const graph = page.getByLabel('pricing-overview-chart');
|
||||
await graph.waitFor();
|
||||
await graph.getByText('$60').waitFor();
|
||||
await graph.locator('tspan').filter({ hasText: 'BOM Pricing' }).waitFor();
|
||||
@ -236,7 +236,7 @@ test('Parts - Pricing (Supplier)', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'SKU Not sorted' }).waitFor();
|
||||
|
||||
// Supplier Pricing - linkjumping
|
||||
let target = page.getByText('ARR-26041-LPC').first();
|
||||
const target = page.getByText('ARR-26041-LPC').first();
|
||||
await target.waitFor();
|
||||
await target.click();
|
||||
// await page.waitForURL('**/purchasing/supplier-part/697/');
|
||||
@ -262,7 +262,7 @@ test('Parts - Pricing (Variant)', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'Variant Pricing' }).click();
|
||||
|
||||
// Variant Pricing - linkjumping
|
||||
let target = page.getByText('Green Chair').first();
|
||||
const target = page.getByText('Green Chair').first();
|
||||
await target.waitFor();
|
||||
await target.click();
|
||||
await page.waitForURL('**/part/109/**');
|
||||
|
@ -8,7 +8,7 @@ test('Basic Login Test', async ({ page }) => {
|
||||
// Check that the username is provided
|
||||
await page.getByText(user.username);
|
||||
|
||||
await expect(page).toHaveTitle(RegExp('^InvenTree'));
|
||||
await expect(page).toHaveTitle(/^InvenTree/);
|
||||
|
||||
// Go to the dashboard
|
||||
await page.goto(baseUrl);
|
||||
@ -19,7 +19,7 @@ test('Basic Login Test', async ({ page }) => {
|
||||
// Check that the username is provided
|
||||
await page.getByText(user.username);
|
||||
|
||||
await expect(page).toHaveTitle(RegExp('^InvenTree'));
|
||||
await expect(page).toHaveTitle(/^InvenTree/);
|
||||
|
||||
// Go to the dashboard
|
||||
await page.goto(baseUrl);
|
||||
@ -39,7 +39,7 @@ test('Quick Login Test', async ({ page }) => {
|
||||
// Check that the username is provided
|
||||
await page.getByText(user.username);
|
||||
|
||||
await expect(page).toHaveTitle(RegExp('^InvenTree'));
|
||||
await expect(page).toHaveTitle(/^InvenTree/);
|
||||
|
||||
// Go to the dashboard
|
||||
await page.goto(baseUrl);
|
||||
|
@ -120,7 +120,7 @@ test('Report Editing', async ({ page, request }) => {
|
||||
expect(textareaValue).toContain(
|
||||
`<img class='qr' alt="{% trans 'QR Code' %}" src='{% qrcode qr_data %}'>`
|
||||
);
|
||||
textarea.fill(textareaValue + '\nHello world');
|
||||
textarea.fill(`${textareaValue}\nHello world`);
|
||||
|
||||
// Switch back and forth to see if the changed contents get correctly passed between the hooks
|
||||
await page.getByRole('tab', { name: 'Code', exact: true }).click();
|
||||
|
Reference in New Issue
Block a user