cypress-realworld-testing
cypress-realworld-testing copied to clipboard
Cypress robots test spec fails to run in E2E test
Issue
Cypress test spec cypress/e2e/robots.cy.ts fails to run when following the README > Cypress E2E Tests instructions:
Cypress E2E Tests
Cypress tests can be run via the Cypress test runner and UI with the following command.
yarn cypress:open
The same tests can be run in headless mode, as they would be in CI with the following command.
yarn cypress:run
Note: the test robots.cy.ts only runs on linux. On other operating systems the test content is bypassed. Also on Windows several other tests, which succeed on Ubuntu, fail running under Windows.
Steps to reproduce
Follow instructions from README > Installation instructions then execute:
yarn cypress run -s cypress/e2e/robots.cy.ts
This runs Cypress 10.5.0
Running: robots.cy.ts (1 of 1)
Robots.txt
✓ allows all pages to be crawled (92ms)
✓ allows all user agents (34ms)
1) has the correct Host URL
2) has the correct url for the Sitemap
2 passing (9s)
2 failing
1) Robots.txt
has the correct Host URL:
AssertionError: Timed out retrying after 4000ms: expected '# *\nUser-agent: *\nAllow: /\n\n# Host\nHost: https://learn.cypress.io\n\n# Sitemaps\nSitemap: https://learn.cypress.io/sitemap.xml\n' to include 'Host: undefined'
at Context.eval (http://localhost:3000/__cypress/tests?p=cypress/e2e/robots.cy.ts:109:18)
2) Robots.txt
has the correct url for the Sitemap:
AssertionError: Timed out retrying after 4000ms: expected '# *\nUser-agent: *\nAllow: /\n\n# Host\nHost: https://learn.cypress.io\n\n# Sitemaps\nSitemap: https://learn.cypress.io/sitemap.xml\n' to include 'Sitemap: undefined'
at Context.eval (http://localhost:3000/__cypress/tests?p=cypress/e2e/robots.cy.ts:114:18)
Suggestion
Add instructions to README > Cypress E2E Tests:
To successfully run the Cypress test spec cypress/e2e/robots.cy.ts on
linuxoperating systems, first set the environment variableSITE_URLas follows:
export SITE_URL=https://learn.cypress.io
If desired, I can submit a PR to add the documentation suggestion.
Closed due to no feedback.