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

    fresh-doctor-14925

    11/08/2022, 10:40 AM
    Yeah, I'm pretty sure this is something you would configure on the bash side
  • f

    fresh-doctor-14925

    11/08/2022, 10:44 AM
    You could have a counter variable which is incremented if a test fails, then pass this along with your
    exit
    statement at the end https://linuxhint.com/bash-exit-code-of-last-command/
  • m

    mysterious-belgium-25713

    11/08/2022, 10:46 AM
    Yeah i think he is mixing up 2 status messages. 1. Cypress having failed test 2. reporter giving status 0. The reporter should give status 0 because that means it executed correctly and was able to create your html report. I would just have a watcher or bash script that will check if cypress has fails to give an error. But i would not alter the reporters exit code.
  • f

    fresh-doctor-14925

    11/08/2022, 10:59 AM
    Yeah, to be honest it was very confusing when we'd have failing test jobs giving different exit codes. I'd also advise against
  • c

    clean-intern-72668

    11/08/2022, 11:14 AM
    Thanks for the response. I have configured jenkins job for the same and it is giving me success even if test cases are failing. if [ $? > 0 ] then exit 1 else exit 0 fi I have added this to shell script. How can I fail jenkins job if tests are failing.
  • f

    fresh-doctor-14925

    11/08/2022, 11:25 AM
    My hunch is that it's always hitting the
    else
    . What happens if you flip the logic?
    Copy code
    if [ $? == 0 ]
    then
        exit 0
    else
        exit 1
    fi
  • c

    clean-intern-72668

    11/08/2022, 12:18 PM
    It is the same. What is the way to fail jenkins job if there are failed cases and we are using mochawesome reporter? My observation is that my last step is generating and merging of reports and as it is getting executed correctly so the $? is always 0. I am able to get the passing/failing test in the report. But jenkins job shows success.
  • f

    future-eye-56254

    11/08/2022, 12:25 PM
    Hello All I am trying to consume messages from a kafka topic. I have a consume.js script which runs perfectly fine and starts consuming messages when I run it separately like "node consume.js" & actually sends the results from the topic to a json file. But the same when I run through cypress and am using cy.exec('node consume.js') it fails with an error. `CypressError:
    cy.exec('node /Users/sn/Documents/Kafka/consume2.js')
    failed because the command exited with a non-zero code. Pass
    {failOnNonZeroExit: false}
    to ignore exit code failures. Information about the failure: Code: 1 Stdout: {"level":"INFO","timestamp":"2022-11-08T12:17:12.850Z","logger":"kafkajs","message":"[Consumer] Starting","groupId":"my-app12"} {"level":"INFO","timestamp":"2022-11-08T12:17:16.253Z","logger":"kafk... Stderr: undefined:1 undefined ^` Not sure whats going wring here. I have the code & the error here in the repo : https://github.com/asn-007/CypressKafka Could some one please take a look and help. Also is executing this through cy.exec the best way ?
  • f

    fresh-doctor-14925

    11/08/2022, 12:34 PM
    Sorry, I can't help you there. I haven't worked with mochawesome. I think this is more a subject for the mochawesome team
  • f

    fresh-doctor-14925

    11/08/2022, 12:42 PM
    For whatever reason, you're getting
    undefined
    returned when you attempt to make the call with Cypress. Clue's in this error:
    SyntaxError: Unexpected token u in JSON at position 0
  • g

    green-boots-72737

    11/08/2022, 1:27 PM
    Can someone please tell me how I can type into
    <div id="foo"><div contenteditable="true"></div></div>
    with Cypress? I would like to know before I loose my mind.
    cy.get('#foo [contenteditable]').type('Test')
    does nothing at all. 😕
  • f

    fresh-doctor-14925

    11/08/2022, 1:46 PM
    What's the error you're seeing? Have you tried
    .type('Test', { force: true })
  • g

    green-boots-72737

    11/08/2022, 1:47 PM
    Theres no error at all. The content of the div simply does not change. I've tried about half a dozen suggested hacks. One of them caused an error regarding the element being covered, so I used force true. The error went away, but the div I was trying to get Cypress to type into was still empty.
  • g

    green-boots-72737

    11/08/2022, 1:48 PM
    Its a SlateJS component if that helps!
  • f

    fresh-doctor-14925

    11/08/2022, 1:50 PM
    > Theres no error at all. If the
    cy.get('#foo [contenteditable]')
    isn't working, the test would fail. What happens when you bring your mouse cursor over this
    get
    event in the left hand bar? Shouldn't matter that it's Slate. That should work in Cypress 5.5 and above
  • g

    green-boots-72737

    11/08/2022, 1:51 PM
    As you say,
    cy.get('#foo [contenteditable]')
    works - there is no error
  • g

    green-boots-72737

    11/08/2022, 1:52 PM
    Hovering over
    get
    in the sidebar just makes that line a darker grey
  • g

    green-boots-72737

    11/08/2022, 1:52 PM
    It highlights an element in the main view a darker blue
  • g

    green-boots-72737

    11/08/2022, 1:53 PM
    Its definitely got no problem getting the element
  • g

    green-boots-72737

    11/08/2022, 1:53 PM
    Its just changing the value that doesn't work, but I really do not know why
  • f

    fresh-doctor-14925

    11/08/2022, 1:53 PM
    Cool. We can rule that out, then 🙂 I wonder if it's something dumb like needing a
    .click()
    beforehand. I'm sure it was something like that when I was testing a Slate input
  • g

    green-boots-72737

    11/08/2022, 1:53 PM
    Hehe tried that
  • g

    green-boots-72737

    11/08/2022, 1:53 PM
    Tried this way also https://stackoverflow.com/questions/61360117/how-to-test-slate-js-behavior-in-cypress
  • g

    green-boots-72737

    11/08/2022, 1:55 PM
    Am heckin bamboozled
  • f

    fresh-doctor-14925

    11/08/2022, 1:55 PM
    Yeah, that was what my googling turned up as well The DOM doesn't change when the item is clicked and in focus, does it? Like, it's not magicking an input element out of the ether?
  • g

    green-boots-72737

    11/08/2022, 1:57 PM
    Hmm, well there is no paint flashes in the DOM in the devtools, so Im pretty sure not
  • g

    green-boots-72737

    11/08/2022, 1:57 PM
    Another strange thing, the standard
    .type()
    works when I'm running Cypress component tests, but not when running Cypress erm..."normal" tests
  • f

    fresh-doctor-14925

    11/08/2022, 1:58 PM
    Wat
  • g

    green-boots-72737

    11/08/2022, 1:58 PM
    Seemed sort of related to this https://github.com/cypress-io/cypress/issues/23699
  • f

    fresh-doctor-14925

    11/08/2022, 1:59 PM
    Interesting! Well, I'm afraid I'm stumped. If you've got a URL or something, I can have a little play around and see if I can come up with a solution. That said, it seems like you've done everything I would try. Sorry!
1...197198199...252Latest