From ce366632498a85d6c0fbd1147cab3afdcb670e38 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Wed, 8 Apr 2020 02:50:08 +0000 Subject: [PATCH] Separate nightwatch config for running Run and Deploy Tests --- ci/browser_tests.sh | 2 +- nightwatch.js | 14 ++++++++++++- package.json | 2 +- test-browser/tests/fileExplorer.js | 2 +- test-browser/tests/generalSettings.js | 2 +- test-browser/tests/runAndDeploy.js | 30 +++++---------------------- 6 files changed, 22 insertions(+), 30 deletions(-) diff --git a/ci/browser_tests.sh b/ci/browser_tests.sh index d09efa27ba..30ad9655ad 100755 --- a/ci/browser_tests.sh +++ b/ci/browser_tests.sh @@ -21,7 +21,7 @@ setupRemixd sleep 5 -npm run nightwatch_parallel || TEST_EXITCODE=1 +npm run nightwatch_parallel & nightwatch_local_runAndDeploy || TEST_EXITCODE=1 echo "$TEST_EXITCODE" if [ "$TEST_EXITCODE" -eq 1 ] diff --git a/nightwatch.js b/nightwatch.js index 78fd0153a0..c3067eebec 100644 --- a/nightwatch.js +++ b/nightwatch.js @@ -30,10 +30,22 @@ module.exports = { 'browserName': 'firefox', 'javascriptEnabled': true, 'acceptSslCerts': true - } + }, + 'exclude': ['./test-browser/tests/runAndDeploy.js'] }, 'chrome': { + 'desiredCapabilities': { + 'browserName': 'chrome', + 'javascriptEnabled': true, + 'acceptSslCerts': true, + 'goog:chromeOptions': { + 'args': ['window-size=2560,1440', 'start-fullscreen'] + } + } + }, + + 'chrome-runAndDeploy': { 'desiredCapabilities': { 'browserName': 'chrome', 'javascriptEnabled': true, diff --git a/package.json b/package.json index e618e50281..3757e7beb1 100644 --- a/package.json +++ b/package.json @@ -185,7 +185,7 @@ "nightwatch_local_fileExplorer": "nightwatch ./test-browser/tests/fileExplorer.js --config nightwatch.js --env chrome ", "nightwatch_local_debugger": "nightwatch ./test-browser/tests/debugger.js --config nightwatch.js --env chrome ", "nightwatch_local_editor": "nightwatch ./test-browser/tests/editor.js --config nightwatch.js --env chrome ", - "nightwatch_local_runAndDeploy": "nightwatch ./test-browser/tests/runAndDeploy.js --config nightwatch.js --env chrome ", + "nightwatch_local_runAndDeploy": "nightwatch ./test-browser/tests/runAndDeploy.js --config nightwatch.js --env chrome-runAndDeploy ", "onchange": "onchange build/app.js -- npm-run-all lint", "prepublish": "mkdirp build; npm-run-all -ls downloadsolc_root build", "remixd": "remixd -s ./contracts --remix-ide http://127.0.0.1:8080", diff --git a/test-browser/tests/fileExplorer.js b/test-browser/tests/fileExplorer.js index 839809967b..11ec9b8ea9 100644 --- a/test-browser/tests/fileExplorer.js +++ b/test-browser/tests/fileExplorer.js @@ -86,7 +86,7 @@ module.exports = { .pause(2000) .perform((done) => { if (runtimeBrowser === 'chrome') { - browser.switchBrowserTab(2) + browser.switchBrowserTab(1) .assert.urlContains('https://gist.github.com') } done() diff --git a/test-browser/tests/generalSettings.js b/test-browser/tests/generalSettings.js index 93c4dcfb2e..39885dd0f5 100644 --- a/test-browser/tests/generalSettings.js +++ b/test-browser/tests/generalSettings.js @@ -23,7 +23,7 @@ module.exports = { .waitForElementVisible('*[data-id="settingsTabGitterChannelButton"]') .click('*[data-id="settingsTabGitterChannelButton"]') .pause(2000) - .perform((done) => { if (runtimeBrowser === 'chrome') { browser.switchBrowserTab(2).assert.urlContains('https://gitter.im/ethereum/remix') } done() }) + .perform((done) => { if (runtimeBrowser === 'chrome') { browser.switchBrowserTab(1).assert.urlContains('https://gitter.im/ethereum/remix') } done() }) }, 'Should activate `generate contract metadata`': function (browser) { diff --git a/test-browser/tests/runAndDeploy.js b/test-browser/tests/runAndDeploy.js index 10da0b8b47..2f331a7a17 100644 --- a/test-browser/tests/runAndDeploy.js +++ b/test-browser/tests/runAndDeploy.js @@ -68,10 +68,7 @@ module.exports = { }, 'Should connect to Ropsten Test Network using MetaMask': function (browser) { - const runtimeBrowser = browser.capabilities.browserName - - runtimeBrowser === 'chrome' - ? browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') + browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) .click('.network-indicator__down-arrow') .useXpath().click("//span[text()='Ropsten Test Network']") @@ -89,14 +86,10 @@ module.exports = { .waitForElementPresent('.page-container__footer-button:nth-of-type(2)') .click('.page-container__footer-button:nth-of-type(2)') .switchBrowserTab(0) - : '' }, 'Should deploy contract on Ropsten Test Network using MetaMask': function (browser) { - const runtimeBrowser = browser.capabilities.browserName - - runtimeBrowser === 'chrome' - ? browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') + browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') .clickLaunchIcon('fileExplorers') .switchFile('browser/Greet.sol') .clickLaunchIcon('udapp') @@ -110,14 +103,10 @@ module.exports = { .waitForElementPresent('.transaction-status--submitted') .pause(35000) .switchBrowserTab(0) - : '' }, 'Should run low level interaction (fallback function) on Ropsten Test Network using MetaMask': function (browser) { - const runtimeBrowser = browser.capabilities.browserName - - runtimeBrowser === 'chrome' - ? browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') + browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .waitForElementPresent('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]') .waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') @@ -130,14 +119,10 @@ module.exports = { .waitForElementPresent('.transaction-status--submitted') .pause(35000) .switchBrowserTab(0) - : '' }, 'Should connect to Ethereum Main Network using MetaMask': function (browser) { - const runtimeBrowser = browser.capabilities.browserName - - runtimeBrowser === 'chrome' - ? browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') + browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(2) .waitForElementPresent('.network-indicator__down-arrow') .click('.network-indicator__down-arrow') @@ -152,14 +137,10 @@ module.exports = { .click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]') .waitForElementPresent('*[data-id="settingsNetworkEnv"]') .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Main (1) network') - : '' }, 'Should deploy contract on Ethereum Main Network using MetaMask': function (browser) { - const runtimeBrowser = browser.capabilities.browserName - - runtimeBrowser === 'chrome' - ? browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') + browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') .clickLaunchIcon('fileExplorers') .switchFile('browser/Greet.sol') .clickLaunchIcon('udapp') @@ -169,7 +150,6 @@ module.exports = { .assert.containsText('*[data-id="modalDialogModalBody"]', 'You are creating a transaction on the main network. Click confirm if you are sure to continue.') .modalFooterCancelClick() .end() - : browser.end() }, tearDown: sauce