Skip to content

kenchandev/cypress-bug-reduced-test-case

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cypress Bug - Reduced Test Case

Issue Link: cypress-io/cypress#6193

The following repository is a reduced test case for a bug in the Cypress testing tool. If a webpage with zero JavaScript present contains a DOM element with the id attribute set to jquery (for example, <p id="jquery">jQuery</p>), then the error TypeError: item.first is not a function is thrown.

(dist/index.html)

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Reduced Test Case</title>
</head>
<body>
  <h1>Homepage</h1>
  <p id="jquery">jQuery</p>
</body>
</html>

(cypress/e2e/homepage.js)

describe("homepage", () => {
  beforeEach(() => {
    cy.visit("/");
  });

  it("should find the jQuery text", () => {
    cy.findByText("jQuery").should("exist");
  });
});

To reproduce the bug:

  1. Download this repository.
  2. Run npm install && npm run test:e2e.
  3. Execute the test file homepage.js in Cypress Test Runner.

Close out the test runner via ctrl + c. Remove the id attribute from the element <p id="jquery">jQuery</p> from dist/index.html. Re-run npm run test:e2e and re-execute the same test file as before.

About

A very small test case for reproducing a Cypress bug.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published