Skip to content

Commit

Permalink
Fix commands tests
Browse files Browse the repository at this point in the history
  • Loading branch information
11joselu committed Nov 28, 2024
1 parent 9c09dc3 commit afa59e1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Cypress.Commands.add('isInViewport', (selector) => {
const yOffset = cy.$$('#js-header').outerHeight();
const y = cy.$$(selector).offset().top - yOffset;
cy.window().its('scrollY').should('be.greaterThan', 0);
cy.window().its('scrollY').should('equal', Math.round(y));
cy.window().its('scrollY').should('be.eq', Math.round(y));
});

/**
Expand All @@ -21,7 +21,7 @@ Cypress.Commands.add('isInViewport', (selector) => {
*/
Cypress.Commands.add('validateServiceListInDropdown', () => {
cy.get('#js-menu .navbar__item.dropdown').click();
cy.get('.dropdown .options li').should('have.length', 7);
cy.get('.dropdown .options li').should('have.length', 8);

cy.get('.dropdown .options li a').each((service, index) => {
// Follow same order of web menu
Expand All @@ -35,14 +35,20 @@ Cypress.Commands.add('validateServiceListInDropdown', () => {
title: 'Curso Quality Assurance',
url: '/curso-quality-assurance.html',
},
{
title: 'Taller de Front-end online',
url: 'https://online-trainings.codium.team/',
},
{
title: 'Programa de aceleración',
url: '/programa-de-aceleracion.html',
},
];
const menuItem = serviceList[index];
cy.wrap(service).should('contain', menuItem.title);
cy.wrap(service).should('have.attr', 'href').should('eq', menuItem.url);
cy.wrap(service)
.should('have.attr', 'href')
.should('contain', menuItem.url);
});
});

Expand Down

0 comments on commit afa59e1

Please sign in to comment.