-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
demo-02.feature
28 lines (23 loc) · 1.06 KB
/
demo-02.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Feature: browser automation 2
Background:
* configure driver = { type: 'chrome' }
# * configure driverTarget = { docker: 'ptrthomas/karate-chrome', showDriverLog: true }
Scenario: google search, land on the karate github page, and search for a file
Given driver 'https://google.com'
And input('textarea[name=q]', 'karate dsl')
When click('input[name=btnI]')
Then waitForUrl('https://github.com/karatelabs/karate')
When click('{a}Go to file')
And def searchField = waitFor('input[name=query]')
Then match driver.url == 'https://github.com/karatelabs/karate/find/master'
When searchField.input('karate-logo.png')
And def innerText = function(locator){ return scriptAll(locator, '_.innerText') }
And def searchFunction =
"""
function() {
var results = innerText('.js-tree-browser-result-path');
return results.size() == 2 ? results : null;
}
"""
And def searchResults = waitUntil(searchFunction)
Then match searchResults contains 'karate-core/src/main/resources/karate-logo.png'