From ee0450cbaa12a6071f3f74381cceb18ca0569779 Mon Sep 17 00:00:00 2001 From: Harel M Date: Fri, 1 Mar 2024 14:21:25 +0200 Subject: [PATCH] Update tests readmes (#3776) --- test/README.md | 8 +++++--- test/integration/README.md | 8 ++++---- test/integration/browser/README.md | 14 -------------- 3 files changed, 9 insertions(+), 21 deletions(-) delete mode 100644 test/integration/browser/README.md diff --git a/test/README.md b/test/README.md index 640fb19584..3685909349 100644 --- a/test/README.md +++ b/test/README.md @@ -16,10 +16,12 @@ npm test Note that for Linux you'll need to prefix test commands with `xvfb-run -a` for example `xvfb-run -a npm run test` Note that some tests rely on the built project and will not pass until you have run `npm run build-dist`. -To run individual tests: +To run specific tests: - - Unit tests: `npx jest path/to/file.test.ts` (e.g. `npx jest src/style/style_layer.test.ts`) - - Render tests: `npm run test-render -- render-test-name` (e.g. `npm run test-render -- text-rotation-alignment`) + - Unit test by file name : `npx jest path/to/file.test.ts --reporters=default` (e.g. `npx jest src/style/style_layer.test.ts`) + - Unit test that matches a test name: `npx jest path/to/file.test.ts --reporters=default -t "test name"` + - Browser test that matches a test name: `npx jest test/integration/browser/browser.test.ts --reporters=default -t "test name"`, in some cases here you might want to change the headeless mode in the test file to be `false` to see what's happening in the browser. + - Render tests that matches a folder or file names: `npm run test-render -- render-test-name` (e.g. `npm run test-render -- text-rotation-alignment`) To run folders in watch mode, meaning they will run continuously as you make changes to relevant code, (i.e. for test driven development): use `npm run test-watch-roots *folder1* [*folder2*...]` (e.g. `npm run test-watch-roots ./src/ui/control`) diff --git a/test/integration/README.md b/test/integration/README.md index b8dc16978d..c21e1ad97c 100644 --- a/test/integration/README.md +++ b/test/integration/README.md @@ -59,7 +59,7 @@ Additionally, it may be helpful to use a visual jest frontend (e.g. `npx majesti To run a subset of tests or an individual test, you can pass a specific subdirectory to the `test-render` script. For example, to run all the tests for a given property, e.g. `circle-radius`: ``` -$ npm run test-render circle-radius +$ npm run test-render -- circle-radius ... * passed circle-radius/antimeridian * passed circle-radius/default @@ -73,7 +73,7 @@ Done in 2.71s. ``` Or to run a single test: ``` -$ npm run test-render circle-radius/literal +$ npm run test-render -- circle-radius/literal ... * passed circle-radius/literal 1 passed (100.0%) @@ -83,7 +83,7 @@ Done in 2.32s. ### Detailed debug messages for render tests Render tests are executed in browser, and by default console messages are hidden. If need to see them, please pass --debug parameter: ``` -$ npm run test-render raster-masking/overlapping-zoom -- --debug +$ npm run test-render -- raster-masking/overlapping-zoom --debug ``` ### Viewing render test results @@ -106,7 +106,7 @@ open ./test/integration/render/results.html If want to skip the report, please pass --skip-report parameter ``` -$ npm run test-render circle-radius/literal -- --skip-report +$ npm run test-render -- circle-radius/literal --skip-report ``` ### Updating results of render test results diff --git a/test/integration/browser/README.md b/test/integration/browser/README.md deleted file mode 100644 index 7c3631f8a3..0000000000 --- a/test/integration/browser/README.md +++ /dev/null @@ -1,14 +0,0 @@ -This folder contains files for automated testing of MapLibre GL JS in real browsers using [Selenium WebDriver](https://www.npmjs.com/package/selenium-webdriver). - -## Prerequisites - -To run Webdriver, you'll have to install the driver for every browser you want to test in. - -- **Google Chrome**: `npm install -g chromedriver` -- **Mozilla Firefox**: `npm install -g geckodriver` -- **Apple Safari**: (`safaridriver` ships with macOS) -- **Microsoft Edge**: See https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ - -## Running - -- Run browser tests with `npx jest test/integration/browser/browser.test.ts`.