Merge pull request #843 from agagancarczyk/sessionType-test

Session type test
This commit is contained in:
agagancarczyk 2021-07-14 11:47:52 +01:00 committed by GitHub
commit ca03bb4cc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,46 @@
import LoginPage from "../support/pages/LoginPage";
import SidebarPage from "../support/pages/admin_console/SidebarPage";
import SessionsPage from "../support/pages/admin_console/manage/sessions/SessionsPage";
import { keycloakBefore } from "../support/util/keycloak_before";
const loginPage = new LoginPage();
const sidebarPage = new SidebarPage();
const sessionsPage = new SessionsPage();
describe("Sessions test", function () {
describe("Session type dropdown", function () {
beforeEach(function () {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToSessions();
});
it("Check dropdown display", () => {
sessionsPage.shouldDisplay();
});
it("Check dropdown options exist", () => {
sessionsPage.shouldNotBeEmpty();
});
it("Select 'All session types' dropdown option", () => {
sessionsPage.selectAllSessionsType();
});
it("Select 'Regular SSO' dropdown option", () => {
sessionsPage.selectRegularSSO();
});
it("Select 'Offline' dropdown option", () => {
sessionsPage.selectOffline();
});
it("Select 'Direct grant' dropdown option", () => {
sessionsPage.selectDirectGrant();
});
it("Select 'Service account' dropdown option", () => {
sessionsPage.selectServiceAccount();
});
});
});

View file

@ -0,0 +1,62 @@
export default class SessionsPage {
sessionTypeDrpDwn: string;
sessionTypeList: string;
allSessionTypesOption: string;
regularSSOOption: string;
offlineOption: string;
directGrantOption: string;
serviceAccountOption: string;
selectedType: string;
constructor() {
this.sessionTypeDrpDwn = ".pf-c-select__toggle";
this.sessionTypeList = ".pf-c-select__toggle + ul";
this.allSessionTypesOption = "all-sessions-option";
this.regularSSOOption = "regular-sso-option";
this.offlineOption = "offline-option";
this.directGrantOption = "direct-grant-option";
this.serviceAccountOption = "service-account-option";
this.selectedType = ".pf-c-select__toggle-text";
}
shouldDisplay() {
cy.get(this.sessionTypeDrpDwn).should("exist");
}
shouldNotBeEmpty() {
cy.get(this.sessionTypeDrpDwn).click();
cy.get(this.sessionTypeList).should("exist");
return this;
}
selectAllSessionsType() {
cy.get(this.sessionTypeDrpDwn).click();
cy.getId(this.allSessionTypesOption).click();
cy.get(this.selectedType).should('have.text', 'All session types');
}
selectRegularSSO() {
cy.get(this.sessionTypeDrpDwn).click();
cy.getId(this.regularSSOOption).click();
cy.get(this.selectedType).should('have.text', 'Regular SSO');
}
selectOffline() {
cy.get(this.sessionTypeDrpDwn).click();
cy.getId(this.offlineOption).click();
cy.get(this.selectedType).should('have.text', 'Offline');
}
selectDirectGrant() {
cy.get(this.sessionTypeDrpDwn).click();
cy.getId(this.directGrantOption).click();
cy.get(this.selectedType).should('have.text', 'Direct grant');
}
selectServiceAccount() {
cy.get(this.sessionTypeDrpDwn).click();
cy.getId(this.serviceAccountOption).click();
cy.get(this.selectedType).should('have.text', 'Service account');
}
}