https://cypress.io logo
Join Discord
Powered by
# help
  • i

    icy-alarm-88737

    11/03/2022, 1:34 AM
    gotcha, i think i'll look into doing that
  • i

    icy-alarm-88737

    11/03/2022, 1:34 AM
    im wondering if the selector is applied after the text search, purely as a way of traversing back up the hierarchy after finding the first element with the containing text
  • a

    adorable-smartphone-87280

    11/03/2022, 1:34 AM
    Very possible.
  • a

    adorable-smartphone-87280

    11/03/2022, 1:35 AM
    Even though it's listed first, it might be interpreted as an options modifier and since the string match has already happened on the wrong element, it might cause the whole thing to fail.
  • i

    icy-alarm-88737

    11/03/2022, 1:36 AM
    the docs say "Specify a selector to filter DOM elements containing the text. Cypress will ignore its default preference order for the specified selector. Using a selector allows you to return more shallow elements (higher in the tree) that contain the specific text." but its not as clear as I would like
  • a

    adorable-smartphone-87280

    11/03/2022, 1:36 AM
    Seems to me that
    cy.contains
    with a selector included should be interpreted as a
    cy.get().contains()
    chain under the hood.
  • i

    icy-alarm-88737

    11/03/2022, 1:37 AM
    i'll check if a
    cy.get().contains()
    chain works as expected tomorrow and post a github issue accordingly
  • i

    icy-alarm-88737

    11/03/2022, 1:38 AM
    at the very least i hope the docs can be improved here
  • i

    icy-alarm-88737

    11/03/2022, 1:38 AM
    thx for the discussion
  • a

    adorable-smartphone-87280

    11/03/2022, 1:38 AM
    Agreed
  • a

    adorable-smartphone-87280

    11/03/2022, 1:38 AM
    Yeah good bug hunt.
  • g

    gentle-dress-1046

    11/03/2022, 7:55 AM
    Hey Im forced to use
    cy.get(selector).find(selector)
    to get elements, now sometimes I executes some assertions such as
    cy.get(selector).find(selector).should("have.length, 0")
    or
    .should("not.exists")
    but its like
    .find
    does not act like
    .get
    in terms of what it yields, which causes code like this
    cy.get(selector).find(selector).should("have.length, 0")
    to fail because he couldn't find any element
  • e

    eager-breakfast-44562

    11/03/2022, 8:37 AM
    Hello I'm new to the cypress and I'm trying to write some basic tests for my Hangman js/html/css project. The goal I'm trying to achive is to run getWord() function and work with the word (press buttons that contain Letters in word and win the game). Unfortunately As I try command var name = getWord() I got an error saying getWord is not defined. I tried to include ./Hangman.js file (whole logic is here including specific function) but was unsuccessful. Can anyone help me please? Thank a lot
  • g

    gentle-dress-1046

    11/03/2022, 9:20 AM
    Can you add the code? you are probably importing it wrong
  • e

    eager-breakfast-44562

    11/03/2022, 9:28 AM
    Sure, this is code for test
  • e

    eager-breakfast-44562

    11/03/2022, 9:28 AM
    And this is code for Hangman.js
  • g

    gentle-dress-1046

    11/03/2022, 9:45 AM
    are you trying to do unit tests or e2e tests?
  • g

    gentle-dress-1046

    11/03/2022, 9:45 AM
    because its looks like you mixing it up, I mean is that you are calling inner function in the application but using the
    cy.visit
    command
  • g

    gentle-dress-1046

    11/03/2022, 9:47 AM
    Look at this example of unit testing in cypress: https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/unit-testing__application-code/cypress/e2e/unit_test_application_code_spec.cy.js
  • g

    gentle-dress-1046

    11/03/2022, 9:51 AM
    but simply you get getWord is not defined because you dont not export your fucntions, you should use
    mouse.exports
  • e

    eager-breakfast-44562

    11/03/2022, 9:56 AM
    Thank you, I will check the link you provided. Regarding to mouse.exports where exactly should I use this command?
  • g

    gentle-dress-1046

    11/03/2022, 10:21 AM
    yeah sorry, meant
    module.exports
    you can add code like this in the file:
    Copy code
    module.exports = {
      getWord
    }
    also you are not importing correctly, you should use
    import {getWord} from "/Hangman"
  • g

    gentle-dress-1046

    11/03/2022, 10:22 AM
    but you should decide if you want to e2e or unit test
  • c

    creamy-fish-66612

    11/03/2022, 11:19 AM
    how to upload a file when input type is button using cypress file-upload?
  • c

    creamy-fish-66612

    11/03/2022, 11:21 AM
    i have written code like this..const yourFixturePath = 'table.jpg' cy.get('input[name="btn1"]').attachFile(yourFixturePath)
  • p

    powerful-receptionist-26165

    11/03/2022, 12:17 PM
    Hello, my organisation uses enterprise SSO credentials, and i am trying to spin up a prometheus exporter, but it is not allowing me to login. how do i go about getting a basic auth credentials for an enterprise sso org?
  • p

    powerful-receptionist-26165

    11/03/2022, 12:18 PM
    https://github.com/rguilmont/cypress-dashboard-exporter
  • f

    flaky-tailor-940

    11/03/2022, 1:24 PM
    Does anyone know how to change the test timezone?
  • e

    elegant-pencil-72411

    11/03/2022, 1:27 PM
    Has anyone faced` identity provider error` working with auth0 before?
  • a

    agreeable-doctor-59104

    11/03/2022, 2:29 PM
    Hello All, how we can configure baseurl for multiple environments like dev, staging,prod in cypress.config.js and how to call them as per environment in cypress 10.11.0. As from v10+ .json is deprecated. Any guidance will be helpful.
1...193194195...252Latest