diff --git a/src/frontend/src/components/buttons/ScanButton.tsx b/src/frontend/src/components/buttons/ScanButton.tsx index c3fe6d14b598..83dd990aaf38 100644 --- a/src/frontend/src/components/buttons/ScanButton.tsx +++ b/src/frontend/src/components/buttons/ScanButton.tsx @@ -16,6 +16,7 @@ export function ScanButton() { innerProps: {} }) } + title={t`Open QR code scanner`} > diff --git a/src/frontend/src/components/modals/LicenseModal.tsx b/src/frontend/src/components/modals/LicenseModal.tsx index a790e765b56a..c321d11532bb 100644 --- a/src/frontend/src/components/modals/LicenseModal.tsx +++ b/src/frontend/src/components/modals/LicenseModal.tsx @@ -23,7 +23,10 @@ export function LicenceView(entries: Readonly) { {entries?.length > 0 ? ( {entries?.map((entry: any, index: number) => ( - + {entry.name} diff --git a/src/frontend/tests/modals.spec.ts b/src/frontend/tests/modals.spec.ts new file mode 100644 index 000000000000..4d628eaf1f3c --- /dev/null +++ b/src/frontend/tests/modals.spec.ts @@ -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(); +});