From 5568844672fe3ba9617d330a110a44810cad2030 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Wed, 9 Dec 2020 13:20:27 +0100 Subject: [PATCH] using getValue in test --- .../src/commands/addAtAddressInstance.ts | 28 ++++++++-------- apps/remix-ide-e2e/src/tests/runAndDeploy.ts | 33 ++++++++++++++++--- 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts b/apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts index 2369b576d8..5adb6a9fd4 100644 --- a/apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts +++ b/apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts @@ -16,20 +16,20 @@ class addAtAddressInstance extends EventEmitter { function addInstance (browser: NightwatchBrowser, address: string, isValidFormat: boolean, isValidChecksum: boolean, callback: VoidFunction) { browser.clickLaunchIcon('udapp').clearValue('.ataddressinput').setValue('.ataddressinput', address, function () { browser.click('button[id^="runAndDeployAtAdressButton"]') - .execute(function () { - const ret = document.querySelector('div[class^="modal-body"] div').innerHTML - const modal = document.querySelector('#modal-footer-ok') as HTMLElement - - modal.click() - return ret - }, [], function (result) { - if (!isValidFormat) { - browser.assert.equal(result.value, 'Invalid address.') - } else if (!isValidChecksum) { - browser.assert.equal(result.value, 'Invalid checksum address.') - } - callback() - }) + .execute(function () { + const ret = document.querySelector('div[class^="modal-body"] div').innerHTML + const modal = document.querySelector('#modal-footer-ok') as HTMLElement + + modal.click() + return ret + }, [], function (result) { + if (!isValidFormat) { + browser.assert.equal(result.value, 'Invalid address.') + } else if (!isValidChecksum) { + browser.assert.equal(result.value, 'Invalid checksum address.') + } + callback() + }) }) } diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy.ts index 0e5409ce06..a5c07092d0 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy.ts @@ -1,4 +1,5 @@ 'use strict' +import { doesNotThrow } from 'assert' import { NightwatchBrowser } from "nightwatch" import init from '../helpers/init' import sauce from './sauce' @@ -29,15 +30,39 @@ module.exports = { .clearValue('#value') .setValue('#value', '0000') .click('*[data-id="remixDRValueLabel"]') - .assert.containsText('*[data-id="dandrValue"]', '0') + .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') - .assert.containsText('*[data-id="dandrValue"]', '0') + .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', '') - .assert.containsText('*[data-id="dandrValue"]', '0') + .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') - .assert.containsText('*[data-id="dandrValue"]', '0') + .execute(function () { + const elem = document.getElementById('value') as HTMLInputElement + return elem + }, [], function (result) { + console.log('loging ', result.value) + browser.assert.equal(result.value, "0") + }) }, 'Should sign message using account key': function (browser: NightwatchBrowser) {