From 1b71106c630415bc0f680aaa2aa8f80ff297af96 Mon Sep 17 00:00:00 2001 From: kdaud Date: Mon, 18 Nov 2024 16:51:44 +0300 Subject: [PATCH] OZ-707: Deleting a synced Odoo group deletes the corresponding Keycloak role. --- e2e/tests/keycloak-odoo-flows.spec.ts | 32 ++++++++++++++++++++++++++- e2e/utils/functions/odoo.ts | 4 ++-- package.json | 2 +- 3 files changed, 34 insertions(+), 4 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() { diff --git a/package.json b/package.json index 7c98608..e356f7c 100644 --- a/package.json +++ b/package.json @@ -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" },