karate

Switch Page Karate UI issue

醉酒当歌 提交于 2021-02-05 07:45:06
问题 I am having an issue with switching tabs using Karate UI. My code is as follows: Scenario: SwitchPage Test Given driver 'original URL' * retry(5, 10000).waitFor('#someID') * input('#someID', ['numbers', 'input', Key.ENTER]) // this will open the new page * print driver.title \\ this prints the original title of the original URL * switchPage('NewURL') * delay(10000) // I've put this just in case but it doesn't work without it either Then print driver.title // this still prints the original

Is there a way to assert and fail a request after polling in karate?

∥☆過路亽.° 提交于 2021-02-05 07:16:15
问题 I have a request where i get Processing or Submitted in a response parameter if the request is in process or passed respectively. I am able to poll and get if the status is "Processing" or"Submitted" but after that I am unable to fail the request if still i am not getting the expected status after polling for 5 times. How can i fail request after certain retries do not provide me expected response? 回答1: The answer is in your question, I assume you are polling using a js function, If so you

Edit(update, delete) one of headers in karate

别说谁变了你拦得住时间么 提交于 2021-02-05 07:14:25
问题 I have this header which is in a .js file and I am reading this header using * configure headers = read('classpath:services/Headers/distheader.js') Question #1 How can I edit one of the headers in this file at run-time using my scenario data? I tried setting * header 'xyz' = 'value' but it doesn't edit it. Question #2 If I want to delete one of the headers, how is it possible? 回答1: So 90% of your scenarios are "happy path", and you have a headers JS configured. Now you need some scenarios to

How to edit configured headers in karate framework

ⅰ亾dé卋堺 提交于 2021-02-05 07:13:51
问题 In my framework I have headers.js file. I am calling that js file on background of every feature file using the command * configure headers = read('headers.js') . This working as expected, some scenarios I need to change the 'client-id' value. For example headers.js has a client-id=xyz, I need to change client-id=abc for couple of scenarios rest all are using client-id as xyz (my headers have 20 different values, I don't want to write that in require feature files) Is there any way to modify

match response while ignoring array order

强颜欢笑 提交于 2021-02-05 07:09:25
问题 Given following response: * def resp = {"a":[{"c": 2},{"c": 1}, {"c":3}], "b":[6,5,4]} I want to match it no matter the order arrays are in. I know I could do it with contains directive but I think that would require me to do multiple match patterns like: * match resp.a.[*].c contains [3,2,1] * match resp.b contains [5,4,6] Is there something like global config to ignore array order all together or do I have to roll with contains? 回答1: The following works. You could also specify the size of

match response while ignoring array order

左心房为你撑大大i 提交于 2021-02-05 07:05:17
问题 Given following response: * def resp = {"a":[{"c": 2},{"c": 1}, {"c":3}], "b":[6,5,4]} I want to match it no matter the order arrays are in. I know I could do it with contains directive but I think that would require me to do multiple match patterns like: * match resp.a.[*].c contains [3,2,1] * match resp.b contains [5,4,6] Is there something like global config to ignore array order all together or do I have to roll with contains? 回答1: The following works. You could also specify the size of

Is there an option for us to customize and group the test scenarios in the statics section of the Karate Gatling Report?

对着背影说爱祢 提交于 2021-02-05 06:51:29
问题 In the statics section of the Gatling report, the tests are grouped based on paths. However in our case the API URI + path is same and the functional flow will be differentiated based on the header values and the request method is POST. So in this case even if I test four different scenarios/flows, all the tests will be grouped as a single, since the path is same. Is there any option for us to group the statistics section based on scenarios/something else? Is there any option for us to group

Is there a way to output a pretty report when running via command line?

三世轮回 提交于 2021-02-05 06:40:06
问题 Is there a way to output pretty report when running Karate via the command line? Running this: java -jar karate-0.9.1.jar tests/*.feature Produces this: 15:32:56.363 [main] INFO com.intuit.karate.netty.Main - Karate version: 0.9.1 15:32:56.466 [main] INFO com.intuit.karate.Runner - Karate version: 0.9.1 15:32:56.868 [ForkJoinPool-1-worker-1] WARN com.intuit.karate - skipping bootstrap configuration: could not find or read file: classpath:karate-config.js 15:32:57.065 [ForkJoinPool-1-worker-1]

Is there a way to output a pretty report when running via command line?

自古美人都是妖i 提交于 2021-02-05 06:39:04
问题 Is there a way to output pretty report when running Karate via the command line? Running this: java -jar karate-0.9.1.jar tests/*.feature Produces this: 15:32:56.363 [main] INFO com.intuit.karate.netty.Main - Karate version: 0.9.1 15:32:56.466 [main] INFO com.intuit.karate.Runner - Karate version: 0.9.1 15:32:56.868 [ForkJoinPool-1-worker-1] WARN com.intuit.karate - skipping bootstrap configuration: could not find or read file: classpath:karate-config.js 15:32:57.065 [ForkJoinPool-1-worker-1]

Are #ignore and #present the same thing?

假装没事ソ 提交于 2021-02-05 05:52:31
问题 What's a case where I'd want to use #ignore vs. #present or vice-versa? Or are they identical? My first read of the docs I thought the following would pass, but it does not. Edit to add : This fails in Karate 0.9.0 but passes in 0.8.0. * def foo = {a: 1} * match foo == {a: 1, b: "#ignore"} These do pass: * def foo = {a: 1} * match foo == {a: 1, b: "##ignore"} * match foo == {a: 1, b: "##present"} 回答1: Yes, when you want to match for the key not being present or null, use the double-hash: *