2021-01-27 12:56:28 +00:00
|
|
|
import ListingPage from "../support/pages/admin_console/ListingPage";
|
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
|
|
|
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
|
|
|
import Masthead from "../support/pages/admin_console/Masthead";
|
2022-01-07 07:27:58 +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();
|
|
|
|
|
|
|
|
const logOutTest = () => {
|
|
|
|
it("logs out", () => {
|
|
|
|
masthead.signOut();
|
|
|
|
loginPage.isLogInPage();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const goToAcctMgtTest = () => {
|
|
|
|
it("opens manage account and returns to admin console", () => {
|
|
|
|
masthead.accountManagement();
|
|
|
|
cy.contains("Welcome to Keycloak Account Management");
|
|
|
|
cy.get("#landingReferrerLink").click({ force: true });
|
2022-01-05 09:56:38 +00:00
|
|
|
masthead.checkIsAdminConsole();
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
describe("Masthead tests in desktop mode", () => {
|
|
|
|
beforeEach(() => {
|
2021-03-18 12:48:14 +00:00
|
|
|
keycloakBefore();
|
2021-01-21 12:09:50 +00:00
|
|
|
loginPage.logIn();
|
|
|
|
});
|
|
|
|
|
|
|
|
goToAcctMgtTest();
|
|
|
|
|
|
|
|
it("disables header help and form field help", () => {
|
|
|
|
const sidebarPage = new SidebarPage();
|
|
|
|
const listingPage = new ListingPage();
|
|
|
|
|
|
|
|
sidebarPage.goToClientScopes();
|
|
|
|
listingPage.goToItemDetails("address");
|
|
|
|
|
|
|
|
cy.get("#view-header-subkey").should("exist");
|
2021-12-14 14:56:36 +00:00
|
|
|
cy.findByTestId("help-label-name").should("exist");
|
2021-01-21 12:09:50 +00:00
|
|
|
|
|
|
|
masthead.toggleGlobalHelp();
|
|
|
|
|
|
|
|
cy.get("#view-header-subkey").should("not.exist");
|
2021-12-14 14:56:36 +00:00
|
|
|
cy.findByTestId("help-label-name").should("not.exist");
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
logOutTest();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("Masthead tests with kebab menu", () => {
|
|
|
|
beforeEach(() => {
|
2021-03-18 12:48:14 +00:00
|
|
|
keycloakBefore();
|
2021-01-21 12:09:50 +00:00
|
|
|
loginPage.logIn();
|
|
|
|
masthead.setMobileMode(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("shows kabab and hides regular menu", () => {
|
2021-05-06 09:06:20 +00:00
|
|
|
masthead.checkKebabShown();
|
2021-01-21 12:09:50 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// TODO: Add test for help when using kebab menu.
|
|
|
|
// Feature not yet implemented for kebab.
|
|
|
|
|
|
|
|
goToAcctMgtTest();
|
|
|
|
logOutTest();
|
|
|
|
});
|