Skip to content

Commit

Permalink
fix test name and group name
Browse files Browse the repository at this point in the history
  • Loading branch information
nk2136 committed Dec 5, 2024
1 parent 0a9af25 commit cb12d75
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions end2end/tests/userAccessGroup.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import { test, expect } from '@playwright/test';

test('Validate group creation and an employee addition', async ({ page }) => {
test('Create group and add an employee', async ({ page }) => {
await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=mod_groups');

// Generate a unique group name
let randNum = Math.floor(Math.random() * 10000);
let uniqueText = `New Test Group ${randNum}`;

// Create a new group
const createGroupButton = page.getByRole('button', { name: '+ Create group' });
await createGroupButton.click();

const groupTitle = page.getByLabel('Group Title');
await groupTitle.fill('New Test Group 0');
await groupTitle.fill(uniqueText);

const saveButton = page.getByRole('button', { name: 'Save' });
await saveButton.click();
await page.reload();

// Validate that the new group is successfully created and visible
const newGroup = page.getByRole('heading', { name: 'New Test Group 0' });
await newGroup.waitFor();
const newGroup = page.getByRole('heading', { name: uniqueText });
await expect(newGroup).toBeVisible();

// Open new group and add an employee
Expand All @@ -39,7 +43,7 @@ test('Validate group creation and an employee addition', async ({ page }) => {
await expect(employeeTable).toHaveText(/Tester, Tester/);
});

test('Validate group import from another leaf site', async ({ page }) => {
test('Import a group from another leaf site and delete it', async ({ page }) => {
await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=mod_groups');

const importGroupButton = page.getByRole('button', { name: 'Import group' });
Expand All @@ -54,7 +58,6 @@ test('Validate group import from another leaf site', async ({ page }) => {
await searchLabel.fill('Concrete Shoes');

const group = page.getByRole('cell', { name: 'Concrete Shoes & kids' });
await group.waitFor();
await group.click();

const importButton = page.getByRole('button', { name: 'Import', exact: true });
Expand All @@ -63,4 +66,16 @@ test('Validate group import from another leaf site', async ({ page }) => {
// Verify that the group has been successfully imported
const importedGroup = page.getByRole('heading', { name: 'Concrete Shoes & Kids' });
await expect(importedGroup).toBeVisible();

await importedGroup.click();

// Delete group
const deleteGroupButton = page.getByRole('button', { name: 'Delete Group' });

await deleteGroupButton.click();
const yesButton = page.locator('#confirm_button_save');
await yesButton.click();

await page.reload();
await expect(importedGroup).not.toBeVisible();
});

0 comments on commit cb12d75

Please sign in to comment.