Skip to content

Commit

Permalink
Remove <Playground> from PUI frontend (#8276)
Browse files Browse the repository at this point in the history
* Remove <Playground> from PUI frontend

- Components are now mature enough with sufficient examples in the codebase

* Remove dead code
  • Loading branch information
SchrodingersGat authored Oct 13, 2024
1 parent 8aade76 commit 7d3eb43
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 349 deletions.
4 changes: 0 additions & 4 deletions src/frontend/src/defaults/links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ export const navTabs = [
{ text: <Trans>Sales</Trans>, name: 'sales', role: UserRoles.sales_order }
];

if (IS_DEV_OR_DEMO) {
navTabs.push({ text: <Trans>Playground</Trans>, name: 'playground' });
}

export const docLinks = {
app: 'https://docs.inventree.org/app/',
getting_started: 'https://docs.inventree.org/en/latest/getting_started/',
Expand Down
9 changes: 0 additions & 9 deletions src/frontend/src/defaults/menuItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,3 @@ export const menuItems: menuItemsCollection = {
link: '/settings/admin'
}
};

if (IS_DEV_OR_DEMO) {
menuItems['playground'] = {
id: 'playground',
text: <Trans>Playground</Trans>,
link: '/playground',
highlight: true
};
}
240 changes: 0 additions & 240 deletions src/frontend/src/pages/Index/Playground.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions src/frontend/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ export const LayoutComponent = Loadable(
lazy(() => import('./components/nav/Layout'))
);
export const Home = Loadable(lazy(() => import('./pages/Index/Home')));
export const Playground = Loadable(
lazy(() => import('./pages/Index/Playground'))
);

export const CompanyDetail = Loadable(
lazy(() => import('./pages/company/CompanyDetail'))
Expand Down Expand Up @@ -125,7 +122,6 @@ export const routes = (
<Route path="home/" element={<Home />} />,
<Route path="dashboard/" element={<Dashboard />} />,
<Route path="notifications/*" element={<Notifications />} />,
<Route path="playground/" element={<Playground />} />,
<Route path="scan/" element={<Scan />} />,
<Route path="settings/">
<Route index element={<Navigate to="admin/" />} />
Expand Down
72 changes: 0 additions & 72 deletions src/frontend/tests/pages/pui_index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,78 +1,6 @@
import { test } from '../baseFixtures.js';
import { doQuickLogin } from '../login.js';

const newPartName = 'UITESTIN123';

test('Pages - Index - Playground', async ({ page }) => {
await doQuickLogin(page);

await page.goto('./');
// Playground
await page.getByRole('tab', { name: 'Playground' }).click();
await page.getByRole('button', { name: 'API Forms' }).click();

// New Part
await page.getByRole('button', { name: 'Create New Part' }).click();
await page.getByLabel('related-field-category').fill('category 0');

await page
.getByRole('option', { name: 'Category 0' })
.locator('div')
.first()
.click();

// Set the "name"
await page.getByLabel('text-field-name').fill(newPartName);
await page.getByLabel('number-field-initial_stock').fill('1');

await page
.getByLabel('Create Part')
.getByRole('button', { name: 'Cancel' })
.click();

// Edit Part
await page.getByRole('button', { name: 'Edit Part' }).click();
await page.getByLabel('IPN').click();
await page.getByLabel('IPN').fill(newPartName);
await page
.getByLabel('Edit Part')
.getByRole('button', { name: 'Cancel' })
.click();

// Create Stock Item
await page.getByRole('button', { name: 'Create Stock Item' }).click();
await page.getByLabel('related-field-part').fill('R_1K_0402_1');
await page.getByText('R_1K_0402_1%').click();
await page
.getByLabel('Add Stock Item')
.getByRole('button', { name: 'Cancel' })
.click();

// EditCategory
await page.getByRole('button', { name: 'Edit Category' }).click();
await page.getByLabel('related-field-parent').click();
await page.getByText('Category 0').click();
await page
.getByLabel('Edit Category')
.getByRole('button', { name: 'Cancel' })
.click();

// Create Part new Modal
await page.getByRole('button', { name: 'Create Part new Modal' }).click();
await page.getByLabel('related-field-category').click();
await page.getByText('Category 0').click();
await page
.getByLabel('Create part')
.getByRole('button', { name: 'Cancel' })
.click();

// Status Label
await page.getByRole('button', { name: 'Status labels' }).click();
await page.getByRole('textbox').dblclick();
await page.getByRole('textbox').fill('50');
await page.getByText('Attention needed').waitFor();
});

test('Pages - Index - Dashboard', async ({ page }) => {
await doQuickLogin(page);

Expand Down
21 changes: 1 addition & 20 deletions src/frontend/tests/pui_command.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,5 @@ test('Quick Command - No Keys', async ({ page }) => {
.click();
await page.waitForURL('https://docs.inventree.org/**');

// Test addition of new actions
await page.goto(`${baseUrl}/playground`);
await page.locator('p').filter({ hasText: 'Playground' }).waitFor();
await page.getByRole('button', { name: 'Spotlight actions' }).click();
await page.getByRole('button', { name: 'Register extra actions' }).click();
/*
await page.getByPlaceholder('Search...').fill('secret');
await page.getByRole('button', { name: 'Secret action It was' }).click();
await page.getByLabel('open-spotlight').click();
await page.getByPlaceholder('Search...').fill('Another secret action');
await page
.getByRole('button', {
name: 'Another secret action You can register multiple actions with just one command'
})
.click();
await page.getByRole('tab', { name: 'Home' }).click();
await page.getByLabel('open-spotlight').click();
*/
await page.getByPlaceholder('Search...').fill('secret');
await page.getByText('Nothing found...').click();
// TODO: Test addition of new actions
});

0 comments on commit 7d3eb43

Please sign in to comment.