CodeceptJS behaving differently in the CI compared to local environment #3643
-
I opened this as an issue before but saw that there is a discussion section and thought this might be better suited here. Contents: What are you trying to achieve?Running tests in the pipeline to give the same results as the local environment. What do you get instead?So for many tests we've needed to disable them in the CI as the test is unable to find the xpath with the value when trying to see the data on screen.
I.waitForElement(`//div[@data-qa='delivery-costs-indicator']//div[contains(text(),'Free')]`);
I.seeElement(`//div[@data-qa='delivery-costs-indicator']//div[contains(text(),'Free')]`); For this sample above, the wait for element passes correctly, but it's not able to see the same element it just waited for. The allure report mentions it's undefined. It's also inconsistent. It might pass in one test and then fail in another. Checking the screenshot, the element is clearly present and it always passes in the local environment. Example from another test The content it was looking for was present in the screenshot Details
We recently also updated the docker image running in our CI and since then the problems have started.
Debugging1I've also tried replacing
with
But the results were the same, so I don't think it's the difference in how the environment is mounted. 2I see that between the upgrades that the assertions that were taking about 155ms to validate is immediately failing 4ms in. waitForAction is currently set to 1500, and waitForTimeout is 10000. But these 2 don't seem to have an impact on what's happening here. I tried to look into assertion timeouts but couldn't find anything in the documentation. Am I missing something? 3Another example of passing locally, but failing in the CI In this example puppeteer gave a different error: Execution context was destroyed, most likely because of a navigation. But the icon was still clearly visible in the screenshot |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
What's the error in console? Did you try waitForVisible()? |
Beta Was this translation helpful? Give feedback.
-
Error in console is mostly just a failed assertion. cannot find the element yet. From what I can tell though it's due to the assertions happening much faster than they were before the update. The allure report under 2 shows the difference in the assertion being able to pass after 155ms, while the failure happens in 4ms. Adding a wait and then finding the element seems to be more stable, but there are 100s of tests with different assertions that now need new waits added that weren't needed before. |
Beta Was this translation helpful? Give feedback.
Found something else that helped
https://codecept.io/plugins/#steptimeout
We didn't have this configured before, and it's working like the older version after configuring it.