Create a reusable cypress_test() macro
I want to write a couple of tests for some plotting web pages. I keep
asking other folks to validate that I didn't break anything. It's time
to automate this.
This patch creates a new macro that will make it easier for everyone
to write such tests. We're also converting the one existing Cypress
test to use the new macro.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I8ec82dc8ebdcc22a394f3b66fbc5c39e937adc6e
diff --git a/scouting/cypress_runner.js b/scouting/cypress_runner.js
index 6c63adb..c8f60f8 100644
--- a/scouting/cypress_runner.js
+++ b/scouting/cypress_runner.js
@@ -57,17 +57,22 @@
// Wait for the server to be ready, run the tests, then shut down the server.
(async () => {
+ // Parse command line options.
+ let runOptions = await cypress.cli.parseRunArguments(process.argv.slice(2));
+
await serverStartup;
- const result = await cypress.run({
- headless: true,
- config: {
- baseUrl: 'http://localhost:8000',
- screenshotsFolder:
- process.env.TEST_UNDECLARED_OUTPUTS_DIR + '/screenshots',
- video: false,
- videosFolder: process.env.TEST_UNDECLARED_OUTPUTS_DIR + '/videos',
- },
- });
+ const result = await cypress.run(
+ Object.assign(runOptions, {
+ headless: true,
+ config: {
+ baseUrl: 'http://localhost:8000',
+ screenshotsFolder:
+ process.env.TEST_UNDECLARED_OUTPUTS_DIR + '/screenshots',
+ video: false,
+ videosFolder: process.env.TEST_UNDECLARED_OUTPUTS_DIR + '/videos',
+ },
+ })
+ );
await servers.kill();
await serverShutdown;