diff --git a/.github/workflows/pull-request-validation.yml b/.github/workflows/pull-request-validation.yml index 680f4b05fa..341d3590d9 100644 --- a/.github/workflows/pull-request-validation.yml +++ b/.github/workflows/pull-request-validation.yml @@ -236,11 +236,11 @@ jobs: - run: npm clean-install - - name: Run docker-compose build - run: docker-compose -f docker-compose-wsl2.yml build --build-arg REGISTRY=mcr.microsoft.com/mirror/docker/library + - name: Run docker compose build + run: docker compose -f docker-compose-wsl2.yml build --build-arg REGISTRY=mcr.microsoft.com/mirror/docker/library - - name: Run docker-compose up - run: docker-compose -f docker-compose-wsl2.yml up --detach --scale chrome=2 + - name: Run docker compose up + run: docker compose -f docker-compose-wsl2.yml up --detach --scale chrome=2 - name: Wait for Docker to be ready run: | @@ -269,7 +269,7 @@ jobs: - if: always() name: Print Docker logs - run: docker-compose -f docker-compose-wsl2.yml logs + run: docker compose -f docker-compose-wsl2.yml logs - if: always() name: Append ID to test result diff --git a/__tests__/__image_snapshots__/chrome-docker/style-options-js-style-options-bubble-background-and-color-1-snap.png b/__tests__/__image_snapshots__/chrome-docker/style-options-js-style-options-bubble-background-and-color-1-snap.png deleted file mode 100644 index d9bbfb5417..0000000000 Binary files a/__tests__/__image_snapshots__/chrome-docker/style-options-js-style-options-bubble-background-and-color-1-snap.png and /dev/null differ diff --git a/__tests__/__image_snapshots__/chrome-docker/style-options-js-style-options-hide-scroll-to-bottom-button-1-snap.png b/__tests__/__image_snapshots__/chrome-docker/style-options-js-style-options-hide-scroll-to-bottom-button-1-snap.png deleted file mode 100644 index 8f7c71cce2..0000000000 Binary files a/__tests__/__image_snapshots__/chrome-docker/style-options-js-style-options-hide-scroll-to-bottom-button-1-snap.png and /dev/null differ diff --git a/__tests__/__image_snapshots__/chrome-docker/style-options-js-style-options-hide-scroll-to-bottom-button-2-snap.png b/__tests__/__image_snapshots__/chrome-docker/style-options-js-style-options-hide-scroll-to-bottom-button-2-snap.png deleted file mode 100644 index 153284c88c..0000000000 Binary files a/__tests__/__image_snapshots__/chrome-docker/style-options-js-style-options-hide-scroll-to-bottom-button-2-snap.png and /dev/null differ diff --git a/__tests__/__image_snapshots__/chrome-docker/video-js-video-1-snap.png b/__tests__/__image_snapshots__/chrome-docker/video-js-video-1-snap.png index 12df712fa6..3ca5366456 100644 Binary files a/__tests__/__image_snapshots__/chrome-docker/video-js-video-1-snap.png and b/__tests__/__image_snapshots__/chrome-docker/video-js-video-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/chat-adapter-direct-line-app-service-extension-js-direct-line-app-service-service-chat-adapter-should-connect-to-the-mock-bot-1-snap.png b/__tests__/__image_snapshots__/html/chat-adapter-direct-line-app-service-extension-js-direct-line-app-service-service-chat-adapter-should-connect-to-the-mock-bot-1-snap.png index 76ee65ac0e..3f3c251d51 100644 Binary files a/__tests__/__image_snapshots__/html/chat-adapter-direct-line-app-service-extension-js-direct-line-app-service-service-chat-adapter-should-connect-to-the-mock-bot-1-snap.png and b/__tests__/__image_snapshots__/html/chat-adapter-direct-line-app-service-extension-js-direct-line-app-service-service-chat-adapter-should-connect-to-the-mock-bot-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/conversation-start-properties-no-locale-is-sent-js-conversation-start-properties-with-no-locale-is-sent-should-get-hello-and-welcome-message-1-snap.png b/__tests__/__image_snapshots__/html/conversation-start-properties-no-locale-is-sent-js-conversation-start-properties-with-no-locale-is-sent-should-get-hello-and-welcome-message-1-snap.png index 60e934cd50..712f13b2b8 100644 Binary files a/__tests__/__image_snapshots__/html/conversation-start-properties-no-locale-is-sent-js-conversation-start-properties-with-no-locale-is-sent-should-get-hello-and-welcome-message-1-snap.png and b/__tests__/__image_snapshots__/html/conversation-start-properties-no-locale-is-sent-js-conversation-start-properties-with-no-locale-is-sent-should-get-hello-and-welcome-message-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/conversation-start-properties-send-en-us-js-conversation-start-properties-with-locale-of-en-us-should-get-hello-and-welcome-message-1-snap.png b/__tests__/__image_snapshots__/html/conversation-start-properties-send-en-us-js-conversation-start-properties-with-locale-of-en-us-should-get-hello-and-welcome-message-1-snap.png index 60e934cd50..70325cd939 100644 Binary files a/__tests__/__image_snapshots__/html/conversation-start-properties-send-en-us-js-conversation-start-properties-with-locale-of-en-us-should-get-hello-and-welcome-message-1-snap.png and b/__tests__/__image_snapshots__/html/conversation-start-properties-send-en-us-js-conversation-start-properties-with-locale-of-en-us-should-get-hello-and-welcome-message-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/conversation-start-properties-send-invalid-type-js-conversation-start-properties-with-locale-of-invalid-type-should-get-hello-and-welcome-message-1-snap.png b/__tests__/__image_snapshots__/html/conversation-start-properties-send-invalid-type-js-conversation-start-properties-with-locale-of-invalid-type-should-get-hello-and-welcome-message-1-snap.png index 60e934cd50..712f13b2b8 100644 Binary files a/__tests__/__image_snapshots__/html/conversation-start-properties-send-invalid-type-js-conversation-start-properties-with-locale-of-invalid-type-should-get-hello-and-welcome-message-1-snap.png and b/__tests__/__image_snapshots__/html/conversation-start-properties-send-invalid-type-js-conversation-start-properties-with-locale-of-invalid-type-should-get-hello-and-welcome-message-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/conversation-start-properties-send-non-existing-js-conversation-start-properties-with-non-existing-locale-should-get-hello-and-welcome-message-1-snap.png b/__tests__/__image_snapshots__/html/conversation-start-properties-send-non-existing-js-conversation-start-properties-with-non-existing-locale-should-get-hello-and-welcome-message-1-snap.png index 60e934cd50..7c662e4c4c 100644 Binary files a/__tests__/__image_snapshots__/html/conversation-start-properties-send-non-existing-js-conversation-start-properties-with-non-existing-locale-should-get-hello-and-welcome-message-1-snap.png and b/__tests__/__image_snapshots__/html/conversation-start-properties-send-non-existing-js-conversation-start-properties-with-non-existing-locale-should-get-hello-and-welcome-message-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/conversation-start-properties-send-non-iso-format-js-conversation-start-properties-with-non-iso-format-locale-should-get-hello-and-welcome-message-1-snap.png b/__tests__/__image_snapshots__/html/conversation-start-properties-send-non-iso-format-js-conversation-start-properties-with-non-iso-format-locale-should-get-hello-and-welcome-message-1-snap.png index 60e934cd50..809585b2b9 100644 Binary files a/__tests__/__image_snapshots__/html/conversation-start-properties-send-non-iso-format-js-conversation-start-properties-with-non-iso-format-locale-should-get-hello-and-welcome-message-1-snap.png and b/__tests__/__image_snapshots__/html/conversation-start-properties-send-non-iso-format-js-conversation-start-properties-with-non-iso-format-locale-should-get-hello-and-welcome-message-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/conversation-start-properties-send-zh-cn-js-conversation-start-properties-with-locale-of-zh-cn-should-get-hello-and-welcome-in-simplified-chinese-1-snap.png b/__tests__/__image_snapshots__/html/conversation-start-properties-send-zh-cn-js-conversation-start-properties-with-locale-of-zh-cn-should-get-hello-and-welcome-in-simplified-chinese-1-snap.png index 029b279549..3bd852d2df 100644 Binary files a/__tests__/__image_snapshots__/html/conversation-start-properties-send-zh-cn-js-conversation-start-properties-with-locale-of-zh-cn-should-get-hello-and-welcome-in-simplified-chinese-1-snap.png and b/__tests__/__image_snapshots__/html/conversation-start-properties-send-zh-cn-js-conversation-start-properties-with-locale-of-zh-cn-should-get-hello-and-welcome-in-simplified-chinese-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/style-options-bubble-border-js-bubble-border-with-color-radius-style-and-width-set-1-snap.png b/__tests__/__image_snapshots__/html/style-options-bubble-border-js-bubble-border-with-color-radius-style-and-width-set-1-snap.png index 5b1dd598f0..63699f251f 100644 Binary files a/__tests__/__image_snapshots__/html/style-options-bubble-border-js-bubble-border-with-color-radius-style-and-width-set-1-snap.png and b/__tests__/__image_snapshots__/html/style-options-bubble-border-js-bubble-border-with-color-radius-style-and-width-set-1-snap.png differ diff --git a/__tests__/__image_snapshots__/chrome-docker/file-attachment-js-show-zip-files-with-content-url-1-snap.png b/__tests__/__image_snapshots__/html/upload-zip-file-with-content-url-js-upload-a-zip-file-with-content-url-should-send-1-snap.png similarity index 100% rename from __tests__/__image_snapshots__/chrome-docker/file-attachment-js-show-zip-files-with-content-url-1-snap.png rename to __tests__/__image_snapshots__/html/upload-zip-file-with-content-url-js-upload-a-zip-file-with-content-url-should-send-1-snap.png diff --git a/__tests__/__image_snapshots__/chrome-docker/file-attachment-js-show-zip-files-without-content-url-1-snap.png b/__tests__/__image_snapshots__/html/upload-zip-file-without-content-url-js-upload-a-zip-file-without-content-url-should-send-1-snap.png similarity index 100% rename from __tests__/__image_snapshots__/chrome-docker/file-attachment-js-show-zip-files-without-content-url-1-snap.png rename to __tests__/__image_snapshots__/html/upload-zip-file-without-content-url-js-upload-a-zip-file-without-content-url-should-send-1-snap.png diff --git a/__tests__/fileAttachment.js b/__tests__/fileAttachment.js deleted file mode 100644 index 383116841a..0000000000 --- a/__tests__/fileAttachment.js +++ /dev/null @@ -1,139 +0,0 @@ -import { imageSnapshotOptions, timeouts } from './constants.json'; - -import allImagesLoaded from './setup/conditions/allImagesLoaded'; -import minNumActivitiesShown from './setup/conditions/minNumActivitiesShown'; -import uiConnected from './setup/conditions/uiConnected'; -import getActivityElements from './setup/elements/getActivityElements'; - -// selenium-webdriver API doc: -// https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html - -jest.setTimeout(timeouts.test); - -test('show ZIP files with contentUrl', async () => { - const { driver, pageObjects } = await setupWebDriver({ - createDirectLine: options => { - const directLine = window.WebChat.createDirectLine(options); - const patchedDirectLine = { - activity$: new Observable(observer => { - const subscription = directLine.activity$.subscribe({ - next(activity) { - observer.next( - Object.assign({}, activity, { - attachments: (activity.attachments || []).map(attachment => - Object.assign({}, attachment, { - contentUrl: 'https://example.org/' - }) - ) - }) - ); - } - }); - - return () => subscription.unsubscribe(); - }), - - connectionStatus$: directLine.connectionStatus$, - postActivity: directLine.postActivity.bind(directLine), - token: directLine.token - }; - - return patchedDirectLine; - }, - props: { styleOptions: { sendAttachmentOn: 'attach' } } - }); - - await driver.wait(uiConnected(), timeouts.directLine); - - await pageObjects.sendFile('empty.zip'); - await driver.wait(minNumActivitiesShown(2), timeouts.directLine); - await driver.wait(allImagesLoaded(), timeouts.fetchImage); - - const base64PNG = await driver.takeScreenshot(); - - expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions); - - const [firstActivity, secondActivity] = await getActivityElements(driver); - - await expect( - driver.executeScript( - firstActivity => firstActivity.querySelector('a[target="_blank"]').getAttribute('href'), - firstActivity - ) - ).resolves.toEqual('https://example.org/'); - - await expect( - driver.executeScript( - firstActivity => firstActivity.querySelector('a[target="_blank"]').getAttribute('download'), - firstActivity - ) - ).resolves.toEqual('empty.zip'); - - await expect( - driver.executeScript( - secondActivity => secondActivity.querySelector('a[target="_blank"]').getAttribute('href'), - secondActivity - ) - ).resolves.toEqual('https://example.org/'); - - await expect( - driver.executeScript( - secondActivity => secondActivity.querySelector('a[target="_blank"]').getAttribute('download'), - secondActivity - ) - ).resolves.toEqual('empty.zip'); -}); - -test('show ZIP files without contentUrl', async () => { - const { driver, pageObjects } = await setupWebDriver({ - createDirectLine: options => { - const directLine = window.WebChat.createDirectLine(options); - const patchedDirectLine = { - activity$: new Observable(observer => { - const subscription = directLine.activity$.subscribe({ - next(activity) { - observer.next( - Object.assign({}, activity, { - attachments: (activity.attachments || []).map(attachment => - Object.assign({}, attachment, { - contentUrl: undefined - }) - ) - }) - ); - } - }); - - return () => subscription.unsubscribe(); - }), - - connectionStatus$: directLine.connectionStatus$, - postActivity: directLine.postActivity.bind(directLine), - token: directLine.token - }; - - return patchedDirectLine; - }, - props: { styleOptions: { sendAttachmentOn: 'attach' } } - }); - - await driver.wait(uiConnected(), timeouts.directLine); - - await pageObjects.sendFile('empty.zip'); - await driver.wait(minNumActivitiesShown(2), timeouts.directLine); - await driver.wait(allImagesLoaded(), timeouts.fetchImage); - - const base64PNG = await driver.takeScreenshot(); - - expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions); - - await expect( - driver.executeScript(() => !!document.querySelector('[role="listitem"]:nth-child(1) a')) - ).resolves.toBeFalsy(); - await expect( - driver.executeScript(() => !!document.querySelector('[role="listitem"]:nth-child(2) a')) - ).resolves.toBeFalsy(); - await expect( - driver.executeScript(() => !!document.querySelector('[role="listitem"]:nth-child(1) a')) - ).resolves.toBeFalsy(); -}); diff --git a/__tests__/hooks/useReferenceGrammarId.js b/__tests__/hooks/useReferenceGrammarId.js deleted file mode 100644 index ac534329b8..0000000000 --- a/__tests__/hooks/useReferenceGrammarId.js +++ /dev/null @@ -1,33 +0,0 @@ -import { timeouts } from '../constants.json'; - -// selenium-webdriver API doc: -// https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html - -jest.setTimeout(timeouts.test); - -test('getter should return reference grammar ID', async () => { - const { pageObjects } = await setupWebDriver({ - createDirectLine: options => { - const workingDirectLine = window.WebChat.createDirectLine(options); - - return { - activity$: workingDirectLine.activity$, - connectionStatus$: workingDirectLine.connectionStatus$, - getSessionId: workingDirectLine.getSessionId.bind(workingDirectLine), - postActivity: workingDirectLine.postActivity.bind(workingDirectLine), - referenceGrammarId: '12345678-1234-5678-abcd-12345678abcd' - }; - } - }); - - const [referenceGrammarID] = await pageObjects.runHook('useReferenceGrammarID'); - - expect(referenceGrammarID).toBe('12345678-1234-5678-abcd-12345678abcd'); -}); - -test('setter should be falsy', async () => { - const { pageObjects } = await setupWebDriver(); - const [_, setReferenceGrammarID] = await pageObjects.runHook('useReferenceGrammarID'); - - expect(setReferenceGrammarID).toBeFalsy(); -}); diff --git a/__tests__/html/assets/uploads/empty.zip b/__tests__/html/assets/uploads/empty.zip new file mode 100644 index 0000000000..37e10a926f Binary files /dev/null and b/__tests__/html/assets/uploads/empty.zip differ diff --git a/__tests__/html/chatAdapter.directLineAppServiceExtension.html b/__tests__/html/chatAdapter.directLineAppServiceExtension.html index 3f50ef624a..af4f9cb00d 100644 --- a/__tests__/html/chatAdapter.directLineAppServiceExtension.html +++ b/__tests__/html/chatAdapter.directLineAppServiceExtension.html @@ -1,4 +1,4 @@ - +
@@ -10,19 +10,18 @@ + + + + + + + + + + + diff --git a/__tests__/html/hooks.useReferenceGrammarId.js b/__tests__/html/hooks.useReferenceGrammarId.js new file mode 100644 index 0000000000..c1136cd13b --- /dev/null +++ b/__tests__/html/hooks.useReferenceGrammarId.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('useReferenceGrammarId', () => { + test('should return value', () => runHTML('hooks.useReferenceGrammarId.html')); +}); diff --git a/__tests__/html/speech.customAudioConfig.html b/__tests__/html/speech.customAudioConfig.html index c84cb5b2f7..32d9508357 100644 --- a/__tests__/html/speech.customAudioConfig.html +++ b/__tests__/html/speech.customAudioConfig.html @@ -11,7 +11,7 @@ + + + + + + + +