Fix failing gist test

pull/1/head
ioedeveloper 5 years ago
parent b08b20de97
commit ffa2e74adc
  1. 1
      package.json
  2. 2
      src/app/files/file-explorer.js
  3. 2
      src/app/ui/landing-page/landing-page.js
  4. 2
      src/app/ui/modal-dialog-custom.js
  5. 2
      src/app/ui/modaldialog.js
  6. 42
      test-browser/tests/gist.js

@ -174,7 +174,6 @@
"nightwatch_local_remixd": "nightwatch ./test-browser/tests/remixd.js --config nightwatch.js --env chrome ", "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_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_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_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_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 ", "nightwatch_local_pluginManager": "nightwatch ./test-browser/tests/pluginManager.js --config nightwatch.js --env chrome ",

@ -643,7 +643,7 @@ fileExplorer.prototype.renderMenuItems = function () {
` `
} else { } else {
return yo` return yo`
<span id=${action} onclick=${(event) => { event.stopPropagation(); this[ action ]() }} class="newFile ${icon} ${css.newFile}" title=${title}></span> <span id=${action} data-id="fileExplorerNewFile${action}" onclick=${(event) => { event.stopPropagation(); this[ action ]() }} class="newFile ${icon} ${css.newFile}" title=${title}></span>
` `
} }
}) })

@ -216,7 +216,7 @@ export class LandingPage extends ViewPlugin {
<p class="mb-1 ${css.text}" onclick=${() => connectToLocalhost()}>Connect to Localhost</p> <p class="mb-1 ${css.text}" onclick=${() => connectToLocalhost()}>Connect to Localhost</p>
<p class="mb-1">Import From:</p> <p class="mb-1">Import From:</p>
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-sm btn-secondary" onclick="${() => importFromGist()}">Gist</button> <button class="btn btn-sm btn-secondary" data-id="landingPageImportFromGistButton" onclick="${() => importFromGist()}">Gist</button>
<button class="btn btn-sm btn-secondary" onclick="${() => load('Github', 'github URL', ['https://github.com/0xcert/ethereum-erc721/src/contracts/tokens/nf-token-metadata.sol', 'https://github.com/OpenZeppelin/openzeppelin-solidity/blob/67bca857eedf99bf44a4b6a0fc5b5ed553135316/contracts/access/Roles.sol', 'github:OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol#v2.1.2'])}">GitHub</button> <button class="btn btn-sm btn-secondary" onclick="${() => load('Github', 'github URL', ['https://github.com/0xcert/ethereum-erc721/src/contracts/tokens/nf-token-metadata.sol', 'https://github.com/OpenZeppelin/openzeppelin-solidity/blob/67bca857eedf99bf44a4b6a0fc5b5ed553135316/contracts/access/Roles.sol', 'github:OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol#v2.1.2'])}">GitHub</button>
<button class="btn btn-sm btn-secondary" onclick="${() => load('Swarm', 'bzz-raw URL', ['bzz-raw://<swarm-hash>'])}">Swarm</button> <button class="btn btn-sm btn-secondary" onclick="${() => load('Swarm', 'bzz-raw URL', ['bzz-raw://<swarm-hash>'])}">Swarm</button>
<button class="btn btn-sm btn-secondary" onclick="${() => load('Ipfs', 'ipfs URL', ['ipfs://<ipfs-hash>'])}">Ipfs</button> <button class="btn btn-sm btn-secondary" onclick="${() => load('Ipfs', 'ipfs URL', ['ipfs://<ipfs-hash>'])}">Ipfs</button>

@ -66,7 +66,7 @@ module.exports = {
function prompt (title, text, hidden, inputValue, ok, cancel, focus) { function prompt (title, text, hidden, inputValue, ok, cancel, focus) {
if (!inputValue) inputValue = '' if (!inputValue) inputValue = ''
var type = hidden ? 'password' : 'text' var type = hidden ? 'password' : 'text'
var input = yo`<input type=${type} name='prompt_text' id='prompt_text' class="${css['prompt_text']} form-control" value='${inputValue}' >` var input = yo`<input type=${type} name='prompt_text' id='prompt_text' class="${css['prompt_text']} form-control" value='${inputValue}' data-id="modalDialogCustomPromptText">`
modal(title, yo`<div>${text}<div>${input}</div></div>`, modal(title, yo`<div>${text}<div>${input}</div></div>`,
{ {
fn: () => { if (typeof ok === 'function') ok(document.getElementById('prompt_text').value) } fn: () => { if (typeof ok === 'function') ok(document.getElementById('prompt_text').value) }

@ -134,7 +134,7 @@ function html (opts) {
<div id="modal-background" class="modal-dialog" role="document"> <div id="modal-background" class="modal-dialog" role="document">
<div class="modal-content ${css.modalContent} ${opts.class}"> <div class="modal-content ${css.modalContent} ${opts.class}">
<div class="modal-header"> <div class="modal-header">
<h6 class="modal-title"></h6> <h6 class="modal-title" data-id="modalDialogModalTitle"></h6>
<span class="modal-close"> <span class="modal-close">
<i id="modal-close" title="Close" class="fas fa-times" aria-hidden="true"></i> <i id="modal-close" title="Close" class="fas fa-times" aria-hidden="true"></i>
</span> </span>

@ -20,9 +20,9 @@ module.exports = {
*/ */
console.log('token', process.env.gist_token) console.log('token', process.env.gist_token)
browser browser
.waitForElementVisible('#icon-panel', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('#publishToGist') .click('*[data-id="fileExplorerNewFilepublishToGist"]')
.modalFooterOKClick() .modalFooterOKClick()
.getModalBody((value, done) => { .getModalBody((value, done) => {
const reg = /gist.github.com\/([^.]+)/ const reg = /gist.github.com\/([^.]+)/
@ -44,38 +44,38 @@ module.exports = {
}, },
'Load Gist Modal': function (browser) { 'Load Gist Modal': function (browser) {
browser browser.clickLaunchIcon('home')
.waitForElementVisible('#icon-panel', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.scrollAndClick('div.file > div.btn-group > button:nth-child(1)') .scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
.waitForElementVisible('h6.modal-title') .waitForElementVisible('*[data-id="modalDialogModalTitle"]')
.assert.containsText('h6.modal-title', 'Load a Gist') .assert.containsText('*[data-id="modalDialogModalTitle"]', 'Load a Gist')
.waitForElementVisible('div.modal-body > div') .waitForElementVisible('*[data-id="modalDialogModalBody"]')
.assert.containsText('div.modal-body > div', 'Enter the ID of the Gist or URL you would like to load.') .assert.containsText('*[data-id="modalDialogModalBody"]', 'Enter the ID of the Gist or URL you would like to load.')
.waitForElementVisible('#prompt_text') .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.click('#modal-footer-cancel') .modalFooterCancelClick()
}, },
'Display Error Message For Invalid Gist ID': function (browser) { 'Display Error Message For Invalid Gist ID': function (browser) {
browser browser
.waitForElementVisible('#icon-panel', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.scrollAndClick('div.file > div.btn-group > button:nth-child(1)') .scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
.waitForElementVisible('#prompt_text') .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.setValue('#prompt_text', testData.invalidGistId) .setValue('*[data-id="modalDialogCustomPromptText"]', testData.invalidGistId)
.modalFooterOKClick() .modalFooterOKClick()
.waitForElementVisible('div.modal-body > div') .waitForElementVisible('*[data-id="modalDialogModalBody"]')
.assert.containsText('div.modal-body > div', 'Gist load error: Not Found') .assert.containsText('*[data-id="modalDialogModalBody"]', 'Gist load error: Not Found')
.modalFooterOKClick() .modalFooterOKClick()
}, },
'Import From Gist For Valid Gist ID': function (browser) { 'Import From Gist For Valid Gist ID': function (browser) {
browser browser
.waitForElementVisible('#icon-panel', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.scrollAndClick('div.file > div.btn-group > button:nth-child(1)') .scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
.waitForElementVisible('#prompt_text') .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.setValue('#prompt_text', testData.validGistId) .setValue('*[data-id="modalDialogCustomPromptText"]', testData.validGistId)
.modalFooterOKClick() .modalFooterOKClick()
.switchFile(`browser/gists/${testData.validGistId}`) .switchFile(`browser/gists/${testData.validGistId}`)
.switchFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`) .switchFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`)

Loading…
Cancel
Save