forked from microsoft/BotFramework-WebChat
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
300 additions
and
59 deletions.
There are no files selected for viewing
Binary file added
BIN
+92.2 KB
...hrome-docker/carousel-js-carousel-with-avatar-initials-2-attachments-1-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+59.3 KB
.../carousel-js-carousel-with-avatar-initials-4-attachments-and-message-1-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+21.6 KB
.../carousel-js-carousel-with-avatar-initials-4-attachments-and-message-2-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+54.1 KB
...rousel-js-carousel-with-avatar-initials-4-attachments-and-no-message-1-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.5 KB
...rousel-js-carousel-with-avatar-initials-4-attachments-and-no-message-2-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+100 KB
...me-docker/carousel-js-carousel-without-avatar-initials-2-attachments-1-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+59.4 KB
...rousel-js-carousel-without-avatar-initials-4-attachments-and-message-1-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19.9 KB
...rousel-js-carousel-without-avatar-initials-4-attachments-and-message-2-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+54.7 KB
...sel-js-carousel-without-avatar-initials-4-attachments-and-no-message-1-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.8 KB
...sel-js-carousel-without-avatar-initials-4-attachments-and-no-message-2-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-21 Bytes
(100%)
...how-correctly-formatted-buttons-when-suggested-actions-are-displayed-1-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-15 Bytes
(100%)
...ommand-should-show-response-from-bot-and-no-text-from-user-on-imback-1-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-15 Bytes
(100%)
...d-should-show-response-from-bot-and-no-text-from-user-on-messageback-1-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-11 Bytes
(100%)
...mand-should-show-response-from-bot-and-no-text-from-user-on-postback-1-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-15 Bytes
(100%)
...mand-should-show-response-from-bot-and-text-from-user-on-messageback-1-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-12 Bytes
(100%)
...command-should-show-response-from-bot-and-text-from-user-on-postback-1-snap.png
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
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,183 @@ | ||
import { By, Key } from 'selenium-webdriver'; | ||
|
||
import { imageSnapshotOptions, timeouts } from './constants.json'; | ||
import directLineConnected from './setup/conditions/directLineConnected'; | ||
import minNumActivitiesReached from './setup/conditions/minNumActivitiesReached'; | ||
import webChatLoaded from './setup/conditions/webChatLoaded'; | ||
|
||
// selenium-webdriver API doc: | ||
// https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html | ||
|
||
describe('carousel without avatar initials', () => { | ||
test('4 attachments and no message', async () => { | ||
const { driver, pageObjects } = await setupWebDriver(); | ||
|
||
await driver.wait(webChatLoaded(), timeouts.navigation); | ||
await driver.wait(directLineConnected(), timeouts.directLine); | ||
|
||
const input = await driver.findElement(By.css('input[type="text"]')); | ||
|
||
await input.sendKeys('carousel', Key.RETURN); | ||
await driver.wait(minNumActivitiesReached(2), timeouts.directLine); | ||
|
||
// TODO: [P2] Remove this sleep which wait for the image to be loaded | ||
await driver.sleep(1000); | ||
|
||
// Hide cursor before taking screenshot | ||
await pageObjects.hideCursor(); | ||
|
||
expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); | ||
|
||
const rightFlipper = await driver.findElement(By.css('button[aria-label="Right"]')); | ||
|
||
await rightFlipper.click(); | ||
await rightFlipper.click(); | ||
await rightFlipper.click(); | ||
await rightFlipper.click(); | ||
|
||
// Wait for carousel animation to finish | ||
await driver.sleep(1000); | ||
|
||
expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); | ||
}, 60000); | ||
|
||
test('4 attachments and message', async () => { | ||
const { driver, pageObjects } = await setupWebDriver(); | ||
|
||
await driver.wait(webChatLoaded(), timeouts.navigation); | ||
await driver.wait(directLineConnected(), timeouts.directLine); | ||
|
||
const input = await driver.findElement(By.css('input[type="text"]')); | ||
|
||
await input.sendKeys('layout carousel', Key.RETURN); | ||
await driver.wait(minNumActivitiesReached(2), timeouts.directLine); | ||
|
||
// TODO: [P2] Remove this sleep which wait for the image to be loaded | ||
await driver.sleep(1000); | ||
|
||
// Hide cursor before taking screenshot | ||
await pageObjects.hideCursor(); | ||
|
||
expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); | ||
|
||
const rightFlipper = await driver.findElement(By.css('button[aria-label="Right"]')); | ||
|
||
await rightFlipper.click(); | ||
await rightFlipper.click(); | ||
await rightFlipper.click(); | ||
await rightFlipper.click(); | ||
|
||
// Wait for carousel animation to finish | ||
await driver.sleep(1000); | ||
|
||
expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); | ||
}, 60000); | ||
|
||
test('2 attachments', async () => { | ||
const { driver, pageObjects } = await setupWebDriver({ width: 640 }); | ||
|
||
await driver.wait(webChatLoaded(), timeouts.navigation); | ||
await driver.wait(directLineConnected(), timeouts.directLine); | ||
|
||
const input = await driver.findElement(By.css('input[type="text"]')); | ||
|
||
await input.sendKeys('layout double', Key.RETURN); | ||
await driver.wait(minNumActivitiesReached(2), timeouts.directLine); | ||
|
||
// TODO: [P2] Remove this sleep which wait for the image to be loaded | ||
await driver.sleep(1000); | ||
|
||
// Hide cursor before taking screenshot | ||
await pageObjects.hideCursor(); | ||
|
||
expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); | ||
}, 60000); | ||
}); | ||
|
||
describe('carousel with avatar initials', () => { | ||
const WEB_CHAT_PROPS = { styleOptions: { botAvatarInitials: 'BF', userAvatarInitials: 'WC' } }; | ||
|
||
test('4 attachments and no message', async () => { | ||
const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS }); | ||
|
||
await driver.wait(webChatLoaded(), timeouts.navigation); | ||
await driver.wait(directLineConnected(), timeouts.directLine); | ||
|
||
const input = await driver.findElement(By.css('input[type="text"]')); | ||
|
||
await input.sendKeys('carousel', Key.RETURN); | ||
await driver.wait(minNumActivitiesReached(2), timeouts.directLine); | ||
|
||
// TODO: [P2] Remove this sleep which wait for the image to be loaded | ||
await driver.sleep(1000); | ||
|
||
// Hide cursor before taking screenshot | ||
await pageObjects.hideCursor(); | ||
|
||
expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); | ||
|
||
const rightFlipper = await driver.findElement(By.css('button[aria-label="Right"]')); | ||
|
||
await rightFlipper.click(); | ||
await rightFlipper.click(); | ||
await rightFlipper.click(); | ||
await rightFlipper.click(); | ||
|
||
// Wait for carousel animation to finish | ||
await driver.sleep(1000); | ||
|
||
expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); | ||
}, 60000); | ||
|
||
test('4 attachments and message', async () => { | ||
const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS }); | ||
|
||
await driver.wait(webChatLoaded(), timeouts.navigation); | ||
await driver.wait(directLineConnected(), timeouts.directLine); | ||
|
||
const input = await driver.findElement(By.css('input[type="text"]')); | ||
|
||
await input.sendKeys('layout carousel', Key.RETURN); | ||
await driver.wait(minNumActivitiesReached(2), timeouts.directLine); | ||
|
||
// TODO: [P2] Remove this sleep which wait for the image to be loaded | ||
await driver.sleep(1000); | ||
|
||
// Hide cursor before taking screenshot | ||
await pageObjects.hideCursor(); | ||
|
||
expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); | ||
|
||
const rightFlipper = await driver.findElement(By.css('button[aria-label="Right"]')); | ||
|
||
await rightFlipper.click(); | ||
await rightFlipper.click(); | ||
await rightFlipper.click(); | ||
await rightFlipper.click(); | ||
|
||
// Wait for carousel animation to finish | ||
await driver.sleep(1000); | ||
|
||
expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); | ||
}, 60000); | ||
|
||
test('2 attachments', async () => { | ||
const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS, width: 640 }); | ||
|
||
await driver.wait(webChatLoaded(), timeouts.navigation); | ||
await driver.wait(directLineConnected(), timeouts.directLine); | ||
|
||
const input = await driver.findElement(By.css('input[type="text"]')); | ||
|
||
await input.sendKeys('layout double', Key.RETURN); | ||
await driver.wait(minNumActivitiesReached(2), timeouts.directLine); | ||
|
||
// TODO: [P2] Remove this sleep which wait for the image to be loaded | ||
await driver.sleep(1000); | ||
|
||
// Hide cursor before taking screenshot | ||
await pageObjects.hideCursor(); | ||
|
||
expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions); | ||
}, 60000); | ||
}); |
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 |
---|---|---|
|
@@ -3,5 +3,9 @@ | |
"customDiffConfig": { | ||
"threshold": 0.14 | ||
} | ||
}, | ||
"timeouts": { | ||
"directLine": 2500, | ||
"navigation": 5000 | ||
} | ||
} |
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,12 @@ | ||
import { Condition } from 'selenium-webdriver'; | ||
|
||
export default function () { | ||
return new Condition('Waiting for Direct Line to connect', async driver => { | ||
return await driver.executeScript(() => { | ||
const { store } = window.WebChatTest; | ||
const { activities } = store.getState(); | ||
|
||
return activities.filter(({ from: { role } }) => role === 'user').every(({ channelData: { state } }) => state === 'sent'); | ||
}); | ||
}); | ||
} |
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 @@ | ||
import { By, until } from 'selenium-webdriver'; | ||
|
||
export default function () { | ||
return until.elementLocated(By.css('[role="form"] ul')); | ||
} |
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,3 @@ | ||
export default async function hideCursor(driver) { | ||
await driver.executeScript(() => document.querySelector(':focus').blur()); | ||
} |
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,7 @@ | ||
import hideCursor from './hideCursor'; | ||
|
||
export default function (driver) { | ||
return { | ||
hideCursor: hideCursor.bind(null, driver) | ||
}; | ||
} |
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
Oops, something went wrong.