Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeout capabilities(aws:maxDurationSecs & aws:idleTimeoutSecs) are not reflecting in Karate #1

Closed
Idsbali opened this issue Aug 31, 2021 · 2 comments
Labels
question Further information is requested

Comments

@Idsbali
Copy link

Idsbali commented Aug 31, 2021

When I added the timeout capabilities(aws:maxDurationSecs & aws:idleTimeoutSecs) in DeviceFarmTarget.java as shown below its not getting reflected. Please see the devicefarm webdriver.log below
--------------------------DeviceFarmTarget.java---------------------------------
@OverRide
public Map<String, Object> start(Logger logger) {
logger.info("making request to aws for browser: {}", browserName);
logger.info(" sercurty key arn : {}", arn);
DeviceFarmClient client = DeviceFarmClient.builder().region(Region.US_WEST_2).build();
CreateTestGridUrlRequest request = CreateTestGridUrlRequest.builder()
.expiresInSeconds(86400)
.projectArn(arn)
.build();
// logger.info(" request: {}", request);
CreateTestGridUrlResponse response = client.createTestGridUrl(request);
// logger.info(" response: {}", response);
String webDriverUrl = response.url();
// logger.info("aws url provisioned: {}", webDriverUrl);
Map<String, Object> map = new HashMap();
map.put("type", driverType);
map.put("start", false);
map.put("webDriverUrl", webDriverUrl);
// this is needed because it can take a minute or two for the "desktop" to be provisioned by aws
map.put("httpConfig", Collections.singletonMap("readTimeout", 120000));
// refer: https://docs.aws.amazon.com/devicefarm/latest/testgrid/techref-support.html
Map<String, Object> session = new HashMap();
map.put("webDriverSession", session);
Map<String, Object> capabilities = new HashMap();
capabilities.put("browserName", browserName);
capabilities.put("aws:maxDurationSecs", 2400);
capabilities.put("aws:idleTimeoutSecs", 900);
session.put("capabilities", capabilities);

    // for some reason, both are needed for aws device farm
    session.put("desiredCapabilities", capabilities);    
    return map;
}

----------------------------Webdriver.log-------------------------------
"capabilities": {
"alwaysMatch": {
"goog:chromeOptions": {
"args": [
"user-data-dir=C:\Users\testnode\chrome_user_data",
"--enable-logging --v=1"
]
}
},
"aws:idleTimeoutSecs": 240,
"aws:maxDurationSecs": 2400,
"browserName": "chrome"
}

The AWS suggested was trying setting the timeout capabilities(aws:maxDurationSecs & aws:idleTimeoutSecs) inside alwaysMatch .However, In the above case its outside the alwaysMatch.
IF this is the case, how do we add this capabilities in the DeviceFarmTarget.java so that it reflects inside the alwaysMatch block. Please let me know if you have any suggestion.

DeviceFarmTarget.docx

@ptrthomas ptrthomas added the question Further information is requested label Aug 31, 2021
@ptrthomas
Copy link
Owner

@Idsbali completely up to you how you create the hash map, this is just example code, you are encouraged to do the research and figure out what should be passed. this has nothing to do with karate. take the help of someone who knows java well if required

@ptrthomas
Copy link
Owner

@Idsbali in case this helps - you can create nested maps, so it is completely up to you

Map<String, Object> session = new HashMap();
map.put("webDriverSession", session);
Map<String, Object> capabilities = new HashMap();
session.put("capabilities", capabilities);
Map<String, Object> alwaysMatch = new HashMap();
session.put("alwaysMatch", alwaysMatch);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants