This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add custom locator strategy * address review comments * allow customFindModules cap to register multiple modules as an object * add unit tests for custom element finding plugin
- Loading branch information
Showing
4 changed files
with
229 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
notFind: function () { // eslint-disable-line object-shorthand | ||
return []; | ||
} | ||
}; |
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,29 @@ | ||
module.exports = { | ||
find: function (driver, logger, selector, multiple) { // eslint-disable-line object-shorthand | ||
if (!driver || !driver.opts) { | ||
throw new Error("Expected driver object"); | ||
} | ||
|
||
if (!logger || !logger.info) { | ||
throw new Error("Expected logger object"); | ||
} | ||
|
||
if (selector === "foo") { | ||
return ["bar"]; | ||
} | ||
|
||
if (selector === "foos") { | ||
if (multiple) { | ||
return ["baz1", "baz2"]; | ||
} | ||
|
||
return ["bar1", "bar2"]; | ||
} | ||
|
||
if (selector === "error") { | ||
throw new Error("This is a plugin error"); | ||
} | ||
|
||
return []; | ||
} | ||
}; |