Skip to content

Commit

Permalink
Remove a test
Browse files Browse the repository at this point in the history
  • Loading branch information
compulim committed Jul 10, 2019
1 parent 611ff17 commit 96c1d44
Showing 1 changed file with 3 additions and 42 deletions.
45 changes: 3 additions & 42 deletions __tests__/speech.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,25 @@
import { imageSnapshotOptions, timeouts } from './constants.json';
import { timeouts } from './constants.json';

import allOutgoingActivitiesSent from './setup/conditions/allOutgoingActivitiesSent.js';
import minNumActivitiesShown from './setup/conditions/minNumActivitiesShown';
import speechRecognitionStarted, {
negate as speechRecognitionNotStarted
} from './setup/conditions/speechRecognitionStarted';
import { negate as speechRecognitionNotStarted } from './setup/conditions/speechRecognitionStarted';
import speechSynthesisPending, { negate as speechSynthesisNotPending } from './setup/conditions/speechSynthesisPending';
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);

describe('speech recognition', () => {
test('should send on successful recognition', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
webSpeechPonyfillFactory: () => window.WebSpeechMock
}
});

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

const microphoneButton = await pageObjects.getMicrophoneButton();

await microphoneButton.click();

await driver.wait(speechRecognitionStarted(), timeouts.ui);
await pageObjects.putSpeechRecognitionResult('recognize', 'Hello, World!');
await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
await driver.wait(allOutgoingActivitiesSent(), timeouts.directLine);
await driver.wait(speechSynthesisPending(), timeouts.ui);

const utterance = await pageObjects.startSpeechSynthesize();

expect(utterance).toHaveProperty(
'text',
`Unknown command: I don't know Hello, World!. You can say \"help\" to learn more.`
);

await pageObjects.endSpeechSynthesize();
await driver.wait(speechRecognitionStarted(), timeouts.ui);
});

test('should not start recognition after typing on keyboard while synthesizing', async () => {
const { driver, pageObjects } = await setupWebDriver({
props: {
webSpeechPonyfillFactory: () => window.WebSpeechMock
}
});

const microphoneButton = await pageObjects.getMicrophoneButton();

await microphoneButton.click();
await pageObjects.sendMessageViaMicrophone('Hello, World!');

await driver.wait(speechRecognitionStarted(), timeouts.ui);
await pageObjects.putSpeechRecognitionResult('recognize', 'Hello, World!');
await driver.wait(minNumActivitiesShown(2), timeouts.directLine);
await driver.wait(allOutgoingActivitiesSent(), timeouts.directLine);
await driver.wait(speechSynthesisPending(), timeouts.ui);

const utterance = await pageObjects.startSpeechSynthesize();
Expand Down

0 comments on commit 96c1d44

Please sign in to comment.