Debian Codegraph @

testing/web-platform/tests/tools/wave/docs/rest-api/sessions-api/create.md

raw
1 # `create` - [Sessions API](../README.md#sessions-api)
2
3 The `create` method of the sessions API creates a new session. If provided with an configuration it creates a session accordingly. If no configuration is provided it uses default values. It returns the session token of the newly created session, which is the unique identifier of sessions. While a session has the status `PENDING` it is possible to modify the configuration using the [`update`](./update.md) method of the sessions API. As it is required to create the session from the device under test, this is really helpful, since it allows to configure the session using a second device.
4
5 ## HTTP Request
6
7 `POST /api/sessions`
8
9 ## Request Payload
10
11 ```json
12 {
13 "tests": {
14 "include": "Array<String>",
15 "exclude": "Array<String>"
16 },
17 "types": "Enum['automatic', 'manual']",
18 "timeouts": {
19 "automatic": "Integer",
20 "manual": "Integer",
21 "<test_path>": "Integer"
22 },
23 "reference_tokens": "Array<String>",
24 "labels": "Array<String>",
25 "type": "String"
26 }
27 ```
28
29 - **tests** specifies the tests of the session:
30 - **include** specifies what tests should be selected from all available tests. Can be a path to a test file or directory. Provided query parameters will be added to all matching test urls.
31 - **exclude** specifies what tests should be removed from the included tests. Can be a path to a test file or directory.
32 - **types** what types of tests should be included. Possible values:
33 - **automatic** tests are tests that execute without user interaction.
34 - **manual** tests are tests that require user interaction.
35 - **timeouts** specifies the time to wait for a test to finish in milliseconds.
36 - **automatic**: Sets the default timeout for all automatic tests.
37 - **manual**: Sets the default timeout for all manual tests.
38 - **custom test paths**: Set the timeout for a test file or directory by putting the path with all dots removed as the key.
39 - **reference_tokens** specifies a set of completed sessions that is used to filter out all tests that have not passed in all those sessions from the session that is going to be created.
40 - **labels** specifies the initial set of labels for the session.
41 - **type** specifies the session type to trigger type specific behaviour like different control pages.
42
43 ### Default
44
45 ```json
46 {
47 "tests": {
48 "include": ["/"],
49 "exclude": []
50 },
51 "types": ["automatic", "manual"],
52 "timeouts": {
53 "automatic": 60000,
54 "manual": 300000
55 },
56 "reference_tokens": [],
57 "labels": []
58 }
59 ```
60
61 ## Response Payload
62
63 If successful, the token of the new session is returned.
64
65 ```json
66 {
67 "token": "String"
68 }
69 ```
70
71 ## Example
72
73 **Request:**
74
75 `POST /api/sessions`
76
77 ```json
78 {
79 "tests": {
80 "include": ["/apiOne", "/apiTwo/sub"],
81 "exclude": ["/apiOne/specials"]
82 },
83 "types": ["automatic"],
84 "timeouts": {
85 "automatic": 70000,
86 "/apiOne/example/dir": 30000,
87 "/apiOne/example/filehtml": 45000
88 },
89 "reference_tokens": [
90 "ce2dc080-c283-11e9-b4d6-e046513784c2",
91 "430f47d0-c283-11e9-8776-fcbc36b81035"
92 ],
93 "labels": ["label1", "label2", "label3"]
94 }
95 ```
96
97 **Response:**
98
99 ```json
100 {
101 "token": "6fdbd1a0-c339-11e9-b775-6d49dd567772"
102 }
103 ```