· 7 years ago · Mar 22, 2019, 03:54 PM
1Feature: preorderSubscription
2
3 Background:
4 * url BASE_URL
5 * path "/.rest/graphql"
6 * def getRand =
7 """
8 function() {
9 var r = Math.random().toString(36).substring(7) + "@gmail.com";
10 return r;
11 }
12 """
13 * def email = getRand()
14
15 @1187728
16 Scenario: Проверка уÑпешной подпиÑки на новоÑти по товару
17 Given text query =
18 """
19 mutation preorderSubscription($productId: String!, $email: String!, $parameters: JSessionQueryParameters) {
20 preorderSubscription(productId: $productId, email: $email, parameters: $parameters) {
21 message
22 }
23 }
24 """
25 * def variables =
26 """
27 {
28 "productId": "20031648",
29 "email": '#(email)',
30 "parameters": {
31 "cityId": "CityCZ_975",
32 "regionId": "1",
33 "sessionId": "Y5hJcv8L0GsnChfgn2vby0z1vppHv7XF4fwPvsTmkLgr6DjmQs1S!416549370",
34 "bips": "1081167284"
35 }
36 }
37 """
38 When request { query: '#(query)', variables: '#(variables)' }
39
40 And method post
41 Then status 200
42 * def preorderSubscriptionSchema =
43 """
44 {
45 "data": {
46 "preorderSubscription": null
47 },
48 "errors": [
49 {
50 "message": "INTERNAL_SERVER_ERROR",
51 "path": [
52 "preorderSubscription"
53 ],
54 "errorCode": 500,
55 "errorLink": null,
56 "errorType": "DataFetchingException"
57 }
58 ]
59 }
60 """
61 * print request
62 And match response == preorderSubscriptionSchema