Skip to content

Commit

Permalink
Merge pull request #1946 from nerdalert/playwright-tests
Browse files Browse the repository at this point in the history
Add more playwright tests
  • Loading branch information
mergify[bot] authored Feb 28, 2024
2 parents a29b872 + 530a7a6 commit 294ae44
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 11 deletions.
26 changes: 19 additions & 7 deletions ui/src/pages/VPCs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ export const VPCList = () => {
<Datagrid rowClick="show" bulkActionButtons={<VPCListBulkActions />}>
<TextField label="Description" source="description" />
{flags["devices"] && (
<div>
<TextField label="v4 CIDR" source="ipv4_cidr" />
<div style={{ display: "flex", alignItems: "center" }}>
<div style={{ marginRight: "8px" }}>
<TextField label="v4 CIDR" source="ipv4_cidr" />
</div>
<TextField label="v6 CIDR" source="ipv6_cidr" />
<ReferenceManyCount
label="Devices"
Expand All @@ -61,12 +63,22 @@ export const VPCShow = () => {
<SimpleShowLayout>
<TextField label="ID" source="id" />
<TextField label="Description" source="description" />

{flags["devices"] && (
<div>
<TextField label="v4 CIDR" source="ipv4_cidr" />
<TextField label="v6 CIDR" source="ipv6_cidr" />

<div style={{ display: "block", marginBottom: "1rem" }}>
<div
style={{
display: "flex",
alignItems: "center",
marginBottom: "8px",
}}
>
<TextField
label="v4 CIDR"
source="ipv4_cidr"
style={{ marginRight: "8px" }}
/>
<TextField label="v6 CIDR" source="ipv6_cidr" />
</div>
<ReferenceManyField
label="Enrolled Devices"
reference="devices"
Expand Down
55 changes: 51 additions & 4 deletions ui/tests/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,55 @@ await page.getByRole('button', { name: 'Login' }).click();
await page.getByLabel('Username or email').fill(lib.username);
await page.getByLabel('Password').fill(lib.password);
await page.getByLabel('Password').press('Enter');

// Validate Dashboard
await expect(page.getByText('Welcome to Nexodus')).toBeVisible();


});
await page.getByRole('menuitem', { name: 'Dashboard' }).click();
await expect(page.getByText('Welcome to Nexodus')).toBeVisible();
// Validate Organizations
await page.getByRole('menuitem', { name: 'Organizations' }).click();
await expect(page.locator('#react-admin-title').getByText('Organizations')).toBeVisible();
// Validate VPCs
await page.getByRole('menuitem', { name: 'VPCs' }).click();
await expect(page.getByText('default vpc')).toBeVisible();
await page.getByRole('cell', { name: 'default vpc' }).click();
await expect(page.getByText('100.64.0.0')).toBeVisible();
// Validate Devices
await page.getByRole('menuitem', { name: 'Devices' }).click();
await expect(page.locator('#react-admin-title').getByText('Devices')).toBeVisible();
// Validate Sites
await page.getByRole('menuitem', { name: 'Sites' }).click();
// Validate Invitations
await page.getByRole('menuitem', { name: 'Invitations' }).click();
await expect(page.getByLabel('Create')).toBeVisible();
await page.getByLabel('Create').click();
await expect(page.getByLabel('Email Address *')).toBeVisible();
// Validate Security Groups
await page.getByRole('menuitem', { name: 'Security Groups' }).click();
await page.getByRole('cell', { name: 'default vpc security group' }).click();
await page.getByRole('button', { name: 'Edit Rules' }).click();
await page.getByRole('button', { name: 'Add Rule' }).click();
await page.getByRole('combobox').first().click();
await page.getByRole('option', { name: 'All ICMP' }).click();
await page.getByRole('button', { name: 'Save Rules' }).click();
await page.getByRole('tab', { name: 'Outbound Rules' }).click();
await page.getByRole('button', { name: 'Add Rule' }).click();
await page.getByRole('combobox').first().click();
await page.getByRole('option', { name: 'All ICMP' }).click();
await page.getByRole('button', { name: 'Save Rules' }).click();
await page.getByRole('tab', { name: 'Inbound Rules' }).click();
await expect(page.getByText('All ICMP')).toBeVisible();
await page.getByRole('tab', { name: 'Outbound Rules' }).click();
await expect(page.getByText('All ICMP')).toBeVisible();
await page.getByRole('button', { name: 'Delete' }).click();
await page.getByRole('tab', { name: 'Inbound Rules' }).click();
await page.getByRole('button', { name: 'Delete' }).click();
await page.getByRole('button', { name: 'Save Rules' }).click();
// Validate Registration Keys
await page.getByRole('menuitem', { name: 'Registration Keys' }).click();
await page.getByLabel('Create').click();
await expect(page.getByLabel('Description')).toBeVisible();
// Validate Logout
await page.getByLabel('Profile').click();
await page.getByText('Logout').click();
await expect(page.getByRole('button', { name: 'Login' })).toBeVisible();
});

0 comments on commit 294ae44

Please sign in to comment.