diff --git a/ci/browser_tests.sh b/ci/browser_tests.sh index ed89d8540a..68cc35caec 100755 --- a/ci/browser_tests.sh +++ b/ci/browser_tests.sh @@ -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 ] diff --git a/test-browser/commands/clickElementAtPosition.js b/test-browser/commands/clickElementAtPosition.js new file mode 100644 index 0000000000..b0ec4816f6 --- /dev/null +++ b/test-browser/commands/clickElementAtPosition.js @@ -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 diff --git a/test-browser/tests/solidityUnittests.js b/test-browser/tests/solidityUnittests.js index 5f649ac977..c52c73b847 100644 --- a/test-browser/tests/solidityUnittests.js +++ b/test-browser/tests/solidityUnittests.js @@ -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"]')