Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nilgaar committed Dec 3, 2024
1 parent 0cf0b00 commit 58bfdce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion e2e-tests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineConfig({
timeout: 90 * 1000,
testDir: "./playwright",
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
forbidOnly: false,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
Expand Down
17 changes: 14 additions & 3 deletions e2e-tests/playwright/e2e/plugins/rbac/rbac-api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { PolicyComplete, Response } from "../../../support/pages/rbac";
import { Common, setupBrowser } from "../../../utils/common";
import { UIhelper } from "../../../utils/ui-helper";
import { RbacConstants } from "../../../data/rbac-constants";
import { RhdhAuthHack } from "../../../support/api/rhdh-auth-hack";

// TODO: reenable tests
test.describe.serial("Test RBAC plugin REST API", () => {
test.describe.serial.only("Test RBAC plugin REST API", () => {
let common: Common;
let uiHelper: UIhelper;
let page: Page;
Expand All @@ -23,7 +22,7 @@ test.describe.serial("Test RBAC plugin REST API", () => {
common = new Common(page);

await common.loginAsGithubUser();
const apiToken = await RhdhAuthHack.getInstance().getApiToken(page);
const apiToken = process.env.BACKEND_SECRET;
responseHelper = new Response(apiToken);
});

Expand All @@ -46,6 +45,18 @@ test.describe.serial("Test RBAC plugin REST API", () => {
responseHelper.getSimpleRequest(),
);

if (!rolesResponse.ok()) {
throw Error(
`RBAC rolesResponse API call failed with status code ${rolesResponse} and body: ${await rolesResponse.json()}`,
);
}

if (!policiesResponse.ok()) {
throw Error(
`RBAC rolesResponse API call failed with status code ${policiesResponse} and body: ${await policiesResponse.json()}`,
);
}

await responseHelper.checkResponse(
rolesResponse,
RbacConstants.getExpectedRoles(),
Expand Down

0 comments on commit 58bfdce

Please sign in to comment.