From 81109c2a2b4a01a19b2a0c0e2fc24ad0ee730bdc Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 19 May 2020 08:37:47 +0000 Subject: [PATCH] Re-enabled syntax highlighting tests --- .../src/app/editor/sourceHighlighter.js | 4 +- .../test-browser/tests/editor.test.js | 71 +++++++++---------- 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/apps/remix-ide/src/app/editor/sourceHighlighter.js b/apps/remix-ide/src/app/editor/sourceHighlighter.js index 8b45081829..cf30861bed 100644 --- a/apps/remix-ide/src/app/editor/sourceHighlighter.js +++ b/apps/remix-ide/src/app/editor/sourceHighlighter.js @@ -31,7 +31,7 @@ class SourceHighlighter { } } - currentSourceLocationFromfileName (lineColumnPos, filePath, style) { + async currentSourceLocationFromfileName (lineColumnPos, filePath, style) { if (this.statementMarker) this._deps.editor.removeMarker(this.statementMarker, this.source) if (this.fullLineMarker) this._deps.editor.removeMarker(this.fullLineMarker, this.source) this.statementMarker = null @@ -40,7 +40,7 @@ class SourceHighlighter { if (lineColumnPos) { this.source = filePath if (this._deps.config.get('currentFile') !== this.source) { - this._deps.fileManager.switchFile(this.source) + await this._deps.fileManager.switchFile(this.source) } const css = csjs` diff --git a/apps/remix-ide/test-browser/tests/editor.test.js b/apps/remix-ide/test-browser/tests/editor.test.js index 9d1941b842..92dcfb24ba 100644 --- a/apps/remix-ide/test-browser/tests/editor.test.js +++ b/apps/remix-ide/test-browser/tests/editor.test.js @@ -70,44 +70,43 @@ module.exports = { .checkElementStyle('.ace_comment.ace_doc', 'color', aceThemes.dark.comment) .checkElementStyle('.ace_function', 'color', aceThemes.dark.function) .checkElementStyle('.ace_variable', 'color', aceThemes.dark.variable) - .end() }, - // 'Should highlight source code': function (browser) { - // browser.addFile('sourcehighlight.js', sourcehighlightScript) - // .switchFile('browser/sourcehighlight.js') - // .executeScript('remix.exeCurrent()') - // .editorScroll('down', 60) - // .waitForElementPresent('.highlightLine32') - // .checkElementStyle('.highlightLine32', 'background-color', 'rgb(8, 108, 181)') - // .waitForElementPresent('.highlightLine40') - // .checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)') - // .waitForElementPresent('.highlightLine50') - // .checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)') - // }, - - // 'Should remove 1 highlight from source code': function (browser) { - // browser.addFile('removeSourcehighlightScript.js', removeSourcehighlightScript) - // .switchFile('browser/removeSourcehighlightScript.js') - // .executeScript('remix.exeCurrent()') - // .switchFile('browser/3_Ballot.sol') - // .editorScroll('down', 60) - // .waitForElementNotPresent('.highlightLine32') - // .checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)') - // .checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)') - // }, - - // 'Should remove all highlights from source code': function (browser) { - // browser.addFile('removeAllSourcehighlightScript.js', removeAllSourcehighlightScript) - // .switchFile('browser/removeAllSourcehighlightScript.js') - // .executeScript('remix.exeCurrent()') - // .switchFile('browser/3_Ballot.sol') - // .editorScroll('down', 60) - // .waitForElementNotPresent('.highlightLine32') - // .waitForElementNotPresent('.highlightLine40') - // .waitForElementNotPresent('.highlightLine50') - // .end() - // }, + 'Should highlight source code': function (browser) { + browser.addFile('sourcehighlight.js', sourcehighlightScript) + .switchFile('browser/sourcehighlight.js') + .executeScript('remix.exeCurrent()') + .editorScroll('down', 60) + .waitForElementPresent('.highlightLine32') + .checkElementStyle('.highlightLine32', 'background-color', 'rgb(8, 108, 181)') + .waitForElementPresent('.highlightLine40') + .checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)') + .waitForElementPresent('.highlightLine50') + .checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)') + }, + + 'Should remove 1 highlight from source code': function (browser) { + browser.addFile('removeSourcehighlightScript.js', removeSourcehighlightScript) + .switchFile('browser/removeSourcehighlightScript.js') + .executeScript('remix.exeCurrent()') + .switchFile('browser/3_Ballot.sol') + .editorScroll('down', 60) + .waitForElementNotPresent('.highlightLine32') + .checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)') + .checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)') + }, + + 'Should remove all highlights from source code': function (browser) { + browser.addFile('removeAllSourcehighlightScript.js', removeAllSourcehighlightScript) + .switchFile('browser/removeAllSourcehighlightScript.js') + .executeScript('remix.exeCurrent()') + .switchFile('browser/3_Ballot.sol') + .editorScroll('down', 60) + .waitForElementNotPresent('.highlightLine32') + .waitForElementNotPresent('.highlightLine40') + .waitForElementNotPresent('.highlightLine50') + .end() + }, tearDown: sauce }