Undo gist.js and importFrom.js tests merge and added unique identifiers for terminal tests

pull/1/head
ioedeveloper 5 years ago
parent 4bb44b8d04
commit b647c435fd
  1. 2
      src/app/panels/terminal.js
  2. 2
      src/app/ui/auto-complete-popup.js
  3. 6
      test-browser/commands/journalChildIncludes.js
  4. 4
      test-browser/commands/journalLastChild.js
  5. 6
      test-browser/commands/journalLastChildIncludes.js
  6. 45
      test-browser/tests/gist.js
  7. 57
      test-browser/tests/importFromGist.js
  8. 16
      test-browser/tests/terminal.js

@ -113,7 +113,7 @@ class Terminal extends Plugin {
render () { render () {
var self = this var self = this
if (self._view.el) return self._view.el if (self._view.el) return self._view.el
self._view.journal = yo`<div id="journal" class=${css.journal}></div>` self._view.journal = yo`<div id="journal" class=${css.journal} data-id="terminalJournal"></div>`
self._view.input = yo` self._view.input = yo`
<span class=${css.input} onload=${() => { this.focus() }} onpaste=${paste} onkeydown=${change}></span> <span class=${css.input} onload=${() => { this.focus() }} onpaste=${paste} onkeydown=${change}></span>
` `

@ -41,7 +41,7 @@ class AutoCompletePopup {
<div> <div>
${self.data._options.map((item, index) => { ${self.data._options.map((item, index) => {
return yo` return yo`
<div class="${css.autoCompleteItem} ${css.listHandlerHide} item ${self._selectedElement === index ? 'border border-primary' : ''}"> <div data-id="autoCompletePopUpAutoCompleteItem" class="${css.autoCompleteItem} ${css.listHandlerHide} item ${self._selectedElement === index ? 'border border-primary' : ''}">
<div value=${index} onclick=${(event) => { self.handleSelect(event.srcElement.innerText) }}> <div value=${index} onclick=${(event) => { self.handleSelect(event.srcElement.innerText) }}>
${getKeyOf(item)} ${getKeyOf(item)}
</div> </div>

@ -1,14 +1,14 @@
const EventEmitter = require('events') const EventEmitter = require('events')
/* /*
Checks if any child elements of journal (console) contains a value. Checks if any child elements of journal (console) contains a matching value.
*/ */
class JournalChildIncludes extends EventEmitter { class JournalChildIncludes extends EventEmitter {
command (val) { command (val) {
let isTextFound = false let isTextFound = false
const browser = this.api const browser = this.api
this.api.elements('css selector', '#journal', (res) => { this.api.elements('css selector', 'div[data-id="terminalJournal"]', (res) => {
res.value.forEach(function (jsonWebElement) { res.value.forEach(function (jsonWebElement) {
const jsonWebElementId = jsonWebElement.ELEMENT const jsonWebElementId = jsonWebElement.ELEMENT
@ -20,7 +20,7 @@ class JournalChildIncludes extends EventEmitter {
}) })
}) })
browser.perform(() => { browser.perform(() => {
browser.assert.ok(isTextFound, isTextFound ? `<#journal> contains ${val}.` : `${val} not found in <#journal > div:last-child>`) browser.assert.ok(isTextFound, isTextFound ? `<div[data-id="terminalJournal"]> contains ${val}.` : `${val} not found in <div[data-id="terminalJournal"]> div:last-child>`)
this.emit('complete') this.emit('complete')
}) })
return this return this

@ -3,8 +3,8 @@ const EventEmitter = require('events')
class JournalLastChild extends EventEmitter { class JournalLastChild extends EventEmitter {
command (val) { command (val) {
this.api this.api
.waitForElementVisible('#journal > div:last-child', 10000) .waitForElementVisible('div[data-id="terminalJournal"] > div:last-child', 10000)
.assert.containsText('#journal > div:last-child', val).perform(() => { .assert.containsText('div[data-id="terminalJournal"] > div:last-child', val).perform(() => {
this.emit('complete') this.emit('complete')
}) })
return this return this

@ -6,11 +6,11 @@ const EventEmitter = require('events')
class JournalLastChildIncludes extends EventEmitter { class JournalLastChildIncludes extends EventEmitter {
command (val) { command (val) {
this.api this.api
.waitForElementVisible('#journal > div:last-child', 10000) .waitForElementVisible('div[data-id="terminalJournal"] > div:last-child', 10000)
.getText('#journal > div:last-child', (result) => { .getText('div[data-id="terminalJournal"] > div:last-child', (result) => {
console.log('JournalLastChildIncludes', result.value) console.log('JournalLastChildIncludes', result.value)
if (result.value.indexOf(val) === -1) return this.api.assert.fail(`wait for ${val} in ${result.value}`) if (result.value.indexOf(val) === -1) return this.api.assert.fail(`wait for ${val} in ${result.value}`)
else this.api.assert.ok(`<#journal > div:last-child> contains ${val}.`) else this.api.assert.ok(`<div[data-id="terminalJournal"] > div:last-child> contains ${val}.`)
this.emit('complete') this.emit('complete')
}) })
return this return this

@ -1,10 +1,6 @@
'use strict' 'use strict'
const init = require('../helpers/init') const init = require('../helpers/init')
const sauce = require('./sauce') const sauce = require('./sauce')
const testData = {
validGistId: '1859c97c6e1efc91047d725d5225888e',
invalidGistId: '6368b389f9302v32902msk2402'
}
// 99266d6da54cc12f37f11586e8171546c7700d67 // 99266d6da54cc12f37f11586e8171546c7700d67
module.exports = { module.exports = {
@ -42,45 +38,6 @@ module.exports = {
} }
}) })
}, },
'Load Gist Modal': function (browser) {
browser
.waitForElementVisible('#icon-panel')
.clickLaunchIcon('home')
.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 tearDown: sauce
} }

@ -0,0 +1,57 @@
'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
}

@ -9,30 +9,30 @@ module.exports = {
'Should execution a simple console command': function (browser) { 'Should execution a simple console command': function (browser) {
browser browser
.waitForElementVisible('#terminalCli', 10000) .waitForElementVisible('div[data-id="terminalCli"]', 10000)
.executeScript('1+1') .executeScript('1+1')
.journalLastChild('2') .journalLastChild('2')
}, },
'Should clear console': function (browser) { 'Should clear console': function (browser) {
browser browser
.waitForElementVisible('#terminalCli') .waitForElementVisible('div[data-id="terminalCli"]')
.journalChildIncludes('Welcome to Remix') .journalChildIncludes('Welcome to Remix')
.click('#clearConsole') .click('#clearConsole')
.assert.containsText('#journal', '') .assert.containsText('div[data-id="terminalJournal"]', '')
}, },
'Should display auto-complete menu': function (browser) { 'Should display auto-complete menu': function (browser) {
browser browser
.waitForElementVisible('#terminalCli') .waitForElementVisible('div[data-id="terminalCli"]')
.click('#terminalCli') .click('div[data-id="terminalCli"]')
.keys('remix.') .keys('remix.')
.assert.visible('div[class^="autoCompleteItem"]') .assert.visible('div[data-id="autoCompletePopUpAutoCompleteItem"]')
}, },
'Should execute remix.help() command': function (browser) { 'Should execute remix.help() command': function (browser) {
browser browser
.waitForElementVisible('#terminalCli') .waitForElementVisible('div[data-id="terminalCli"]')
.executeScript('remix.help()') .executeScript('remix.help()')
.journalChildIncludes('remix.call(message: {name, key, payload})') .journalChildIncludes('remix.call(message: {name, key, payload})')
.journalChildIncludes('remix.getFile(path)') .journalChildIncludes('remix.getFile(path)')
@ -48,7 +48,7 @@ module.exports = {
'Should execute remix.debugHelp() command': function (browser) { 'Should execute remix.debugHelp() command': function (browser) {
browser browser
.waitForElementVisible('#terminalCli') .waitForElementVisible('div[data-id="terminalCli"]')
.executeScript('remix.debugHelp()') .executeScript('remix.debugHelp()')
.journalChildIncludes('Here are some examples of scripts that can be run (using remix.exeCurrent() or directly from the console)') .journalChildIncludes('Here are some examples of scripts that can be run (using remix.exeCurrent() or directly from the console)')
.journalChildIncludes('Please see https://www.npmjs.com/package/remix-debug for more informations') .journalChildIncludes('Please see https://www.npmjs.com/package/remix-debug for more informations')

Loading…
Cancel
Save