Intercepting multiple graphql operations in a karate UI scenario always returns the first response from mock feature

Viewed 45

My scenario in the top feature file looks like this:

Scenario: Fetch a cat type id and create a cat

* driver.intercept({ patterns: [{ urlPattern: '*api/graphql*'}], mock: 
'Mock.feature' })

When I click on the button to add a cat (//first graphql call happens. This gets cat types from the mock as expected)

And input a name

And select the cat type

And click create  (//second graphql call happens here. But this returns the cat types again)

Then I see a success message

Here is the mock.feature:

Scenario: karate.match("request contains operationName: 'getCatTypes'")

  • def response = call read ('response.json')

Scenario: karate.match("request contains operationName: 'AddCat'")

  • def response = call read ('response1.json')

We use karate standalone jar and on version v1.2.0.RC1 (tried with 1.1.0 as well).

Appreciate any suggestions/directions.

1 Answers
Related