-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Moved E2E Tests To Typescript #343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 2c8e441
Tryout advance custom commands
ioedeveloper c6d91e9
Setup generic test script command for nightwatch tests.
ioedeveloper 31dd550
Add custom commands types
ioedeveloper a199d4a
Define missing types
ioedeveloper 6446a64
Moved more custom commands to typescript
ioedeveloper 1feb99d
Setup ballot tests in typescript
ioedeveloper 8391438
Ballot test setup completed
ioedeveloper 4ab4a37
add executeScript command
ioedeveloper e023afa
Added debugger tests
ioedeveloper 6c5a8da
Added defaultLayout tests
ioedeveloper 3911627
Added editor tests
ioedeveloper 637be79
Added fileExplorer test
ioedeveloper 693528c
Added file manager test
ioedeveloper fe5a5e4
Added generalSettings test
ioedeveloper 61f5bd7
Added gist tests
ioedeveloper 63b0756
Added libraryDeployment tests
ioedeveloper aa46b4e
Added pluginManager tests
ioedeveloper 91ff8e8
Added publishContract tests
ioedeveloper 4347dbe
Added recorder tests
ioedeveloper af250b0
Added remixd tests
ioedeveloper 13a5289
Added run and deploy tests
ioedeveloper 4cd6f80
Added sign message
ioedeveloper 307715b
Added solidityImport tests
ioedeveloper cd6cdac
Added solidityUnit tests
ioedeveloper 59b8f23
Added specialFunctions tests
ioedeveloper 36bdf02
Added staticAnalysis tests
ioedeveloper a0621db
Added terminal tests
ioedeveloper 73115fd
Added transactionExecution tests
ioedeveloper ece2553
Added txListener tests
ioedeveloper 959fe18
Added usingWorker tests
ioedeveloper f87dc9a
Added workspace tests
ioedeveloper 30fbf38
Change e2e tests commands in package.json
ioedeveloper c3b0fb1
Move metamask chrome extension to remix-ide-e2e project
ioedeveloper 8be71b9
Added e2e build command
ioedeveloper 4e6d8a6
Added new e2e tests comand to ci build step
ioedeveloper 616b6e2
Update e2e command in package.json
ioedeveloper 52074ce
Removed test-browser directory from remix-ide project
ioedeveloper 74206de
Removed nightwatch config files from remix-ide and updated config.yml…
ioedeveloper 7966774
Added missing types
ioedeveloper 374e03c
Fixed failing tests
ioedeveloper c7ec853
Fixed failing tests
ioedeveloper 1004777
Try any type to fix test
ioedeveloper a25678e
Fixed failing tests
ioedeveloper bf4fa45
Set path for test reports
ioedeveloper 1fe3235
Added test reports and screenshots directory
ioedeveloper 6234ad8
Modify nightwatch config file
ioedeveloper acb9cc5
Fix firefox shell script
ioedeveloper 9e6fe91
fix failing chrome tests
ioedeveloper 74b945e
Add e2e reports dir to .gitignore
ioedeveloper b092431
Verify element is checked before proceeding with tests
ioedeveloper bb20974
Debug circleci
ioedeveloper 47da15d
Removed reports folder
ioedeveloper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ build | |
| dist | ||
| node_modules | ||
| lint.xml | ||
| test-browser/reports/* | ||
| reports/* | ||
| babelify-src | ||
| docs/_build | ||
| .DS_Store | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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": ["!**/*"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
7 changes: 4 additions & 3 deletions
7
...de/test-browser/commands/clickFunction.js → ...mix-ide-e2e/src/commands/clickFunction.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
...de/test-browser/commands/clickInstance.js → ...mix-ide-e2e/src/commands/clickInstance.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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..There was a problem hiding this comment.
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.
thisis the context which the command function uses. It is normally passed by the caller of thecommandfunction from nightwatch. Also, passing parameters into thecommandfunction without specifyingthisworks perfectly. It just uses the default context forthiswhich is theaddAtAddressInstanceclass for this example.