From ed131b5c0983cfb5dde509bbae9bd5ec51f75c79 Mon Sep 17 00:00:00 2001 From: Daud Kakumirizi Date: Thu, 28 Nov 2024 21:57:17 +0300 Subject: [PATCH] OZ-707: Deleting a synced Odoo group deletes the corresponding Keycloak role. (#116) --- e2e/tests/keycloak-odoo-flows.spec.ts | 32 ++++++++++++++++++++++++++- e2e/utils/functions/odoo.ts | 4 ++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/e2e/tests/keycloak-odoo-flows.spec.ts b/e2e/tests/keycloak-odoo-flows.spec.ts index f8524e4..05735f3 100644 --- a/e2e/tests/keycloak-odoo-flows.spec.ts +++ b/e2e/tests/keycloak-odoo-flows.spec.ts @@ -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 @@ -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(); }); diff --git a/e2e/utils/functions/odoo.ts b/e2e/utils/functions/odoo.ts index 611371d..901354c 100644 --- a/e2e/utils/functions/odoo.ts +++ b/e2e/utils/functions/odoo.ts @@ -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() { @@ -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() {