RedBlueCarrots / WikiPath

0 stars 0 forks source link

67 testing add selenium web driver tests #84

Closed RadiationOcelot closed 5 months ago

RadiationOcelot commented 5 months ago

For reasons beyond us, selenium only wishes to function on my machine, on WSL. I.. don't know what makes my machine able to do it (or what makes other machines unable to run it properly), but here's what I did to get it working on my machine:

  1. On WSL or a Unix system, install Firefox via sudo snap install firefox. This should automatically install the webdriver for Firefox: geckodriver According to the slides: selenium would automatically install the Firefox webdriver, but for whatever reason, I had to install it manually via this way.
  2. In selenium.py, in setUp(), replace the default path stored in the geckodriver_path variable with wherever geckodriver is located on your machine.
  3. In the WikiPath directory, run python -m unittest tests/selenium.py and hope that it works on your machine.

The selenium tests are as follows:

  1. Check the create account functionality, and check if logging in and out does function properly
  2. Creates a challenge and checks if it displays correctly on /index and on /view
  3. Makes a new account to attempt to submit a submission, and checks if that submission also displays correctly

Note: I've added a bunch of ids to elements in the templates to aid with the selenium tests, so far they serve no use other than these tests.

RadiationOcelot commented 5 months ago

image Can confirm that currently the server does pass the test!