Skip to content

Commit

Permalink
Fix demoVideo
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasnordquist committed Apr 20, 2020
1 parent ff00f7a commit 3c40be9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const ConnectionSettings = memo(function ConnectionSettings(props: Props) {
<Grid container={true} spacing={3}>
<Grid item={true} xs={8} className={classes.gridPadding}>
<TextField
className={classes.fullWidth}
className={`${classes.fullWidth} advanced-connection-settings-topic-input`}
label="Topic"
placeholder="example/topic"
margin="normal"
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/Demo/Mouse.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'
import { Theme, withStyles } from '@material-ui/core'
const cursor = require('./cursor.png')
import cursor from './cursor.png'

interface State {
enabled: boolean
Expand Down
2 changes: 1 addition & 1 deletion app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"allowSyntheticDefaultImports": true
},
"include": ["./src/**/*"],
"exclude": ["**/*.d.ts"],
"exclude": ["**/*.d.ts", ".src/**/*.png"],
"awesomeTypescriptLoaderOptions": {
"useCache": true,
"transpileModule": true,
Expand Down
9 changes: 5 additions & 4 deletions src/spec/scenarios/showAdvancedConnectionSettings.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { Browser, Element } from 'webdriverio'
import { clickOn, sleep, setTextInInput } from '../util'
import { Browser } from 'webdriverio'
import { clickOn, sleep, setInputText } from '../util'

export async function showAdvancedConnectionSettings(browser: Browser) {
const advancedSettingsButton = await browser.$('//button/span[contains(text(),"Advanced")]')
const addButton = await browser.$('//button/span[contains(text(),"Add")]')
const topicInput = await browser.$('//*[contains(@class, "advanced-connection-settings-topic-input")]//input')

await clickOn(advancedSettingsButton, browser)
await setTextInInput('Subscription', 'garden/#', browser)
await setInputText(topicInput, 'garden/#', browser)
await clickOn(addButton, browser)

await setTextInInput('Subscription', 'livingroom/#', browser)
await setInputText(topicInput, 'livingroom/#', browser)
await clickOn(addButton, browser)

await deleteFirstSubscribedTopic(browser)
Expand Down
6 changes: 6 additions & 0 deletions src/spec/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export async function deleteTextWithBackspaces(element: Element, browser: Browse
}
}

export async function setInputText(input: Element, text: string, browser: Browser) {
await clickOn(input, browser, 1)
await deleteTextWithBackspaces(input, browser)
await input.setValue(text)
}

export async function setTextInInput(name: string, text: string, browser: Browser) {
const input = await browser.$(`//label[contains(text(), "${name}")]/..//input`)
await clickOn(input, browser, 1)
Expand Down

0 comments on commit 3c40be9

Please sign in to comment.