Skip to content

Commit

Permalink
[ui] driver interface has terminated property
Browse files Browse the repository at this point in the history
allow user to force new browser instance within test flow
this is needed for situations like mixing robot (desktop) and browser tests
specifically when a cef instance is being used
  • Loading branch information
ptrthomas committed Aug 20, 2020
1 parent 58e3387 commit 9546c31
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1043,8 +1043,8 @@ public void setDriver(Driver driver) {
public void driver(String expression) {
ScriptValue sv = Script.evalKarateExpression(expression, this);
// re-create driver within a test if needed
// but user is expected to call quit()
if (driver == null || sv.isMapLike()) {
// but user is expected to call quit() OR use the driver keyword with a JSON argument
if (driver == null || driver.isTerminated() || sv.isMapLike()) {
Map<String, Object> options = config.getDriverOptions();
if (options == null) {
options = new HashMap();
Expand Down Expand Up @@ -1114,7 +1114,7 @@ public void stop(StepResult lastStepResult) {
if (webSocketClients != null) {
webSocketClients.forEach(WebSocketClient::close);
}
if (driver != null) { // TODO afterScenario plugin unification
if (driver != null) {
driver.quit();
DriverOptions options = driver.getOptions();
if (options.target != null) {
Expand Down
Loading

0 comments on commit 9546c31

Please sign in to comment.