Modified data-attribute selector

pull/5370/head
ioedeveloper 5 years ago
parent cd8cf797a4
commit 835ffb4509
  1. 4
      test-browser/commands/journalChildIncludes.js
  2. 4
      test-browser/commands/journalLastChild.js
  3. 6
      test-browser/commands/journalLastChildIncludes.js
  4. 16
      test-browser/tests/terminal.js

@ -8,7 +8,7 @@ class JournalChildIncludes extends EventEmitter {
let isTextFound = false let isTextFound = false
const browser = this.api const browser = this.api
this.api.elements('css selector', 'div[data-id="terminalJournal"]', (res) => { this.api.elements('css selector', '*[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 ? `<div[data-id="terminalJournal"]> contains ${val}.` : `${val} not found in <div[data-id="terminalJournal"]> div:last-child>`) browser.assert.ok(isTextFound, isTextFound ? `<*[data-id="terminalJournal"]> contains ${val}.` : `${val} not found in <*[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('div[data-id="terminalJournal"] > div:last-child', 10000) .waitForElementVisible('*[data-id="terminalJournal"] > div:last-child', 10000)
.assert.containsText('div[data-id="terminalJournal"] > div:last-child', val).perform(() => { .assert.containsText('*[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('div[data-id="terminalJournal"] > div:last-child', 10000) .waitForElementVisible('*[data-id="terminalJournal"] > div:last-child', 10000)
.getText('div[data-id="terminalJournal"] > div:last-child', (result) => { .getText('*[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(`<div[data-id="terminalJournal"] > div:last-child> contains ${val}.`) else this.api.assert.ok(`<*[data-id="terminalJournal"] > div:last-child> contains ${val}.`)
this.emit('complete') this.emit('complete')
}) })
return this return this

@ -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('div[data-id="terminalCli"]', 10000) .waitForElementVisible('*[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('div[data-id="terminalCli"]') .waitForElementVisible('*[data-id="terminalCli"]')
.journalChildIncludes('Welcome to Remix') .journalChildIncludes('Welcome to Remix')
.click('#clearConsole') .click('#clearConsole')
.assert.containsText('div[data-id="terminalJournal"]', '') .assert.containsText('*[data-id="terminalJournal"]', '')
}, },
'Should display auto-complete menu': function (browser) { 'Should display auto-complete menu': function (browser) {
browser browser
.waitForElementVisible('div[data-id="terminalCli"]') .waitForElementVisible('*[data-id="terminalCli"]')
.click('div[data-id="terminalCli"]') .click('*[data-id="terminalCli"]')
.keys('remix.') .keys('remix.')
.assert.visible('div[data-id="autoCompletePopUpAutoCompleteItem"]') .assert.visible('*[data-id="autoCompletePopUpAutoCompleteItem"]')
}, },
'Should execute remix.help() command': function (browser) { 'Should execute remix.help() command': function (browser) {
browser browser
.waitForElementVisible('div[data-id="terminalCli"]') .waitForElementVisible('*[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('div[data-id="terminalCli"]') .waitForElementVisible('*[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