itemengine-cypress-automation 1.0.332-e2eFixes4thMarch-728228a.0 → 1.0.332

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,479 @@
1
+ import { questionAndResourceReferenceIds } from "../../support/helpers/createItem"
2
+
3
+ describe('Fetch Resources and tools Data API cases', () => {
4
+ var timestamp;
5
+ before(() => {
6
+ cy.loginAs('admin');
7
+ cy.createItem('DataApiGetResourcesTest1');
8
+ cy.wait(5000)
9
+ cy.createItem('DataApiGetResourcesTest2');
10
+ cy.visit(`${Cypress.env('itemEngineHomePage')}`);
11
+ });
12
+
13
+ after(() => {
14
+ cy.on('uncaught:exception', () => {
15
+ return false
16
+ });
17
+ cy.deleteItems();
18
+ cy.logout();
19
+ });
20
+
21
+ it('If the user clicks on the Fetch Resources and Tools option from the menu bar, user should be navigated to the Fetch Resources and Tools page', () => {
22
+ cy.contains('Item Bank')
23
+ .click();
24
+ cy.contains('Fetch Resources and Tools')
25
+ .click();
26
+ cy.contains('Fetch Resources and Tools')
27
+ .parent()
28
+ .parent()
29
+ .should('have.class', 'Mui-selected');
30
+ cy.url()
31
+ .should('eq', Cypress.config().baseUrl + '/item-engine/data-api/item-bank/fetch-resources');
32
+ });
33
+
34
+ it('Example Request should be displayed', () => {
35
+ cy.get('pre[class="body-param__example microlight"]')
36
+ .eq(0)
37
+ .then((text) => {
38
+ console.log(text[0].innerText)
39
+ });
40
+ cy.get('pre[class="body-param__example microlight"]')
41
+ .eq(0)
42
+ .should('have.text', "{\n \"types\": [\n 1\n ],\n \"references\": [\n \"0ad5727f-625e-4c41-92ab-ac570b91f44a\"\n ],\n \"item_references\": [\n \"23786694-272c-4ae1-846e-495e7217f3b9\"\n ],\n \"keyword\": \"some keyword\",\n \"sort\": \"desc\",\n \"sort_field\": \"created\",\n \"limit\": 50,\n \"organisation_id\": \"eb7d4a20-c96c-4852-9b34-7e3231016315\",\n \"next_token\": [\n 1703069388983,\n \"c765e28-fd62-0351-8385-05c165ac05d5\"\n ]\n}\n");
43
+ });
44
+
45
+ it('Example Response for status code 200 should be displayed', () => {
46
+ cy.get('td[class="response-col_status"]')
47
+ .eq(0)
48
+ .should('have.text', '200');
49
+ cy.get('.response-col_description__inner')
50
+ .eq(0)
51
+ .should('have.text', 'OK');
52
+ cy.get('pre[class="example microlight"]')
53
+ .eq(0)
54
+ .should('have.text', "{\n \"meta\": {\n \"status\": true,\n \"timestamp\": 1652264312568,\n \"records\": 11,\n \"next_token\": [\n 1703069388983,\n \"myPassageRef071\"\n ]\n },\n \"data\": [\n {\n \"reference\": \"myPassageRef071\",\n \"type\": 1,\n \"data\": {\n \"type\": \"Passage\",\n \"content\": \"This is content of the passage\",\n \"heading\": \"This is passage heading\"\n },\n \"type_name\": \"Passage\"\n }\n ]\n}\n");
55
+ });
56
+
57
+ it('Example Response for status code 401 should be displayed', () => {
58
+ cy.get('td[class="response-col_status"]')
59
+ .eq(1)
60
+ .should('have.text', '401');
61
+ cy.get('.response-col_description__inner')
62
+ .eq(1)
63
+ .should('have.text', 'Unauthorized');
64
+ cy.get('pre[class="example microlight"]')
65
+ .eq(1)
66
+ .should('have.text', "{\n \"meta\": {\n \"status\": false,\n \"message\": \"Invalid Signature\",\n \"timestamp\": 1653650826764\n },\n \"data\": []\n}\n");
67
+ });
68
+
69
+ it('Example Response for status code 422 should be displayed', () => {
70
+ cy.get('td[class="response-col_status"]')
71
+ .eq(2)
72
+ .should('have.text', '422');
73
+ cy.get('.response-col_description__inner')
74
+ .eq(2)
75
+ .should('have.text', 'Unprocessable Entity');
76
+ cy.get('pre[class="example microlight"]')
77
+ .eq(2)
78
+ .should('have.text', "{\n \"meta\": {\n \"status\": false,\n \"message\": \"field is required\",\n \"timestamp\": 1705577441132\n },\n \"data\": []\n}\n");
79
+ });
80
+
81
+ it('Example Response for status code 500 should be displayed', () => {
82
+ cy.get('td[class="response-col_status"]')
83
+ .eq(3)
84
+ .should('have.text', '500');
85
+ cy.get('.response-col_description__inner')
86
+ .eq(3)
87
+ .should('have.text', 'Internal Server Error');
88
+ cy.get('pre[class="example microlight"]')
89
+ .eq(3)
90
+ .should('have.text', "{\n \"meta\": {\n \"status\": false,\n \"message\": \"Error occurred while saving data\",\n \"timestamp\": 1705577441132\n },\n \"data\": []\n}\n");
91
+ });
92
+
93
+ it('Entering request with a non existing resource reference id', () => {
94
+ cy.get('.try-out__btn')
95
+ .click();
96
+ cy.get('textarea[class="body-param__text"]')
97
+ .clear()
98
+ .fill(`{\n "types": [],\n "references": ["non existing item reference"],\n "item_references": [],\n "keyword": "random keyword",\n "sort": "desc",\n "sort_field": "created",\n "limit": 50,\n "page": 0\n}`);
99
+ cy.get('.execute')
100
+ .click();
101
+ cy.wait(2000);
102
+ cy.get('.loading-container')
103
+ .should('not.exist');
104
+ //Storing the timestamp for assertion
105
+ cy.get('pre[class="microlight"]')
106
+ .eq(1)
107
+ .within(() => {
108
+ cy.contains('timestamp')
109
+ .next().next().then((currTimestamp) => {
110
+ timestamp = currTimestamp[0].innerText
111
+ });
112
+ });
113
+ });
114
+
115
+ it('A blank data array should be received in the response with status code 200', () => {
116
+ cy.get('td[class="response-col_status"]')
117
+ .eq(0)
118
+ .should('have.text', '200');
119
+ cy.get('pre[class="microlight"]')
120
+ .eq(1)
121
+ .should('have.text', `{\n \"meta\": {\n \"status\": true,\n \"records\": 0,\n \"timestamp\": ${timestamp},\n \"next_token\": null\n },\n \"data\": []\n}\n`);
122
+ });
123
+
124
+ it.skip('Entering the request with multiple item references separated by a comma', () => {
125
+ cy.get('textarea[class="body-param__text"]')
126
+ .clear()
127
+ .fill(`{\n "item_references": ["DataApiGetResourcesTest1","DataApiGetResourcesTest1"]}`);
128
+ cy.get('.execute')
129
+ .click();
130
+ cy.wait(2000);
131
+ cy.get('.loading-container')
132
+ .should('not.exist');
133
+ //Storing the timestamp for assertion
134
+ cy.get('pre[class="microlight"]')
135
+ .eq(1)
136
+ .within(() => {
137
+ cy.contains('timestamp')
138
+ .next().next().then((currTimestamp) => {
139
+ timestamp = currTimestamp[0].innerText
140
+ });
141
+ });
142
+ });
143
+
144
+ it.skip('All the resources and tool of the entered item reference should be returned in the response with status code 200', () => {
145
+ cy.get('td[class="response-col_status"]')
146
+ .eq(0)
147
+ .should('have.text', '200');
148
+ cy.get('pre[class="microlight"]')
149
+ .eq(1)
150
+ .should('have.text', `{\n "meta": {\n "status": true,\n "timestamp": ${timestamp},\n "records": 4\n },\n "data": [\n {\n "reference": "${questionAndResourceReferenceIds[1][7]}",\n "type": 1,\n "meta_data": {\n "lexile": "Lexile Details",\n "flesch_kincaid": "Flesch-Kincaid Details",\n "teacher_guideline": "<p>Teacher Guidelines appear here</p>\\n"\n },\n "settings": {\n "enable_pagination": true\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for Passage",\n "options_list": [\n {\n "text": "<p>Paginated content 1</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n },\n {\n "text": "<p>Paginated content 2</p>\\n",\n "option_number": 2,\n "option_identifier": "ContentIdentifire2"\n },\n {\n "text": "<p>Paginated Content 3</p>\\n",\n "option_number": 3,\n "option_identifier": "ContentIdentifire3"\n }\n ]\n },\n "type_name": "Passage"\n },\n {\n "reference": "${questionAndResourceReferenceIds[1][8]}",\n "type": 1,\n "meta_data": {\n "lexile": "",\n "flesch_kincaid": "",\n "teacher_guideline": ""\n },\n "settings": {\n "enable_pagination": false\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for passage without pagination",\n "options_list": [\n {\n "text": "<p>passage content without pagination</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n }\n ]\n },\n "type_name": "Passage"\n },\n {\n "reference": "${questionAndResourceReferenceIds[0][7]}",\n "type": 1,\n "meta_data": {\n "lexile": "Lexile Details",\n "flesch_kincaid": "Flesch-Kincaid Details",\n "teacher_guideline": "<p>Teacher Guidelines appear here</p>\\n"\n },\n "settings": {\n "enable_pagination": true\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for Passage",\n "options_list": [\n {\n "text": "<p>Paginated content 1</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n },\n {\n "text": "<p>Paginated content 2</p>\\n",\n "option_number": 2,\n "option_identifier": "ContentIdentifire2"\n },\n {\n "text": "<p>Paginated Content 3</p>\\n",\n "option_number": 3,\n "option_identifier": "ContentIdentifire3"\n }\n ]\n },\n "type_name": "Passage"\n },\n {\n "reference": "${questionAndResourceReferenceIds[0][8]}",\n "type": 1,\n "meta_data": {\n "lexile": "",\n "flesch_kincaid": "",\n "teacher_guideline": ""\n },\n "settings": {\n "enable_pagination": false\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for passage without pagination",\n "options_list": [\n {\n "text": "<p>passage content without pagination</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n }\n ]\n },\n "type_name": "Passage"\n }\n ]\n}\n`);
151
+ });
152
+
153
+ it.skip('Entering the request with multiple item references, filtered by type', () => {
154
+ cy.get('textarea[class="body-param__text"]')
155
+ .clear()
156
+ .fill(`{\n "types": [1],\n "references": [],\n "item_references": ["DataApiGetResourcesTest1","DataApiGetResourcesTest2"],\n "keyword": "random keyword",\n "sort": "desc",\n "sort_field": "created",\n "limit": 50,\n "page": 0\n}`);
157
+ cy.get('.execute')
158
+ .click();
159
+ cy.wait(2000);
160
+ cy.get('.loading-container')
161
+ .should('not.exist');
162
+ //Storing the timestamp for assertion
163
+ cy.get('pre[class="microlight"]')
164
+ .eq(1)
165
+ .within(() => {
166
+ cy.contains('timestamp')
167
+ .next().next().then((currTimestamp) => {
168
+ timestamp = currTimestamp[0].innerText
169
+ });
170
+ });
171
+ });
172
+
173
+ it.skip('The keyword filter should be applicable when the user user has entered the type & if there are no resources with the entered keyword, a blank data array should be returned in the response, with status code 200', () => {
174
+ cy.get('td[class="response-col_status"]')
175
+ .eq(0)
176
+ .should('have.text', '200');
177
+ cy.get('pre[class="microlight"]')
178
+ .eq(1)
179
+ .should('have.text', `{\n "meta": {\n "status": true,\n "timestamp": ${timestamp},\n "records": 0\n },\n "data": []\n}\n`);
180
+ });
181
+
182
+ it.skip('Entering the request with multiple item references, filtered by type and without keyword filter', () => {
183
+ cy.get('textarea[class="body-param__text"]')
184
+ .clear()
185
+ .fill(`{\n "types": [1],\n "references": [],\n "item_references": ["DataApiGetResourcesTest1","DataApiGetResourcesTest2"],\n "keyword": "",\n "sort": "desc",\n "sort_field": "created",\n "limit": 50,\n "page": 0\n}`);
186
+ cy.get('.execute')
187
+ .click();
188
+ cy.wait(2000);
189
+ cy.get('.loading-container')
190
+ .should('not.exist');
191
+ //Storing the timestamp for assertion
192
+ cy.get('pre[class="microlight"]')
193
+ .eq(1)
194
+ .within(() => {
195
+ cy.contains('timestamp')
196
+ .next().next().then((currTimestamp) => {
197
+ timestamp = currTimestamp[0].innerText
198
+ });
199
+ });
200
+ });
201
+
202
+ it.skip('All the resources and tool of the entered item reference and filtered by type should be returned in the response with status code 200', () => {
203
+ cy.get('td[class="response-col_status"]')
204
+ .eq(0)
205
+ .should('have.text', '200');
206
+ cy.get('pre[class="microlight"]')
207
+ .eq(1)
208
+ .should('have.text', `{\n "meta": {\n "status": true,\n "timestamp": ${timestamp},\n "records": 4\n },\n "data": [\n {\n "reference": "${questionAndResourceReferenceIds[1][7]}",\n "type": 1,\n "meta_data": {\n "lexile": "Lexile Details",\n "flesch_kincaid": "Flesch-Kincaid Details",\n "teacher_guideline": "<p>Teacher Guidelines appear here</p>\\n"\n },\n "settings": {\n "enable_pagination": true\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for Passage",\n "options_list": [\n {\n "text": "<p>Paginated content 1</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n },\n {\n "text": "<p>Paginated content 2</p>\\n",\n "option_number": 2,\n "option_identifier": "ContentIdentifire2"\n },\n {\n "text": "<p>Paginated Content 3</p>\\n",\n "option_number": 3,\n "option_identifier": "ContentIdentifire3"\n }\n ]\n },\n "type_name": "Passage"\n },\n {\n "reference": "${questionAndResourceReferenceIds[1][8]}",\n "type": 1,\n "meta_data": {\n "lexile": "",\n "flesch_kincaid": "",\n "teacher_guideline": ""\n },\n "settings": {\n "enable_pagination": false\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for passage without pagination",\n "options_list": [\n {\n "text": "<p>passage content without pagination</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n }\n ]\n },\n "type_name": "Passage"\n },\n {\n "reference": "${questionAndResourceReferenceIds[0][7]}",\n "type": 1,\n "meta_data": {\n "lexile": "Lexile Details",\n "flesch_kincaid": "Flesch-Kincaid Details",\n "teacher_guideline": "<p>Teacher Guidelines appear here</p>\\n"\n },\n "settings": {\n "enable_pagination": true\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for Passage",\n "options_list": [\n {\n "text": "<p>Paginated content 1</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n },\n {\n "text": "<p>Paginated content 2</p>\\n",\n "option_number": 2,\n "option_identifier": "ContentIdentifire2"\n },\n {\n "text": "<p>Paginated Content 3</p>\\n",\n "option_number": 3,\n "option_identifier": "ContentIdentifire3"\n }\n ]\n },\n "type_name": "Passage"\n },\n {\n "reference": "${questionAndResourceReferenceIds[0][8]}",\n "type": 1,\n "meta_data": {\n "lexile": "",\n "flesch_kincaid": "",\n "teacher_guideline": ""\n },\n "settings": {\n "enable_pagination": false\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for passage without pagination",\n "options_list": [\n {\n "text": "<p>passage content without pagination</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n }\n ]\n },\n "type_name": "Passage"\n }\n ]\n}\n`);
209
+ });
210
+
211
+ it.skip('Entering the request with multiple item references, filtered by type and sorted by created ascending', () => {
212
+ cy.get('textarea[class="body-param__text"]')
213
+ .clear()
214
+ .fill(`{\n "types": [1],\n "references": [],\n "item_references": ["DataApiGetResourcesTest1","DataApiGetResourcesTest2"],\n "keyword": "",\n "sort": "asc",\n "sort_field": "created",\n "limit": 50,\n "page": 0\n}`);
215
+ cy.get('.execute')
216
+ .click();
217
+ cy.wait(2000);
218
+ cy.get('.loading-container')
219
+ .should('not.exist');
220
+ //Storing the timestamp for assertion
221
+ cy.get('pre[class="microlight"]')
222
+ .eq(1)
223
+ .within(() => {
224
+ cy.contains('timestamp')
225
+ .next().next().then((currTimestamp) => {
226
+ timestamp = currTimestamp[0].innerText
227
+ });
228
+ });
229
+ });
230
+
231
+ it.skip('All the resources and tool of the entered item reference, filtered by type and sorted by created ascending should be returned in the response with status code 200', () => {
232
+ cy.get('td[class="response-col_status"]')
233
+ .eq(0)
234
+ .should('have.text', '200');
235
+ cy.get('pre[class="microlight"]')
236
+ .eq(1)
237
+ .should('have.text', `{\n "meta": {\n "status": true,\n "timestamp": ${timestamp},\n "records": 4\n },\n "data": [\n {\n "reference": "${questionAndResourceReferenceIds[0][7]}",\n "type": 1,\n "meta_data": {\n "lexile": "Lexile Details",\n "flesch_kincaid": "Flesch-Kincaid Details",\n "teacher_guideline": "<p>Teacher Guidelines appear here</p>\\n"\n },\n "settings": {\n "enable_pagination": true\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for Passage",\n "options_list": [\n {\n "text": "<p>Paginated content 1</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n },\n {\n "text": "<p>Paginated content 2</p>\\n",\n "option_number": 2,\n "option_identifier": "ContentIdentifire2"\n },\n {\n "text": "<p>Paginated Content 3</p>\\n",\n "option_number": 3,\n "option_identifier": "ContentIdentifire3"\n }\n ]\n },\n "type_name": "Passage"\n },\n {\n "reference": "${questionAndResourceReferenceIds[0][8]}",\n "type": 1,\n "meta_data": {\n "lexile": "",\n "flesch_kincaid": "",\n "teacher_guideline": ""\n },\n "settings": {\n "enable_pagination": false\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for passage without pagination",\n "options_list": [\n {\n "text": "<p>passage content without pagination</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n }\n ]\n },\n "type_name": "Passage"\n },\n {\n "reference": "${questionAndResourceReferenceIds[1][7]}",\n "type": 1,\n "meta_data": {\n "lexile": "Lexile Details",\n "flesch_kincaid": "Flesch-Kincaid Details",\n "teacher_guideline": "<p>Teacher Guidelines appear here</p>\\n"\n },\n "settings": {\n "enable_pagination": true\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for Passage",\n "options_list": [\n {\n "text": "<p>Paginated content 1</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n },\n {\n "text": "<p>Paginated content 2</p>\\n",\n "option_number": 2,\n "option_identifier": "ContentIdentifire2"\n },\n {\n "text": "<p>Paginated Content 3</p>\\n",\n "option_number": 3,\n "option_identifier": "ContentIdentifire3"\n }\n ]\n },\n "type_name": "Passage"\n },\n {\n "reference": "${questionAndResourceReferenceIds[1][8]}",\n "type": 1,\n "meta_data": {\n "lexile": "",\n "flesch_kincaid": "",\n "teacher_guideline": ""\n },\n "settings": {\n "enable_pagination": false\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for passage without pagination",\n "options_list": [\n {\n "text": "<p>passage content without pagination</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n }\n ]\n },\n "type_name": "Passage"\n }\n ]\n}\n`);
238
+ });
239
+
240
+ it.skip('Entering the request with multiple item references, filtered by type and resource reference and sorted by created ascending', () => {
241
+ cy.get('textarea[class="body-param__text"]')
242
+ .clear()
243
+ .fill(`{\n "types": [1],\n "references": ["${questionAndResourceReferenceIds[0][7]}","${questionAndResourceReferenceIds[1][8]}","incorrect reference"],\n "item_references": ["DataApiGetResourcesTest1","DataApiGetResourcesTest2"],\n "keyword": "",\n "sort": "asc",\n "sort_field": "created",\n "limit": 50,\n "page": 0\n}`);
244
+ cy.get('.execute')
245
+ .click();
246
+ cy.wait(2000);
247
+ cy.get('.loading-container')
248
+ .should('not.exist');
249
+ //Storing the timestamp for assertion
250
+ cy.get('pre[class="microlight"]')
251
+ .eq(1)
252
+ .within(() => {
253
+ cy.contains('timestamp')
254
+ .next().next().then((currTimestamp) => {
255
+ timestamp = currTimestamp[0].innerText
256
+ });
257
+ });
258
+ });
259
+
260
+ it.skip('All the resources and tool of the entered item reference, filtered by type and sorted by created ascending should be returned in the response with status code 200', () => {
261
+ cy.get('td[class="response-col_status"]')
262
+ .eq(0)
263
+ .should('have.text', '200');
264
+ // cy.get('td[class="response-col_status"]')
265
+ // .eq(0)
266
+ // .should('have.text', '200');
267
+ cy.get('pre[class="microlight"]')
268
+ .eq(1)
269
+ .should('have.text', `{\n "meta": {\n "status": true,\n "timestamp": ${timestamp},\n "records": 2\n },\n "data": [\n {\n "reference": "${questionAndResourceReferenceIds[0][7]}",\n "type": 1,\n "meta_data": {\n "lexile": "Lexile Details",\n "flesch_kincaid": "Flesch-Kincaid Details",\n "teacher_guideline": "<p>Teacher Guidelines appear here</p>\\n"\n },\n "settings": {\n "enable_pagination": true\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for Passage",\n "options_list": [\n {\n "text": "<p>Paginated content 1</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n },\n {\n "text": "<p>Paginated content 2</p>\\n",\n "option_number": 2,\n "option_identifier": "ContentIdentifire2"\n },\n {\n "text": "<p>Paginated Content 3</p>\\n",\n "option_number": 3,\n "option_identifier": "ContentIdentifire3"\n }\n ]\n },\n "type_name": "Passage"\n },\n {\n "reference": "${questionAndResourceReferenceIds[1][8]}",\n "type": 1,\n "meta_data": {\n "lexile": "",\n "flesch_kincaid": "",\n "teacher_guideline": ""\n },\n "settings": {\n "enable_pagination": false\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for passage without pagination",\n "options_list": [\n {\n "text": "<p>passage content without pagination</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n }\n ]\n },\n "type_name": "Passage"\n }\n ]\n}\n`);
270
+ });
271
+
272
+ it.skip('Entering the request with multiple item references, filtered by type and resource reference, sorted by created ascending and filtered by keyword', () => {
273
+ cy.get('textarea[class="body-param__text"]')
274
+ .clear()
275
+ .fill(`{\n "types": [1],\n "references": ["${questionAndResourceReferenceIds[0][7]}","${questionAndResourceReferenceIds[1][8]}","incorrect reference"],\n "item_references": ["DataApiGetResourcesTest1","DataApiGetResourcesTest2"],\n "keyword": "pagination",\n "sort": "asc",\n "sort_field": "created",\n "limit": 50,\n "page": 0\n}`);
276
+ cy.get('.execute')
277
+ .click();
278
+ cy.wait(2000);
279
+ cy.get('.loading-container')
280
+ .should('not.exist');
281
+ //Storing the timestamp for assertion
282
+ cy.get('pre[class="microlight"]')
283
+ .eq(1)
284
+ .within(() => {
285
+ cy.contains('timestamp')
286
+ .next().next().then((currTimestamp) => {
287
+ timestamp = currTimestamp[0].innerText
288
+ });
289
+ });
290
+ });
291
+
292
+ it.skip('All the resources and tool of the entered item reference, filtered by type, sorted by created ascending & filtered by keyword should be returned in the response with status code 200', () => {
293
+ cy.get('td[class="response-col_status"]')
294
+ .eq(0)
295
+ .should('have.text', '200');
296
+ // cy.get('td[class="response-col_status"]')
297
+ // .eq(0)
298
+ // .should('have.text', '200');
299
+ cy.get('pre[class="microlight"]')
300
+ .eq(1)
301
+ .should('have.text', `{\n "meta": {\n "status": true,\n "timestamp": ${timestamp},\n "records": 1\n },\n "data": [\n {\n "reference": "${questionAndResourceReferenceIds[1][8]}",\n "type": 1,\n "meta_data": {\n "lexile": "",\n "flesch_kincaid": "",\n "teacher_guideline": ""\n },\n "settings": {\n "enable_pagination": false\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for passage without pagination",\n "options_list": [\n {\n "text": "<p>passage content without pagination</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n }\n ]\n },\n "type_name": "Passage"\n }\n ]\n}\n`);
302
+ });
303
+
304
+ it('Entering request with an invalid resource integer', () => {
305
+ cy.get('textarea[class="body-param__text"]')
306
+ .clear()
307
+ .fill(`{\n "types": [100],\n "references": ["${questionAndResourceReferenceIds[0][7]}","${questionAndResourceReferenceIds[1][8]}","incorrect reference"],\n "item_references": ["DataApiGetResourcesTest1","DataApiGetResourcesTest2"],\n "keyword": "pagination",\n "sort": "asc",\n "sort_field": "created",\n "limit": 50,\n "page": 0\n}`);
308
+ cy.get('.execute')
309
+ .click();
310
+ cy.wait(2000);
311
+ cy.get('.loading-container')
312
+ .should('not.exist');
313
+ //Storing the timestamp for assertion
314
+ cy.get('pre[class="microlight"]')
315
+ .eq(1)
316
+ .within(() => {
317
+ cy.contains('timestamp')
318
+ .next().next().then((currTimestamp) => {
319
+ timestamp = currTimestamp[0].innerText
320
+ });
321
+ });
322
+ });
323
+
324
+ it('A blank data array should be received in the response, with a status code 200', () => {
325
+ cy.get('td[class="response-col_status"]')
326
+ .eq(0)
327
+ .should('have.text', '200');
328
+ cy.get('pre[class="microlight"]')
329
+ .eq(1)
330
+ .should('have.text', `{\n \"meta\": {\n \"message\": \"Please provide valid resource types\",\n \"timestamp\": ${timestamp},\n \"status\": false\n },\n \"data\": []\n}\n`);
331
+ });
332
+
333
+ it('Entering request with a non existing question reference', () => {
334
+ cy.get('textarea[class="body-param__text"]')
335
+ .clear()
336
+ .fill(`{\n "types": [],\n "references": ["${questionAndResourceReferenceIds[0][7]}","${questionAndResourceReferenceIds[1][8]}"],\n "item_references": ["incorrect item reference"],\n "keyword": "pagination",\n "sort": "asc",\n "sort_field": "created",\n "limit": 50,\n "page": 0\n}`);
337
+ cy.get('.execute')
338
+ .click();
339
+ cy.wait(2000);
340
+ cy.get('.loading-container')
341
+ .should('not.exist');
342
+ //Storing the timestamp for assertion
343
+ cy.get('pre[class="microlight"]')
344
+ .eq(1)
345
+ .within(() => {
346
+ cy.contains('timestamp')
347
+ .next().next().then((currTimestamp) => {
348
+ timestamp = currTimestamp[0].innerText
349
+ });
350
+ });
351
+ });
352
+
353
+ it('A blank data array should be received in the response, with a status code 200', () => {
354
+ cy.get('td[class="response-col_status"]')
355
+ .eq(0)
356
+ .should('have.text', '200');
357
+ cy.get('pre[class="microlight"]')
358
+ .eq(1)
359
+ .should('have.text', `{\n \"meta\": {\n \"message\": \"Error occurred while fetching data\",\n \"timestamp\": ${timestamp},\n \"status\": false\n },\n \"data\": []\n}\n`
360
+ );
361
+ });
362
+
363
+ it('Entering request with an invalid resource type- invalid input syntax', () => {
364
+ cy.get('textarea[class="body-param__text"]')
365
+ .clear()
366
+ .fill(`{\n "types": ["passage"],\n "references": ["${questionAndResourceReferenceIds[0][7]}","${questionAndResourceReferenceIds[1][8]}","incorrect reference"],\n "item_references": ["DataApiGetResourcesTest1","DataApiGetResourcesTest2"],\n "keyword": "pagination",\n "sort": "asc",\n "sort_field": "created",\n "limit": 50,\n "page": 0\n}`);
367
+ cy.get('.execute')
368
+ .click();
369
+ cy.wait(2000);
370
+ cy.get('.loading-container')
371
+ .should('not.exist');
372
+ cy.get('pre[class="microlight"]')
373
+ .eq(1)
374
+ .within(() => {
375
+ cy.contains('timestamp')
376
+ .next().next().then((currTimestamp) => {
377
+ timestamp = currTimestamp[0].innerText
378
+ });
379
+ });
380
+ });
381
+
382
+ //need to check status code
383
+ it('Error message should be received in the response, with a status code 500', () => {
384
+ cy.get('td[class="response-col_status"]')
385
+ .eq(0)
386
+ .should('have.text', '200');
387
+ cy.get('pre[class="microlight"]')
388
+ .eq(1)
389
+ .should('have.text', `{\n \"meta\": {\n \"message\": \"Please provide valid resource types\",\n \"timestamp\": ${timestamp},\n \"status\": false\n },\n \"data\": []\n}\n`
390
+ );
391
+ });
392
+
393
+ it('Entering request with an invalid organization ID', () => {
394
+ cy.get('textarea[class="body-param__text"]')
395
+ .clear()
396
+ .fill(`{\n "types": [],\n "references": ["${questionAndResourceReferenceIds[0][7]}"],\n "item_references": ["DataApiGetResourcesTest1", "DataApiGetResourcesTest2"],\n "keyword": "",\n "sort": "asc",\n "sort_field": "created",\n "limit": 50,\n "page": 0,\n "organisation_id": "incorrectOrgID"\n}\n`);
397
+ cy.get('.execute')
398
+ .click();
399
+ cy.wait(2000);
400
+ cy.get('.loading-container')
401
+ .should('not.exist');
402
+ cy.get('pre[class="microlight"]')
403
+ .eq(1)
404
+ .within(() => {
405
+ cy.contains('timestamp')
406
+ .next().next().then((currTimestamp) => {
407
+ timestamp = currTimestamp[0].innerText
408
+ });
409
+ });
410
+ });
411
+
412
+ //need to check status code
413
+ it('Error message should be received in the response, with a status code 422', () => {
414
+ cy.get('td[class="response-col_status"]')
415
+ .eq(0)
416
+ .should('have.text', '200');
417
+ cy.get('pre[class="microlight"]')
418
+ .eq(1)
419
+ .should('have.text', `{\n \"meta\": {\n \"message\": \"Invalid OrganisationId\",\n \"timestamp\": ${timestamp},\n \"status\": false\n },\n \"data\": []\n}\n`);
420
+ });
421
+
422
+ it('Entering request with an existing resource reference id', () => {
423
+ cy.get('textarea[class="body-param__text"]')
424
+ .clear()
425
+ .fill(`{\n "types": [],\n "references": ["${questionAndResourceReferenceIds[0][7]}"],\n "item_references": ["DataApiGetResourcesTest1", "DataApiGetResourcesTest2"],\n "keyword": "",\n "sort": "asc",\n "sort_field": "created",\n "limit": 50,\n "page": 0\n}`);
426
+ cy.get('.execute')
427
+ .click();
428
+ cy.wait(2000);
429
+ cy.get('.loading-container')
430
+ .should('not.exist');
431
+ //Storing the timestamp for assertion
432
+ cy.get('pre[class="microlight"]')
433
+ .eq(1)
434
+ .within(() => {
435
+ cy.contains('timestamp')
436
+ .next().next().then((currTimestamp) => {
437
+ timestamp = currTimestamp[0].innerText
438
+ });
439
+ });
440
+ });
441
+
442
+ it.skip('The question as per the entered question reference, should be returned in the response, with a status code 200', () => {
443
+ cy.get('td[class="response-col_status"]')
444
+ .eq(0)
445
+ .should('have.text', '200');
446
+ cy.get('pre[class="microlight"]')
447
+ .eq(1)
448
+ .should('have.text', `{\n "meta": {\n "status": true,\n "timestamp": ${timestamp},\n "records": 1\n },\n "data": [\n {\n "reference": "${questionAndResourceReferenceIds[0][7]}",\n "type": 1,\n "meta_data": {\n "lexile": "Lexile Details",\n "flesch_kincaid": "Flesch-Kincaid Details",\n "teacher_guideline": "<p>Teacher Guidelines appear here</p>\\n"\n },\n "settings": {\n "enable_pagination": true\n },\n "data": {\n "type": "Passage",\n "heading": "Heading for Passage",\n "options_list": [\n {\n "text": "<p>Paginated content 1</p>\\n",\n "option_number": 1,\n "option_identifier": "ContentIdentifire1"\n },\n {\n "text": "<p>Paginated content 2</p>\\n",\n "option_number": 2,\n "option_identifier": "ContentIdentifire2"\n },\n {\n "text": "<p>Paginated Content 3</p>\\n",\n "option_number": 3,\n "option_identifier": "ContentIdentifire3"\n }\n ]\n },\n "type_name": "Passage"\n }\n ]\n}\n`);
449
+ });
450
+
451
+ it('Entering request with an invalid combination of item and resource reference id', () => {
452
+ cy.get('textarea[class="body-param__text"]')
453
+ .clear()
454
+ .fill(`{\n "types": [],\n "references": ["${questionAndResourceReferenceIds[0][7]}"],\n "item_references": ["DataApiGetResourcesTest2"],\n "keyword": "",\n "sort": "asc",\n "sort_field": "created",\n "limit": 50,\n "page": 0\n}`);
455
+ cy.get('.execute')
456
+ .click();
457
+ cy.wait(2000);
458
+ cy.get('.loading-container')
459
+ .should('not.exist');
460
+ //Storing the timestamp for assertion
461
+ cy.get('pre[class="microlight"]')
462
+ .eq(1)
463
+ .within(() => {
464
+ cy.contains('timestamp')
465
+ .next().next().then((currTimestamp) => {
466
+ timestamp = currTimestamp[0].innerText
467
+ });
468
+ });
469
+ });
470
+
471
+ it.skip('A blank data array should be received in the response, with a status code 200', () => {
472
+ cy.get('td[class="response-col_status"]')
473
+ .eq(0)
474
+ .should('have.text', '200');
475
+ cy.get('pre[class="microlight"]')
476
+ .eq(1)
477
+ .should('have.text', `{\n "meta": {\n "status": true,\n "timestamp": ${timestamp},\n "records": 0\n },\n "data": []\n}\n`);
478
+ });
479
+ });
@@ -129,7 +129,6 @@ describe('Save Item Data API cases', () => {
129
129
  .find('span')
130
130
  .eq(0)
131
131
  .should('have.text', '<!DOCTYPE ');
132
- ///Need to revisit
133
132
  // cy.get('pre[class="microlight"]')
134
133
  // .eq(0)
135
134
  // .should('have.text', '{\n "message": "\\"items[0].reference\\" is not allowed to be empty",\n "success": false\n}\n');
@@ -100,7 +100,7 @@ describe('Set Question Data API cases', () => {
100
100
  .should('not.exist');
101
101
  });
102
102
 
103
- it('Reference property is required message should be received in the response, with status code 422', () => {
103
+ it('Reference property is required message should be received in the response, with status code 200', () => {
104
104
  cy.get('td[class="response-col_status"]')
105
105
  .eq(0)
106
106
  .should('have.text', '200');
@@ -130,7 +130,6 @@ describe('Set Question Data API cases', () => {
130
130
  });
131
131
  });
132
132
 
133
- //need to check the status code
134
133
  it('Invalid XML message should be received in the response, with status code 200', () => {
135
134
  cy.get('td[class="response-col_status"]')
136
135
  .eq(0)
@@ -151,8 +150,7 @@ describe('Set Question Data API cases', () => {
151
150
  .should('not.exist');
152
151
  });
153
152
 
154
- //need to check the status code
155
- it('XML is not allowed to be empty message should be received in the response, with status code 422', () => {
153
+ it('XML is not allowed to be empty message should be received in the response, with status code 200', () => {
156
154
  cy.get('td[class="response-col_status"]')
157
155
  .eq(0)
158
156
  .should('have.text', '200');
@@ -174,7 +172,7 @@ describe('Set Question Data API cases', () => {
174
172
  .should('not.exist');
175
173
  });
176
174
 
177
- it('Reference id already exists message should be received in the response, with status code 422', () => {
175
+ it('Reference id already exists message should be received in the response, with status code 200', () => {
178
176
  cy.get('pre[class="microlight"]')
179
177
  .eq(1)
180
178
  cy.get('pre[class="microlight"]')
@@ -70,7 +70,7 @@ describe('Save MCQ Question with Alternate Answers API cases', () => {
70
70
  .should('have.text', '200');
71
71
  cy.get('pre[class="microlight"]')
72
72
  .eq(1)
73
- .should('have.text', `{\n "meta": {\n "message": "Key (reference_id, organisation_id)=(1ed861b-7dd3-1a1-0abc-7158cf8d4a7-dataAPiTest, 7e15466c-30cb-4fdf-b160-6e6fc3660d0e) already exists.",\n "timestamp": ${timestamp},\n "status": false\n },\n "data": []\n}\n`);
73
+ .should('have.text', `{\n \"meta\": {\n \"message\": \"Key (reference_id, organisation_id)=(1ed861b-7dd3-1a1-0abc-7158cf8d4a7-dataAPiTest, 7e15466c-30cb-4fdf-b160-6e6fc3660d0e) already exists.\",\n \"timestamp\": ${timestamp},\n \"status\": false\n },\n \"data\": []\n}\n`);
74
74
  });
75
75
 
76
76
  it('Entering request with empty question_XML', () => {
@@ -4,7 +4,17 @@ export var questionAndResourceReferenceIds = [];
4
4
  export var createdAndUpdatedAtDate = [];
5
5
 
6
6
  const domainName = `${Cypress.env('SANDBOX_SERVICES_URL')}`.slice(8);
7
- const referenceIdsItem = ["f72bdb8-e6ad-64f-617b-fe40d2b0a7"];
7
+
8
+ let referenceIdsItem = [];
9
+ if (domainName === 'sandbox.itemengine-dev.il-apps.com') {
10
+ referenceIdsItem = ["bdf0e1d-2a1b-6dc4-851d-e14c4b75f4c8"];
11
+ } else if (domainName === 'sandbox.itemengine-qa.il-apps.com') {
12
+ referenceIdsItem = ["a61f2-1a16-eff1-421d-ba3defd3e643"];
13
+ } else if (domainName === 'sandbox.itemengine-staging.il-apps.com') {
14
+ referenceIdsItem = ["f72bdb8-e6ad-64f-617b-fe40d2b0a7"];
15
+ } else if (domainName === 'sandbox.itemengine-prod.il-apps.com') {
16
+ referenceIdsItem = ["0bd4400-7737-5b10-86d-d24ddd101da"];
17
+ }
8
18
 
9
19
  Cypress.Commands.add('createItem', (itemName) => {
10
20
  const token = window.localStorage.getItem('ngie_accessToken');
@@ -86,7 +96,7 @@ Cypress.Commands.add('createItem', (itemName) => {
86
96
  },
87
97
  "type": "item",
88
98
  "userId": userID,
89
- "domain": "sandbox.itemengine-staging.il-apps.com"
99
+ "domain": domainName
90
100
  }
91
101
  },
92
102
  "query": "query generateSignedRequest($input: GenerateSignedRequest) {\n generateSignedRequest(input: $input) {\n success\n signedRequest {\n authentication {\n timestamp\n domain\n consumerKey\n signature\n userId\n __typename\n }\n request\n __typename\n }\n __typename\n }\n}\n"
@@ -286,8 +296,8 @@ Cypress.Commands.add('createItem', (itemName) => {
286
296
  cy.log('ENCOUNTERED A 5xx ERROR');
287
297
  }
288
298
  var currCreatedAndUpdatedAtDate = [];
289
- currCreatedAndUpdatedAtDate.push(resp.body.data.setItem.data.createdAt);
290
- currCreatedAndUpdatedAtDate.push(resp.body.data.setItem.data.updatedAt);
299
+ currCreatedAndUpdatedAtDate.push(resp.body.data.setItem.data.dt_created);
300
+ currCreatedAndUpdatedAtDate.push(resp.body.data.setItem.data.dt_updated);
291
301
  createdAndUpdatedAtDate.push(currCreatedAndUpdatedAtDate);
292
302
  questionAndResourceReferenceIds.push(currentReferenceIds);
293
303
  itemReferenceIds.push(itemName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.332-e2eFixes4thMarch-728228a.0",
3
+ "version": "1.0.332",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,7 +30,7 @@
30
30
  "spinnaker:audioResponse": "node scripts/questions.mjs --env theme=ilc,questionType=AudioResponseNew_VideoResponseNew_UploadResponse_ToolAudioPlayerNew,grepTags=-css+-a11y",
31
31
  "spinnaker:feedbackScale": "node scripts/questions.mjs --env theme=ilc,questionType=FeedbackScaleNew_BrainingCampManipulative_EditItem_ToolSettings,grepTags=-css+-a11y",
32
32
  "spinnaker:resourcesAndTools": "node scripts/questions.mjs --env theme=ilc,questionType=Compass_ContentBlocks_Protractor_ReadingRuler_SimpleCalculator_Ruler,grepTags=-css+-a11y",
33
- "spinnaker:dataApiTest": "node scripts/questions.mjs --env theme=ilc,questionType=DataApi,grepTags=-css+-a11y"
33
+ "spinnaker:dataApiTest": "node scripts/questions.mjs --env theme=ilc,questionType=DataApi_Sessions,grepTags=-css+-a11y"
34
34
  },
35
35
  "repository": {
36
36
  "type": "git",
@@ -52,4 +52,4 @@
52
52
  "devDependencies": {
53
53
  "@applitools/eyes-cypress": "^3.47.0"
54
54
  }
55
- }
55
+ }