Skip to content

Commit

Permalink
Update e2e to use the navigation bar (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
arbulu89 authored Apr 13, 2022
1 parent a075f67 commit ae54b26
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion assets/js/components/Layout/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const Layout = () => {
return (
<Link
key={index}
className={`w-full text-gray-800 dark:text-white flex items-center pl-6 p-2 my-2 transition-colors duration-200 justify-start ${
className={`tn-menu-item w-full text-gray-800 dark:text-white flex items-center pl-6 p-2 my-2 transition-colors duration-200 justify-start ${
isCurrentRoute(item.href)
? 'border-l-4 border-jungle-green-500'
: 'hover:border-l-4 hover:border-jungle-green-500'
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/cypress/integration/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ describe("User account page", () => {
before(() => {
cy.loadScenario("healthy-27-node-SAP-cluster");
cy.login();
cy.visit("/about");
cy.navigateToItem('About');
cy.url().should("include", "/about");
});

Expand Down
8 changes: 4 additions & 4 deletions test/e2e/cypress/integration/clusters_overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ import {
allClusterIds,
clusterIdByName,
} from '../fixtures/clusters-overview/available_clusters';

context('Clusters Overview', () => {
const availableClusters = allClusterNames();
const availableClustersId = allClusterIds();
before(() => {
cy.loadScenario('healthy-27-node-SAP-cluster');
cy.login();
cy.visit('/clusters');
cy.navigateToItem('Clusters');
cy.url().should("include", "/clusters");
});

describe('Registered Clusters should be available in the overview', () => {
it('should show all of the registered clusters', () => {
cy.get('.tn-clustername')
Expand All @@ -34,4 +35,3 @@ import {
});
});
});

2 changes: 1 addition & 1 deletion test/e2e/cypress/integration/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("Dashboard page", () => {
cy.loadScenario("healthy-27-node-SAP-cluster");
cy.task("startAgentHeartbeat", agents());
cy.login();
cy.visit("/");
cy.navigateToItem('Dashboard');
cy.url().should("include", "/");
});

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/cypress/integration/hosts_overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ context("Hosts Overview", () => {
cy.task("startAgentHeartbeat", agents());
cy.login();

cy.visit("/hosts");
cy.navigateToItem('Hosts');
cy.url().should("include", "/hosts");
});

Expand Down
8 changes: 8 additions & 0 deletions test/e2e/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

const initializeOpenSidebar = () => cy.setCookie('sidebar-collapsed', 'false');

Cypress.Commands.add("login", () => {
const [username, password] = [
Cypress.env("login_user"),
Expand All @@ -48,3 +50,9 @@ Cypress.Commands.add("loadScenario", (scenario) => {
`cd ${projectRoot} && ${photofinishBinary} run --url "http://${webAPIHost}:${webAPIPort}/api/collect" ${scenario}`
);
});

Cypress.Commands.add('navigateToItem', (item) => {
initializeOpenSidebar();
const items = Array.isArray(item) ? item : [item];
items.forEach((it) => cy.get('.tn-menu-item').contains(it).click());
});

0 comments on commit ae54b26

Please sign in to comment.