Forum Discussion

karmaTrinlema's avatar
karmaTrinlema
Occasional Contributor
4 years ago

failing cucumber test: not detecting flash message

I have a surprisingly simple cucumber scenario for a rails 4 app that isn't passing.  I am checking that a flash message got set, and this test fails when I run cucumber.  However, it is all correct, set, appearing, etc. when I run it live.  I could really use some insight about what might be happening.

THANKS!

  • karmaTrinlema's avatar
    karmaTrinlema
    4 years ago

    What I found out is that I have to check the flash message first because it is ephemeral.  I was checking which page I was on first.  I re-ran the test with put page.body and saw that when I swapped the order of the tests, I could see the flash message. 

     

    Thank you for your help.

  • Do you have the possibility to take a screenshot when the test is failing?

    Do you have the possibility to execute your test not in headless mode, to freeze it, and to check the DOM?

    • karmaTrinlema's avatar
      karmaTrinlema
      Occasional Contributor

      What I found out is that I have to check the flash message first because it is ephemeral.  I was checking which page I was on first.  I re-ran the test with put page.body and saw that when I swapped the order of the tests, I could see the flash message. 

       

      Thank you for your help.