linagora/james-gatling

Have a step for /changes (Email + Mailbox)

chibenwa opened this issue · 3 comments

Initialize a first step the state with a /get call (prepare) (old state)

given the previous state, do a /changes call and record the newer state for later calls.

How

In JmapMailbox:

Define a method for fetching new state:

def getNewState(oldState: State): ChainBuilder = {
    JmapHttp.apiCall("mailboxChanges")
      .body(StringBody(
        s"""{
           |  "using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail"],
           |  "methodCalls": [[
           |    "Mailbox/changes",
           |      "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
           |      "sinceState": $oldState
           |    "c1"]]
           |}""".stripMargin))
      .check(status.is(200))
      .check(jsonPath("$.$.methodResponses[0][1].newState").saveAs("oldState")))

In JmapEmail:

Define a method for fetching new state:

def getNewState(oldState: State): ChainBuilder = {
    JmapHttp.apiCall("mailboxChanges")
      .body(StringBody(
        s"""{
           |  "using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail"],
           |  "methodCalls": [[
           |    "Email/changes",
           |      "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
           |      "sinceState": $oldState
           |    "c1"]]
           |}""".stripMargin))
      .check(status.is(200))
      .check(jsonPath("$.$.methodResponses[0][1].newState").saveAs("newState")))

DoD

Create 2 simple scenarios:

  • Fetch initial state of Mailbox by a Mailbox/get call -> make some changes to Mailbox (update see flags) -> fetch new state -> check new state is different than initial state.
  • Fetch initial state of Email by a Email/get call -> make some changes to Email (update flags) -> fetch new state -> check new state is different than initial state.

We do have a /query call for email in Gatling already btw, just not taking states into consideration so far

We do have a /query call for email in Gatling already btw, just not taking states into consideration so far

/changes sorry

Add back reference in the request