Skip to content

Commit

Permalink
Merge pull request #559 from SCCapstone/newTests
Browse files Browse the repository at this point in the history
New tests
  • Loading branch information
epadams authored Apr 23, 2024
2 parents ff2eb78 + e0fee68 commit 6956a9b
Show file tree
Hide file tree
Showing 3 changed files with 2,196 additions and 1,351 deletions.
23 changes: 8 additions & 15 deletions FU.SPA/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,42 +57,35 @@ Add the following to your `hosts` file (`/etc/hosts` on Linux and `C:\Windows\Sy
127.0.0.1 fu-api
127.0.0.1 fu-spa

To test with a clean API and SPA run

npm run selenium-test:clean
**Note: there are currently issues with running tests on the command line. This includes some tests not properly
running and tests being completely unable to run with the Chrome driver. Run them through Selenium IDE for
the best experience.**

To startup a clean API and SPA for test development, run

npm run container-setup

To stop run
To stop containers, run

npm run container-teardown

To start just the API for SPA development, run

npm run api-start

To pause the container press `CTRL-C`. To resume it run the above command. To stop and remove the container run
To pause the container press `CTRL-C`. To resume it run the above command. To stop and remove the container, run

npm run api-teardown

To run tests, go to the Selenium IDE extension in your browser of choice, load the `tests/Forces_Unite.side` project file, and run the tests. You can run tests indivdually
or run them all together in the `default` test suite.

### Developing Selenium Tests

Tests are located in `FU.SPA/tests`.

To add initial testing data, add API calls to `tests/setup-tests.js`. The file can be run manually with `node tests/setup-tests.js`. If run manually, the `API_BASE_URL` environment variable must be set. See [here](https://nodejs.org/en/learn/command-line/how-to-read-environment-variables-from-nodejs) for details.

To run behavioral tests with a API and SPA already running, run

npm run selenium-test

or

selenium-side-runner tests/*.side -c browserName=firefox

You can also change the browserName option to chrome/chromium if you want to test that browser engine instead.

### Coding Style

Prettier and ESLint are used to enforce a consistent coding style.
1 change: 1 addition & 0 deletions FU.SPA/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"format-check": "npx prettier . --check",
"selenium-test": "npx selenium-side-runner tests/Forces_Unite.side -c browserName=firefox",
"selenium-test:clean": "npm run container-setup && npm run selenium-test && npm run container-teardown",
"selenium-test:suite": "npx selenium-side-runner tests/Forces_Unite.side -c browserName=firefox -f ",
"container-setup": "npm run container-teardown && docker compose -f tests/docker-compose.yml up --build -d",
"container-teardown": "docker compose -f tests/docker-compose.yml down",
"api-start": "docker compose -f ../FU.API/FU.API/docker-compose.yml up --build",
Expand Down
Loading

0 comments on commit 6956a9b

Please sign in to comment.