karate

Karate - UI Testing - When using Zalenium Safari and MSEDGE immediately error on driver/session call => no capabilities found

断了今生、忘了曾经 提交于 2021-01-28 18:38:37
问题 git project: https://github.com/jbart18/karate_testing I'm trying to simplify having the main browsers (Chrome, Firefox, Edge & Safari) working via Zalenium. It seems the most simple approach and have been able to get chrome and firefox (gecko driver) running/working straight away. The problem lies within Edge and Safari and the inability to submit capabilities in the session request. I am running on Windows 10 professional and have been able to get tests working for: edge: through specifying

Verify numeric fields in JSON response have values till two decimal points using Karate

孤者浪人 提交于 2021-01-28 18:05:01
问题 JSON Response: [ { "actNum": "12345678", "prodType": "Test", "period": { "January": [ { "name": "Jake", "rRar": 12.34, "lRar": 340.45, "address": "New York" }, { "name": "Jorge", "rRar": 28.78, "lRar": 250.49, "address": "Chicago" } ] } } ] I have to verify that numeric fields in the above response rRar and lRar should have value till two decimal points like 12.78,32.56. Could anyone please help me if this validation can be done using Karate API? 回答1: Here you go: * def nums = $response..rRar

How to filter a list of maps using an external variable

情到浓时终转凉″ 提交于 2021-01-28 14:51:42
问题 I have a list of maps like this: [ { "name": "Marco", "email": "marco@gmail.com", "age": 20 }, { "name": "Polo", "email": "polo@gmail.com", "age": 25 } ] And I want to return only the entry whose email is a specific one, like polo@gmail.com I'll normally filter like this: * def filter_func = function(x){ return x.email == "polo@gmail.com" } * def list = response * def filtered = karate.filter(list, filter_func) But the email have to be a variable, because first I create a random account, then

How to filter a list of maps using an external variable

孤街浪徒 提交于 2021-01-28 14:32:58
问题 I have a list of maps like this: [ { "name": "Marco", "email": "marco@gmail.com", "age": 20 }, { "name": "Polo", "email": "polo@gmail.com", "age": 25 } ] And I want to return only the entry whose email is a specific one, like polo@gmail.com I'll normally filter like this: * def filter_func = function(x){ return x.email == "polo@gmail.com" } * def list = response * def filtered = karate.filter(list, filter_func) But the email have to be a variable, because first I create a random account, then

path variable initialized in the background gets reset for some scenarios

[亡魂溺海] 提交于 2021-01-28 13:34:15
问题 We have a main feature file with about 80 scenarios mixed of testing POST and GET request, and some of them called auxiliary feature files that get data from different REST endpoints. In the main feature file, we have Background section where we set a path variable. I noticed that this path variable gets reset (just empty) for some scenarios. I'm not sure what causes this, but one common thing they have are that they are all POST requests. To resolve this problem, I'm doing this : Given path

Generate report and integrate it with jenkins

时光毁灭记忆、已成空白 提交于 2021-01-28 12:15:42
问题 I am new in Karate but know almost all the basics. I want to generate a report for my test cases which will be kept in the folder for history purposes. currently, I am using the HTML report which overrides or updates every time I run my test cases. If you can recommend me a step-by-step tutorial or a link, or simply give me a hint on how to approach this. I have tried to use the allure framework and I am struggling to set it up. Thought it would be the best approach to solve my problem.

Write karate gatling data to different databases listening to different ports using influx config

白昼怎懂夜的黑 提交于 2021-01-28 11:38:12
问题 I want to write gatling performance data to different ports or to the databases because I have multiple microservices. Below is my galting config file- graphite { light = false # only send the all* stats host = "localhost" # The host where the Carbon server is located port = 2003 # The port to which the Carbon server listens to (2003 is default for plaintext, 2004 is default for pickle) protocol = "tcp" # The protocol used to send data to Carbon (currently supported : "tcp", "udp")

Can upload / download files at Karate Driver?

风格不统一 提交于 2021-01-28 11:11:32
问题 When using KarateDriver, I want to upload and download files on the browser. Upload : Using <input type="file" /> Download : Browser download. The response header is Content-Disposition: attachment; filename=sample.txt But I don't know how to do it. Is that possible? 回答1: Sorry we haven't implemented it yet. If you have some sample Selenium code we can take a look at that. Maybe we should open a feature request. 来源: https://stackoverflow.com/questions/56329658/can-upload-download-files-at

Karate UI: Javascript dropdown not getting clicked

北战南征 提交于 2021-01-28 10:17:01
问题 Scenario: Sample scenario Given driver 'https://material-ui.com/components/selects/' * delay(5000) * scroll("//div[@id='demo-simple-select']") * click('#demo-simple-select') * click("//div[@id='demo-simple-select']") * Karate.stop(500) Note: Here there is no native or traditional dropdown.Javascript/Material UI dropdown is used. 回答1: Use mouse() and input() for e.g. * mouse('#demo-simple-select').click() * input('body', Key.ENTER) If all this fails, try JS: https://stackoverflow.com/a

Karate UI: Javascript dropdown not getting clicked

走远了吗. 提交于 2021-01-28 10:15:52
问题 Scenario: Sample scenario Given driver 'https://material-ui.com/components/selects/' * delay(5000) * scroll("//div[@id='demo-simple-select']") * click('#demo-simple-select') * click("//div[@id='demo-simple-select']") * Karate.stop(500) Note: Here there is no native or traditional dropdown.Javascript/Material UI dropdown is used. 回答1: Use mouse() and input() for e.g. * mouse('#demo-simple-select').click() * input('body', Key.ENTER) If all this fails, try JS: https://stackoverflow.com/a