-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add resemblejs to smoke tests (#3899)
### Installing resemblejs #### Getting resemblejs to work in the repo Override yarn config in smoke tests to use node runtime instead of electron. It seems that the tests need to compile `resemblejs` to target `node` instead of `electron` so that the correct header files are used. Using `npm` worked because it doesn't have anything set to target the Electron runtime. Yarn was merging in the options `<positron root>/.yarnrc`, which sets the runtime to `electron`. #### Building resemblejs (which depends on canvas) will require some configuration updates: OS X brew install pkg-config cairo libpng jpeg giflib Debian sudo apt-get install -y libcairo-dev libsdl-pango-dev libjpeg-dev libgif-dev Windows https://github.com/Automattic/node-canvas/wiki/Installation:-Windows Documentation PR: posit-dev/positron-wiki#55 ### Resemblejs usage Resemblejs is being used to compare plots in Positron at runtime against master plots stored in the repo. The master plots are generated locally with a line of code similar to: ``` await app.code.driver.getLocator('.plot-instance .image-wrapper img').screenshot({ path: 'screenshot.png' }); ``` Screenshot.png is then renamed and moved to the proper directory. Note that screenshot.png is collected in CI and not locally. Files collected locally differ too much from CI to be use with a reasonable comparison threshold. Tests fail currently if the "rawMismatchPercentage" is greater than 2%. Locally generated snapshots seem to differ from CI snapshots by about 5.0 - 7.5%. An all black image differs by about 98% but an all white image only differs by 4.6%. This is why the threshold is set lower that the difference between a local and a CI image. ### QA Notes - use of resemblejs in code ```ts // import { compareImages } from 'resemblejs'; // importing the dependency as require to avoid error once transpiled to .js const compareImages = require('resemblejs/compareImages'); ``` Using the package might need to be done like this. My early testing had some issues with imports and it didn't know how to find `resemblejs` during runtime. --------- Co-authored-by: Chris Mead <[email protected]>
- Loading branch information
1 parent
24aadab
commit 4f27520
Showing
11 changed files
with
429 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ jobs: | |
- name: Setup Build Environment | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y vim curl build-essential clang make cmake git python3-pip python-is-python3 libsodium-dev libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1 libnss3 libnspr4 libasound2 libkrb5-dev | ||
sudo apt-get install -y vim curl build-essential clang make cmake git python3-pip python-is-python3 libsodium-dev libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1 libnss3 libnspr4 libasound2 libkrb5-dev libcairo-dev libsdl-pango-dev libjpeg-dev libgif-dev | ||
sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb | ||
sudo chmod +x /etc/init.d/xvfb | ||
sudo update-rc.d xvfb defaults | ||
|
@@ -54,6 +54,8 @@ jobs: | |
# Perform the main yarn command; this installs all Node packages and | ||
# dependencies | ||
yarn --immutable --network-timeout 120000 | ||
yarn --cwd test/automation install | ||
yarn --cwd test/smoke install | ||
- name: Compile and Download | ||
run: yarn npm-run-all --max_old_space_size=4095 -lp compile "electron x64" playwright-install download-builtin-extensions | ||
|
@@ -137,3 +139,11 @@ jobs: | |
with: | ||
name: run-artifacts | ||
path: .build/logs/smoke-tests-electron/ | ||
|
||
- name: slack-smoke-test-report | ||
if: always() | ||
uses: ivanklee86/[email protected] | ||
env: | ||
SLACK_CHANNEL: C06DNFJSHPD | ||
SLACK_TOKEN: ${{ secrets.SMOKE_TESTS_SLACK_TOKEN }} | ||
XUNIT_PATH: .build/logs/smoke-tests-electron/test-results/results.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
disturl "" | ||
target "" | ||
ms_build_id "" | ||
runtime "node" | ||
build_from_source "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.