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.

Replace Selenium with Cypress in the testable-projects-fcc Repo

See original GitHub issue

Currently the automated test suite in the testable-projects-fcc repo uses Selenium to run tests against each of the projects.

Because it can be difficult to keep Selenium and the web drivers for each browser in sync, we’d like to replace it with Cypress. Cypress now has support for Chrome and Firefox, and would allow us to pin browser versions so we don’t have browser/web driver version issues running the tests locally with yarn test or with GitHub actions.

Right now there seems to be two main parts of the test runner: a Mocha test at /test/projects.js that goes through each project and feeds the local file path to Selenium, and Selenium logic at /test/automate/automate-utils.js .

Right now, Selenium is just used to open each local project in the browser, click the “Run Tests” button, wait for the tests to run, and click on the “Tests” button to see the results. If any of the tests fail, the error messages are taken from the dropdown that appears after the “Tests” button is clicked again and fed back to Mocha to show in the console.

If we use Cypress to test each project, we should be able to replace Selenium, and the Chrome and Gecko web drivers.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ManasMahanandcommented, May 13, 2021

I’ve been looking through the repo, and playing around with stuff to understand how it all works right now. One thing I’m confused about:

Under package.json, “scripts” you have “test” which is what is run when I run yarn test. And that runs “mocha”.

But when I run yarn test, it also runs eslint, and some prettier stuff before it runs mocha. I don’t get why it’s doing that, and also how does mocha know to run projects.js under test?

1reaction
scissorsneedfoodtoocommented, May 12, 2021

Hi @ManasMahanand, thanks for your patience. We’d certainly welcome the help. Feel free to explore the testable-projects-fcc repo and let us know if you have any questions.

@Sembauke, thanks for the additional info. While it would be nice to test the projects on CodePen for extra assurance, we don’t currently do that with Selenium.

All of the code that’s in the example CodePen projects are in the testable-projects-fcc repo and can be run locally. The goal here would just be to replace the Selenium test runner with Cypress instead.

Just to give a bit of context, the testable-projects-fcc repo is used for two things: to develop the CDN loaded test suite for the Responsive Web Design, Front End Libraries, and the D3 projects, and to track the code for all of those example projects.

If there’s a bug in one of those example projects like the Tribute Page, we should update the project in the testable-projects-fcc repo, then once those changes are merged, copy them over to the example CodePen project.

Or if we need to make a change to the CDN loaded test suite, we can run those changes against the example projects in the repo (which should mirror what’s on CodePen), and ensure those changes work against valid projects.

Hope that helps, and sorry if it’s a bit confusing. It all gets a bit messy because we’re discussing testing tests haha.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Selenium vs Cypress: Does Cypress Replace Selenium - DZone
Learn how Cypress compares to Selenium, a better choice in the software testing world, in terms of speed test, architecture, ...
Read more >
Automated End-to-End Testing With Selenium and Cypress.io
Cypress project. Clone the example project from the repo git clone git@github.com:thinkcru/cypress-io-test-project.git ...
Read more >
My experience moving from Selenium to Cypress - Medium
Advantages of Cypress · Automatic retry on finding elements and mostly all actions that do not change the state (like click for example) ......
Read more >
Cypress vs. Selenium: What's Right for You? - Perfecto
Cypress vs. Selenium, which is better? Compare the differences between the Cypress and Selenium test automation frameworks in this blog.
Read more >
Cypress Vs Selenium: How To Pick The Right Testing Tool For ...
Like Selenium, Cypress is also an open-source test automation framework ... Cypress to change code that might interfere with the ability to ...
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