Re-enable permissions test and fixed sub tabs (#2477)

This commit is contained in:
Erik Jan de Wit 2022-04-21 11:26:58 +02:00 committed by GitHub
parent 50ba699ab8
commit f789ee643f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 32 deletions

View file

@ -23,22 +23,22 @@ describe("Client authentication subtab", () => {
"client-authentication-" + (Math.random() + 1).toString(36).substring(7);
before(() => {
adminClient.createClient({
protocol: "openid-connect",
clientId,
publicClient: false,
authorizationServicesEnabled: true,
serviceAccountsEnabled: true,
standardFlowEnabled: true,
});
});
beforeEach(() => {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToClients();
listingPage.searchItem(clientId).goToItemDetails(clientId);
clientDetailsPage.goToAuthorizationTab();
cy.wrap(
adminClient.createClient({
protocol: "openid-connect",
clientId,
publicClient: false,
authorizationServicesEnabled: true,
serviceAccountsEnabled: true,
standardFlowEnabled: true,
})
);
});
after(() => {
@ -142,7 +142,7 @@ describe("Client authentication subtab", () => {
authenticationTab.formUtils().cancel();
});
it.skip("Should create a permission", () => {
it("Should create a permission", () => {
authenticationTab.goToPermissionsSubTab();
permissionsSubTab.createPermission("resource").fillPermissionForm({

View file

@ -5,31 +5,40 @@ export default class TabPage extends CommonElements {
constructor() {
super(".pf-c-tabs");
this.tabItemSelector = this.parentSelector + ".pf-c-tabs__item";
this.tabItemSelector = ".pf-c-tabs__item";
}
clickTab(tabName: string) {
cy.get(this.tabItemSelector).contains(tabName).click();
this.checkIsCurrentTab(tabName);
private getTab(tabName: string, index: number | undefined = 0) {
return cy
.get(this.parentSelector)
.eq(index)
.find(this.tabItemSelector)
.contains(tabName);
}
clickTab(tabName: string, index: number | undefined = 0) {
this.getTab(tabName, index).click();
this.checkIsCurrentTab(tabName, index);
return this;
}
checkIsCurrentTab(tabName: string) {
cy.get(this.tabItemSelector)
.contains(tabName)
.parent()
.should("have.class", "pf-m-current");
checkIsCurrentTab(tabName: string, index: number | undefined = 0) {
this.getTab(tabName, index).parent().should("have.class", "pf-m-current");
return this;
}
checkTabExists(tabName: string, exists: boolean) {
checkTabExists(
tabName: string,
exists: boolean,
index: number | undefined = 0
) {
const condition = exists ? "exist" : "not.exist";
cy.get(this.tabItemSelector).contains(tabName).should(condition);
this.getTab(tabName, index).should(condition);
return this;
}
checkNumberOfTabsIsEqual(number: number) {
cy.get(this.tabItemSelector).should("have.length", number);
checkNumberOfTabsIsEqual(number: number, index: number | undefined = 0) {
cy.get(this.parentSelector).eq(index).should("have.length", number);
return this;
}
}

View file

@ -27,37 +27,37 @@ export default class AuthorizationTab extends CommonPage {
private exportSubTab = new ExportTab();
goToSettingsSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Settings);
this.tabUtils().clickTab(AuthorizationSubTab.Settings, 1);
return this.settingsSubTab;
}
goToResourcesSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Resources);
this.tabUtils().clickTab(AuthorizationSubTab.Resources, 1);
return this.resourcesSubTab;
}
goToScopesSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Scopes);
this.tabUtils().clickTab(AuthorizationSubTab.Scopes, 1);
return this.scopesSubTab;
}
goToPoliciesSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Policies);
this.tabUtils().clickTab(AuthorizationSubTab.Policies, 1);
return this.policiesSubTab;
}
goToPermissionsSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Permissions);
this.tabUtils().clickTab(AuthorizationSubTab.Permissions, 1);
return this.permissionsSubTab;
}
goToEvaluateSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Evaluate);
this.tabUtils().clickTab(AuthorizationSubTab.Evaluate, 1);
return this.evaluateSubTab;
}
goToExportSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Export);
this.tabUtils().clickTab(AuthorizationSubTab.Export, 1);
return this.exportSubTab;
}
}