Coder Social home page Coder Social logo

qa-with-cypress's Introduction

Cypress Automation

Automated test cases for website Hobsons.com

Test Cases

  • Assert that Hobsons.com renders as expected.

  • Assert that clicking the arrow in the Hero graphic image on the home screen scrolls the page to the appropriate section into the viewport window aligned with the top of the visible screen.

  • Assert that all links are available in the "hamburger" menu and children links are available under "Resources" menu.

  • Assert all events on the page "Resources > Events", that will occur in future with dates specified in units of day, month and year.

Tests covered

Home_page_spec.js

  • Assert the page loads successfully with correct title
  • Check the page scroll to correct position at specific viewport
  • Expect the list of drop downs are available on clicking the hamburger menu

Additional Validations

  • Ensure that all images load without failing
  • Assert the logo should be visible
  • Ensure the banner title to be expected
  • Assert if the hamburger menus when clicked gets navigated to their appropriate pages
describe('The Home page', () => {
    it('Assert the page loads successfully with correct title', function () {
        cy.title().should('be.equal', 'Education Advances | Hobsons');
    });

    it('Check the page scroll to correct position at specific viewport', () => {
        cy.viewport(1366, 768);

        cy.get('.home-more').click();

        cy.get('.learn-more-wrapper')
            .scrollIntoView()
            .should('be.visible');

        cy.window().then(($window) => {
            expect($window.scrollY).to.be.closeTo(700, 100);
        });

    });
)}

events_page_spec.js

  • Make sure the events with the future date are asserted
describe('Checking the Events', () => {
    beforeEach(() => {
        cy.visit('/resources/events');
        cy.get('.res-events').as('eventList');
    })

    it('Make sure the events with the future date are asserted', () => {
        cy.get('@eventList')
        .each(($ele, i) => {
            const eventTitle = Cypress.$($ele).find('.txt > h4 > a').text();
            const texts = $ele.map((i, el) => {
                return getNewDate(Cypress.$(el).find('.txt > p > small').text())
            })
            if (texts[0].maxDate.trim() !== '') {
                try {
                    expect(new Date(texts[0].maxDate), i + '- ' + eventTitle).to.be.greaterThan(currDate); 
                } catch (error) {
                    eventStatus = false;                             
                    cy.log(error.message);
                }
            } else {
                cy.log(i + ' - ' + eventTitle + ' - event date doesn\'t match with the formatted date')
            }     
        })
        .then(() => {
            expect(eventStatus).to.be.equal(true);
        })
    })
)}

Built With

qa-with-cypress's People

Contributors

kaviarasurajamanickam avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.