diff --git a/e2e/tests/keycloak-odoo-flows.spec.ts b/e2e/tests/keycloak-odoo-flows.spec.ts index f8524e4..b5508ef 100644 --- a/e2e/tests/keycloak-odoo-flows.spec.ts +++ b/e2e/tests/keycloak-odoo-flows.spec.ts @@ -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(); @@ -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(); 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" },