remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/apps/remix-ide/test-browser/tests/gist.test.js

98 lines
3.9 KiB

'use strict'
const init = require('../helpers/init')
const sauce = require('./sauce')
const testData = {
validGistId: '1859c97c6e1efc91047d725d5225888e',
invalidGistId: '6368b389f9302v32902msk2402'
}
// 99266d6da54cc12f37f11586e8171546c7700d67
module.exports = {
before: function (browser, done) {
init(browser, done)
},
'UploadToGists': function (browser) {
/*
- set the access token
- publish to gist
- retrieve the gist
- switch to a file in the new gist
*/
console.log('token', process.env.gist_token)
Nightwatch config for running tests in parallel Added drivers path for chrome and firefox Changed firefox port Installed geckodriver Changed firefox config cli_args config Fixed linting error Modified config Revert nightwatch config Fixed linting error Set drivers path Fixed linting error point driver path to new location Set marionette to false Removed cli_args option Set parallel command in ci Retry firefox in pipeline Retry firefox in ci pipeline Remove cli_args from nightwatch config Retry ci pipeline Load gecko in circleci Debug circleci Debug circleci Retry pipeline Retry pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Retry pipeline Retry pipeline Retry pipeline Retry pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Changed CI selenium-server-standalone to selenium-standalone Fixed linting error Set marionette to false Add download of old firefox to ci build Set marionette to true Set permission Rearranged steps Fix ci error Remove gecko driver Use node_modules selenium standalone Change build steps Change firefox version Update firefox version Renamed firefox start step Test yml changes Test yml changes Test yml changes Test yml changes Setup workflows for running firefox and chrome tests in parallel Setup workflows for running firefox and chrome tests in parallel Setup workflows for running firefox and chrome tests in parallel Setup workflows for running firefox and chrome tests in parallel Use selenium-standalone Use selenium-standalone Set selenium-server version Added selenium config Fixed liniting error Fixed Build error path Fixed Selenium config error path Changed selenium server version Test for chrome Added config for chrome Test firefox and chrome in parallel Add firefox config to seleniumConfig Downgrade firefox driver version Download firefox browser Test circleci parallelism Test circleci parallelism Remove parallelism Added delay to ZoKrates test to fix failing test Fixed failing gist tests for firefox Disabled remixd tests for firefox browser Fix linting error Fixed failing terminal test Remove gecko driver dependency Disable remixd test for firefox Fixed failing solidity unit tests switch to .keys() to .sendKeys() since it is supported by both chrome and firefox
5 years ago
const runtimeBrowser = browser.capabilities.browserName
browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers')
.rightClick('[data-path="browser/1_Storage.sol"]')
.click('*[id="menuitemcreate folder"]')
.waitForElementVisible('*[data-id="modalDialogContainer"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', 'Browser_Tests')
.modalFooterOKClick()
.waitForElementVisible('*[data-id="treeViewLibrowser/Browser_Tests"]')
.addFile('File.sol', { content: '' })
.click('*[data-id="fileExplorerNewFilepublishToGist"]')
.modalFooterOKClick()
.getModalBody((value, done) => {
const reg = /gist.github.com\/([^.]+)/
const id = value.match(reg)
console.log('gist regex', id)
if (!id) {
browser.assert.fail('cannot get the gist id', '', '')
} else {
let gistid = id[1]
browser
.modalFooterCancelClick()
.executeScript(`remix.loadgist('${gistid}')`)
.perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('browser/gists') } done() })
.openFile(`browser/gists/${gistid}`)
.openFile(`browser/gists/${gistid}/1_Storage.sol`)
.perform(done)
}
})
},
'Load Gist Modal': function (browser) {
browser.clickLaunchIcon('home')
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers')
.scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
.waitForElementVisible('*[data-id="modalDialogModalTitle"]')
.assert.containsText('*[data-id="modalDialogModalTitle"]', 'Load a Gist')
.waitForElementVisible('*[data-id="modalDialogModalBody"]')
.assert.containsText('*[data-id="modalDialogModalBody"]', 'Enter the ID of the Gist or URL you would like to load.')
.waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.modalFooterCancelClick()
},
'Display Error Message For Invalid Gist ID': function (browser) {
browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers')
.scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
.waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', testData.invalidGistId)
.modalFooterOKClick()
.waitForElementVisible('*[data-id="modalDialogModalBody"]')
.assert.containsText('*[data-id="modalDialogModalBody"]', 'Gist load error: Not Found')
.modalFooterOKClick()
},
'Import From Gist For Valid Gist ID': function (browser) {
browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers')
.scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
.waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', testData.validGistId)
.modalFooterOKClick()
.openFile(`browser/gists/${testData.validGistId}`)
.openFile(`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
}