added a command 'validateValueInput'

added file
pull/5370/head
LianaHus 4 years ago committed by Liana Husikyan
parent 5568844672
commit 21f93abd1f
  1. 22
      apps/remix-ide-e2e/src/commands/validateValueInput.ts
  2. 40
      apps/remix-ide-e2e/src/tests/runAndDeploy.ts
  3. 3
      apps/remix-ide-e2e/src/types/index.d.ts

@ -0,0 +1,22 @@
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'
class ValidateValueInput extends EventEmitter {
command (this: NightwatchBrowser, selector: string, valueTosSet: string, expectedValue: string) {
const browser = this.api
browser.perform((done) => {
browser.clearValue(selector)
.setValue(selector, valueTosSet)
.execute(function (selector) {
const elem = document.querySelector(selector) as HTMLInputElement
return elem.value
}, [selector], function (result) {
browser.assert.equal(result.value, expectedValue)
done()
})
})
return this
}
}
module.exports = ValidateValueInput

@ -27,42 +27,10 @@ module.exports = {
'Should load run and deploy tab and check value validation': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
.assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEPLOY & RUN TRANSACTIONS')
.clearValue('#value')
.setValue('#value', '0000')
.click('*[data-id="remixDRValueLabel"]')
.execute(function () {
const elem = document.getElementById('value') as HTMLInputElement
return elem.value
}, [], function (result) {
console.log('logging ', result)
browser.assert.equal(result.value, "0")
})
.clearValue('#value')
.setValue('#value', '-44')
.execute(function () {
const elem = document.getElementById('value') as HTMLInputElement
return elem
}, [], function (result) {
console.log('loging ', result.value)
browser.assert.equal(result.value, "0")
})
.clearValue('#value')
.setValue('#value', '')
.execute(function () {
const elem = document.getElementById('value') as HTMLInputElement
return elem
}, [], function (result) {
console.log('loging ', result.value)
browser.assert.equal(result.value, "0")
})
.setValue('#value', 'dragon')
.execute(function () {
const elem = document.getElementById('value') as HTMLInputElement
return elem
}, [], function (result) {
console.log('loging ', result.value)
browser.assert.equal(result.value, "0")
})
.validateValueInput('#value', '0000', '0')
.validateValueInput('#value', '-44', '0')
.validateValueInput('#value', '', '0')
.validateValueInput('#value', 'dragon', '0')
},
'Should sign message using account key': function (browser: NightwatchBrowser) {

@ -51,7 +51,8 @@ declare module "nightwatch" {
sendLowLevelTx(address: string, value: string, callData: string): NightwatchBrowser,
journalLastChild(val: string): NightwatchBrowser,
checkTerminalFilter(filter: string, test: string): NightwatchBrowser,
noWorkerErrorFor(version: string): NightwatchBrowser
noWorkerErrorFor(version: string): NightwatchBrowser,
validateValueInput(selector: string, valueTosSet: string, expectedValue: string): NightwatchBrowser
}
export interface NightwatchBrowser {

Loading…
Cancel
Save