Skip to content

Commit

Permalink
feat(executor/web): implement next window (#226)
Browse files Browse the repository at this point in the history
* Add gecko web driver

* Add a new statement to switch to next windows

* Add documentation with an example
  • Loading branch information
kevinramage authored Mar 18, 2020
1 parent e145c61 commit e4ba258
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
28 changes: 28 additions & 0 deletions executors/web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,34 @@ testcases:

```

Next Window action allow you to change the current window
Next Window have one boolean parameter, this parameter must be true
Example:

```yaml
name: TestSuite NextWindow
testcases:
- name: TestCase NextWindow
context:
type: web
driver: chrome
debug: true
steps:
- action:
navigate:
url: https://javascript.info/popup-windows
- action:
click:
find: article > div:nth-child(3) > div:nth-child(17) a[data-action='run']
wait: 4
screenshot: beforeNextWindow.png
- action:
nextWindow: true
screenshot: resultNextWindow.png
assertions:
- result.url ShouldStartWith https://www.google.com
```
## Output
* result.url
Expand Down
1 change: 1 addition & 0 deletions executors/web/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type Action struct {
Find string `yaml:"find,omitempty"`
Navigate *Navigate `yaml:"navigate,omitempty"`
Wait int64 `yaml:"wait,omitempty"`
NextWindow bool `yaml:"nextWindow,omitempty"`
}

// Fill represents informations needed to fill input/textarea
Expand Down
4 changes: 4 additions & 0 deletions executors/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func (Executor) Run(testCaseContext venom.TestCaseContext, l venom.Logger, step
}
} else if e.Action.Wait != 0 {
time.Sleep(time.Duration(e.Action.Wait) * time.Second)
} else if ( e.Action.NextWindow ) {
if err := ctx.Page.NextWindow(); err != nil {
return nil, err
}
}

// take a screenshot
Expand Down

0 comments on commit e4ba258

Please sign in to comment.