Skip to content

Commit

Permalink
add validations
Browse files Browse the repository at this point in the history
  • Loading branch information
nk2136 committed Nov 26, 2024
1 parent f0b6c13 commit 368afdb
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions end2end/tests/userAccessGroup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,57 +13,54 @@ test('Validate group creation and an employee addition', async ({ page }) => {
const saveButton = page.getByRole('button', { name: 'Save' });
await saveButton.click();

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

// Click on the new group to add a employee
// Open new group and add an employee
await newGroup.click();

const searchInput = page.getByLabel('Search for user to add as');
await searchInput.fill('test');

const employeeToAdd = page.getByRole('cell', { name: 'Tester, Tester Product Liaison' });
await employeeToAdd.click();

// Validate remove employee button
const removeButton = page.getByRole('button', { name: 'Remove' });
await removeButton.waitFor();

await saveButton.click();

const employeeNames = page.getByText('Rhona Goodwin + 1 others');
await expect(employeeNames).toBeVisible();
// Reload the page to ensure the changes are reflected
await page.reload();
await newGroup.click();

// Validate that the employee appears in the group’s employee table
const employeeTable = page.locator('#employee_table');
await employeeTable.waitFor();
await expect(employeeTable).toHaveText(/Tester, Tester/);
});

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

// import button
const importGroupButton = page.getByRole('button', { name: 'Import group' });
await importGroupButton.waitFor();
await importGroupButton.click();

// Search for the user to add to the group
const importGroupDialog = page.locator('[aria-describedby="import_dialog"]');
await importGroupDialog.waitFor();

// Import the group
const searchLabel = page.getByLabel('Search for user to add as');
await searchLabel.waitFor();
await searchLabel.fill('Concrete Shoes');

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

// import button
const importButton = page.getByRole('button', { name: 'Import', exact: true });
await importButton.click();

const searchBox = page.getByLabel('Filter by group or user name');
await searchBox.fill('Concrete Shoes & kids');
await page.keyboard.press('Enter');

// validate group is added
// Verify that the group has been successfully imported
const importedGroup = page.getByRole('heading', { name: 'Concrete Shoes & Kids' });
await expect(importedGroup).toBeVisible();
});

0 comments on commit 368afdb

Please sign in to comment.