Skip to content

Commit

Permalink
Cypress/reviewing menu tests (#367)
Browse files Browse the repository at this point in the history
* skipping about test

* Wrapping reload within checkink to ensure it waits for it
Adding check for elem visibility before clicking on deploy service button
Removing test skips

* Adding wrap to checkLandingLocaotr for better wait after clicking on link

* forcing explicit wait before reload

* adding implicit waits
  • Loading branch information
mmartin24 authored Aug 7, 2023
1 parent 9f03d81 commit ea67a87
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
12 changes: 10 additions & 2 deletions cypress/e2e/unit_tests/menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,15 @@ describe('Menu testing', () => {
cy.aboutPageFunction({ compareVersionVsMainPage: true });

// Returns to about page, refresh and checks 'Back' turns into 'Home'
cy.checkLink('v', '/epinio/c/default/about', 'about', false);
cy.reload();
cy.checkLink('v', '/epinio/c/default/about', 'about', false)
// Adding wait because reloads may break severely rest of tests
// if executed before previous comand is completed
cy.wait(10000)

cy.log('Reloading Page')
cy.reload({ timeout: 20000} );


cy.checkElementVisibility('.back-link', 'Home')
});

Expand All @@ -66,6 +73,7 @@ describe('Menu testing', () => {
cy.clickButton('Deploy Application');
cy.checkElementVisibility('[data-testid="epinio_app-source_type"]', 'Folder');
cy.go('back');
cy.checkElementVisibility('body', 'Create Instance');
cy.clickButton('Create Instance');
cy.checkElementVisibility('body', 'Catalog Service');
cy.go('back');
Expand Down
11 changes: 8 additions & 3 deletions cypress/support/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Cypress.Commands.add('dexLogin', (username = 'admin@epinio.io', password = 'pass
cy.get('#submit-login').click();
// Checking redirection to landing page is correct and Dex user is present
if (checkLandingPage == true) {
cy.contains('Welcome to Epinio').should('be.visible')
cy.contains('Welcome to Epinio', {timeout: 20000}).should('be.visible')
cy.get('.user-image.text-right.hand', {timeout: 5000}).click().then(() => {
cy.contains('admin@epinio.io');})}
})
Expand Down Expand Up @@ -319,8 +319,13 @@ Cypress.Commands.add('checkLink', (nameInLink, url, checkLandingLocator, goBack=
expect(response.body).to.have.length.greaterThan(100)

if (checkLandingLocator){
cy.contains('a', nameInLink, { matchCase: false }).click()
cy.contains(checkLandingLocator, { matchCase: false }).should('be.visible');
// cy.contains('a', nameInLink, { matchCase: false }).click()
// cy.contains(checkLandingLocator, { matchCase: false }).should('be.visible');
cy.contains('a', nameInLink, { matchCase: false }).click().then(() => {
cy.log('Checking landing locator')
cy.contains(checkLandingLocator, { matchCase: false, timeout: 30000 }).should('be.visible');
})

// Return to previous page if true (default)
if (goBack === true){
cy.go('back');
Expand Down

0 comments on commit ea67a87

Please sign in to comment.