Skip to content

Commit

Permalink
OZ-707: Deleting a synced Odoo group deletes the corresponding Keyclo…
Browse files Browse the repository at this point in the history
…ak role.
  • Loading branch information
kdaud committed Nov 25, 2024
1 parent 921dfb7 commit 1b71106
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
32 changes: 31 additions & 1 deletion e2e/tests/keycloak-odoo-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ test('Logging out from Odoo ends the session in Keycloak and logs out the user.'

// replay
await odoo.logout();
await keycloak.confirmLogout();
await expect(page).toHaveURL(/.*login/);

// verify
Expand Down Expand Up @@ -130,6 +129,37 @@ test('Updating a synced Odoo group updates the corresponding Keycloak role.', as
await expect(page.getByText(`Accounting / ${randomOdooGroupName.updatedGroupName}`)).toBeVisible();
});

test('Deleting a synced Odoo group deletes the corresponding Keycloak role.', async ({ page }) => {
// setup
await page.goto(`${ODOO_URL}`);
await odoo.enterLoginCredentials();
await expect(page.locator('li.o_user_menu a span')).toHaveText(/administrator/i);
await odoo.activateDeveloperMode();
await odoo.navigateToGroups();
await odoo.createGroup();
await keycloak.open();
await keycloak.navigateToClients();
await keycloak.selectOdooId();
await keycloak.selectRoles();
await keycloak.searchOdooRole();
await expect(page.locator('tbody:nth-child(2) td:nth-child(1) a')).toHaveText(`Accounting / ${randomOdooGroupName.groupName}`);

// replay
await page.goto(`${ODOO_URL}`);
await odoo.navigateToSettings();
await odoo.navigateToGroups();
await odoo.searchGroup();
await odoo.deleteGroup();

// verify
await page.goto(`${KEYCLOAK_URL}/admin/master/console`);
await keycloak.navigateToClients();
await keycloak.selectOdooId();
await keycloak.selectRoles();
await keycloak.searchOdooRole();
await expect(page.getByText(`Accounting / ${randomOdooGroupName.groupName}`)).not.toBeVisible();
});

test.afterEach(async ({ page }) => {
await page.close();
});
4 changes: 2 additions & 2 deletions e2e/utils/functions/odoo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class Odoo {
await this.page.getByText(/accounting/i).click();
await this.page.getByLabel(/name/i).fill(`${randomOdooGroupName.groupName}`);
await this.page.getByRole('button', { name: /save/i }).click();
await delay(240000);
await delay(250000);
}

async searchGroup() {
Expand All @@ -109,7 +109,7 @@ export class Odoo {
await this.page.getByLabel(/name/i).fill(`${randomOdooGroupName.updatedGroupName}`);
await this.page.getByRole('button', { name: /save/i }).click();
randomOdooGroupName.groupName = `${randomOdooGroupName.updatedGroupName}`;
await delay(240000);
await delay(250000);
}

async deleteGroup() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"!playwright-report/"
],
"scripts": {
"ozone-pro": "npx playwright test",
"ozone-pro": "npx playwright test keycloak-odoo",
"ozone-foss": "npx playwright test odoo-openmrs erpnext-openmrs openmrs-senaite",
"openmrs-distro-his": "npx playwright test odoo-openmrs openmrs-senaite"
},
Expand Down

0 comments on commit 1b71106

Please sign in to comment.