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

    gray-kilobyte-89541

    12/19/2022, 1:00 AM
    https://glebbahmutov.com/blog/cypress-mailosaur/
  • m

    most-secretary-62975

    12/19/2022, 1:07 AM
    @gray-kilobyte-89541 thank you. Will take a look.
  • g

    green-fish-63208

    12/19/2022, 2:50 PM
    is it allowed to have multiple describe in one spec/test file? Thank you
  • f

    fresh-doctor-14925

    12/19/2022, 2:52 PM
    I'd suggest using
    context()
    within your describe block instead
  • g

    green-fish-63208

    12/19/2022, 2:57 PM
    how? please provide link. Thanks
  • f

    fresh-doctor-14925

    12/19/2022, 3:00 PM
    Easily found in the cypress documentation
  • g

    gray-kilobyte-89541

    12/19/2022, 3:47 PM
    search the docs for "organize tests"
  • g

    green-fish-63208

    12/19/2022, 3:59 PM
    yes, I already saw it. Thanks for your help
  • c

    cold-cat-63632

    12/19/2022, 4:17 PM
    hi everyone .. i need a small help .. how can i access value of this element? <td _ngcontent-sla-a115 class="text-center ng-star-inserted" data-field="{ { "column": "RULE_33", "id": 123, "value": true, "label": "test label" }
  • c

    cold-cat-63632

    12/19/2022, 4:17 PM
    i am trying to check if the value = true
  • f

    fresh-doctor-14925

    12/19/2022, 4:18 PM
    .invoke('val')
    or
    .its('value')
    one of those should work
  • c

    cold-cat-63632

    12/19/2022, 4:18 PM
    thanks @fresh-doctor-14925 .. let me try that
  • f

    fresh-doctor-14925

    12/19/2022, 4:20 PM
    You could also just do
    .should('have.value', true)
    That's the cleanest way imo
  • c

    cold-cat-63632

    12/19/2022, 4:22 PM
    thank you very much @fresh-doctor-14925 I tried .invoke('value') .should('be.true) but i am getting this error .. Timed out retrying after 30000ms: cy.invoke() errored because the property: value does not exist on your subject.
  • f

    fresh-doctor-14925

    12/19/2022, 4:22 PM
    I edited that response and offered some other suggestions
  • c

    cold-cat-63632

    12/19/2022, 4:23 PM
    ok let me try the .its('value')
  • c

    cold-cat-63632

    12/19/2022, 4:24 PM
    with .its('value) .. its.value assertexpected undefined to be true
  • c

    cold-cat-63632

    12/19/2022, 4:25 PM
    for some reason, it is not working with the above 3 solutions
  • f

    fresh-doctor-14925

    12/19/2022, 4:25 PM
    It sounds to me like you're not getting the element correctly, especially if
    .should('have.value', true)
    isn't working
  • c

    cold-cat-63632

    12/19/2022, 4:28 PM
    there are more than 100 td elements .. i am reaching target td with cy.get and then .eq(123) .. in the test runner if i hover mouse over the .eq(123) .. i see it is highlighting the correct td
  • c

    cold-cat-63632

    12/19/2022, 4:30 PM
    also, the code i pasted above is at .eq(123) level .. it is not nested in some child element
  • f

    fresh-doctor-14925

    12/19/2022, 4:31 PM
    what happens if you do
    Copy code
    .eq(123)
    .its('data-field')
    Looking again at your code, I think you need to get the contents of that attribute, and then do an assertion on the object
  • c

    cold-cat-63632

    12/19/2022, 4:34 PM
    sorry Liam .. what do you mean by get the contents of that attribute?
  • c

    cold-cat-63632

    12/19/2022, 4:36 PM
    Timed out retrying after 30000ms: cy.its() errored because the property: column does not exist on your subject. cy.its() waited for the specified property column to exist, but it never did.
  • c

    cold-cat-63632

    12/19/2022, 4:36 PM
    i tried with .its('column')
  • f

    fresh-doctor-14925

    12/19/2022, 6:35 PM
    Like with
    class
    ,
    data-field
    is something that you should be able to access with
    its()
  • t

    thankful-wire-37848

    12/19/2022, 7:19 PM
    The data-field attribute holds a json string. I guess he should do something like
    cy.get(...).its('data-field').then(field => JSON.parse(field).value).should('be.true')
    . Not sure though if
    .its('data-field')
    will work though as that is not a DOM property of input.
  • f

    fresh-doctor-14925

    12/19/2022, 7:31 PM
    It might also be possible to do a
    .should('deep.include', { 'value': true })
    Instead of the JSON parsing
  • t

    thankful-wire-37848

    12/19/2022, 7:34 PM
    .its('dataset.field')
    might work btw
  • g

    gray-kilobyte-89541

    12/19/2022, 8:27 PM
    can you open DevTools and paste exactly what the element's HTML is? Or a screenshot. Like it has a
    data-field
    attribute with stringified JSON object?
1...233234235...252Latest