Skip to content

Instantly share code, notes, and snippets.

@dualyticalchemy
Created February 7, 2021 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dualyticalchemy/9dc59660363032a01c5b4f5cd552b246 to your computer and use it in GitHub Desktop.
Save dualyticalchemy/9dc59660363032a01c5b4f5cd552b246 to your computer and use it in GitHub Desktop.
describe('Home (iPad)', () => {
const baseUrl = Cypress.env('baseUrl:home-unit') || 'http://localhost:8000';
it('should check for localStorage', () => {
cy.visit(baseUrl);
const localStorage = cy.window().its('localStorage');
cy.log('checking for localStorage');
expect(localStorage).to.exist;
cy.log("condition: 'get' in localStorage", 'get' in localStorage);
expect('get' in localStorage).to.be.true;
});
it('should visit the home-unit page and load AngularJS', () => {
cy.visit(baseUrl, {
onLoad: function (contentWindow) {
expect(contentWindow.angular).to.exist;
}
});
cy.get('body');
cy.wait(500);
});
it('should have class', () => {
cy.visit(baseUrl);
const sel = 'body';
cy.get(sel)
.should('have.class', 'O-home-unit');
cy.wait(500);
});
it('should have class on title', () => {
cy.visit(baseUrl, {
onLoad: function (contentWindow) {
expect(contentWindow.document).to.exist;
}
});
cy.wait(1000);
cy
.get('zoll-tablet-view')
.contains('Unit')
.should('have.class', 'title');
cy.wait(1000);
cy
.get('zoll-tablet-view')
.contains('Unit')
.should('be.visible');
});
it('should navigate to unit-crew', () => {
cy.visit(baseUrl);
cy.contains('Open').closest('a');
cy.wait(500);
cy.contains('Open').closest('a')
.click();
cy.wait(500);
});
it('should navigate to unit-crew, then select a crew', () => {
const context = 'zoll-configurable-row';
const elementText = 'Open';
const nextElementText = 'Crew 2';
cy.visit(baseUrl).then(() => {
cy.wait(500);
cy.get(context).contains(elementText);
cy.wait(500);
cy.get(context).contains(elementText).click();
cy.wait(1000);
cy.contains(nextElementText).parent().click();
cy.wait(1000);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment