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

Develop #1328

Merged
merged 7 commits into from
Oct 15, 2020
Merged

Develop #1328

merged 7 commits into from
Oct 15, 2020

Conversation

chaudharydeepak
Copy link
Contributor

@chaudharydeepak chaudharydeepak commented Oct 14, 2020

#1293 unify cookie for api and ui tests

Thanks for contributing this Pull Request. Make sure that you submit this Pull Request against the develop branch of this repository, add a brief description, and tag the relevant issue(s) and PR(s) below.

  • Relevant Issues : Allow UI cookies to flow through api calls and vice-versa.
  • Type of change :
    • New feature
    • Bug fix for existing feature

@@ -107,6 +110,19 @@
@AutoDef
Map<String, Object> cookie(String name);

@AutoDef
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left this method as default to avoid duplicating the logic in multiple driver implementations. Let me know if this ok, else we can push to respective driver implementations. - Deepak

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the default method approach

/**
* Cookie Utility method for UI calls.
*/
public class UICookieUtils {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can add this utility method tocom.intuit.karate.http.HttpUtils

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

/**
* creates a map corresponding to cookie. This is used by appropriate drivers.
* Karate Cookie Map is of type <String, String> vs the internal framwork expects appropriate types -
* for ex boolean for secure and persistent keys.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes this makes sense. can you just apply IDE java formatting to add white-space (nit pick)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@@ -107,6 +110,19 @@
@AutoDef
Map<String, Object> cookie(String name);

@AutoDef
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the default method approach

Given driver 'https://google.com'
And input("input[name=q]", 'karate dsl')
When submit().click("input[name=btnI]")
Then waitForUrl('https://github.com/intuit/karate')

Scenario: pass cookie from API call to UI call
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since I am used to using demo-01.feature for various live demos, can you move this into a new feature and java runner ? really appreciate that you took time to write a test 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! created new runner / feature for hybrid and reverted all -1 changes.

@chaudharydeepak
Copy link
Contributor Author

@ptrthomas - thank you for the review - I will make the changes and resubmit.

@chaudharydeepak
Copy link
Contributor Author

@ptrthomas - pushed changes per review comments. Thank you.

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

Successfully merging this pull request may close these issues.

2 participants