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

View file

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

View file

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