mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-27 09:10:51 +00:00
[CI] Playwright testing improvements (#8985)
* Run playwright tests in headless mode * Add navigation helper * Validate files * test fix * Remove 'headless' * Fixes * Fix for 'navigate' helper * Further updates
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
import { test } from '../baseFixtures';
|
||||
import { baseUrl } from '../defaults';
|
||||
import { clearTableFilters, getRowFromCell } from '../helpers';
|
||||
import { clearTableFilters, getRowFromCell, navigate } from '../helpers';
|
||||
import { doQuickLogin } from '../login';
|
||||
|
||||
/**
|
||||
@ -45,7 +44,7 @@ test('Parts - Tabs', async ({ page }) => {
|
||||
await page.getByRole('tab', { name: 'Used In' }).click();
|
||||
await page.getByRole('tab', { name: 'Pricing' }).click();
|
||||
|
||||
await page.goto(`${baseUrl}/part/category/index/parts`);
|
||||
await navigate(page, 'part/category/index/parts');
|
||||
await page.getByText('Blue Chair').click();
|
||||
await page.getByRole('tab', { name: 'Bill of Materials' }).click();
|
||||
await page.getByRole('tab', { name: 'Build Orders' }).click();
|
||||
@ -54,7 +53,7 @@ test('Parts - Tabs', async ({ page }) => {
|
||||
test('Parts - Manufacturer Parts', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
await page.goto(`${baseUrl}/part/84/suppliers`);
|
||||
await navigate(page, 'part/84/suppliers');
|
||||
|
||||
await page.getByRole('tab', { name: 'Suppliers' }).click();
|
||||
await page.getByText('Hammond Manufacturing').click();
|
||||
@ -67,7 +66,7 @@ test('Parts - Manufacturer Parts', async ({ page }) => {
|
||||
test('Parts - Supplier Parts', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
await page.goto(`${baseUrl}/part/15/suppliers`);
|
||||
await navigate(page, 'part/15/suppliers');
|
||||
|
||||
await page.getByRole('tab', { name: 'Suppliers' }).click();
|
||||
await page.getByRole('cell', { name: 'DIG-84670-SJI' }).click();
|
||||
@ -81,14 +80,14 @@ test('Parts - Locking', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
// Navigate to a known assembly which is *not* locked
|
||||
await page.goto(`${baseUrl}/part/104/bom`);
|
||||
await navigate(page, 'part/104/bom');
|
||||
await page.getByRole('tab', { name: 'Bill of Materials' }).click();
|
||||
await page.getByLabel('action-button-add-bom-item').waitFor();
|
||||
await page.getByRole('tab', { name: 'Parameters' }).click();
|
||||
await page.getByLabel('action-button-add-parameter').waitFor();
|
||||
|
||||
// Navigate to a known assembly which *is* locked
|
||||
await page.goto(`${baseUrl}/part/100/bom`);
|
||||
await navigate(page, 'part/100/bom');
|
||||
await page.getByRole('tab', { name: 'Bill of Materials' }).click();
|
||||
await page.getByLabel('part-lock-icon').waitFor();
|
||||
await page.getByText('Part is Locked', { exact: true }).waitFor();
|
||||
@ -107,7 +106,7 @@ test('Parts - Allocations', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
// Let's look at the allocations for a single stock item
|
||||
await page.goto(`${baseUrl}/stock/item/324/`);
|
||||
await navigate(page, 'stock/item/324/');
|
||||
await page.getByRole('tab', { name: 'Allocations' }).click();
|
||||
|
||||
await page.getByRole('button', { name: 'Build Order Allocations' }).waitFor();
|
||||
@ -115,7 +114,7 @@ test('Parts - Allocations', async ({ page }) => {
|
||||
await page.getByRole('cell', { name: 'Making tables for SO 0003' }).waitFor();
|
||||
|
||||
// Let's look at the allocations for an entire part
|
||||
await page.goto(`${baseUrl}/part/74/details`);
|
||||
await navigate(page, 'part/74/details');
|
||||
|
||||
// Check that the overall allocations are displayed correctly
|
||||
await page.getByText('11 / 825').waitFor();
|
||||
@ -174,7 +173,7 @@ test('Parts - Pricing (Nothing, BOM)', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
// Part with no history
|
||||
await page.goto(`${baseUrl}/part/82/pricing`);
|
||||
await navigate(page, 'part/82/pricing');
|
||||
|
||||
await page.getByText('Small plastic enclosure, black').waitFor();
|
||||
await page.getByRole('tab', { name: 'Part Pricing' }).click();
|
||||
@ -186,7 +185,7 @@ test('Parts - Pricing (Nothing, BOM)', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'Supplier Pricing' }).isDisabled();
|
||||
|
||||
// Part with history
|
||||
await page.goto(`${baseUrl}/part/108/pricing`);
|
||||
await navigate(page, 'part/108/pricing');
|
||||
await page.getByText('A chair - with blue paint').waitFor();
|
||||
await page.getByRole('tab', { name: 'Part Pricing' }).click();
|
||||
await page.getByLabel('Part Pricing').getByText('Part Pricing').waitFor();
|
||||
@ -224,7 +223,7 @@ test('Parts - Pricing (Supplier)', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
// Part
|
||||
await page.goto(`${baseUrl}/part/55/pricing`);
|
||||
await navigate(page, 'part/55/pricing');
|
||||
await page.getByText('Ceramic capacitor, 100nF in').waitFor();
|
||||
await page.getByRole('tab', { name: 'Part Pricing' }).click();
|
||||
await page.getByLabel('Part Pricing').getByText('Part Pricing').waitFor();
|
||||
@ -250,7 +249,7 @@ test('Parts - Pricing (Variant)', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
// Part
|
||||
await page.goto(`${baseUrl}/part/106/pricing`);
|
||||
await navigate(page, 'part/106/pricing');
|
||||
await page.getByText('A chair - available in multiple colors').waitFor();
|
||||
await page.getByRole('tab', { name: 'Part Pricing' }).click();
|
||||
await page.getByLabel('Part Pricing').getByText('Part Pricing').waitFor();
|
||||
@ -276,7 +275,7 @@ test('Parts - Pricing (Internal)', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
// Part
|
||||
await page.goto(`${baseUrl}/part/65/pricing`);
|
||||
await navigate(page, 'part/65/pricing');
|
||||
await page.getByText('Socket head cap screw, M2').waitFor();
|
||||
await page.getByRole('tab', { name: 'Part Pricing' }).click();
|
||||
await page.getByLabel('Part Pricing').getByText('Part Pricing').waitFor();
|
||||
@ -301,7 +300,7 @@ test('Parts - Pricing (Purchase)', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
// Part
|
||||
await page.goto(`${baseUrl}/part/69/pricing`);
|
||||
await navigate(page, 'part/69/pricing');
|
||||
await page.getByText('1.25mm Pitch, PicoBlade PCB').waitFor();
|
||||
await page.getByRole('tab', { name: 'Part Pricing' }).click();
|
||||
await page.getByLabel('Part Pricing').getByText('Part Pricing').waitFor();
|
||||
@ -322,7 +321,7 @@ test('Parts - Pricing (Purchase)', async ({ page }) => {
|
||||
test('Parts - Attachments', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
await page.goto(`${baseUrl}/part/69/attachments`);
|
||||
await navigate(page, 'part/69/attachments');
|
||||
|
||||
// Submit a new external link
|
||||
await page.getByLabel('action-button-add-external-').click();
|
||||
@ -344,7 +343,7 @@ test('Parts - Attachments', async ({ page }) => {
|
||||
test('Parts - Parameters', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
await page.goto(`${baseUrl}/part/69/parameters`);
|
||||
await navigate(page, 'part/69/parameters');
|
||||
|
||||
// Create a new template
|
||||
await page.getByLabel('action-button-add-parameter').click();
|
||||
@ -371,7 +370,7 @@ test('Parts - Parameters', async ({ page }) => {
|
||||
test('Parts - Notes', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
await page.goto(`${baseUrl}/part/69/notes`);
|
||||
await navigate(page, 'part/69/notes');
|
||||
|
||||
// Enable editing
|
||||
await page.getByLabel('Enable Editing').waitFor();
|
||||
@ -393,7 +392,7 @@ test('Parts - Notes', async ({ page }) => {
|
||||
test('Parts - 404', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
await page.goto(`${baseUrl}/part/99999/`);
|
||||
await navigate(page, 'part/99999/');
|
||||
await page.getByText('Page Not Found', { exact: true }).waitFor();
|
||||
|
||||
// Clear out any console error messages
|
||||
@ -403,7 +402,7 @@ test('Parts - 404', async ({ page }) => {
|
||||
test('Parts - Revision', async ({ page }) => {
|
||||
await doQuickLogin(page);
|
||||
|
||||
await page.goto(`${baseUrl}/part/906/details`);
|
||||
await navigate(page, 'part/906/details');
|
||||
|
||||
await page.getByText('Revision of').waitFor();
|
||||
await page.getByText('Select Part Revision').waitFor();
|
||||
|
Reference in New Issue
Block a user