Cypress can't run multiple test - cucumber

I have a weird behaviour in cypress lately
When i debug, the issue is that the test starts with this url account.domain.com
as the test goes on, it naturally move to app.domain.com.
All is good for the first test.
The second one uses the same logic, start with account.domain.com ...
While the first one ended the test with the url app.domain.com, it seems that cypress is unable to load account.domain.com in the next test, it doesn't show any error, it just keep loading
Do you have any solution for this please ?
I'm using cucumber by the way

Related

Using AfterEach with different file module in NodeJS getting different values

I'm quite new in using Node JS, and I have been working on a test script that take screenshots whenever a test fails. And I'm trying to do this without the use of Jasmine reporter. I tried to use this approach instead Check if test failed in 'afterEach' of Jest without jasmine, however, I'm working with different files I have a file fail_test.spec.js that is used as my main file, and a test_fail1.js as another testscript file. Here is what happening, my test on fail_test.spec.js works fine with the use of AfterEach, just like in the link, it gives me "true" value if the test passed and "false" value when the test fails and it performs screenshot. The problem is the test_fail1.js is also being check by the AfterEach and it constantly gives of a "false" value even if the test passed. I do intend to use AfterEach with the test_fail1.js and on other tests in the future. So my questions are:
Why does the test_fail1.js only gives of constant "false" value?
Is there any work around with this? Because I just only need to know the status of the test in every testscripts within or with other files (ex.fail_test1.js, fail_test2.js, and so on)

Running Selenium in container brings sudden selenium errors where there were none before

Whenever I run my tests on my computer, they work relatively fine. At the very least, selenium runs without problems.
As soon as I run the same tests on a docker container I start running in all kinds of errors that selenium started throwing, such as: "Element not clickable at point...", "Element is not interactable...", etc.
None of these happen when I run the tests on my computer normally.
I have a Linux Debian 9 computer, docker 1.11, Chrome 72.0, chromedriver 2.41, selenium 3.12. Test are done using py.test and in headless chrome.
My Dockerfile is simple, installing all of the packages for python and putting my tests in there and running them. I run a custom-made Dockerfile and don't have the option to use the premade seleniumHQ ones.
I have first tried running a demo test where I first encountered that problem. I managed to solve it by editing the test code to bypass the exception and trying again. After that succeeded, I tried running a few more complicated tests and kept running into different errors I didn't run into before.
Every solution I found was aimed at solving the thrown exception, but I suspect there's a deeper issue at hand and I can't figure out what it is.
To reiterate: running tests on my computer (both headless and otherwise) works like a charm, but running the same tests in a docker container fails with several selenium errors thrown. For some reason, the tests don't seem to run properly and selenium keeps throwing errors.
I've been trying to solve it for a while now and can't seem to figure out what the problem is.
I'd like to know WHY this problem occurs and how to solve the root cause of it. If it's a known issue and the solution is indeed simply to solve every exception as it comes, I'd like to know that too.
As far as I could find, and how I solved this, is to just follow the exceptions and fix them as they come.
The general problem areas I encountered were the click event on buttons/textbox and clearing the text from a textbox.
The solution involved:
A call to webdriver.execute_script('arguments[0].click();', element) to replace button click events.
A call to webdriver.execute_script('arguments[0].focus();', element) to replace textbox click events.
A call to webdriver.execute_script('arguments[0].value = "";', element) to replace textbox clears.
From where I stand, these solved most if not all the sudden exceptions and the rest worked as intended.
I have encountered similar problems when running Selenium with chromedriver, suddenly elements being unclickable, not visible on the page etc. The solution was to disable /dev/shm usage by adding --disable-dev-shm-usage to the Chrome arguments.

Fail code coverage if no tests exist for code

I have a simple Node JS application and am using Istanbul with Mocha to generate code coverage reports. This is working fine.
If I write a new function, but do not create any tests for it (or even create a test file) is it possible to check for this?
My ultimate goal is for any code which has no tests at all to be picked up by our continuous integration process and for it to fail that build.
Is this possible?
One way you could achieve this is by using code coverage.
"check-coverage": "istanbul check-coverage --root coverage --lines 98 --functions 98 --statements 98 --branches 98"
Just add this in your package.json file, change the threshold if needed. If code is written but no test then the coverage will go down.
I'm not sure if this is the correct way to solve the problem but by running the cover command first and adding the parameter --include-all-sources this then reported on any code without a test file and added them to the coverage.json file it generated.
Then running the check-coverage would fail which is what I'm after. In my CI process I would run cover first, then check-coverage
Personally I find the documentation on Istanbul a little bit confusing/un-clear which is why I didn't see this at first!

How to rerun only failed tests with FitNesse?

I am unable to figure out how to filter out tests based on their run statuses in FitNesse. I'm commenting out all the passed tests manually so that the next run can ignore them. How can I only rerun failed tests?
There is no feature in FitNesse to do this. Usually you want to keep running passed tests to ensure that nothing has caused them to break.

Coded Ui-Data driven tests

I am automating a test scenario which runs on different test inputs.The inputs are passed from a CSV file or MTM. During the test run,the first iteration went through successfully but the 2nd iteration fails for the same flow for which the first has gone through successfully.
Could anyone say the cause for this problem,why is it happening? I thought it would be due to the objects which are set to some value(during the first run) and not initialized to null in the second run.So when the next run happens it fails on some controls saying "Unable to find control" on some objects.But the tool recognized it successfully in the first run.If this is the problem kindly help us on the solution asap.Thanks in advance!!
regards
Amsaveni
You will get this error if your test is running but the controls or app has not yet been loaded. Say Round 1 is finished and round 2 has begun. If you are not starting the app from a same starting point or not waiting for the control, then you will get this exception.
Verify that after each test has completed you app starts in the same state
Verify that you are waiting for your controls
Hand code and debug your test

Resources