【发布时间】:2020-08-18 18:25:39
【问题描述】:
我正在尝试使用 cypress 运行测试,第一次运行测试时,它会转到指定的 URL,即http://demo.nopcommerce.com/, 但我第二次运行测试时,我被重定向到https://demo.nopcommerce.com/page-not-found#/tests/integration\examples\Locators.spec.js
这是我的脚本:
describe('Locating Elements', function() {
it('Verify Types of locators', function() {
cy.visit('http://demo.nopcommerce.com/')
cy.get('#small-searchterms').type('Apple MacBook Pro 13-inch')
cy.get('.button-1.search-box-button[value="Search"]').click()
cy.get('.button-2.product-box-add-to-cart-button[value="Add to cart"]').click()
cy.get('#product_enteredQuantity_4').clear().type('3')
cy.get('input[type="button"][id="add-to-cart-button-4"]').click()
cy.contains('The product has been added to your').should('be.visible')
cy.get('.close').click()
cy.contains('Shopping cart').click()
cy.get('.estimate-shipping-button').click()
cy.get('.estimate-shipping-popup').then(function() {
cy.log('Hello.......')
cy.get('#CountryId').select('India')
})
})
})
【问题讨论】:
标签: cypress