https://cypress.io logo
Join Discord
Powered by
# general-chat
  • l

    late-planet-4481

    06/27/2022, 7:28 PM
    So in that case
    cy.wrap()
    would not be necessary. Delete it and try it!
  • l

    late-planet-4481

    06/27/2022, 7:29 PM
    Oh wait
  • l

    late-planet-4481

    06/27/2022, 7:29 PM
    Ohhh, haha, I'm sorry. The reason
    cy.wrap()
    is used here is to provide a yield to
    .click()
    . My bad, I didn't read closely.
  • s

    silly-journalist-41771

    06/27/2022, 7:30 PM
    errr so without the cy.wrap(subject) I have no yield
  • s

    silly-journalist-41771

    06/27/2022, 7:30 PM
    to chain .click()?
  • l

    late-planet-4481

    06/27/2022, 7:31 PM
    Correct!
  • s

    silly-journalist-41771

    06/27/2022, 7:31 PM
    I don't understand the point of the first argument
  • s

    silly-journalist-41771

    06/27/2022, 7:31 PM
    subject
  • s

    silly-journalist-41771

    06/27/2022, 7:31 PM
    what is subject doing
  • s

    silly-journalist-41771

    06/27/2022, 7:31 PM
    is it some sort of shell
  • s

    silly-journalist-41771

    06/27/2022, 7:31 PM
    to work with
  • l

    late-planet-4481

    06/27/2022, 7:31 PM
    subject
    is the page element you're clicking on.
  • s

    silly-journalist-41771

    06/27/2022, 7:32 PM
    its the cy.get(locator)?
  • s

    silly-journalist-41771

    06/27/2022, 7:32 PM
    it's using that?
  • l

    late-planet-4481

    06/27/2022, 7:32 PM
    Frankly, the whole command is a bit unnecessary if you ask me 🙂
  • s

    silly-journalist-41771

    06/27/2022, 7:32 PM
    I want to use it in multiple places that's why
  • s

    silly-journalist-41771

    06/27/2022, 7:32 PM
    it's a .click and .wait in one
  • s

    silly-journalist-41771

    06/27/2022, 7:32 PM
    instead of having to chain on both
  • l

    late-planet-4481

    06/27/2022, 7:32 PM
    Just write two lines instead of one. Not much difference.
    Copy code
    cy.get('myElement').click()
    cy.wait(1234)
  • s

    silly-journalist-41771

    06/27/2022, 7:32 PM
    I have it as one
  • s

    silly-journalist-41771

    06/27/2022, 7:33 PM
    yeah but that's 2 methods
  • l

    late-planet-4481

    06/27/2022, 7:33 PM
    So? 🙂
  • s

    silly-journalist-41771

    06/27/2022, 7:33 PM
    I wanted to join both methods click and wait
  • s

    silly-journalist-41771

    06/27/2022, 7:33 PM
    into one
  • s

    silly-journalist-41771

    06/27/2022, 7:33 PM
    to re use
  • l

    late-planet-4481

    06/27/2022, 7:34 PM
    Then the
    clickAndWait
    command you have does the job.
  • s

    silly-journalist-41771

    06/27/2022, 7:34 PM
    yeah :p
  • s

    silly-journalist-41771

    06/27/2022, 7:34 PM
    and it was just practice
  • s

    silly-journalist-41771

    06/27/2022, 7:34 PM
    to start using commands class
  • s

    silly-journalist-41771

    06/27/2022, 7:34 PM
    I don't really have many commands
1...596061...127Latest