2021-01-27 12:56:28 +00:00
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
2022-12-07 15:28:28 +00:00
|
|
|
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
|
|
|
|
import Masthead from "../support/pages/admin-ui/Masthead";
|
2022-03-09 16:42:51 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
2021-01-21 12:09:50 +00:00
|
|
|
|
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const masthead = new Masthead();
|
2022-02-08 22:10:27 +00:00
|
|
|
const sidebarPage = new SidebarPage();
|
2023-02-21 13:41:33 +00:00
|
|
|
const helpLabel = ".pf-c-form__group-label-help";
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2023-02-21 13:41:33 +00:00
|
|
|
describe("Masthead tests", () => {
|
2022-02-15 16:02:17 +00:00
|
|
|
beforeEach(() => {
|
2021-01-21 12:09:50 +00:00
|
|
|
loginPage.logIn();
|
2023-02-10 10:10:35 +00:00
|
|
|
keycloakBefore();
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|
|
|
|
|
2023-02-21 13:41:33 +00:00
|
|
|
describe("Desktop view", () => {
|
|
|
|
it("Go to account console and back to admin console", () => {
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
masthead.accountManagement();
|
|
|
|
cy.get("h1").contains("Welcome to Keycloak account management");
|
|
|
|
masthead.goToAdminConsole();
|
|
|
|
masthead.checkIsAdminUI();
|
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2023-02-21 13:41:33 +00:00
|
|
|
it("Sign out reachs to log in screen", () => {
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
masthead.signOut();
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
loginPage.isLogInPage();
|
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2023-02-21 13:41:33 +00:00
|
|
|
it("Go to realm info", () => {
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
masthead.toggleUsernameDropdown().clickRealmInfo();
|
|
|
|
cy.get(".pf-c-card__title").should("contain.text", "Server info");
|
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2023-02-21 13:41:33 +00:00
|
|
|
it("Should go to documentation page", () => {
|
|
|
|
masthead.clickGlobalHelp();
|
2023-06-20 12:21:49 +00:00
|
|
|
masthead
|
|
|
|
.getDocumentationLink()
|
|
|
|
.invoke("attr", "href")
|
|
|
|
.then((href) => {
|
|
|
|
if (!href) return;
|
|
|
|
|
|
|
|
masthead.clickDocumentationLink();
|
|
|
|
cy.origin(href, () => {
|
|
|
|
cy.get("#header").should(
|
|
|
|
"contain.text",
|
|
|
|
"Server Administration Guide"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
2023-02-21 13:41:33 +00:00
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2023-02-21 13:41:33 +00:00
|
|
|
it("Enable/disable help mode in desktop mode", () => {
|
|
|
|
masthead.assertIsDesktopView();
|
|
|
|
cy.get(helpLabel).should("exist");
|
|
|
|
masthead.toggleGlobalHelp();
|
|
|
|
masthead.clickGlobalHelp();
|
|
|
|
cy.get(helpLabel).should("not.exist");
|
|
|
|
masthead.toggleGlobalHelp();
|
|
|
|
cy.get(helpLabel).should("exist");
|
|
|
|
});
|
2022-02-16 16:34:54 +00:00
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2023-02-21 13:41:33 +00:00
|
|
|
describe("Mobile view", () => {
|
|
|
|
it("Mobile menu is shown when in mobile view", () => {
|
|
|
|
cy.viewport("samsung-s10");
|
|
|
|
masthead.assertIsMobileView();
|
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
|
2023-02-21 13:41:33 +00:00
|
|
|
it("Enable/disable help mode in mobile view", () => {
|
|
|
|
cy.viewport("samsung-s10");
|
|
|
|
masthead
|
|
|
|
.assertIsMobileView()
|
|
|
|
.toggleUsernameDropdown()
|
|
|
|
.toggleMobileViewHelp();
|
|
|
|
cy.get(helpLabel).should("not.exist");
|
|
|
|
masthead.toggleMobileViewHelp();
|
|
|
|
cy.get(helpLabel).should("exist");
|
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|
2023-03-22 16:14:53 +00:00
|
|
|
|
|
|
|
describe.skip("Accessibility tests for masthead", () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
loginPage.logIn();
|
|
|
|
keycloakBefore();
|
|
|
|
sidebarPage.waitForPageLoad();
|
|
|
|
masthead.accountManagement();
|
|
|
|
cy.injectAxe();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Check a11y violations on load/ masthead", () => {
|
|
|
|
cy.checkA11y();
|
|
|
|
});
|
|
|
|
});
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|