diff --git a/.eslintrc.yml b/.eslintrc.yml index a85bb21649..ec5c79a656 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -29,6 +29,7 @@ overrides: - files: - 'jest.config.js' + - 'jest.*.config.js' env: node: true diff --git a/.github/workflows/pull-request-validation.yml b/.github/workflows/pull-request-validation.yml index c9d357c3bd..4246d9cbd4 100644 --- a/.github/workflows/pull-request-validation.yml +++ b/.github/workflows/pull-request-validation.yml @@ -49,7 +49,10 @@ jobs: ./babel-passthru-transformer.js ./babel.config.json ./docker-compose-wsl2.yml + ./html2-test-transformer.js ./jest.config.js + ./jest.html2.config.js + ./jest.legacy.config.js ./package-lock.json ./package.json ./__tests__/ diff --git a/.gitignore b/.gitignore index 35ce209a73..b5756d63b6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /__tests__/__image_snapshots__/**/__diff_output__ +/__tests__/html2/**/*.snap-*-diff.png /.env /*.tgz /coverage diff --git a/__tests__/html/fluentTheme/preChatMessageActivity.js b/__tests__/html/fluentTheme/preChatMessageActivity.js deleted file mode 100644 index df16d5cd33..0000000000 --- a/__tests__/html/fluentTheme/preChatMessageActivity.js +++ /dev/null @@ -1,5 +0,0 @@ -/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ - -describe('Fluent theme applied', () => { - test('should display pre-chat message', () => runHTML('fluentTheme/preChatMessageActivity')); -}); diff --git a/__tests__/html/fluentTheme/preChatMessageActivity.layout.withoutImage.js b/__tests__/html/fluentTheme/preChatMessageActivity.layout.withoutImage.js deleted file mode 100644 index 8402f09a80..0000000000 --- a/__tests__/html/fluentTheme/preChatMessageActivity.layout.withoutImage.js +++ /dev/null @@ -1,5 +0,0 @@ -/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ - -describe('Fluent theme applied', () => { - test('should layout properly without image', () => runHTML('fluentTheme/preChatMessageActivity.layout.withoutImage')); -}); diff --git a/__tests__/html/fluentTheme/preChatMessageActivity.longTitle.js b/__tests__/html/fluentTheme/preChatMessageActivity.longTitle.js deleted file mode 100644 index 5a7ee18ad0..0000000000 --- a/__tests__/html/fluentTheme/preChatMessageActivity.longTitle.js +++ /dev/null @@ -1,5 +0,0 @@ -/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ - -describe('Fluent theme applied', () => { - test('should layout properly with very long title and subtitle', () => runHTML('fluentTheme/preChatMessageActivity.longTitle')); -}); diff --git a/__tests__/html/fluentTheme/preChatMessageActivity.wide.js b/__tests__/html/fluentTheme/preChatMessageActivity.wide.js deleted file mode 100644 index dd0f21e7d9..0000000000 --- a/__tests__/html/fluentTheme/preChatMessageActivity.wide.js +++ /dev/null @@ -1,5 +0,0 @@ -/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ - -describe('Fluent theme applied', () => { - test('should display pre-chat message in wide format', () => runHTML('fluentTheme/preChatMessageActivity.wide')); -}); diff --git a/__tests__/html/fluentTheme/preChatMessageActivity.longTitle.html b/__tests__/html2/fluentTheme/preChatMessageActivity/layout.longTitle.html similarity index 99% rename from __tests__/html/fluentTheme/preChatMessageActivity.longTitle.html rename to __tests__/html2/fluentTheme/preChatMessageActivity/layout.longTitle.html index 16af2c02ee..6eb17d4f2f 100644 --- a/__tests__/html/fluentTheme/preChatMessageActivity.longTitle.html +++ b/__tests__/html2/fluentTheme/preChatMessageActivity/layout.longTitle.html @@ -57,7 +57,7 @@ await pageConditions.numActivitiesShown(1); - await host.snapshot(); + await host.snapshot('local'); }); diff --git a/__tests__/__image_snapshots__/html/pre-chat-message-activity-long-title-js-fluent-theme-applied-should-layout-properly-with-very-long-title-and-subtitle-1-snap.png b/__tests__/html2/fluentTheme/preChatMessageActivity/layout.longTitle.html.snap-1.png similarity index 100% rename from __tests__/__image_snapshots__/html/pre-chat-message-activity-long-title-js-fluent-theme-applied-should-layout-properly-with-very-long-title-and-subtitle-1-snap.png rename to __tests__/html2/fluentTheme/preChatMessageActivity/layout.longTitle.html.snap-1.png diff --git a/__tests__/html/fluentTheme/preChatMessageActivity.wide.html b/__tests__/html2/fluentTheme/preChatMessageActivity/layout.wide.html similarity index 99% rename from __tests__/html/fluentTheme/preChatMessageActivity.wide.html rename to __tests__/html2/fluentTheme/preChatMessageActivity/layout.wide.html index cc412a1b45..8b6f2a7a9d 100644 --- a/__tests__/html/fluentTheme/preChatMessageActivity.wide.html +++ b/__tests__/html2/fluentTheme/preChatMessageActivity/layout.wide.html @@ -106,7 +106,7 @@ await pageConditions.numActivitiesShown(1); - await host.snapshot(); + await host.snapshot('local'); }); diff --git a/__tests__/__image_snapshots__/html/pre-chat-message-activity-wide-js-fluent-theme-applied-should-display-pre-chat-message-in-wide-format-1-snap.png b/__tests__/html2/fluentTheme/preChatMessageActivity/layout.wide.html.snap-1.png similarity index 100% rename from __tests__/__image_snapshots__/html/pre-chat-message-activity-wide-js-fluent-theme-applied-should-display-pre-chat-message-in-wide-format-1-snap.png rename to __tests__/html2/fluentTheme/preChatMessageActivity/layout.wide.html.snap-1.png diff --git a/__tests__/html/fluentTheme/preChatMessageActivity.layout.withoutImage.html b/__tests__/html2/fluentTheme/preChatMessageActivity/layout.withoutImage.html similarity index 99% rename from __tests__/html/fluentTheme/preChatMessageActivity.layout.withoutImage.html rename to __tests__/html2/fluentTheme/preChatMessageActivity/layout.withoutImage.html index 37a83a3c41..2d7b783f56 100644 --- a/__tests__/html/fluentTheme/preChatMessageActivity.layout.withoutImage.html +++ b/__tests__/html2/fluentTheme/preChatMessageActivity/layout.withoutImage.html @@ -92,7 +92,7 @@ await pageConditions.numActivitiesShown(1); - await host.snapshot(); + await host.snapshot('local'); }); diff --git a/__tests__/__image_snapshots__/html/pre-chat-message-activity-layout-without-image-js-fluent-theme-applied-should-layout-properly-without-image-1-snap.png b/__tests__/html2/fluentTheme/preChatMessageActivity/layout.withoutImage.html.snap-1.png similarity index 100% rename from __tests__/__image_snapshots__/html/pre-chat-message-activity-layout-without-image-js-fluent-theme-applied-should-layout-properly-without-image-1-snap.png rename to __tests__/html2/fluentTheme/preChatMessageActivity/layout.withoutImage.html.snap-1.png diff --git a/__tests__/html/fluentTheme/preChatMessageActivity.html b/__tests__/html2/fluentTheme/preChatMessageActivity/simple.html similarity index 59% rename from __tests__/html/fluentTheme/preChatMessageActivity.html rename to __tests__/html2/fluentTheme/preChatMessageActivity/simple.html index 6f6a8f9c19..c63b11128e 100644 --- a/__tests__/html/fluentTheme/preChatMessageActivity.html +++ b/__tests__/html2/fluentTheme/preChatMessageActivity/simple.html @@ -48,7 +48,8 @@ type: 'https://schema.org/Person', description: 'Ready to explore? Select one of the suggestions below to get started...', name: 'Onboarding Buddy', - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJIAAACQCAMAAADUbcK3AAAC+lBMVEUAAADxX0TJpYvTsaLPsJn+a0zUuqTQspv4ZEj+XTvMdmP/akr6Wjr/c1TzUzbTtqH/ZUPRtJ3StZ7VuqXPrZTj1Mf/YT//ZkXh0cT8YUP+bUzgzcDRt6P0Vzv+YT/6akz/ZkX/bEzj1Mj/aUnUuKP/YkDh08f+aEjStp//XTv/YD3Rs5z/Xz3QsZrKqY/StaHi1MfaNx//YkL/Y0LMq5LNrJPKp43/b1Di08jTt6D/YkD+aUn8cFLLqY/+Wjzi08bLpoz/cVH/ZkX+bk/3Qyrg0cPUt6LcxrTWvar/eVrqRy//ZEL3QSb/XTrLqpDcxrXUuaP/a0r6Wjv0PiPj1cj1QSbxRCnhz8L+f2LMq5L/e134RSn5NR36e17dybrZwK77TTD6TjPg0cP/fV/QsZnrPif8RCv5KhT8PSTaxLP8RirXvqv5OyHEJRL/bEzJpYr/eVrEJxL9LBb+SS3/f1/8UDDPoYznRSr8JA/fzLzMLBbh08fbx7fXwK7VvKjcybrey7zYw7PWvqvUuqX/aEfezb/fz8HStqHRtZ//YkH/akrg0cXaxbT/bk7/ZUX/bEv/cVLYwrD/c1T/YT7TuKP/ZEP/TjH/b1D/RSv/UzXg0MP/Qyj/NRz/dlj/eFr/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56VjaUXf9ZlkhUi6cNmkEkZI6vf8ZV79NK4vaKlaEnI7SP0U4SpTU17ujoPAGu2ozpX8i3bb8EX+idGricqayXRMjMhgMxq6aP0TYN5fbjUF5KZaL5o4nkpOlcBJeBJyncsWL0ElTE0AVDR0dHS8QBb1542ZTyauEB98iF4wlw0iR/Ji9myCrRYIIJOOprvpqiCgJHOTzefqnUuHFss0rJ00hw0kOEyeZTfmSRMjo7Gp69aShg20aJX3lI6BMOePQ+jVjcK6HaUrRVHLSBWkikE6ecnZ9Lnn1pLafxEbAkS0TF4yfNI4MP0G3Lb7SWWk2mw1nJYpYVNVUX4MfuorRe/fuPb5y++rJU8g/JkvMUWn0ZpPhTOAJObiIZars+vz5cPr+/fvHjSBBKUaxLUel2r1R/Bqhn0RWqwlpMkhQE2TqrK1XJezaHyJrfCIJdvJVV/9BZDap1CToRU34B5FZn0OCX9LWqxJF8PhFwd83/rZ7ddgisylOTUJQ0qLhizSpAglBMZkSRGhAhEXSkpC0dpF0ESdpUuUkNGVuDDiz0WAihEUKUTHHciXefi7SJAokVE3fmSdtHrFMGWoSuuZvzJMuUulICFu7eKOE28/TKOQklGmzpYr0iTEkpAlRMElao1SIQps8K9sS8ByFXQRTVLbICYniU2UkDAna7E3iJqRelQBRWIpevNNwYcgJ6dSosgQSthJ3Dz2P9JiQ4Sw6c5MlkMhkVWnlJKwJMm3mTsPfRCZ9nCI6rCKOitamZm+C6fd5ZNXHZ2SpAfofybRZmXG7Nxn9V85otOo1qowEhVog/y+oEjIzcuJUKC4uJyM1kXr+e3jx1CqQVqeOIZEiRYoUKVKkSJEiRYoUtL4DkaWZtZT0Fr4AAAAASUVORK5CYII=' } } ], @@ -104,7 +105,7 @@ await pageConditions.numActivitiesShown(1); - await host.snapshot(); + await host.snapshot('local'); // WHEN: The first card action button is clicked. await host.click( @@ -112,15 +113,17 @@ ); // THEN: Send box text box should have the value typed for the user. - await host.snapshot(); + await host.snapshot('local'); // WHEN: The sixth (last) card action button is clicked. await host.click( - document.querySelectorAll(`[data-testid="${WebChat.testIds.preChatMessageActivityStarterPromptsCardAction}"]`)[5] + document.querySelectorAll( + `[data-testid="${WebChat.testIds.preChatMessageActivityStarterPromptsCardAction}"]` + )[5] ); // THEN: Send box text box should be replaced. - await host.snapshot(); + await host.snapshot('local'); }); diff --git a/__tests__/__image_snapshots__/html/pre-chat-message-activity-js-fluent-theme-applied-should-display-pre-chat-message-1-snap.png b/__tests__/html2/fluentTheme/preChatMessageActivity/simple.html.snap-1.png similarity index 100% rename from __tests__/__image_snapshots__/html/pre-chat-message-activity-js-fluent-theme-applied-should-display-pre-chat-message-1-snap.png rename to __tests__/html2/fluentTheme/preChatMessageActivity/simple.html.snap-1.png diff --git a/__tests__/__image_snapshots__/html/pre-chat-message-activity-js-fluent-theme-applied-should-display-pre-chat-message-2-snap.png b/__tests__/html2/fluentTheme/preChatMessageActivity/simple.html.snap-2.png similarity index 100% rename from __tests__/__image_snapshots__/html/pre-chat-message-activity-js-fluent-theme-applied-should-display-pre-chat-message-2-snap.png rename to __tests__/html2/fluentTheme/preChatMessageActivity/simple.html.snap-2.png diff --git a/__tests__/__image_snapshots__/html/pre-chat-message-activity-js-fluent-theme-applied-should-display-pre-chat-message-3-snap.png b/__tests__/html2/fluentTheme/preChatMessageActivity/simple.html.snap-3.png similarity index 100% rename from __tests__/__image_snapshots__/html/pre-chat-message-activity-js-fluent-theme-applied-should-display-pre-chat-message-3-snap.png rename to __tests__/html2/fluentTheme/preChatMessageActivity/simple.html.snap-3.png diff --git a/docker-compose-wsl2.yml b/docker-compose-wsl2.yml index 768dc73a5d..9a8bc6d003 100644 --- a/docker-compose-wsl2.yml +++ b/docker-compose-wsl2.yml @@ -42,6 +42,7 @@ services: stop_grace_period: 0s volumes: - ./__tests__/html/:/var/web/__tests__/html/ + - ./__tests__/html2/:/var/web/__tests__/html2/ - ./packages/bundle/dist/:/var/web/packages/bundle/dist/ - ./packages/fluent-theme/dist/:/var/web/packages/fluent-theme/dist/ - ./packages/test/fluent-bundle/dist/:/var/web/packages/test/fluent-bundle/dist/ diff --git a/html2-test-transformer.js b/html2-test-transformer.js new file mode 100644 index 0000000000..1fa24c2f73 --- /dev/null +++ b/html2-test-transformer.js @@ -0,0 +1,16 @@ +const { relative, resolve } = require('path'); + +const testRoot = resolve(__dirname, './__tests__/html2/'); + +module.exports = { + process: (_, sourcePath) => { + const html = relative(testRoot, sourcePath); + + return { + code: ` + test(${JSON.stringify(html)}, () => + runHTML(${JSON.stringify(`/__tests__/html2/${html}`)})); + ` + }; + } +}; diff --git a/jest.config.js b/jest.config.js index 0352e20edf..a599157f1c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,56 +1,11 @@ -const { defaults } = require('jest-config'); const { join, relative } = require('path'); -const TRANSFORM_IGNORE_PACKAGES = [ - 'botframework-webchat-api', - 'botframework-webchat-component', - 'botframework-webchat-core', - 'botframework-webchat', - 'character-entities', - 'decode-named-character-reference', - 'mdast-util-from-markdown', - 'mdast-util-to-string', - 'micromark-core-commonmark', - 'micromark-factory-destination', - 'micromark-factory-label', - 'micromark-factory-space', - 'micromark-factory-title', - 'micromark-factory-whitespace', - 'micromark-util-character', - 'micromark-util-chunked', - 'micromark-util-classify-character', - 'micromark-util-combine-extensions', - 'micromark-util-decode-numeric-character-reference', - 'micromark-util-decode-string', - 'micromark-util-encode', - 'micromark-util-html-tag-name', - 'micromark-util-normalize-identifier', - 'micromark-util-resolve-all', - 'micromark-util-sanitize-uri', - 'micromark-util-subtokenize', - 'micromark', - 'mime', - 'unist-util-stringify-position', - 'uuid' -]; - module.exports = { - collectCoverageFrom: [ - '/packages/*/src/**/*.{js,jsx,ts,tsx}', - '!/*.{spec,test}.{js,jsx,ts,tsx}', - '!/*.json', - '!/node_modules/**', - '!/packages/playground/**', - '!/samples/**' - ], + collectCoverageFrom: ['/packages/*/src/**/*.{js,jsx,ts,tsx}'], coverageReporters: ['json', 'lcov', 'text-summary', 'clover', 'cobertura'], - globals: { - npm_package_version: '0.0.0-0.jest' - }, // We only have 4 instances of Chromium running simultaneously. maxWorkers: 4, - moduleDirectories: ['node_modules', 'packages'], - moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'], + projects: ['/jest.html2.config.js', '/jest.legacy.config.js'], reporters: [ 'default', [ @@ -109,45 +64,6 @@ module.exports = { jestResultFilename: join(__dirname, 'coverage/jest.json') } ], - [ - 'github-actions', - { - silent: false - } - ] - ], - setupFilesAfterEnv: [ - '/__tests__/setup/setupDotEnv.js', - '/__tests__/setup/setupGlobalAgent.js', - '/__tests__/setup/preSetupTestFramework.js', - '/__tests__/setup/setupCryptoGetRandomValues.js', - '/__tests__/setup/setupImageSnapshot.js', - '/__tests__/setup/setupTestNightly.js', - '/__tests__/setup/setupTimeout.js' - ], - testPathIgnorePatterns: [ - '/lib/', - '/node_modules/', - '/__tests__/html/__dist__', - '/__tests__/html/__jest__', - '/__tests__/html/assets', - '/__tests__/setup/', - '/packages/bundle/__tests__/types/__typescript__/', - '/packages/core/__tests__/types/__typescript__/', - '/packages/directlinespeech/__tests__/utilities/', - '/packages/playground/', - '/samples/' - ], - transform: { - '[\\/]__tests__[\\/]html[\\/]': './babel-passthru-transformer.js', - '\\.[jt]sx?$': './babel-jest-config.js' - }, - transformIgnorePatterns: [ - // jest-environment-jsdom import packages as browser. - // Packages, such as "uuid", export itself for browser as ES5 + ESM. - // Since jest@28 cannot consume ESM yet, we need to transpile these packages. - `/node_modules/(?!(${TRANSFORM_IGNORE_PACKAGES.join('|')})/)`, - '/packages/(?:test/)?\\w+/(?:lib/|dist/|\\w+\\.js)', - ...defaults.transformIgnorePatterns.filter(pattern => pattern !== '/node_modules/') + ['github-actions', { silent: false }] ] }; diff --git a/jest.html2.config.js b/jest.html2.config.js new file mode 100644 index 0000000000..5b01c48c79 --- /dev/null +++ b/jest.html2.config.js @@ -0,0 +1,18 @@ +module.exports = { + displayName: { color: 'cyan', name: 'html2' }, + globals: { npm_package_version: '0.0.0-0.jest' }, + moduleFileExtensions: ['html', 'js'], // Will cause fail validation error if 'js' is not included. + rootDir: './', + setupFilesAfterEnv: [ + '/__tests__/setup/setupImageSnapshot.js', + '/__tests__/setup/setupTestNightly.js', + '/__tests__/setup/setupTimeout.js' + ], + testEnvironment: '/packages/test/harness/src/host/jest/WebDriverEnvironment.js', // Cannot load environment in HTML file due to syntax requirements. Jest also ignores environment comment in transformed file. + testMatch: ['/__tests__/html2/**/*.html'], + testPathIgnorePatterns: ['/node_modules/', '/packages/', '/samples/'], // Jest will warn obsoleted snapshots outside of "testMatch", need "testPathIgnorePatterns" to skip checking obsoleted snapshots. + transform: { + '\\.html$': '/html2-test-transformer.js', + '\\.[jt]sx?$': '/babel-jest-config.js' + } +}; diff --git a/jest.legacy.config.js b/jest.legacy.config.js new file mode 100644 index 0000000000..cf1b679942 --- /dev/null +++ b/jest.legacy.config.js @@ -0,0 +1,80 @@ +const { defaults } = require('jest-config'); + +const TRANSFORM_IGNORE_PACKAGES = [ + 'botframework-webchat-api', + 'botframework-webchat-component', + 'botframework-webchat-core', + 'botframework-webchat', + 'character-entities', + 'decode-named-character-reference', + 'mdast-util-from-markdown', + 'mdast-util-to-string', + 'micromark-core-commonmark', + 'micromark-factory-destination', + 'micromark-factory-label', + 'micromark-factory-space', + 'micromark-factory-title', + 'micromark-factory-whitespace', + 'micromark-util-character', + 'micromark-util-chunked', + 'micromark-util-classify-character', + 'micromark-util-combine-extensions', + 'micromark-util-decode-numeric-character-reference', + 'micromark-util-decode-string', + 'micromark-util-encode', + 'micromark-util-html-tag-name', + 'micromark-util-normalize-identifier', + 'micromark-util-resolve-all', + 'micromark-util-sanitize-uri', + 'micromark-util-subtokenize', + 'micromark', + 'mime', + 'unist-util-stringify-position', + 'uuid' +]; + +module.exports = { + displayName: { color: 'yellow', name: 'legacy' }, + globals: { + npm_package_version: '0.0.0-0.jest' + }, + moduleDirectories: ['node_modules', 'packages'], + moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'], + rootDir: './', + setupFilesAfterEnv: [ + '/__tests__/setup/setupDotEnv.js', + '/__tests__/setup/setupGlobalAgent.js', + '/__tests__/setup/preSetupTestFramework.js', + '/__tests__/setup/setupCryptoGetRandomValues.js', + '/__tests__/setup/setupImageSnapshot.js', + '/__tests__/setup/setupTestNightly.js', + '/__tests__/setup/setupTimeout.js' + ], + testMatch: ['**/__tests__/**/*.?([mc])[jt]s?(x)', '**/?(*.)+(spec|test).?([mc])[jt]s?(x)'], + testPathIgnorePatterns: [ + '/lib/', + '/node_modules/', + '/__tests__/html/.*?(\\.html)', + '/__tests__/html/__dist__', + '/__tests__/html/__jest__', + '/__tests__/html/assets', + '/__tests__/setup/', + '/packages/bundle/__tests__/types/__typescript__/', + '/packages/core/__tests__/types/__typescript__/', + '/packages/directlinespeech/__tests__/utilities/', + '/packages/playground/', + '/samples/' + ], + transform: { + '[\\/]__tests__[\\/]html[\\/]': '/babel-passthru-transformer.js', + '\\.[jt]sx?$': '/babel-jest-config.js' + }, + transformIgnorePatterns: [ + // jest-environment-jsdom import packages as browser. + // Packages, such as "uuid", export itself for browser as ES5 + ESM. + // Since jest@28 cannot consume ESM yet, we need to transpile these packages. + `/node_modules/(?!(${TRANSFORM_IGNORE_PACKAGES.join('|')})/)`, + '/packages/(?:test/)?\\w+/(?:lib/|dist/|\\w+\\.js)', + ...defaults.transformIgnorePatterns.filter(pattern => pattern !== '/node_modules/') + ] +}; diff --git a/packages/test/harness/src/host/common/host/snapshot.js b/packages/test/harness/src/host/common/host/snapshot.js index 3318e88d48..a62a6cb7fc 100644 --- a/packages/test/harness/src/host/common/host/snapshot.js +++ b/packages/test/harness/src/host/common/host/snapshot.js @@ -1,19 +1,29 @@ -const { join } = require('path'); +const { join, relative } = require('path'); const allImagesCompleted = require('../allImagesCompleted'); const checkAccessibilty = require('./checkAccessibility'); const takeStabilizedScreenshot = require('../takeStabilizedScreenshot'); +const testRoot = join(__dirname, '../../../../../../../__tests__/html/'); + module.exports = webDriver => - async function snapshot() { + async function snapshot(mode) { await allImagesCompleted(webDriver); const screenshot = await takeStabilizedScreenshot(webDriver); - expect(screenshot).toMatchImageSnapshot({ - // jest-image-snapshot does not support . - customSnapshotsDir: join(__dirname, '../../../../../../../__tests__/__image_snapshots__/html/') - }); + expect(screenshot).toMatchImageSnapshot( + mode === 'local' + ? { + customDiffDir: testRoot, + customSnapshotIdentifier: ({ counter, testPath }) => `${relative(testRoot, testPath)}.snap-${counter}`, + customSnapshotsDir: testRoot + } + : { + // jest-image-snapshot does not support . + customSnapshotsDir: join(__dirname, '../../../../../../../__tests__/__image_snapshots__/html/') + } + ); await checkAccessibilty(webDriver)(); };