Skip to content

Commit

Permalink
chore: mac render tests (#9175)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixpalmer authored Sep 26, 2024
1 parent 230104f commit 728d9a6
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 2 deletions.
15 changes: 14 additions & 1 deletion modules/test-utils/src/snapshot-test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type ImageDiffOptions = {
tolerance?: number; // 0.1,
includeAA?: boolean; // false,
includeEmpty?: boolean; // true
platform?: string;
};

type DiffImageResult = {
Expand Down Expand Up @@ -140,8 +141,20 @@ export class SnapshotTestRunner extends TestRunner<
};
// Take screenshot and compare
const result = await window.browserTestDriver_captureAndDiffScreen(diffOptions);

// If failed, try if we have a platform specific golden image
let resultOverride;
const platform = this.testOptions.imageDiffOptions?.platform?.toLowerCase();
if (!result.success) {
diffOptions.goldenImage = diffOptions.goldenImage.replace(
'golden-images/',
`golden-images/platform-overrides/${platform}/`
);
resultOverride = await window.browserTestDriver_captureAndDiffScreen(diffOptions);
}

// invoke user callback
if (result.success) {
if (result.success || resultOverride.success) {
this.pass(result);
} else {
this.fail(result);
Expand Down
File renamed without changes.
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.
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.
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.
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.
3 changes: 2 additions & 1 deletion test/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// THE SOFTWARE.
import test from 'tape';
import TEST_CASES from './test-cases';
import {WIDTH, HEIGHT} from './constants';
import {WIDTH, HEIGHT, OS} from './constants';
import {SnapshotTestRunner} from '@deck.gl/test-utils';

import './jupyter-widget';
Expand All @@ -40,6 +40,7 @@ test('Render Test', t => {
timeout: 10000,

imageDiffOptions: {
platform: OS,
threshold: 0.99,
includeEmpty: false
// uncomment to save screenshot to disk
Expand Down

0 comments on commit 728d9a6

Please sign in to comment.