From 968d4ba2b71b6ac76ed9c827e91a2bcd6c411a8d Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Tue, 9 Apr 2024 22:20:10 +0200 Subject: [PATCH] add testing for new commands --- src/frontend/tests/pui_command.ts | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/frontend/tests/pui_command.ts diff --git a/src/frontend/tests/pui_command.ts b/src/frontend/tests/pui_command.ts new file mode 100644 index 0000000000..47e69739a9 --- /dev/null +++ b/src/frontend/tests/pui_command.ts @@ -0,0 +1,36 @@ +import { expect, test } from '@playwright/test'; + +test('test', async ({ page }) => { + await page.goto('./platform/'); + await expect(page).toHaveTitle('InvenTree'); + await page.waitForURL('**/platform/'); + await page.getByLabel('username').fill('allaccess'); + await page.getByLabel('password').fill('nolimits'); + await page.getByRole('button', { name: 'Log in' }).click(); + await page.waitForURL('**/platform'); + await page.goto('./platform/'); + + await expect(page).toHaveTitle('InvenTree'); + await page.waitForURL('**/platform/'); + // wait for the page to load - 0.5s + await page.waitForTimeout(500); + + // Open Spotlight with Keyboard Shortcut + await page.keyboard.press('Meta+K'); + await page + .getByRole('button', { name: 'Dashboard Go to the InvenTree' }) + .click(); + await page + .locator('div') + .filter({ hasText: /^Dashboard$/ }) + .click(); + await page.waitForURL('**/platform/dashboard'); + + // Open Spotlight with Button + await page.getByRole('button', { name: 'Open spotlight' }).click(); + await page.getByRole('button', { name: 'Home Go to the home page' }).click(); + await page + .getByRole('heading', { name: 'Welcome to your Dashboard,' }) + .click(); + await page.waitForURL('**/platform'); +});