空手道 UI 自动化测试结果不一致
Karate UI Automation test results are not coherent
我的目标是前往 Amazon.com,搜索一本书并确认它出现在结果中。我断言的结果不连贯。
Feature: Amazon UI automation
Background:
* def baseUrl = 'https://www.amazon.com/'
Scenario: Search for item
Given driver baseUrl
And def searchTerm = "Explore It"
And def searchTermEncoded = "Explore+It"
# When input("#twotabsearchtextbox", [searchTerm, Key.ENTER]) # ENTER doesn't work ¯\_(ツ)_/¯
When input("#twotabsearchtextbox", searchTerm)
And click("#nav-search-submit-text")
Then locate("div.s-result-list").exists # 1) this passes
And locate("{span}Reduce Risk and Increase Confidence").exists # 2) this passes
And match driver.url contains "s?k=" + searchTermEncoded # 3) this fails
断言 3) 没有通过。这意味着空手道无法到达亚马逊的结果页面。我确认这是真的,因为我拍了 screenshot()
并且空手道仍在主页中,搜索栏已填满。
那么为什么断言 1 和 2 通过了呢? 1) 的定位器只存在于结果页中,在主页中没有任何可匹配的。另外2)的文字是书的全名,只有搜索后才会出现。
这是一个错误,可能与以下错误相同:
已在版本 0.9.6.RC3
中修复
我的目标是前往 Amazon.com,搜索一本书并确认它出现在结果中。我断言的结果不连贯。
Feature: Amazon UI automation
Background:
* def baseUrl = 'https://www.amazon.com/'
Scenario: Search for item
Given driver baseUrl
And def searchTerm = "Explore It"
And def searchTermEncoded = "Explore+It"
# When input("#twotabsearchtextbox", [searchTerm, Key.ENTER]) # ENTER doesn't work ¯\_(ツ)_/¯
When input("#twotabsearchtextbox", searchTerm)
And click("#nav-search-submit-text")
Then locate("div.s-result-list").exists # 1) this passes
And locate("{span}Reduce Risk and Increase Confidence").exists # 2) this passes
And match driver.url contains "s?k=" + searchTermEncoded # 3) this fails
断言 3) 没有通过。这意味着空手道无法到达亚马逊的结果页面。我确认这是真的,因为我拍了 screenshot()
并且空手道仍在主页中,搜索栏已填满。
那么为什么断言 1 和 2 通过了呢? 1) 的定位器只存在于结果页中,在主页中没有任何可匹配的。另外2)的文字是书的全名,只有搜索后才会出现。
这是一个错误,可能与以下错误相同:
已在版本 0.9.6.RC3
中修复