From 8b632f91f2977ac9f787c102f9f045c74dfd99ca Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 19 Feb 2018 18:36:54 -0800 Subject: [PATCH] allow testing in multiple browsers --- README.md | 11 ++++++++++- package.json | 5 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 45f4a05..de80053 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ In separate terminals: 3\. Run a debuggable TestCafé instance: - npx testcafe --hostname localhost --skip-js-errors --debug-mode chrome tests/spec + npx testcafe --hostname localhost --skip-js-errors --debug-mode firefox tests/spec If you want to export the current data in the Mastodon instance as canned data, so that it can be loaded later: @@ -42,6 +42,15 @@ Run integration tests: npm test +Run tests for a particular browser: + + BROWSER=chrome npm run test-browser + BROWSER=chrome:headless npm run test-browser + BROWSER=firefox npm run test-browser + BROWSER=firefox:headless npm run test-browser + BROWSER=safari npm run test-browser + BROWSER=edge npm run test-browser + Automatically fix most linting issues: npx standard --fix \ No newline at end of file diff --git a/package.json b/package.json index 096582f..d333684 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,9 @@ "build-sass": "node ./bin/build-sass.js", "build-sass-watch": "node ./bin/build-sass.js --watch", "run-mastodon": "node ./bin/run-mastodon", - "run-testcafe": "testcafe --hostname localhost --skip-js-errors chrome:headless tests/spec", - "test": "run-p --race run-mastodon dev test-mastodon", + "run-testcafe": "cross-env-shell testcafe --hostname localhost --skip-js-errors $BROWSER tests/spec", + "test": "cross-env BROWSER=chrome:headless npm run test-browser", + "test-browser": "run-p --race run-mastodon dev test-mastodon", "test-mastodon": "run-s wait-for-mastodon-to-start run-testcafe", "wait-for-mastodon-to-start": "node bin/wait-for-mastodon-to-start.js", "globalize-css": "node ./bin/globalize-css.js",