Tests: Add TestCafe acceptance test runner example

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2022-08-31 19:42:18 +02:00
parent fb921a4932
commit 7814273ac2
3 changed files with 12 additions and 2 deletions

View file

@ -43,6 +43,9 @@ test-pkg: reset-sqlite run-test-pkg
test-api: reset-sqlite run-test-api test-api: reset-sqlite run-test-api
test-short: reset-sqlite run-test-short test-short: reset-sqlite run-test-short
test-mariadb: reset-acceptance run-test-mariadb test-mariadb: reset-acceptance run-test-mariadb
testcafe: testcafe-auth-chromium
testcafe-auth-chromium: storage/acceptance acceptance-sqlite-restart run-testcafe-auth-chromium acceptance-sqlite-stop
testcafe-public-chromium: storage/acceptance acceptance-sqlite-restart run-testcafe-public-chromium acceptance-sqlite-stop
acceptance-auth-run-chromium: storage/acceptance acceptance-auth-sqlite-restart acceptance-auth acceptance-auth-sqlite-stop acceptance-auth-run-chromium: storage/acceptance acceptance-auth-sqlite-restart acceptance-auth acceptance-auth-sqlite-stop
acceptance-public-run-chromium: storage/acceptance acceptance-sqlite-restart acceptance acceptance-sqlite-stop acceptance-public-run-chromium: storage/acceptance acceptance-sqlite-restart acceptance acceptance-sqlite-stop
acceptance-auth-run-firefox: storage/acceptance acceptance-auth-sqlite-restart acceptance-auth-firefox acceptance-auth-sqlite-stop acceptance-auth-run-firefox: storage/acceptance acceptance-auth-sqlite-restart acceptance-auth-firefox acceptance-auth-sqlite-stop
@ -204,6 +207,12 @@ test-js:
acceptance-old: acceptance-old:
$(info Running JS acceptance tests in Chrome...) $(info Running JS acceptance tests in Chrome...)
(cd frontend && npm run acceptance --first="chromium:headless" --second=plus --third=public && cd ..) (cd frontend && npm run acceptance --first="chromium:headless" --second=plus --third=public && cd ..)
run-testcafe-auth-chromium:
$(info Running auth-mode tests in 'chromium:headless'...)
(cd frontend && npm run testcafe -- chromium:headless --test-grep "^(Common|Core)\:*" --test-meta mode=auth --config-file ./testcaferc.json "tests/acceptance")
run-testcafe-public-chromium:
$(info Running public-mode tests in 'chromium:headless'...)
(cd frontend && npm run testcafe -- chromium:headless --test-grep "^(Common|Core)\:*" --test-meta mode=public --config-file ./testcaferc.json "tests/acceptance")
acceptance: acceptance:
$(info Running JS acceptance tests in Chrome...) $(info Running JS acceptance tests in Chrome...)
(cd frontend && npm run acceptance --first="chromium:headless" --second="^(Common|Core)\:*" --third=public --fourth="tests/acceptance" && cd ..) (cd frontend && npm run acceptance --first="chromium:headless" --second="^(Common|Core)\:*" --third=public --fourth="tests/acceptance" && cd ..)
@ -491,4 +500,4 @@ tidy:
install-go install-darktable install-tensorflow devtools tar.gz fix-permissions rootshell help dep-acceptance \ install-go install-darktable install-tensorflow devtools tar.gz fix-permissions rootshell help dep-acceptance \
docker-local docker-local-all docker-local-bookworm docker-local-bullseye docker-local-buster docker-local-impish \ docker-local docker-local-all docker-local-bookworm docker-local-bullseye docker-local-buster docker-local-impish \
docker-local-develop docker-local-develop-all docker-local-develop-bookworm docker-local-develop-bullseye \ docker-local-develop docker-local-develop-all docker-local-develop-bookworm docker-local-develop-bullseye \
docker-local-develop-buster docker-local-develop-impish test-mariadb reset-acceptance run-test-mariadb; docker-local-develop-buster docker-local-develop-impish test-mariadb reset-acceptance run-test-mariadb testcafe;

View file

@ -13,6 +13,7 @@
"fmt": "eslint --cache --fix src/ *.js .eslintrc.js", "fmt": "eslint --cache --fix src/ *.js .eslintrc.js",
"test": "karma start", "test": "karma start",
"upgrade": "npm --depth 10 update && npm audit fix", "upgrade": "npm --depth 10 update && npm audit fix",
"testcafe": "testcafe",
"acceptance": "testcafe $npm_config_first --test-grep $npm_config_second --test-meta mode=$npm_config_third --config-file ./testcaferc.json $npm_config_fourth", "acceptance": "testcafe $npm_config_first --test-grep $npm_config_second --test-meta mode=$npm_config_third --config-file ./testcaferc.json $npm_config_fourth",
"acceptance-short": "testcafe $npm_config_first --test-grep $npm_config_second --test-meta mode=$npm_config_third,type=short --config-file ./testcaferc.json $npm_config_fourth", "acceptance-short": "testcafe $npm_config_first --test-grep $npm_config_second --test-meta mode=$npm_config_third,type=short --config-file ./testcaferc.json $npm_config_fourth",
"acceptance-local": "testcafe chromium --selector-timeout 5000 -S -s tests/acceptance/screenshots tests/acceptance", "acceptance-local": "testcafe chromium --selector-timeout 5000 -S -s tests/acceptance/screenshots tests/acceptance",

View file

@ -10,7 +10,7 @@ const toolbar = new Toolbar();
const menu = new Menu(); const menu = new Menu();
const page = new Page(); const page = new Page();
test.meta("testID", "components-001").only.meta({ mode: "private" })( test.meta("testID", "components-001").meta({ mode: "private" })(
"Common: Mobile Toolbar", "Common: Mobile Toolbar",
async (t) => { async (t) => {
if (t.browser.platform === "mobile") { if (t.browser.platform === "mobile") {