Skip to content

Commit

Permalink
added new test scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
nk2136 committed Nov 14, 2024
1 parent a19b080 commit c56c1b2
Showing 1 changed file with 43 additions and 8 deletions.
51 changes: 43 additions & 8 deletions end2end/tests/userAccessGroup.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { test, expect } from '@playwright/test';

test.beforeEach(async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
});

test.afterAll(async ({ page }) => {
await page.close();
});

test('Validate if the user is able to access user access grups from admin panel', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/');
await page.getByRole('button', { name: ' User Access Groups Modify' }).click();
await expect(page.locator('#bodyarea')).toContainText('AdminUser access');
})

test('Validate if the user is able to create a new group and add a user', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
await page.getByRole('button', { name: '+ Create group' }).click();
await page.getByLabel('Group Title').fill('New Test Group 0');
await page.getByRole('button', { name: 'Save' }).click();
Expand All @@ -19,23 +22,27 @@ test('Validate if the user is able to create a new group and add a user', async
const removeBtn = page.getByRole('button', { name: 'Remove' });
await removeBtn.waitFor();
await page.getByRole('button', { name: 'Save' }).click();
await page.reload();
const user = page.locator('#members208').getByText('Rhona Goodwin + 1 others');
await user.waitFor({ state: 'visible' });
});

test('Validate if the user is able to view the new group in the group history', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
await page.getByRole('button', { name: 'Show group history' }).click();
await expect(page.locator('tbody')).toContainText('Tester Tester added new group: New Test Group 0');
await page.getByRole('button', { name: 'Close' }).click();
});

test('Validate if the user is able to search for the new group in User groups', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
await page.getByRole('link', { name: 'User groups' }).click();
await page.getByLabel('Filter by group or user name').fill('New Test Group 0');
await page.keyboard.press('Enter');
await expect(page.locator('text=New Test Group 0')).toBeVisible();
});

test('Validate if the user is able to view the group history', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
await page.getByLabel('Filter by group or user name').fill('New Test Group 0');
await expect(page.locator('text=New Test Group 0')).toBeVisible();
await page.getByRole('heading', { name: 'New Test Group' }).click();
Expand All @@ -47,6 +54,7 @@ test('Validate if the user is able to view the group history', async ({ page })
});

test('Validate if the user is able to add the user in Nexus', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
await page.getByRole('heading', { name: 'New Test Group' }).click();
await page.getByRole('button', { name: 'Add to Nexus' }).click();
await page.getByRole('button', { name: 'Yes' }).click();
Expand All @@ -57,13 +65,15 @@ test('Validate if the user is able to add the user in Nexus', async ({ page }) =
});

test('Validate if the user is able to search for System Admin in the System administrators', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
await page.getByRole('link', { name: 'System administrators (2)' }).click();
await page.getByLabel('Filter by group or user name').fill('sysa');
await page.keyboard.press('Enter');
await expect(page.locator('#groupTitle1')).toContainText('sysadmin');
})

test('Validate if the user is able to add a new admin in System Admin', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
const sysadmin = page.locator('#adminList');
await sysadmin.click();
const searchBox = page.getByLabel('Search for user to add as');
Expand All @@ -85,6 +95,7 @@ test('Validate if the user is able to add a new admin in System Admin', async ({
});

test('Validate if the user is able to find the new admin in the primary admin', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
await page.getByRole('heading', { name: 'Primary Admin' }).click();
await page.locator('#employeeSelectorDropdown').selectOption('vtrofbrebekah');
await page.getByRole('button', { name: 'Save' }).click();
Expand All @@ -93,7 +104,8 @@ test('Validate if the user is able to find the new admin in the primary admin',
await page.getByRole('button', { name: 'Close' }).click();
});

test('Validate if the user is able to see primary admin histroy', async ({ page }) => {
test('Validate if the user is able to see primary admin history', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
await page.getByRole('heading', { name: 'Primary Admin' }).click();
await expect(page.getByRole('button', { name: 'View History' })).toBeVisible();
await page.getByRole('button', { name: 'View History' }).click();
Expand All @@ -102,6 +114,7 @@ test('Validate if the user is able to see primary admin histroy', async ({ page
});

test('Validate if the user is able to remove an admin from System Admin', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
const sysadmin = page.locator('#adminList');
await sysadmin.click();
await page.getByLabel('REMOVE Carroll, Zoila').click();
Expand All @@ -112,18 +125,40 @@ test('Validate if the user is able to remove an admin from System Admin', async
});

test('Validate if the user is able to import a group', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
await page.getByRole('button', { name: 'Import group' }).click();
await page.getByLabel('Search for user to add as').fill('copper');
await page.getByRole('cell', { name: 'Copper Books' }).click();
await page.getByRole('button', { name: 'Import', exact: true }).click();
await page.getByLabel('Filter by group or user name').fill('copper Books');
await page.keyboard.press('Enter');
await expect(page.locator('#groupTitle183')).toContainText('Copper Books');
})
});

test('Validate if the user can add multiple users to the group', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
await page.getByRole('heading', { name: 'New Test Group 0' }).click();
await page.getByLabel('Search for user to add as').click();
await page.getByLabel('Search for user to add as').fill('car');
await page.getByRole('cell', { name: 'Nikolaus, Carlton Hills.' }).click();
await page.getByLabel('Search for user to add as').click();
await page.getByLabel('Search for user to add as').fill('ni');
await page.getByRole('cell', { name: 'Nicolas, Sherlyn Huels.' }).click();
await page.getByLabel('Search for user to add as').click();
await expect(page.getByRole('table')).toContainText('Nicolas, Sherlyn');
await page.getByRole('button', { name: 'Save' }).click();
const users = page.locator('#members208').getByText('Rhona Goodwin + 3 others');
await users.waitFor();
await page.getByRole('heading', { name: 'New Test Group 0' }).click();
await expect(page.getByRole('table')).toContainText('Nikolaus, Carlton');
await expect(page.getByRole('table')).toContainText('Nicolas, Sherlyn');
await page.getByRole('button', { name: 'Close' }).click();
});

test('Validate if the user is able to delete the group and remove the user', async ({ page }) => {
await page.goto('https://host.docker.internal/LEAF_Request_Portal/admin/?a=mod_groups#/');
await page.getByRole('heading', { name: 'New Test Group 0' }).click();
await page.getByRole('button', { name: 'Remove' }).click();
await page.locator('#removeMember_0').click();
await page.getByRole('button', { name: 'Yes' }).click();
await expect(page.getByRole('cell', { name: 'users, testing' })).not.toBeVisible();
await page.getByRole('heading', { name: 'New Test Group 0' }).click();
Expand Down

0 comments on commit c56c1b2

Please sign in to comment.