Added custom command for element selection at position (index)

pull/1/head
ioedeveloper 5 years ago committed by Aniket
parent b4d51cac9e
commit 6cc2b5efd4
  1. 5
      ci/browser_tests.sh
  2. 24
      test-browser/commands/clickElementAtPosition.js
  3. 10
      test-browser/tests/solidityUnittests.js

@ -21,8 +21,9 @@ setupRemixd
sleep 5
npm run nightwatch_parallel || TEST_EXITCODE=1
npm run nightwatch_local_runAndDeploy || TEST_EXITCODE=1
npm run nightwatch_local_solidityUnitTests || TEST_EXITCODE=1
#npm run nightwatch_parallel || TEST_EXITCODE=1
#npm run nightwatch_local_runAndDeploy || TEST_EXITCODE=1
echo "$TEST_EXITCODE"
if [ "$TEST_EXITCODE" -eq 1 ]

@ -0,0 +1,24 @@
const EventEmitter = require('events')
class ClickElement extends EventEmitter {
command (cssSelector, index = 0) {
this.api.perform((done) => {
_clickElement(this.api, cssSelector, index, () => {
done()
this.emit('complete')
})
})
return this
}
}
function _clickElement (browser, cssSelector, index, cb) {
browser.waitForElementPresent(cssSelector)
.execute(function (cssSelector, index) {
document.querySelectorAll(cssSelector)[index].click()
}, [cssSelector, index], function () {
cb()
})
}
module.exports = ClickElement

@ -42,7 +42,7 @@ module.exports = {
.click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
.waitForElementPresent('*[data-id="testTabCheckAllTests"]')
.click('*[data-id="testTabCheckAllTests"]')
.click('.singleTestLabel:nth-of-type(2)')
.clickElementAtPosition('.singleTestLabel', 1)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(15000)
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/simple_storage_test.sol (MyTest)')
@ -60,7 +60,7 @@ module.exports = {
.click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
.waitForElementPresent('*[data-id="testTabCheckAllTests"]')
.click('*[data-id="testTabCheckAllTests"]')
.click('.singleTestLabel:nth-of-type(3)')
.clickElementAtPosition('.singleTestLabel', 2)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(20000)
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/ks2b_test.sol (kickstarterTest)')
@ -81,7 +81,7 @@ module.exports = {
.switchFile('browser/compilationError_test.sol')
.clickLaunchIcon('solidityUnitTesting')
.click('*[data-id="testTabCheckAllTests"]')
.click('.singleTestLabel:nth-of-type(4)')
.clickElementAtPosition('.singleTestLabel', 3)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(10000)
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsSummary"]')
@ -95,7 +95,7 @@ module.exports = {
.switchFile('browser/deployError_test.sol')
.clickLaunchIcon('solidityUnitTesting')
.click('*[data-id="testTabCheckAllTests"]')
.click('.singleTestLabel:nth-of-type(5)')
.clickElementAtPosition('.singleTestLabel', 4)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(10000)
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsSummary"]')
@ -109,7 +109,7 @@ module.exports = {
.switchFile('browser/methodFailure_test.sol')
.clickLaunchIcon('solidityUnitTesting')
.click('*[data-id="testTabCheckAllTests"]')
.click('.singleTestLabel:nth-of-type(6)')
.clickElementAtPosition('.singleTestLabel', 5)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(15000)
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsSummary"]')

Loading…
Cancel
Save