3

I have configured my cypress test in the GitLab CI/CD pipeline, However, in my local environment, it runs perfectly with no errors, however, when the pipeline job runs, only 2 specs are successful and the rest are in errors.

Cypress version: 7.7.0

Chrome version: 97

Running mode: headless

Here are the parameters of my file

dev_e2e_test:
  image: cypress/browsers:node16.5.0-chrome97-ff96
  stage: test-e2e
  when: always
  script:
    - echo "Starting cypress test"
    - cd client/cypress-automation/cypress
    - npm install cypress
    - npm run testEndToEnd
    paths:
      - node_modules/
    expire_in: 1 day

I don't know if anyone has ever seen this error? thank you for your help

Hasip Timurtas
  • 983
  • 2
  • 11
  • 20
  • What is the error you are getting ? – Alapan Das Feb 03 '22 at 06:36
  • something like timeout, sometime without logs just it fails Here is the one: `AssertionError: Timed out retrying after 4000ms: Expected to find element: /html/body/div[1]/div[2]/main/div/div/div/div/div[1]/div/div/div/div[3]/div[2]/div[2]/div/button/div`, but never found it.` I use cypress-xpath to locate some elements. – TOVONIAINA ARISTIDE Feb 03 '22 at 06:51
  • @AlapanDas but these erros doesn't occured on locally run – TOVONIAINA ARISTIDE Feb 03 '22 at 06:56
  • Ok. On your local, tests run faster than in a CI environment because of the availability of resources, so as a ground-rule always add extra timeouts in places where you think the tests might break. So from your error, it seems that in one of your tests cypress is not able to find a locator. FIrst find the line of code that's causing the issue and then add extra timeouts and try again – Alapan Das Feb 03 '22 at 07:04
  • @AlapanDas I have already increased the timout almost 4 times but nothing has changed, also, I have increased some cy.wait() almost 5 times but still without success, I think there is another problem behind it. – TOVONIAINA ARISTIDE Feb 03 '22 at 08:43
  • configure you CI to emit screenshots upon failure. You can use those to determine what it was the CI was 'seeing' when it failed the tests. It is almost certainly speed as noted. – Paul Collingwood May 09 '22 at 15:22

0 Answers0