-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
1 changed file
with
70 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { timeouts } from '../constants.json'; | ||
|
||
import suggestedActionsShown from '../setup/conditions/suggestedActionsShown'; | ||
import uiConnected from '../setup/conditions/uiConnected'; | ||
|
||
// 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 get suggested actions', async () => { | ||
const { driver, pageObjects } = await setupWebDriver(); | ||
|
||
await driver.wait(uiConnected(), timeouts.directLine); | ||
|
||
await pageObjects.sendMessageViaSendBox('suggested-actions'); | ||
await driver.wait(suggestedActionsShown(), timeouts.directLine); | ||
|
||
await expect(pageObjects.runHook('useSuggestedActions', [], result => result[0])).resolves.toMatchInlineSnapshot(` | ||
Array [ | ||
Object { | ||
"image": "https://tdurnford.github.io/BotFramework-Offline-MockBot/assets/square-icon.png", | ||
"title": "IM back as string", | ||
"type": "imBack", | ||
"value": "postback imback-string", | ||
}, | ||
Object { | ||
"image": "https://tdurnford.github.io/BotFramework-Offline-MockBot/assets/square-icon-red.png", | ||
"title": "Post back as string", | ||
"type": "postBack", | ||
"value": "postback postback-string", | ||
}, | ||
Object { | ||
"image": "https://tdurnford.github.io/BotFramework-Offline-MockBot/assets/square-icon-green.png", | ||
"text": "Some text", | ||
"title": "Post back as JSON", | ||
"type": "postBack", | ||
"value": Object { | ||
"hello": "World!", | ||
}, | ||
}, | ||
Object { | ||
"displayText": "say Hello World!", | ||
"image": "https://tdurnford.github.io/BotFramework-Offline-MockBot/assets/square-icon-purple.png", | ||
"text": "Some text", | ||
"title": "Message back as JSON with display text", | ||
"type": "messageBack", | ||
"value": Object { | ||
"hello": "World!", | ||
}, | ||
}, | ||
Object { | ||
"image": "https://tdurnford.github.io/BotFramework-Offline-MockBot/assets/square-icon-purple.png", | ||
"title": "Message back as JSON without display text", | ||
"type": "messageBack", | ||
"value": Object { | ||
"hello": "World!", | ||
}, | ||
}, | ||
Object { | ||
"displayText": "Aloha", | ||
"image": "https://tdurnford.github.io/BotFramework-Offline-MockBot/assets/square-icon-purple.png", | ||
"text": "echo Hello", | ||
"title": "Message back as string with display text", | ||
"type": "messageBack", | ||
"value": null, | ||
}, | ||
] | ||
`); | ||
}); |