Skip to content

Commit

Permalink
Add playwright tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingersGat committed Nov 5, 2024
1 parent 3eb9ec5 commit b3bb669
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/frontend/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export default defineConfig({
command: 'invoke dev.server -a 127.0.0.1:8000',
env: {
INVENTREE_DEBUG: 'True',
INVENTREE_PLUGINS_ENABLED: 'True'
INVENTREE_PLUGINS_ENABLED: 'True',
INVENTREE_ADMIN_URL: 'test-admin'
},
url: 'http://127.0.0.1:8000/api/',
reuseExistingServer: !process.env.CI,
Expand Down
15 changes: 15 additions & 0 deletions src/frontend/tests/pui_general.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,18 @@ test('Company', async ({ page }) => {
await page.getByText('Enter a valid URL.').waitFor();
await page.getByRole('button', { name: 'Cancel' }).click();
});

/**
* Test for integration of django admin button
*/
test('Admin Button', async ({ page }) => {
await doQuickLogin(page, 'admin', 'inventree');
await page.goto(`${baseUrl}/company/1/details`);

// Click on the admin button
await page.getByLabel(/action-button-open-in-admin/).click();

await page.waitForURL('**/test-admin/company/company/1/change/**');
await page.getByRole('heading', { name: 'Change Company' }).waitFor();
await page.getByRole('link', { name: 'View on site' }).waitFor();
});

0 comments on commit b3bb669

Please sign in to comment.