This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(explorer): allow element explorer to start as a server
If element explorer is run with a port (i.e. --debuggerServerPort 1234), it will start up a server that listens to command from the port instead of a repl that listens to process.stdin.
- Loading branch information
Showing
10 changed files
with
332 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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,47 @@ | ||
var InteractiveTest = require('./interactive_test_util').InteractiveTest; | ||
var port = 6969; | ||
var test = new InteractiveTest('node lib/cli.js --elementExplorer true', port); | ||
|
||
// Check state persists. | ||
test.addCommandExpectation('var x = 3'); | ||
test.addCommandExpectation('x', '3'); | ||
|
||
// Check can return functions. | ||
test.addCommandExpectation('var y = function(param) {return param;}'); | ||
test.addCommandExpectation('y', 'function (param) {return param;}'); | ||
|
||
// Check promises complete. | ||
test.addCommandExpectation('browser.driver.getCurrentUrl()', 'data:,'); | ||
test.addCommandExpectation('browser.get("http://localhost:8081")'); | ||
test.addCommandExpectation('browser.getCurrentUrl()', | ||
'http://localhost:8081/#/form'); | ||
|
||
// Check promises are resolved before being returned. | ||
test.addCommandExpectation('var greetings = element(by.binding("greeting"))'); | ||
test.addCommandExpectation('greetings.getText()', 'Hiya'); | ||
|
||
// Check require is injected. | ||
test.addCommandExpectation('var q = require("q")'); | ||
test.addCommandExpectation( | ||
'var deferred = q.defer(); ' + | ||
'setTimeout(function() {deferred.resolve(1)}, 100); ' + | ||
'deferred.promise', | ||
'1'); | ||
|
||
// Check errors are handled gracefully | ||
test.addCommandExpectation('element(by.binding("nonexistent"))'); | ||
test.addCommandExpectation('element(by.binding("nonexistent")).getText()', | ||
'ERROR: NoSuchElementError: No element found using locator: ' + | ||
'by.binding("nonexistent")'); | ||
|
||
// Check complete calls | ||
test.addCommandExpectation('\t', | ||
'[["element(by.id(\'\'))","element(by.css(\'\'))",' + | ||
'"element(by.name(\'\'))","element(by.binding(\'\'))",' + | ||
'"element(by.xpath(\'\'))","element(by.tagName(\'\'))",' + | ||
'"element(by.className(\'\'))"],""]'); | ||
test.addCommandExpectation('ele\t', '[["element"],"ele"]'); | ||
test.addCommandExpectation('br\t', '[["break","","browser"],"br"]'); | ||
|
||
test.run(); | ||
|
Oops, something went wrong.