question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress check_anchor_links.js misses issues in FAQ

See original GitHub issue

Where to find the issue

cypress/integration/check_anchor_links.js

Describe the issue

The Cypress test cypress/integration/check_anchor_links.js does not find anchor link issues in the new FAQ structure under https://www.coronawarn.app/en/faq/results/ and https://www.coronawarn.app/de/faq/results/

Steps to reproduce

Manually introduce a bad anchor link into /src/data/faq.json.

npm run test:open Select check_anchor_links.js Note that the bad anchor link is not found

Suggested change

Add the directories:

  • /en/faq/results/ and
  • /de/faq/results/

to

cypress/integration/check_anchor_links.js

This is however not sufficient as then the test fails with a syntax error:

  1) Check for broken anchor links
       "/de/faq/results/" - Check for broken anchor links:
     Error: Syntax error, unrecognized expression: #

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
MikeMcC399commented, Apr 4, 2022

Alternative confirmation as follows:

npx cypress run -s cypress/integration/check_anchor_links.js -c baseUrl=https://coronawarn.app

This command runs check_anchor_links.js on the production website https://coronawarn.app in headless mode using the default Electron browser.

$ npx cypress run -s cypress/integration/check_anchor_links.js -c baseUrl=https://coronawarn.app


====================================================================================================

  (Run Starting)

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Cypress:    7.7.0                                                                              β”‚
  β”‚ Browser:    Electron 89 (headless)                                                             β”‚
  β”‚ Specs:      1 found (check_anchor_links.js)                                                    β”‚
  β”‚ Searched:   cypress\integration\check_anchor_links.js                                          β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


────────────────────────────────────────────────────────────────────────────────────────────────────

  Running:  check_anchor_links.js                                                           (1 of 1)
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating


  Check for broken anchor links
    √ Check if txt results exist
    √ "/de" - Check for broken anchor links (4683ms)
    √ "/en" - Check for broken anchor links (2385ms)
    √ "/de/eventregistration/" - Check for broken anchor links (1747ms)
    √ "/en/eventregistration/" - Check for broken anchor links (1770ms)
    √ "/de/community/" - Check for broken anchor links (1085ms)
    √ "/en/community/" - Check for broken anchor links (1386ms)
    √ "/de/analysis/" - Check for broken anchor links (2713ms)
    √ "/en/analysis/" - Check for broken anchor links (1826ms)
    √ "/de/blog/archiv/" - Check for broken anchor links (1961ms)
    √ "/en/blog/archive/" - Check for broken anchor links (1423ms)
    √ "/de/screenshots/" - Check for broken anchor links (1562ms)
    √ "/en/screenshots/" - Check for broken anchor links (2237ms)
    √ "/de/faq/" - Check for broken anchor links (1715ms)
    √ "/de/faq/results/" - Check for broken anchor links (3021ms)
    √ "/en/faq/" - Check for broken anchor links (799ms)
    √ "/en/faq/results/" - Check for broken anchor links (3605ms)
    √ "/de/rat-partner/" - Check for broken anchor links (1924ms)
    √ "/en/rat-partner/" - Check for broken anchor links (1281ms)
    √ "/de/privacy/" - Check for broken anchor links (831ms)
    √ "/en/privacy/" - Check for broken anchor links (931ms)
    √ "/de/terms-of-use/" - Check for broken anchor links (1072ms)
    √ "/en/terms-of-use/" - Check for broken anchor links (1367ms)
    √ "/de/event-qr-code-guide/" - Check for broken anchor links (2874ms)
    √ "/en/event-qr-code-guide/" - Check for broken anchor links (2011ms)
    √ "/de/blog/" - Check for broken anchor links (1389ms)
    √ "/en/blog/" - Check for broken anchor links (1697ms)
    √ "/de/science/" - Check for broken anchor links (1054ms)
    √ "/en/science/" - Check for broken anchor links (1101ms)
    √ "/de/simple-language/" - Check for broken anchor links (4813ms)
    √ "/en/simple-language/" - Check for broken anchor links (1016ms)
    √ "/de/sign-language/" - Check for broken anchor links (1710ms)
    √ "/en/sign-language/" - Check for broken anchor links (2467ms)

  Check for broken anchor links on entries
    √ "/de/blog/" entries - Check for broken links (3517ms)
    √ "/en/blog/" entries - Check for broken links (2101ms)
    √ "/de/science/" entries - Check for broken links (967ms)
    √ "/en/science/" entries - Check for broken links (786ms)


  37 passing (1m)


  (Results)

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Tests:        37                                                                               β”‚
  β”‚ Passing:      37                                                                               β”‚
  β”‚ Failing:      0                                                                                β”‚
  β”‚ Pending:      0                                                                                β”‚
  β”‚ Skipped:      0                                                                                β”‚
  β”‚ Screenshots:  0                                                                                β”‚
  β”‚ Video:        false                                                                            β”‚
  β”‚ Duration:     1 minute, 9 seconds                                                              β”‚
  β”‚ Spec Ran:     check_anchor_links.js                                                            β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


====================================================================================================

  (Run Finished)


       Spec                                              Tests  Passing  Failing  Pending  Skipped
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ √  check_anchor_links.js                    01:09       37       37        -        -        - β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    √  All specs passed!                        01:09       37       37        -        -        -
1reaction
MikeMcC399commented, Apr 4, 2022

Thanks to @ahodzic2 for investigating the Cypress test cypress/integration/check_anchor_links.js, adding the directories /en/faq/results and /de/faq/results and resolving the syntax issue arising! πŸ‘πŸ»

The steps npm run test:open Select check_anchor_links.js

cause the test to run to completion. Bad links in

  • /en/faq/results and
  • /de/faq/results are now identified.

Therefore this issue is now resolved.

See also:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing The Anchor Links - Cypress
The anchor link leads nowhere. Of course, Guillermo quickly fixed the missing element IDs. Yet even then, he missed one of the problems...
Read more >
Testing links with Cypress - Filip Hric
Let's say you want to test all the links in a navigation bar, ideally in most effective way. In this article I show...
Read more >
Check if element has href if it does it shouldn't be empty ...
Just to illustrate the readability of Cypress chained commands. Remove the noise, just use chaining cy.get('Selector for the anchor tag')Β ...
Read more >
Clicking anchor link to download file causes page load timeout
Clicking on a button downloads the file, but after downloading the file, the cypress waiting for page load which is not the expected...
Read more >
Cypress Tips and Tricks - Gleb Bahmutov
Using a single cypress/integration/spec.js file to test a large web application quickly becomes difficult and time consuming. We have separatedΒ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found