Merge pull request #2591 from ethereum/e2e-tests

Homepage Tests
pull/1/head
yann300 5 years ago committed by GitHub
commit c62d2d3457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      package.json
  2. 6
      src/app.js
  3. 2
      src/app/components/main-panel.js
  4. 2
      src/app/components/side-panel.js
  5. 5
      src/app/components/vertical-icons.js
  6. 2
      src/app/panels/file-panel.js
  7. 10
      src/app/panels/terminal.js
  8. 1
      src/app/ui/TreeView.js
  9. 4
      src/app/ui/landing-page/landing-page.js
  10. 24
      test-browser/commands/checkElementStyle.js
  11. 1
      test-browser/commands/journalLastChildIncludes.js
  12. 78
      test-browser/tests/defaultLayout.js

@ -175,6 +175,7 @@
"nightwatch_local_console": "nightwatch ./test-browser/tests/console.js --config nightwatch.js --env chrome ", "nightwatch_local_console": "nightwatch ./test-browser/tests/console.js --config nightwatch.js --env chrome ",
"nightwatch_local_gist": "nightwatch ./test-browser/tests/gist.js --config nightwatch.js --env chrome ", "nightwatch_local_gist": "nightwatch ./test-browser/tests/gist.js --config nightwatch.js --env chrome ",
"nightwatch_local_workspace": "nightwatch ./test-browser/tests/workspace.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 ",
"onchange": "onchange build/app.js -- npm-run-all lint", "onchange": "onchange build/app.js -- npm-run-all lint",
"prepublish": "mkdirp build; npm-run-all -ls downloadsolc_root build", "prepublish": "mkdirp build; npm-run-all -ls downloadsolc_root build",
"remixd": "remixd -s ./contracts --remix-ide http://127.0.0.1:8080", "remixd": "remixd -s ./contracts --remix-ide http://127.0.0.1:8080",

@ -141,21 +141,21 @@ class App {
if (self._view.el) return self._view.el if (self._view.el) return self._view.el
// not resizable // not resizable
self._view.iconpanel = yo` self._view.iconpanel = yo`
<div id="icon-panel" class="${css.iconpanel} bg-light"> <div id="icon-panel" data-id="remixIdeIconPanel" class="${css.iconpanel} bg-light">
${''} ${''}
</div> </div>
` `
// center panel, resizable // center panel, resizable
self._view.sidepanel = yo` self._view.sidepanel = yo`
<div id="side-panel" style="min-width: 320px;" class=${css.sidepanel}> <div id="side-panel" data-id="remixIdeSidePanel" style="min-width: 320px;" class=${css.sidepanel}>
${''} ${''}
</div> </div>
` `
// handle the editor + terminal // handle the editor + terminal
self._view.mainpanel = yo` self._view.mainpanel = yo`
<div id="main-panel" class=${css.mainpanel}> <div id="main-panel" data-id="remixIdeMainPanel" class=${css.mainpanel}>
${''} ${''}
</div> </div>
` `

@ -26,7 +26,7 @@ export class MainPanel extends AbstractPanel {
render () { render () {
return yo` return yo`
<div class=${css.pluginsContainer}> <div class=${css.pluginsContainer} data-id="mainPanelPluginsContainer">
${this.view} ${this.view}
</div>` </div>`
} }

@ -132,7 +132,7 @@ export class SidePanel extends AbstractPanel {
return yo` return yo`
<header class="${css.swapitHeader} px-3"> <header class="${css.swapitHeader} px-3">
<h6 class="${css.swapitTitle}">${name}</h6> <h6 class="${css.swapitTitle}" data-id="sidePanelSwapitTitle">${name}</h6>
${docLink} ${docLink}
${versionWarning} ${versionWarning}
</header> </header>

@ -227,6 +227,7 @@ export class VerticalIcons extends Plugin {
this.appManager.ensureActivated('home') this.appManager.ensureActivated('home')
}}" }}"
plugin="home" title="Home" plugin="home" title="Home"
data-id="verticalIconsHomeIcon"
> >
<svg id="Ebene_2" data-name="Ebene 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 100"> <svg id="Ebene_2" data-name="Ebene 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 100">
<title>remix_logo1</title> <title>remix_logo1</title>
@ -238,7 +239,7 @@ export class VerticalIcons extends Plugin {
</div>` </div>`
this.iconKind['fileexplorer'] = yo` this.iconKind['fileexplorer'] = yo`
<div id='fileExplorerIcons'> <div id='fileExplorerIcons' data-id="verticalIconsFileExplorerIcons">
</div> </div>
` `
@ -273,7 +274,7 @@ export class VerticalIcons extends Plugin {
` `
this.iconKind['settings'] = yo` this.iconKind['settings'] = yo`
<div id='settingsIcons'> <div id='settingsIcons' data-id="verticalIconsSettingsIcons">
</div> </div>
` `

@ -64,7 +64,7 @@ module.exports = class Filepanel extends ViewPlugin {
const explorers = yo` const explorers = yo`
<div> <div>
<div class=${css.treeview}>${fileExplorer.init()}</div> <div class=${css.treeview} data-id="filePanelFileExplorerTree">${fileExplorer.init()}</div>
<div class="filesystemexplorer ${css.treeview}">${fileSystemExplorer.init()}</div> <div class="filesystemexplorer ${css.treeview}">${fileSystemExplorer.init()}</div>
</div> </div>
` `

@ -123,14 +123,14 @@ class Terminal extends Plugin {
self._view.input.innerText = '\n' self._view.input.innerText = '\n'
self._view.cli = yo` self._view.cli = yo`
<div id="terminalCli" class="${css.cli}"> <div id="terminalCli" data-id="terminalCli" class="${css.cli}">
<span class=${css.prompt}>${'>'}</span> <span class=${css.prompt}>${'>'}</span>
${self._view.input} ${self._view.input}
</div> </div>
` `
self._view.icon = yo` self._view.icon = yo`
<i onmouseenter=${hover} onmouseleave=${hover} onmousedown=${minimize} <i onmouseenter=${hover} onmouseleave=${hover} onmousedown=${minimize}
class="btn btn-secondary btn-sm align-items-center ${css.toggleTerminal} fas fa-angle-double-down"></i>` class="btn btn-secondary btn-sm align-items-center ${css.toggleTerminal} fas fa-angle-double-down" data-id="terminalToggleIcon"></i>`
self._view.dragbar = yo` self._view.dragbar = yo`
<div onmousedown=${mousedown} class=${css.dragbarHorizontal}></div>` <div onmousedown=${mousedown} class=${css.dragbarHorizontal}></div>`
@ -146,7 +146,7 @@ class Terminal extends Plugin {
self._view.bar = yo` self._view.bar = yo`
<div class="${css.bar}"> <div class="${css.bar}">
${self._view.dragbar} ${self._view.dragbar}
<div class="${css.menu} border-top border-dark bg-light"> <div class="${css.menu} border-top border-dark bg-light" data-id="terminalToggleMenu">
${self._view.icon} ${self._view.icon}
<div class=${css.clear} id="clearConsole" onclick=${clear}> <div class=${css.clear} id="clearConsole" onclick=${clear}>
<i class="fas fa-ban" aria-hidden="true" title="Clear console" <i class="fas fa-ban" aria-hidden="true" title="Clear console"
@ -177,9 +177,9 @@ class Terminal extends Plugin {
</div> </div>
` `
self._view.term = yo` self._view.term = yo`
<div class="${css.terminal_container}" onscroll=${throttle(reattach, 10)} onclick=${focusinput}> <div class="${css.terminal_container}" data-id="terminalContainer" onscroll=${throttle(reattach, 10)} onclick=${focusinput}>
${self._components.autoCompletePopup.render()} ${self._components.autoCompletePopup.render()}
<div class="bg-secondary" style=" <div class="bg-secondary" data-id="terminalContainerDisplay" style="
position: absolute; position: absolute;
height: 100%; height: 100%;
width: 100%; width: 100%;

@ -91,6 +91,7 @@ class TreeView {
var list = yo`<ul key=${keyPath} class=${css.ul_tv}>${children}</ul>` var list = yo`<ul key=${keyPath} class=${css.ul_tv}>${children}</ul>`
list.style.display = 'none' list.style.display = 'none'
caret.className = list.style.display === 'none' ? `fas fa-caret-right caret ${css.caret_tv}` : `fas fa-caret-down caret ${css.caret_tv}` caret.className = list.style.display === 'none' ? `fas fa-caret-right caret ${css.caret_tv}` : `fas fa-caret-down caret ${css.caret_tv}`
caret.setAttribute('data-id', `treeViewToggle${keyPath}`)
label.onclick = function () { label.onclick = function () {
self.expand(keyPath) self.expand(keyPath)
} }

@ -177,7 +177,7 @@ export class LandingPage extends ViewPlugin {
document.location.reload() document.location.reload()
} }
const img = yo`<img src="assets/img/hexagon-remix-greengrey-texture.png"></img>` const img = yo`<img src="assets/img/hexagon-remix-greengrey-texture.png"></img>`
let container = yo`<div class="${css.homeContainer} bg-light"> let container = yo`<div class="${css.homeContainer} bg-light" data-id="landingPageHomeContainer">
<div> <div>
<div class="alert alert-info clearfix ${css.thisJumboton}"> <div class="alert alert-info clearfix ${css.thisJumboton}">
<div class="${css.headlineContainer}"> <div class="${css.headlineContainer}">
@ -189,7 +189,7 @@ export class LandingPage extends ViewPlugin {
</div> </div>
</div><!-- end of jumbotron --> </div><!-- end of jumbotron -->
</div><!-- end of jumbotron container --> </div><!-- end of jumbotron container -->
<div class="row ${css.hpSections}"> <div class="row ${css.hpSections}" data-id="landingPageHpSections">
<div id="col1" class="col-sm-7"> <div id="col1" class="col-sm-7">
<div class="mb-5"> <div class="mb-5">
<h4>Environments</h4> <h4>Environments</h4>

@ -0,0 +1,24 @@
const EventEmitter = require('events')
class checkElementStyle extends EventEmitter {
command (cssSelector, styleProperty, expectedResult) {
this.api.perform((done) => {
checkStyle(this.api, cssSelector, styleProperty, expectedResult, () => {
done()
this.emit('complete')
})
})
return this
}
}
function checkStyle (browser, cssSelector, styleProperty, expectedResult, callback) {
browser.execute(function (cssSelector, styleProperty) {
return window.getComputedStyle(document.querySelector(cssSelector)).getPropertyValue(styleProperty)
}, [cssSelector, styleProperty], function (result) {
browser.assert.equal(result.value, expectedResult)
callback()
})
}
module.exports = checkElementStyle

@ -10,6 +10,7 @@ class JournalLastChildIncludes extends EventEmitter {
.getText('#journal > div:last-child', (result) => { .getText('#journal > 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}.`)
this.emit('complete') this.emit('complete')
}) })
return this return this

@ -0,0 +1,78 @@
'use strict'
const init = require('../helpers/init')
const sauce = require('./sauce')
module.exports = {
before: function (browser, done) {
init(browser, done, 'http://127.0.0.1:8080', false)
},
'Loads Icon\'s Panel': function (browser) {
browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000)
.waitForElementVisible('div[data-id="verticalIconsHomeIcon"]')
.waitForElementVisible('div[plugin="fileExplorers"]')
.waitForElementVisible('div[plugin="pluginManager"]')
.waitForElementVisible('div[plugin="settings"]')
},
'Loads Side Panel': function (browser) {
browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]')
.assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
.waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
.waitForElementVisible('li[key="browser/4_Ballot_test.sol"]')
},
'Loads Main View': function (browser) {
browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]')
.waitForElementVisible('div[data-id="landingPageHomeContainer"]')
.waitForElementVisible('div[data-id="landingPageHpSections"]')
.waitForElementVisible('div[data-id="terminalContainer"]')
},
'Loads terminal': function (browser) {
browser
.waitForElementVisible('div[data-id="terminalCli"]', 10000)
.journalLastChildIncludes('Welcome to Remix')
},
'Toggles Side Panel': function (browser) {
browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]')
.assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
.clickLaunchIcon('fileExplorers')
.assert.hidden('div[data-id="remixIdeSidePanel"]')
.clickLaunchIcon('fileExplorers')
.assert.visible('div[data-id="remixIdeSidePanel"]')
.assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
},
'Toggles Terminal': function (browser) {
browser.waitForElementVisible('div[data-id="terminalContainer"]')
.assert.visible('div[data-id="terminalContainerDisplay"]')
.click('i[data-id="terminalToggleIcon"]')
.checkElementStyle('div[data-id="terminalToggleMenu"]', 'height', '35px')
.click('i[data-id="terminalToggleIcon"]')
.assert.visible('div[data-id="terminalContainerDisplay"]')
},
'Toggles File Explorer Browser': function (browser) {
browser
.waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
.assert.visible('ul[key="browser"]')
.click('div[data-id="treeViewTogglebrowser"]')
.assert.hidden('ul[key="browser"]')
.click('div[data-id="treeViewTogglebrowser"]')
.assert.visible('ul[key="browser"]')
},
'Switch Tabs using tabs icon': function (browser) {
browser
.waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
.switchFile('browser/3_Ballot.sol')
.assert.containsText('div[title="browser/3_Ballot.sol"]', '3_Ballot.sol')
.click('span[class^=dropdownCaret]')
.click('#homeItem')
.assert.containsText('div[title="home"]', 'Home')
.end()
},
tearDown: sauce
}
Loading…
Cancel
Save