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 18, 2024
1 parent 921dfb7 commit f95c17d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
33 changes: 32 additions & 1 deletion e2e/tests/keycloak-odoo-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test.beforeEach(async ({ page }) => {
openmrs = new OpenMRS(page);
keycloak = new Keycloak(page);
});

/*
test('Logging out from Odoo ends the session in Keycloak and logs out the user.', async ({ page }) => {
// setup
await odoo.open();
Expand Down Expand Up @@ -129,6 +129,37 @@ test('Updating a synced Odoo group updates the corresponding Keycloak role.', as
await keycloak.searchOdooRole();
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();
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 f95c17d

Please sign in to comment.