-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OZ-590: Refactored E2E tests for Keycloak-Superset flows + Updated pl…
…aywright to 1.44.1 (#93)
- Loading branch information
Showing
4 changed files
with
127 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { Keycloak } from '../utils/functions/keycloak'; | ||
import { OpenMRS, delay } from '../utils/functions/openmrs'; | ||
import { Superset, randomSupersetRoleName} from '../utils/functions/superset'; | ||
import { KEYCLOAK_URL } from '../utils/configs/globalSetup'; | ||
|
||
let openmrs: OpenMRS; | ||
let keycloak: Keycloak; | ||
let superset: Superset; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
openmrs = new OpenMRS(page); | ||
keycloak = new Keycloak(page); | ||
superset = new Superset(page); | ||
|
||
await openmrs.login(); | ||
await expect(page).toHaveURL(/.*home/); | ||
}); | ||
|
||
test('Creating a Superset role creates the corresponding Keycloak role.', async ({ page }) => { | ||
// setup | ||
await superset.open(); | ||
|
||
// replay | ||
await superset.addRole(); | ||
|
||
// verify | ||
await keycloak.open(); | ||
await keycloak.goToClients(); | ||
await keycloak.selectSupersetId(); | ||
await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible(); | ||
await superset.deleteRole(); | ||
}); | ||
|
||
test('Updating a synced Superset role updates the corresponding Keycloak role.', async ({ page }) => { | ||
// setup | ||
await superset.open(); | ||
await superset.addRole(); | ||
await keycloak.open(); | ||
await keycloak.goToClients(); | ||
await keycloak.selectSupersetId(); | ||
await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible(); | ||
await expect(page.getByText('')).toBeTruthy(); | ||
|
||
// replay | ||
await superset.updateRole(); | ||
|
||
// verify | ||
await page.goto(`${KEYCLOAK_URL}/admin/master/console`); | ||
await keycloak.goToClients(); | ||
await keycloak.selectSupersetId(); | ||
await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).not.toBeVisible(); | ||
await expect(page.getByText(`${randomSupersetRoleName.updatedRoleName}`)).toBeVisible(); | ||
await superset.deleteUpdatedRole(); | ||
}); | ||
|
||
test('Deleting a synced Superset role deletes the corresponding Keycloak role.', async ({ page }) => { | ||
// setup | ||
await superset.open(); | ||
await superset.addRole(); | ||
await keycloak.open(); | ||
await keycloak.goToClients(); | ||
await keycloak.selectSupersetId(); | ||
await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible(); | ||
|
||
// replay | ||
await superset.deleteRole(); | ||
await delay(30000); | ||
|
||
// verify | ||
await page.goto(`${KEYCLOAK_URL}/admin/master/console`); | ||
await keycloak.goToClients(); | ||
await keycloak.selectSupersetId(); | ||
await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).not.toBeVisible(); | ||
}); | ||
|
||
test('A synced role deleted from within Keycloak gets recreated in the subsequent polling cycle.', async ({ page }) => { | ||
// setup | ||
await superset.open(); | ||
await superset.addRole(); | ||
await keycloak.open(); | ||
await keycloak.goToClients(); | ||
await keycloak.selectSupersetId(); | ||
await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible(); | ||
|
||
// replay | ||
await keycloak.deleteSyncedRole(); | ||
await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).not.toBeVisible(); | ||
await delay(30000); | ||
|
||
// verify | ||
await page.getByLabel('Manage').getByRole('link', { name: 'Clients' }).click(); | ||
await keycloak.selectSupersetId(); | ||
await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible(); | ||
await superset.deleteRole(); | ||
}); | ||
|
||
test.afterEach(async ({ page }) => { | ||
await page.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,12 @@ | |
# yarn lockfile v1 | ||
|
||
|
||
"@playwright/test@^1.43.0": | ||
version "1.43.0" | ||
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.43.0.tgz#5d90f247b26d404dd5d81c60f9c7c5e5159eb664" | ||
integrity sha512-Ebw0+MCqoYflop7wVKj711ccbNlrwTBCtjY5rlbiY9kHL2bCYxq+qltK6uPsVBGGAOb033H2VO0YobcQVxoW7Q== | ||
"@playwright/test@^1.44.1": | ||
version "1.44.1" | ||
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.44.1.tgz#cc874ec31342479ad99838040e99b5f604299bcb" | ||
integrity sha512-1hZ4TNvD5z9VuhNJ/walIjvMVvYkZKf71axoF/uiAqpntQJXpG64dlXhoDXE3OczPuTuvjf/M5KWFg5VAVUS3Q== | ||
dependencies: | ||
playwright "1.43.0" | ||
playwright "1.44.1" | ||
|
||
"@types/node@^20.8.10": | ||
version "20.8.10" | ||
|
@@ -66,17 +66,17 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" | ||
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== | ||
|
||
playwright-core@1.43.0: | ||
version "1.43.0" | ||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.43.0.tgz#d8079acb653abebb0b63062e432479647a4e1271" | ||
integrity sha512-iWFjyBUH97+pUFiyTqSLd8cDMMOS0r2ZYz2qEsPjH8/bX++sbIJT35MSwKnp1r/OQBAqC5XO99xFbJ9XClhf4w== | ||
playwright-core@1.44.1: | ||
version "1.44.1" | ||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.44.1.tgz#53ec975503b763af6fc1a7aa995f34bc09ff447c" | ||
integrity sha512-wh0JWtYTrhv1+OSsLPgFzGzt67Y7BE/ZS3jEqgGBlp2ppp1ZDj8c+9IARNW4dwf1poq5MgHreEM2KV/GuR4cFA== | ||
|
||
playwright@1.43.0: | ||
version "1.43.0" | ||
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.43.0.tgz#2c2efd4ee2a25defd8c24c98ccb342bdd9d435f5" | ||
integrity sha512-SiOKHbVjTSf6wHuGCbqrEyzlm6qvXcv7mENP+OZon1I07brfZLGdfWV0l/efAzVx7TF3Z45ov1gPEkku9q25YQ== | ||
playwright@1.44.1: | ||
version "1.44.1" | ||
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.44.1.tgz#5634369d777111c1eea9180430b7a184028e7892" | ||
integrity sha512-qr/0UJ5CFAtloI3avF95Y0L1xQo6r3LQArLIg/z/PoGJ6xa+EwzrwO5lpNr/09STxdHuUoP2mvuELJS+hLdtgg== | ||
dependencies: | ||
playwright-core "1.43.0" | ||
playwright-core "1.44.1" | ||
optionalDependencies: | ||
fsevents "2.3.2" | ||
|
||
|