From b08b20de9777645b30ea5322080dec172e185804 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Fri, 21 Feb 2020 09:50:25 +0000 Subject: [PATCH 1/2] Merged importFromGist.js test into gist.js test --- test-browser/tests/gist.js | 44 +++++++++++++++++++++ test-browser/tests/importFromGist.js | 57 ---------------------------- 2 files changed, 44 insertions(+), 57 deletions(-) delete mode 100644 test-browser/tests/importFromGist.js diff --git a/test-browser/tests/gist.js b/test-browser/tests/gist.js index d552045284..e365c432c2 100644 --- a/test-browser/tests/gist.js +++ b/test-browser/tests/gist.js @@ -1,6 +1,10 @@ 'use strict' const init = require('../helpers/init') const sauce = require('./sauce') +const testData = { + validGistId: '1859c97c6e1efc91047d725d5225888e', + invalidGistId: '6368b389f9302v32902msk2402' +} // 99266d6da54cc12f37f11586e8171546c7700d67 module.exports = { @@ -37,6 +41,46 @@ module.exports = { .perform(done) } }) + }, + + 'Load Gist Modal': function (browser) { + browser + .waitForElementVisible('#icon-panel', 10000) + .clickLaunchIcon('fileExplorers') + .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') + .waitForElementVisible('h6.modal-title') + .assert.containsText('h6.modal-title', 'Load a Gist') + .waitForElementVisible('div.modal-body > div') + .assert.containsText('div.modal-body > div', 'Enter the ID of the Gist or URL you would like to load.') + .waitForElementVisible('#prompt_text') + .click('#modal-footer-cancel') + }, + + 'Display Error Message For Invalid Gist ID': function (browser) { + browser + .waitForElementVisible('#icon-panel', 10000) + .clickLaunchIcon('fileExplorers') + .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') + .waitForElementVisible('#prompt_text') + .setValue('#prompt_text', testData.invalidGistId) + .modalFooterOKClick() + .waitForElementVisible('div.modal-body > div') + .assert.containsText('div.modal-body > div', 'Gist load error: Not Found') + .modalFooterOKClick() + }, + + 'Import From Gist For Valid Gist ID': function (browser) { + browser + .waitForElementVisible('#icon-panel', 10000) + .clickLaunchIcon('fileExplorers') + .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') + .waitForElementVisible('#prompt_text') + .setValue('#prompt_text', testData.validGistId) + .modalFooterOKClick() + .switchFile(`browser/gists/${testData.validGistId}`) + .switchFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`) + .waitForElementVisible(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry']`) + .assert.containsText(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry'] > span`, 'ApplicationRegistry') .end() }, diff --git a/test-browser/tests/importFromGist.js b/test-browser/tests/importFromGist.js deleted file mode 100644 index 67c46bf285..0000000000 --- a/test-browser/tests/importFromGist.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict' -const init = require('../helpers/init') -const sauce = require('./sauce') - -const testData = { - validGistId: '1859c97c6e1efc91047d725d5225888e', - invalidGistId: '6368b389f9302v32902msk2402' -} - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - - 'Load Gist Modal': function (browser) { - browser - .waitForElementVisible('#icon-panel', 10000) - .clickLaunchIcon('fileExplorers') - .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') - .waitForElementVisible('h6.modal-title') - .assert.containsText('h6.modal-title', 'Load a Gist') - .waitForElementVisible('div.modal-body > div') - .assert.containsText('div.modal-body > div', 'Enter the ID of the Gist or URL you would like to load.') - .waitForElementVisible('#prompt_text') - .click('#modal-footer-cancel') - }, - - 'Display Error Message For Invalid Gist ID': function (browser) { - browser - .waitForElementVisible('#icon-panel', 10000) - .clickLaunchIcon('fileExplorers') - .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') - .waitForElementVisible('#prompt_text') - .setValue('#prompt_text', testData.invalidGistId) - .modalFooterOKClick() - .waitForElementVisible('div.modal-body > div') - .assert.containsText('div.modal-body > div', 'Gist load error: Not Found') - .modalFooterOKClick() - }, - - 'Import From Gist For Valid Gist ID': function (browser) { - browser - .waitForElementVisible('#icon-panel', 10000) - .clickLaunchIcon('fileExplorers') - .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') - .waitForElementVisible('#prompt_text') - .setValue('#prompt_text', testData.validGistId) - .modalFooterOKClick() - .switchFile(`browser/gists/${testData.validGistId}`) - .switchFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`) - .waitForElementVisible(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry']`) - .assert.containsText(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry'] > span`, 'ApplicationRegistry') - .end() - }, - - tearDown: sauce -} From ffa2e74adc96ab0c2382b861e0f19409278ad31b Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Fri, 21 Feb 2020 10:05:35 +0000 Subject: [PATCH 2/2] Fix failing gist test --- package.json | 1 - src/app/files/file-explorer.js | 2 +- src/app/ui/landing-page/landing-page.js | 2 +- src/app/ui/modal-dialog-custom.js | 2 +- src/app/ui/modaldialog.js | 2 +- test-browser/tests/gist.js | 42 ++++++++++++------------- 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index c711558e10..c07ddc0bfc 100644 --- a/package.json +++ b/package.json @@ -174,7 +174,6 @@ "nightwatch_local_remixd": "nightwatch ./test-browser/tests/remixd.js --config nightwatch.js --env chrome ", "nightwatch_local_terminal": "nightwatch ./test-browser/tests/terminal.js --config nightwatch.js --env chrome ", "nightwatch_local_gist": "nightwatch ./test-browser/tests/gist.js --config nightwatch.js --env chrome ", - "nightwatch_local_importFromGist": "nightwatch ./test-browser/tests/importFromGist.js --config nightwatch.js --env chrome ", "nightwatch_local_workspace": "nightwatch ./test-browser/tests/workspace.js --config nightwatch.js --env chrome ", "nightwatch_local_defaultLayout": "nightwatch ./test-browser/tests/defaultLayout.js --config nightwatch.js --env chrome ", "nightwatch_local_pluginManager": "nightwatch ./test-browser/tests/pluginManager.js --config nightwatch.js --env chrome ", diff --git a/src/app/files/file-explorer.js b/src/app/files/file-explorer.js index 4e69f490c7..3534f52a37 100644 --- a/src/app/files/file-explorer.js +++ b/src/app/files/file-explorer.js @@ -643,7 +643,7 @@ fileExplorer.prototype.renderMenuItems = function () { ` } else { return yo` - { event.stopPropagation(); this[ action ]() }} class="newFile ${icon} ${css.newFile}" title=${title}> + { event.stopPropagation(); this[ action ]() }} class="newFile ${icon} ${css.newFile}" title=${title}> ` } }) diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index 055e8a34b8..1548c4d4dd 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -216,7 +216,7 @@ export class LandingPage extends ViewPlugin {

connectToLocalhost()}>Connect to Localhost

Import From:

- + diff --git a/src/app/ui/modal-dialog-custom.js b/src/app/ui/modal-dialog-custom.js index 46eb2808c1..93b139e88a 100644 --- a/src/app/ui/modal-dialog-custom.js +++ b/src/app/ui/modal-dialog-custom.js @@ -66,7 +66,7 @@ module.exports = { function prompt (title, text, hidden, inputValue, ok, cancel, focus) { if (!inputValue) inputValue = '' var type = hidden ? 'password' : 'text' - var input = yo`` + var input = yo`` modal(title, yo`
${text}
${input}
`, { fn: () => { if (typeof ok === 'function') ok(document.getElementById('prompt_text').value) } diff --git a/src/app/ui/modaldialog.js b/src/app/ui/modaldialog.js index ddf734318b..a72b4a0941 100644 --- a/src/app/ui/modaldialog.js +++ b/src/app/ui/modaldialog.js @@ -134,7 +134,7 @@ function html (opts) {