Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
696e5d0
ts-node nightwatch setup
ioedeveloper Jul 23, 2020
2c8e441
Tryout advance custom commands
ioedeveloper Jul 24, 2020
c6d91e9
Setup generic test script command for nightwatch tests.
ioedeveloper Jul 24, 2020
31dd550
Add custom commands types
ioedeveloper Jul 27, 2020
a199d4a
Define missing types
ioedeveloper Jul 27, 2020
6446a64
Moved more custom commands to typescript
ioedeveloper Jul 28, 2020
1feb99d
Setup ballot tests in typescript
ioedeveloper Jul 29, 2020
8391438
Ballot test setup completed
ioedeveloper Jul 30, 2020
4ab4a37
add executeScript command
ioedeveloper Jul 30, 2020
e023afa
Added debugger tests
ioedeveloper Jul 31, 2020
6c5a8da
Added defaultLayout tests
ioedeveloper Jul 31, 2020
3911627
Added editor tests
ioedeveloper Jul 31, 2020
637be79
Added fileExplorer test
ioedeveloper Jul 31, 2020
693528c
Added file manager test
ioedeveloper Jul 31, 2020
fe5a5e4
Added generalSettings test
ioedeveloper Jul 31, 2020
61f5bd7
Added gist tests
ioedeveloper Jul 31, 2020
63b0756
Added libraryDeployment tests
ioedeveloper Jul 31, 2020
aa46b4e
Added pluginManager tests
ioedeveloper Jul 31, 2020
91ff8e8
Added publishContract tests
ioedeveloper Jul 31, 2020
4347dbe
Added recorder tests
ioedeveloper Jul 31, 2020
af250b0
Added remixd tests
ioedeveloper Jul 31, 2020
13a5289
Added run and deploy tests
ioedeveloper Jul 31, 2020
4cd6f80
Added sign message
ioedeveloper Jul 31, 2020
307715b
Added solidityImport tests
ioedeveloper Aug 3, 2020
cd6cdac
Added solidityUnit tests
ioedeveloper Aug 3, 2020
59b8f23
Added specialFunctions tests
ioedeveloper Aug 3, 2020
36bdf02
Added staticAnalysis tests
ioedeveloper Aug 3, 2020
a0621db
Added terminal tests
ioedeveloper Aug 3, 2020
73115fd
Added transactionExecution tests
ioedeveloper Aug 3, 2020
ece2553
Added txListener tests
ioedeveloper Aug 3, 2020
959fe18
Added usingWorker tests
ioedeveloper Aug 3, 2020
f87dc9a
Added workspace tests
ioedeveloper Aug 3, 2020
30fbf38
Change e2e tests commands in package.json
ioedeveloper Aug 10, 2020
c3b0fb1
Move metamask chrome extension to remix-ide-e2e project
ioedeveloper Aug 10, 2020
8be71b9
Added e2e build command
ioedeveloper Aug 10, 2020
4e6d8a6
Added new e2e tests comand to ci build step
ioedeveloper Aug 10, 2020
616b6e2
Update e2e command in package.json
ioedeveloper Aug 10, 2020
52074ce
Removed test-browser directory from remix-ide project
ioedeveloper Aug 10, 2020
74206de
Removed nightwatch config files from remix-ide and updated config.yml…
ioedeveloper Aug 10, 2020
7966774
Added missing types
ioedeveloper Aug 11, 2020
374e03c
Fixed failing tests
ioedeveloper Aug 11, 2020
c7ec853
Fixed failing tests
ioedeveloper Aug 11, 2020
1004777
Try any type to fix test
ioedeveloper Aug 11, 2020
a25678e
Fixed failing tests
ioedeveloper Aug 12, 2020
bf4fa45
Set path for test reports
ioedeveloper Aug 12, 2020
1fe3235
Added test reports and screenshots directory
ioedeveloper Aug 12, 2020
6234ad8
Modify nightwatch config file
ioedeveloper Aug 12, 2020
acb9cc5
Fix firefox shell script
ioedeveloper Aug 12, 2020
9e6fe91
fix failing chrome tests
ioedeveloper Aug 12, 2020
74b945e
Add e2e reports dir to .gitignore
ioedeveloper Aug 12, 2020
b092431
Verify element is checked before proceeding with tests
ioedeveloper Aug 12, 2020
bb20974
Debug circleci
ioedeveloper Aug 18, 2020
47da15d
Removed reports folder
ioedeveloper Aug 18, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ jobs:
java -version
- run:
name: Download Selenium
command: ./node_modules/.bin/selenium-standalone install --config=../remix-project/apps/remix-ide/seleniumConfig.js
command: ./node_modules/.bin/selenium-standalone install --config=../remix-project/apps/remix-ide-e2e/seleniumConfig.js
- run:
name: Start Selenium
command: ./node_modules/.bin/selenium-standalone start --config=../remix-project/apps/remix-ide/seleniumConfig.js
command: ./node_modules/.bin/selenium-standalone start --config=../remix-project/apps/remix-ide-e2e/seleniumConfig.js
background: true
- run: ./apps/remix-ide/ci/browser_tests_chrome.sh
- store_test_results:
path: ./apps/remix-ide/reports/tests
path: ./reports/tests
- store_artifacts:
path: ./apps/remix-ide/reports/screenshots
path: ./reports/screenshots

remix-ide-firefox:
docker:
Expand Down Expand Up @@ -97,10 +97,10 @@ jobs:
- run: npm run build
- run:
name: Download Selenium
command: ./node_modules/.bin/selenium-standalone install --config=../remix-project/apps/remix-ide/seleniumConfig.js
command: ./node_modules/.bin/selenium-standalone install --config=../remix-project/apps/remix-ide-e2e/seleniumConfig.js
- run:
name: Start Selenium
command: ./node_modules/.bin/selenium-standalone start --config=../remix-project/apps/remix-ide/seleniumConfig.js
command: ./node_modules/.bin/selenium-standalone start --config=../remix-project/apps/remix-ide-e2e/seleniumConfig.js
background: true
- run:
name: Download Latest Firefox
Expand All @@ -110,9 +110,9 @@ jobs:
command: sudo dpkg -i firefox-mozilla-build_73.0.1-0ubuntu1_amd64.deb
- run: ./apps/remix-ide/ci/browser_tests_firefox.sh
- store_test_results:
path: ./apps/remix-ide/reports/tests
path: ./reports/tests
- store_artifacts:
path: ./apps/remix-ide/reports/screenshots
path: ./reports/screenshots

remix-ide-run-deploy:
docker:
Expand Down Expand Up @@ -147,14 +147,16 @@ jobs:
java -version
- run:
name: Download Selenium
command: ./node_modules/.bin/selenium-standalone install --config=../remix-project/apps/remix-ide/seleniumConfig.js
command: ./node_modules/.bin/selenium-standalone install --config=../remix-project/apps/remix-ide-e2e/seleniumConfig.js
- run:
name: Start Selenium
command: ./node_modules/.bin/selenium-standalone start --config=../remix-project/apps/remix-ide/seleniumConfig.js
command: ./node_modules/.bin/selenium-standalone start --config=../remix-project/apps/remix-ide-e2e/seleniumConfig.js
background: true
- run: ./apps/remix-ide/ci/browser_tests_run_deploy.sh
- store_test_results:
path: ./reports/tests
- store_artifacts:
path: ./apps/remix-ide/reports/screenshots
path: ./reports/screenshots


deploy-remix-live:
Expand Down Expand Up @@ -186,8 +188,6 @@ jobs:
if [ "${CIRCLE_BRANCH}" == "remix_live" ]; then
./apps/remix-ide/ci/deploy_from_travis_remix-live.sh;
fi
- store_artifacts:
path: ./apps/remix-ide/reports/screenshots

publish:
docker:
Expand Down Expand Up @@ -244,8 +244,6 @@ jobs:
if [ "${CIRCLE_BRANCH}" == "master" ]; then
./apps/remix-ide/ci/deploy_from_travis_remix-alpha.sh;
fi
- store_artifacts:
path: ./apps/remix-ide/reports/screenshots

workflows:
version: 2
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build
dist
node_modules
lint.xml
test-browser/reports/*
reports/*
babelify-src
docs/_build
.DS_Store
Expand Down
14 changes: 14 additions & 0 deletions apps/remix-ide-e2e/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"rules": {},
"overrides": [
{
"files": ["**/*.ts"],
"rules": {
"no-undef": "off",
"@typescript-eslint/no-var-requires": 0
}
}
],
"extends": ["../../.eslintrc"],
"ignorePatterns": ["!**/*"]
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
'use strict'
require('@babel/register')()
import * as fs from 'fs'

const crxFile = require('fs').readFileSync('apps/remix-ide/test-browser/extensions/chrome/metamask.crx')
const metamaskExtension = new Buffer.from(crxFile).toString('base64') // eslint-disable-line
const crxFile = fs.readFileSync('apps/remix-ide-e2e/src/extensions/chrome/metamask.crx')
const metamaskExtension = Buffer.from(crxFile).toString('base64')

module.exports = {
'src_folders': ['apps/remix-ide/test-browser/tests'],
'output_folder': 'apps/remix-ide/reports/tests',
'custom_commands_path': ['apps/remix-ide/test-browser/commands'],
'src_folders': ['dist/apps/remix-ide-e2e/src/tests'],
'output_folder': './reports/tests',
'custom_commands_path': ['dist/apps/remix-ide-e2e/src/commands'],
'custom_assertions_path': '',
'page_objects_path': '',
'globals_path': '',
Expand All @@ -22,7 +21,7 @@ module.exports = {
},
'screenshots': {
'enabled': true,
'path': 'apps/remix-ide/reports/screenshots',
'path': './reports/screenshots',
'on_failure': true,
'on_error': true
},
Expand All @@ -31,7 +30,7 @@ module.exports = {
'javascriptEnabled': true,
'acceptSslCerts': true
},
'exclude': ['apps/remix-ide/test-browser/tests/runAndDeploy.js']
'exclude': ['dist/apps/remix-ide-e2e/src/tests/runAndDeploy.js']
},

'chrome': {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const EventEmitter = require('events')
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events"

class addAtAddressInstance extends EventEmitter {
command (address, isValidFormat, isValidChecksum) {
this.api.perform((done) => {
command (this: NightwatchBrowser, address: string, isValidFormat: boolean, isValidChecksum: boolean): NightwatchBrowser {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like risky to name a variable this, could be addressed in an another PR..

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a variable. this is the context which the command function uses. It is normally passed by the caller of the command function from nightwatch. Also, passing parameters into the command function without specifying this works perfectly. It just uses the default context for this which is the addAtAddressInstance class for this example.

this.api.perform((done: VoidFunction) => {
addInstance(this.api, address, isValidFormat, isValidChecksum, () => {
done()
this.emit('complete')
Expand All @@ -12,12 +13,14 @@ class addAtAddressInstance extends EventEmitter {
}
}

function addInstance (browser, address, isValidFormat, isValidChecksum, callback) {
function addInstance (browser: NightwatchBrowser, address: string, isValidFormat: boolean, isValidChecksum: boolean, callback: VoidFunction) {
browser.clickLaunchIcon('udapp').clearValue('.ataddressinput').setValue('.ataddressinput', address, function () {
browser.click('button[id^="runAndDeployAtAdressButton"]')
.execute(function () {
var ret = document.querySelector('div[class^="modal-body"] div').innerHTML
document.querySelector('#modal-footer-ok').click()
const ret = document.querySelector('div[class^="modal-body"] div').innerHTML
const modal = document.querySelector('#modal-footer-ok') as HTMLElement

modal.click()
return ret
}, [], function (result) {
if (!isValidFormat) {
Expand Down
39 changes: 39 additions & 0 deletions apps/remix-ide-e2e/src/commands/addFile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch'
import EventEmitter from "events"

class AddFile extends EventEmitter {
command (this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser {
this.api.perform((done) => {
addFile(this.api, name, content, () => {
done()
this.emit('complete')
})
})
return this
}
}

function addFile (browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) {
browser.clickLaunchIcon('udapp').clickLaunchIcon('fileExplorers').click('.newFile')
.waitForElementVisible('#modal-dialog')
.perform((client, done) => {
browser.execute(function (fileName) {
if (fileName !== 'Untitled.sol') {
document.querySelector('#modal-dialog #prompt_text').setAttribute('value', fileName)
}
const elem = document.querySelector('#modal-footer-ok') as HTMLElement

elem.click()
}, [name], function (result) {
console.log(result)
done()
})
})
.setEditorValue(content.content)
.pause(1000)
.perform(function () {
done()
})
}

module.exports = AddFile
31 changes: 31 additions & 0 deletions apps/remix-ide-e2e/src/commands/checkElementStyle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import EventEmitter from 'events'
import { NightwatchBrowser } from 'nightwatch'

class checkElementStyle extends EventEmitter {
command (this: NightwatchBrowser, cssSelector: string, styleProperty: string, expectedResult: string): NightwatchBrowser {
this.api.perform((done) => {
checkStyle(this.api, cssSelector, styleProperty, expectedResult, () => {
done()
this.emit('complete')
})
})
return this
}
}

function checkStyle (browser: NightwatchBrowser, cssSelector: string, styleProperty: string, expectedResult: string, callback: VoidFunction) {
browser.execute(function (cssSelector, styleProperty) {
return window.getComputedStyle(document.querySelector(cssSelector)).getPropertyValue(styleProperty)
}, [cssSelector, styleProperty], function (result) {
const value = result.value

if (typeof value === 'string') {
browser.assert.equal(value.trim().toLowerCase(), expectedResult.toLowerCase())
} else {
browser.assert.fail('Failed with error info :', result.value.toString())
}
callback()
})
}

module.exports = checkElementStyle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const EventEmitter = require('events')
import EventEmitter from 'events'
import { NightwatchBrowser } from 'nightwatch'

class CheckTerminalFilter extends EventEmitter {
command (filter, test) {
command (this: NightwatchBrowser, filter: string, test: string): NightwatchBrowser {
this.api.perform((done) => {
checkFilter(this.api, filter, test, () => {
done()
Expand All @@ -12,7 +13,7 @@ class CheckTerminalFilter extends EventEmitter {
}
}

function checkFilter (browser, filter, test, done) {
function checkFilter (browser: NightwatchBrowser, filter: string, test: string, done: VoidFunction) {
if (browser.options.desiredCapabilities.browserName === 'chrome') { // nightwatch deos not handle well that part.... works locally
done()
return
Expand Down
42 changes: 42 additions & 0 deletions apps/remix-ide-e2e/src/commands/checkVariableDebug.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { NightwatchBrowser, NightwatchCheckVariableDebugValue } from 'nightwatch'
import EventEmitter from "events"

const deepequal = require('deep-equal')

class CheckVariableDebug extends EventEmitter {
command (this: NightwatchBrowser, id: string, debugValue: NightwatchCheckVariableDebugValue): NightwatchBrowser {
this.api.perform((done) => {
checkDebug(this.api, id, debugValue, () => {
done()
this.emit('complete')
})
})
return this
}
}

function checkDebug (browser: NightwatchBrowser, id: string, debugValue: NightwatchCheckVariableDebugValue, done: VoidFunction) {
// id is soliditylocals or soliditystate
browser.execute(function (id: string) {
const elem = document.querySelector('#' + id + ' .dropdownrawcontent') as HTMLElement

return elem.innerText
}, [id], function (result) {
console.log(id + ' ' + result.value)
let value
try {
value = JSON.parse(<string>result.value)
} catch (e) {
browser.assert.fail('cant parse solidity state', e.message, '')
done()
return
}
const equal = deepequal(debugValue, value)
if (!equal) {
browser.assert.fail('checkDebug on ' + id, 'info about error\n ' + JSON.stringify(debugValue) + '\n ' + JSON.stringify(value), '')
}
done()
})
}

module.exports = CheckVariableDebug
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const EventEmitter = require('events')
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'

class clearEditablecontent extends EventEmitter {
command (cssSelector) {
command (this: NightwatchBrowser, cssSelector: string): NightwatchBrowser {
this.api.perform((done) => {
clearContent(this.api, cssSelector, () => {
done()
Expand All @@ -12,7 +13,7 @@ class clearEditablecontent extends EventEmitter {
}
}

function clearContent (browser, cssSelector, callback) {
function clearContent (browser: NightwatchBrowser, cssSelector: string, callback: VoidFunction) {
browser.execute(function (cssSelector) {
const selection = window.getSelection()
const range = document.createRange()
Expand Down
27 changes: 27 additions & 0 deletions apps/remix-ide-e2e/src/commands/clickElementAtPosition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'

class ClickElement extends EventEmitter {
command (this: NightwatchBrowser, cssSelector: string, index = 0): NightwatchBrowser {
this.api.perform((done) => {
_clickElement(this.api, cssSelector, index, () => {
done()
this.emit('complete')
})
})
return this
}
}

function _clickElement (browser: NightwatchBrowser, cssSelector: string, index: number, cb: VoidFunction) {
browser.waitForElementPresent(cssSelector)
.execute(function (cssSelector: string, index: number) {
const elem = document.querySelectorAll(cssSelector)[index] as HTMLElement

elem.click()
}, [cssSelector, index], function () {
cb()
})
}

module.exports = ClickElement
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const EventEmitter = require('events')
import { NightwatchBrowser, NightwatchClickFunctionExpectedInput } from 'nightwatch'
import EventEmitter from "events"

class ClickFunction extends EventEmitter {
command (fnFullName, expectedInput) {
command (this: NightwatchBrowser, fnFullName: string, expectedInput?: NightwatchClickFunctionExpectedInput): NightwatchBrowser {
this.api.waitForElementPresent('.instance button[title="' + fnFullName + '"]')
.perform(function (client, done) {
client.execute(function () {
document.querySelector('#runTabView').scrollTop = document.querySelector('#runTabView').scrollHeight
}, [], function () {
if (expectedInput) {
client.setValue('#runTabView input[title="' + expectedInput.types + '"]', expectedInput.values, function () {})
client.setValue('#runTabView input[title="' + expectedInput.types + '"]', expectedInput.values, _ => _)
}
done()
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
const EventEmitter = require('events')
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events"

class ClickInstance extends EventEmitter {
command (index) {
command (this: NightwatchBrowser, index: number): NightwatchBrowser {
index = index + 2
let selector = '.instance:nth-of-type(' + index + ') > div > button'
const selector = '.instance:nth-of-type(' + index + ') > div > button'

this.api.waitForElementPresent(selector).scrollAndClick(selector).perform(() => { this.emit('complete') })
return this
}
Expand Down
Loading