hackforla / hackforla/website

End to end testing of display of events using Selenium

Open
#6,017 4 comments 0 reactions 0 assignees View on GitHub
Complexity: Large Draft Feature: Infrastructure HLC: C P-Feature: Project Info and Page role: back end/devOps size: 2pt
Dominant language
JavaScript
Stars
363
Forks
872
Avg merge
2d 21h
Merged PRs (30d)
18

Description

### Overview
We need to explore the use of automated browser testing tools for ensuring end to end functionality of the website in order to verify the display of meetings on Project pages.

#### Details
In this issue, a test will be developed in JavaScript using Selenium browser automation and the Mocha testing frameworks.

### Action Items
- [ ] Read Getting "Started with Selenium"[^1] and "Mocha (Getting Started)"[^2]
- [ ] If not already installed, install node.js and npm https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
- [ ] In the `test` folder, create a folder `e2e`, then from test/e2e, run `npm init -y` to create a new package
- [ ] Install Selenium and configure dependencies as described in Install a Selenium Library[^1]
- [ ] Install Mocha as described in Mocha Installation[^2]
- [ ] Run docker-compose up to start the jekyll server.
- [ ] In `test/e2e`, create a JavaScript file `meetings-on-project-pages.js`, using Selenium WebDriver and Mocha to load each project page and verify display of meeting information. See Selenium example[^3]
- [ ] The list of project page URLs to test should be generated dynamically from the jekyll _projects collection using liquid. For sample code see the function `retrieveProjectDataFromCollection()` in `assets\js\current-projects.js`
- [ ] During test, the website will be served from http://localhost:4000 so create urls appropriately
- [ ] Run the script using Mocha. Optionally, define an npm script alias
- [ ] Verify that the script reports a passing test on pages in which meetings are displayed, and a failing test on pages in which meetings are not displayed
- [ ] Add/Commit all 3 files in test/e2e: meetings-on-project-pages.js, package.json and package-lock.json
- [ ] Proceed with creating a pull request. In the pull request, provide instructions for reviewers to install and run the tests

[^1]: https://www.selenium.dev/documentation/webdriver/getting_started/install_library/
[^2]: https://mochajs.org/#installation
[^3]:[Organizing and Executing Selenium Code - Test Runner Examples: JavaScript](https://www.selenium.dev/documentation/webdriver/getting_started/using_selenium/)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.