-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rancher UI tests without Epinio icon
- Loading branch information
Showing
6 changed files
with
166 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { Epinio } from '~/cypress/support/epinio'; | ||
import { TopLevelMenu } from '~/cypress/support/toplevelmenu'; | ||
import '~/cypress/support/functions'; | ||
|
||
Cypress.config(); | ||
describe('Simplyfied menu testing for Epinio installed in Rancher', () => { | ||
const topLevelMenu = new TopLevelMenu(); | ||
const epinio = new Epinio(); | ||
|
||
beforeEach(() => { | ||
cy.login(); | ||
cy.visit('/'); | ||
}); | ||
|
||
it('Check Epinio menu', () => { | ||
epinio.checkEpinioNav(); | ||
}); | ||
|
||
it('Verify Welcome Screen without Namespaces', () => { | ||
cy.clickEpinioMenu('Namespaces'); | ||
// Deletes all namespaces if detected | ||
cy.get("body").then(($body) => { | ||
if ($body.text().includes('Delete')) { | ||
cy.deleteAllNamespaces() | ||
} | ||
} | ||
) | ||
cy.clickEpinioMenu('Applications'); | ||
cy.get('h1').contains('Welcome to Epinio').should('be.visible') | ||
// Verify creating namespace from Get Started button works | ||
cy.get('a.btn.role-secondary').contains('Get started').click() | ||
cy.clickButton('Create'); | ||
const defaultNamespace = 'workspace' | ||
cy.typeValue({label: 'Name', value: defaultNamespace}); | ||
cy.clickButton('Create'); | ||
// Check that the namespace has effectively been created | ||
cy.contains(defaultNamespace).should('be.visible'); | ||
}); | ||
|
||
it('Check binary links from version in menu', () => { | ||
// Check link in main page is present and works after clicking | ||
cy.get('.version.text-muted > a').should('have.attr', 'href').and('include', '/epinio/about'); | ||
cy.get('.version.text-muted > a').click(); | ||
|
||
// Test in ABOUT page starts here | ||
cy.get('table > tr > td:nth-child(2)').eq(0).invoke('text').then(version => { | ||
cy.log(`Epinio version in ABOUT PAGE is ${version}`); | ||
// Check "Go back" link | ||
cy.get('.back-link').should('exist').click(); | ||
cy.get('span.label.no-icon').eq(0).contains('Applications').should('be.visible'); | ||
// Checks version displayed in about page is the same as in main page | ||
// Later returns to About page | ||
cy.get('.version.text-muted > a').invoke('text').should('contains', version).then(version_main => { | ||
cy.log(`Epinio version in MAIN UI is ${version_main}`); | ||
cy.visit('/epinio/about'); | ||
}); | ||
|
||
// Check all links work and match the expected version | ||
|
||
// Verify amount of binaries in the page | ||
cy.get('tr.link > td > a').should('have.length', 3); | ||
const binOsNames = ['darwin-arm64', 'linux-arm64', 'windows-x86_64.zip']; | ||
|
||
for (let i = 0; i < binOsNames.length; i++) { | ||
|
||
// Verify binaries names and version match the one in the page | ||
cy.get('tr.link > td > a').contains(binOsNames[i]).and('have.attr', 'href') | ||
.and('include', `https://github.com/epinio/epinio/releases/download/${version}/epinio-${binOsNames[i]}`); | ||
|
||
// Download binaries | ||
// This is added to workaround Cypress error waiting for a page instead of downloading | ||
// Source: https://github.com/cypress-io/cypress/issues/14857#issuecomment-785717474 | ||
cy.window().document().then(function (doc) { | ||
doc.addEventListener('click', () => { | ||
setTimeout(function () { doc.location.reload(); }, 5000); | ||
}); | ||
// Now we can download | ||
cy.get("tr.link > td > a").eq(i).click({ force: true }); | ||
// Adding a bit of wait prior executing command to ensure file is downloaded | ||
cy.wait(1500); | ||
}); | ||
|
||
// Verify files are downloaded in cypress/download and its stdout output | ||
cy.exec(`find "cypress/downloads/" -name "epinio-${binOsNames[i]}*"`).its('stdout').should('contain', `${binOsNames[i]}`); | ||
} | ||
|
||
// Check link "See all packages" and visit binary page | ||
// Check version number in binary page matches the one in Epinio | ||
cy.get('.mt-5').contains('See all packages').invoke('attr', 'href').as('href_repo').then(() => { | ||
cy.get('@href_repo').should('eq', `https://github.com/epinio/epinio/releases/tag/${version}`) | ||
cy.origin('https://github.com', { args: { version } }, ({ version }) => { | ||
cy.visit(`/epinio/epinio/releases/tag/${version}`); | ||
cy.get('.d-inline.mr-3').should('contain', `${version}`); | ||
cy.screenshot(`epinio-bin-repo-${version}`); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |