From a4f54ea1dba8701427b8a8c1ca4f22bf9c0d739e Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Wed, 18 Mar 2020 16:09:48 +0000 Subject: [PATCH] Browser editor tests --- package.json | 1 + src/app/panels/tab-proxy.js | 4 +- src/app/tabs/compileTab/compilerContainer.js | 2 +- src/app/ui/renderer.js | 2 +- test-browser/tests/editor.js | 49 ++++++++++++++++++++ 5 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 test-browser/tests/editor.js diff --git a/package.json b/package.json index 3fcd8992cf..21370e317c 100644 --- a/package.json +++ b/package.json @@ -183,6 +183,7 @@ "nightwatch_local_generalSettings": "nightwatch ./test-browser/tests/generalSettings.js --config nightwatch.js --env chrome ", "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 ", "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/src/app/panels/tab-proxy.js b/src/app/panels/tab-proxy.js index 5c0d0871ad..fa42875908 100644 --- a/src/app/panels/tab-proxy.js +++ b/src/app/panels/tab-proxy.js @@ -180,8 +180,8 @@ export class TabProxy { const zoomBtns = yo`
- this.onZoomOut()}> - this.onZoomIn()}> + this.onZoomOut()}> + this.onZoomIn()}>
` diff --git a/src/app/tabs/compileTab/compilerContainer.js b/src/app/tabs/compileTab/compilerContainer.js index e89c416600..718d788ee6 100644 --- a/src/app/tabs/compileTab/compilerContainer.js +++ b/src/app/tabs/compileTab/compilerContainer.js @@ -189,7 +189,7 @@ class CompilerContainer { this._view.warnCompilationSlow = yo`` this._view.compileIcon = yo`` - this._view.autoCompile = yo`` + this._view.autoCompile = yo`` this._view.hideWarningsBox = yo`` if (this.data.autoCompile) this._view.autoCompile.setAttribute('checked', '') if (this.data.hideWarnings) this._view.hideWarningsBox.setAttribute('checked', '') diff --git a/src/app/ui/renderer.js b/src/app/ui/renderer.js index 6d9ee500a1..a373432172 100644 --- a/src/app/ui/renderer.js +++ b/src/app/ui/renderer.js @@ -90,7 +90,7 @@ Renderer.prototype.error = function (message, container, opt) { var $pre = $(opt.useSpan ? yo`` : yo`
`).html(message)
 
   let classList = opt.type === 'error' ? 'alert alert-danger' : 'alert alert-warning'
-  var $error = $(yo`
`).prepend($pre) + var $error = $(yo`
`).prepend($pre) $(container).append($error) $error.click((ev) => { diff --git a/test-browser/tests/editor.js b/test-browser/tests/editor.js new file mode 100644 index 0000000000..2d9682b921 --- /dev/null +++ b/test-browser/tests/editor.js @@ -0,0 +1,49 @@ +'use strict' +const init = require('../helpers/init') +const sauce = require('./sauce') + +module.exports = { + + before: function (browser, done) { + init(browser, done) + }, + + 'Should zoom in editor': function (browser) { + browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]') + .switchFile('browser/1_Storage.sol') + .waitForElementVisible('*[data-id="editorInput"]') + .checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px') + .click('*[data-id="tabProxyZoomIn"]') + .click('*[data-id="tabProxyZoomIn"]') + .checkElementStyle('*[data-id="editorInput"]', 'font-size', '14px') + }, + + 'Should zoom out editor': function (browser) { + browser.waitForElementVisible('*[data-id="editorInput"]') + .checkElementStyle('*[data-id="editorInput"]', 'font-size', '14px') + .click('*[data-id="tabProxyZoomOut"]') + .click('*[data-id="tabProxyZoomOut"]') + .checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px') + }, + + 'Should display compile error in editor': function (browser) { + browser.waitForElementVisible('*[data-id="editorInput"]') + .waitForElementVisible('*[class="ace_content"]') + .click('*[class="ace_content"]') + .keys('error') + .pause(2000) + .waitForElementVisible('.ace_error') + }, + + 'Should minimize and maximize codeblock in editor': function (browser) { + browser.waitForElementVisible('*[data-id="editorInput"]') + .waitForElementVisible('.ace_open') + .click('.ace_start:nth-of-type(1)') + .waitForElementVisible('.ace_closed') + .click('.ace_start:nth-of-type(1)') + .waitForElementVisible('.ace_open') + .end() + }, + + tearDown: sauce +}