Skip to content

Commit

Permalink
ui/doc: add cypress test for the documentation link
Browse files Browse the repository at this point in the history
Refs: #2149
  • Loading branch information
ChengYanJin committed Jan 15, 2020
1 parent 7a4a611 commit 5d51fd9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ui/cypress/integration/AccessDocumentation.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Feature: AccessDocumentation
Scenario: Access documentation from the Navbar
Given I log in
Then I can access the documentation from the navbar
21 changes: 21 additions & 0 deletions ui/cypress/integration/common/accessDocumentation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Then } from 'cypress-cucumber-preprocessor/steps';

Then('I can access the documentation from the navbar', () => {
const target_url = Cypress.env('target_url');

cy.visit(target_url, {
onBeforeLoad(win) {
// win is the the remote page's window object
// `cy.stub()` stubs the window.open method
cy.stub(win, 'open', url => {
expect(url).to.have.string('/docs/index.html');
});
},
});

cy.get('.sc-dropdown')
.eq(1)
.click();

cy.get('[data-cy = documentation]').click();
});
1 change: 1 addition & 0 deletions ui/src/containers/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const Layout = props => {
onClick: () => {
window.open(`${api.url_doc}/index.html`);
},
'data-cy': 'documentation',
},
];

Expand Down

0 comments on commit 5d51fd9

Please sign in to comment.