Skip to content

Commit

Permalink
Merge branch 'fix-1818' of github.com:corinagum/BotFramework-WebChat …
Browse files Browse the repository at this point in the history
…into fix-1818
  • Loading branch information
corinagum committed Aug 22, 2019
2 parents db85bac + 61e45a9 commit bd408f4
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 4 deletions.
4 changes: 3 additions & 1 deletion __tests__/clockSkew.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { By, Condition, Key } from 'selenium-webdriver';
import { By } from 'selenium-webdriver';

import { imageSnapshotOptions, timeouts } from './constants.json';
import allImagesLoaded from './setup/conditions/allImagesLoaded';
import allOutgoingActivitiesSent from './setup/conditions/allOutgoingActivitiesSent';
import minNumActivitiesShown from './setup/conditions/minNumActivitiesShown';
import uiConnected from './setup/conditions/uiConnected';
Expand Down Expand Up @@ -149,6 +150,7 @@ describe('Clock skew', () => {
await driver.executeScript(() => window.WebChatTest.releaseActivity(3));
await driver.wait(minNumActivitiesShown(5), timeouts.directLine);
await driver.wait(allOutgoingActivitiesSent(), timeouts.directLine);
await driver.wait(allImagesLoaded(), timeouts.fetch);

expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);
});
Expand Down
3 changes: 3 additions & 0 deletions __tests__/disabledUI.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { imageSnapshotOptions, timeouts } from './constants.json';
import uiConnected from './setup/conditions/uiConnected.js';

// selenium-webdriver API doc:
// https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html
Expand All @@ -12,6 +13,8 @@ describe('tests the UI of disabled Web Chat', () => {

const { driver } = await setupWebDriver({ props: { styleOptions, disabled } });

await driver.wait(uiConnected(), timeouts.directLine);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
Expand Down
3 changes: 3 additions & 0 deletions __tests__/offlineUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ describe('offline UI', () => {
await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
await driver.wait(actionDispatched('WEB_CHAT/SAGA_ERROR'), timeouts.directLine);

// Wait until error status come up
await driver.wait(async () => /render error/iu.test(await pageObjects.getNotificationText()), timeouts.ui);

const base64PNG = await driver.takeScreenshot();

expect(base64PNG).toMatchImageSnapshot(imageSnapshotOptions);
Expand Down
2 changes: 1 addition & 1 deletion __tests__/setup/conditions/allImagesLoaded.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Condition } from 'selenium-webdriver';

export default function allImagesLoaded() {
return new Condition(
'Waiting for all images to be loaded',
'all images to be loaded',
async driver =>
await driver.executeScript(() => [].every.call(document.querySelectorAll('img'), ({ complete }) => complete))
);
Expand Down
9 changes: 9 additions & 0 deletions __tests__/setup/pageObjects/getNotificationText.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { By } from 'selenium-webdriver';

export default async function getNotificationText(driver) {
const notificationTextAriaLabel = driver.findElement(By.css('[role="status"] > [aria-label]'));

if (notificationTextAriaLabel) {
return await notificationTextAriaLabel.getAttribute('innerText');
}
}
2 changes: 2 additions & 0 deletions __tests__/setup/pageObjects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import dispatchAction from './dispatchAction';
import endSpeechSynthesize from './endSpeechSynthesize';
import errorSpeechSynthesize from './errorSpeechSynthesize';
import executePromiseScript from './executePromiseScript';
import getNotificationText from './getNotificationText';
import getNumActivitiesShown from './getNumActivitiesShown';
import getSendBoxText from './getSendBoxText';
import getStore from './getStore';
Expand Down Expand Up @@ -35,6 +36,7 @@ export default function pageObjects(driver) {
endSpeechSynthesize,
errorSpeechSynthesize,
executePromiseScript,
getNotificationText,
getNumActivitiesShown,
getSendBoxText,
getStore,
Expand Down
2 changes: 0 additions & 2 deletions packages/component/src/SendBox/ConnectivityStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ const ConnectivityStatus = ({ connectivityStatus, language, styleSet }) => {
renderUninitialized
]);

console.warn({ connectivityStatus });

return (
<div aria-atomic="false" aria-live="polite" role="status">
<DebouncedConnectivityStatus
Expand Down

0 comments on commit bd408f4

Please sign in to comment.