我正在尝试运行 cypress 脚本,该脚本正在登录用户,现在登录后,应用程序从一个 URL 导航到另一个 URL,而 URL 已成功导航,但测试运行器一直处于“新 URL”状态。
我正在使用以下代码:
describe('Login', function(){
it('Login Successfully', function(){
const urlRedirects = [];
cy.visit('https://vep-staging.auth.us-east-1.amazoncognito.com/login?client_id=2bu8f0pfkqaasa8jjatgd8d40g&redirect_uri=https%3A%2F%2Fapp.staging.showcare.io%2Fproduct-showcase&response_type=code&scope=openid&state=254805b5dfbc4f68acbdb28add5536a4&code_challenge=NvfTn44X98LyNBBCJoAdDPHADnHLbiuy0gj2Xcg6Mow&code_challenge_method=S256&response_mode=query')
cy.get('.modal-dialog')
cy.get('#signInFormUsername', { timeout: 10000 }).eq(0).type('email_address', { force: true })
cy.get('#signInFormPassword').eq(0).type('password', { force: true })
cy.get('[name="signInSubmitButton"]').eq(0).click({ force: true }).wait(1000)
.then(() => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/product-showcase')
}).wait(4000)
cy.reload();
cy.get('a').eq(0).trigger('mouseover').click({ force: true })
})
})
})