Created
March 10, 2021 03:16
-
-
Save samlucax/37e4f69ed26a4ac42fa37db4674f222f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Cypress version: 6.5.0 | |
context('Diego', () => { | |
beforeEach(() => { | |
// rota para os endpoints que trazem cada post | |
cy.intercept({ | |
method: 'GET', | |
path: '/_next/data/**' | |
}).as('data') | |
// rota para o último script de ads que é executado ao acessar | |
cy.intercept({ | |
method: 'GET', | |
url: 'https://pagead2.googlesyndication.com/bg/*' | |
}).as('google') | |
cy.visit('https://eresmama.com/'); | |
cy.get('#didomi-notice-agree-button').click() | |
cy.wait('@data').its('response.statusCode').should('eq', 200) | |
// eventualmente essa request demora mais para ser disparada, devido ao número de requests que ocorrem antes | |
cy.wait('@google', { requestTimeout: 15000 }).its('response.statusCode').should('eq', 200) | |
}); | |
it('Teste', () => { | |
// trazendo a área que está abaixo deste elemento para a área visível, | |
// o que garante que o elemento estará em uma área disponível para o clique | |
cy | |
.contains('También te recomendamos') | |
.scrollIntoView() | |
// desabilitando a espera pelas animações & | |
// forçando o clique | |
cy.get('.loading-more button') | |
.click({ | |
waitForAnimations: false, | |
force: true | |
}) | |
cy.wait('@data').its('response.statusCode').should('eq', 200) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment