lundi 4 janvier 2021

Can anyone here can help me with cypress? Please find the code below

My last line of code is not executed and instead of that, the first line of code (that was visiting the page) is executed again, after which cypress tries to execute the remaining code which would automatically throw an error. The last line of code is for selecting the mode of payment instead of which the page is redirected to the home page.

describe('Damensch', () => {
  it('Landing page', () => {

    cy.visit("https://dev1.damensch.com/")

  })
  it('Adding product to cart', () => {

    cy.xpath('//*[@id="menu-item-3531"]/a').click({ force: true })


    cy.xpath("(//span [@title='Limited Edition Box'])[2]").click()
    cy.xpath('//*[@id="bg-swatch-color"]/div[2]/div[3]/form/div[3]/div/div[2]/div[2]/div[2]/span[1]').click()


    cy.get(".qty-plus-btn").click()
    cy.contains('Add to cart').click()
    cy.xpath('//*[@id="primary-navigation"]/div/div/div/div/div[6]/ul/li/div/div/div[15]/p/a').click()  })

  it('Client details', () => {
    cy.get("#shipping_email").type("test11@gmail.com")
    cy.get("#shipping_phone").type("9087927738")
    cy.get("#shipping_name").type("Test Order")
    cy.get("#shipping_postcode").type("160022")
    cy.get("#shipping_address").type("221B Baker Street")
    cy.wait(3000)
    
    cy.get("#save-shipping-add").click() //after this line the browser is redirected to the homepage

    
  })
})

Aucun commentaire:

Enregistrer un commentaire