[PUI] Test modals (#7113)

* add spotlight

* [PUI] Quick commands pallet
Fixes #5888

* add testing for new commands

* add text input testing

* only test backend if code changed

* add trans files

* fix testing text

* always push coverage

* add nav state to manage navigation state

* add navigation action and test

* make test faster

* fix typo

* use texts instead

* fix tests for linux

* use var to determine action key

* Revert "use texts instead"

This reverts commit 7771189556.

* add wait for input

* split out keyboard based tests

* split ou test

* add upload

* revert assert change

* adjust reporting settings

* ignore error code

* fix reporter config

* add full info suit (+tests)

* make tests more accurate

* license modal fixes

* unify icons

* add custom actions registering
with removal on page refresh

* only upload report data if the tests failed

* Revert "add trans files"

This reverts commit 28d96e058f.

* adjust url that iw waited for

* try an await and body locator for keypresses

* test registering addition actions

* extend testing for actions

* add doclink and test

* merge tests

* add modals test

* use quick login

* reduce diff

* fix test

* open packages too

* expand to frontend

* rnsure keys are unique

* ensure no errors in console

* add QR code modal too
This commit is contained in:
Matthias Mair 2024-04-24 01:59:03 +02:00 committed by GitHub
parent 37956db5fc
commit 5f54aef79a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 79 additions and 1 deletions

View File

@ -16,6 +16,7 @@ export function ScanButton() {
innerProps: {}
})
}
title={t`Open QR code scanner`}
>
<IconQrcode />
</ActionIcon>

View File

@ -23,7 +23,10 @@ export function LicenceView(entries: Readonly<any[]>) {
{entries?.length > 0 ? (
<Accordion variant="contained" defaultValue="-">
{entries?.map((entry: any, index: number) => (
<Accordion.Item key={entry.name} value={`entry-${index}`}>
<Accordion.Item
key={entry.name + entry.license + entry.version}
value={`entry-${index}`}
>
<Accordion.Control>
<Group position="apart" grow>
<Text>{entry.name}</Text>

View File

@ -0,0 +1,74 @@
import { test } from './baseFixtures.js';
import { doQuickLogin } from './login.js';
test('PUI - Modals as admin', async ({ page }) => {
await doQuickLogin(page, 'admin', 'inventree');
// Fail on console error
await page.on('console', (msg) => {
if (msg.type() === 'error') test.fail();
});
// use server info
await page.getByRole('button', { name: 'Open spotlight' }).click();
await page
.getByRole('button', {
name: 'Server Information About this Inventree instance'
})
.click();
await page.getByRole('cell', { name: 'Instance Name' }).waitFor();
await page.getByRole('button', { name: 'Dismiss' }).click();
await page.waitForURL('**/platform/home');
// use license info
await page.getByRole('button', { name: 'Open spotlight' }).click();
await page
.getByRole('button', {
name: 'License Information Licenses for dependencies of the service'
})
.click();
await page.getByText('License Information').first().waitFor();
await page.getByRole('tab', { name: 'backend Packages' }).click();
await page.getByRole('button', { name: 'Babel BSD License' }).click();
await page.getByText('Copyright (c) 2013-2023 by').waitFor();
await page.getByRole('tab', { name: 'frontend Packages' }).click();
await page.getByRole('button', { name: '@sentry/utils MIT' }).click();
await page
.getByLabel('@sentry/utilsMIT7.109.0')
.getByText('Copyright (c) 2019 Sentry (')
.waitFor();
await page
.getByLabel('License Information')
.getByRole('button')
.first()
.click();
// use about
await page.getByRole('button', { name: 'Open spotlight' }).click();
await page
.getByRole('button', { name: 'About InvenTree About the InvenTree org' })
.click();
await page.getByRole('cell', { name: 'InvenTree Version' }).click();
await page.goto('./platform/');
// qr code modal
await page.getByRole('button', { name: 'Open QR code scanner' }).click();
await page
.locator('div')
.filter({ hasText: /^Scan QR code$/ })
.getByRole('button')
.click();
await page.getByRole('button', { name: 'Open QR code scanner' }).click();
await page.getByRole('button', { name: 'Close modal' }).click();
await page.getByRole('button', { name: 'Open QR code scanner' }).click();
await page.waitForTimeout(500);
await page
.locator('div')
.filter({ hasText: /^Scan QR code$/ })
.getByRole('button')
.click();
});