itemengine-cypress-automation 1.0.585 → 1.0.586

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.
@@ -441,4 +441,42 @@ describe('Get Question Data API cases', () => {
441
441
  expect(jsonResponse.data[0].type).to.equal('text selection');
442
442
  });
443
443
  });
444
+
445
+ it('Entering a request for a short text response question type', () => {
446
+ cy.get('textarea[class="body-param__text"]')
447
+ .clear()
448
+ .fill(`{\n "item_references": [],\n "references": [],\n "types": ["short text response"],\n "limit": 1,\n "sort_field": "created",\n "sort": "desc"\n}\n`);
449
+ cy.get('.execute')
450
+ .click();
451
+ cy.wait(2000);
452
+ cy.get('.loading-container')
453
+ .should('not.exist');
454
+ cy.get('td[class="response-col_status"]')
455
+ .eq(0)
456
+ .should('have.text', '200');
457
+ cy.get('td.response-col_description')
458
+ .find('code.language-json')
459
+ .eq(0)
460
+ .invoke('text')
461
+ .then((text) => {
462
+ const jsonResponse = JSON.parse(text);
463
+ expect(jsonResponse.data[0]).to.include.keys(
464
+ 'reference',
465
+ 'type',
466
+ 'content',
467
+ 'correct_answer',
468
+ 'scoring',
469
+ 'settings',
470
+ );
471
+
472
+ expect(jsonResponse.data[0].settings).to.include.keys(
473
+ 'additional_settings',
474
+ 'print_layout_settings',
475
+ 'student_view_settings',
476
+ 'tool_settings',
477
+ );
478
+
479
+ expect(jsonResponse.data[0].type).to.equal('short text response');
480
+ });
481
+ });
444
482
  });
@@ -288,4 +288,58 @@ describe('Set Question Data API cases', () => {
288
288
  expect(jsonResponse.meta.message).to.equal('Invalid answer "optiontoken6" in question 1. Must match one of the token IDs.');
289
289
  });
290
290
  });
291
+
292
+ it('Creating short text response question and resource from save API', () => {
293
+ unique_reference_id_1 = uuid();
294
+ unique_reference_id_2 = uuid();
295
+ cy.visit('/item-engine/data-api/item-bank/save-questions');
296
+ cy.get('.try-out__btn')
297
+ .click();
298
+ cy.get('textarea[class="body-param__text"]')
299
+ .clear()
300
+ .fill(`{"questions":[{"reference":"${unique_reference_id_1}","type":"short text response","content":{"instruction":"Test","acknowledgements":"","sampleAnswer":""},"correctAnswer":[{"totalPoints":5,"answers":[{"answer":"This is answer","points":5,"validateAnsInResponse":false}]},{"totalPoints":10,"answers":[{"answer":"This is 1st alternate answer","points":10,"validateAnsInResponse":false}]},{"totalPoints":3,"answers":[{"answer":"This is 2nd alternate answer","points":3,"validateAnsInResponse":false}]}],"scoring":{"points":10,"scoringType":"auto-scored","subScoringType":"allOrNothing","penaltyPoints":null,"penaltyPointType":"noPenalty","minScoreType":"noMinScore","minScorePoints":null,"isNegativeRounded":true,"caseSensitive":false,"ignoreSpaces":true,"scoringGuidance":""},"settings":{"studentViewSettings":{"answerType":"text","autoScale":false,"showCharacterCount":false,"showWordCount":false,"spellCheck":false,"setLimitType":"character","maxCharLimit":50,"maxWordLimit":20,"minCharLimit":0,"minWordLimit":0,"showMaxLimit":false,"showMinLimit":false,"customSpecialCharacter":"","enableSpecialChar":true,"specialCharType":"groupByLanguage","selectedSpecialCharLanguages":["icelandic","french","german","portuguese","scandinavian","spanish","italian"]},"additionalSettings":{"fontSize":"default","placeholder":"This is placeholder","ariaLabel":"","selectedClipboardButtons":["cut","copy","paste"],"nonAccessible":false},"printLayoutSettings":{"excludeFromPrint":false,"displayUnderLine":true,"numberOfLine":1,"lineSpacing":"single","printInstruction":""},"toolSettings":[{"resource":"ruler","enabled":true},{"resource":"protractor","enabled":true},{"resource":"readingRuler","enabled":false},{"resource":"simpleCalculator","enabled":false},{"resource":"scientificCalculator","enabled":false},{"resource":"compass","enabled":false}]}}]}`);
301
+ cy.get('.execute')
302
+ .click();
303
+ cy.wait(2000);
304
+ cy.get('.loading-container')
305
+ .should('not.exist');
306
+ cy.visit('/item-engine/data-api/item-bank/save-resources');
307
+ cy.get('.try-out__btn')
308
+ .click();
309
+ cy.get('textarea[class="body-param__text"]')
310
+ .clear()
311
+ .fill(`{\n "resources": [\n {\n "type": 1,\n "data": {\n "type": "Passage",\n "heading": "Passage created via save resources data API",\n "content": "This is content of the passage"\n },\n "reference": "${unique_reference_id_2}"\n }\n ],\n "organisation_id": "${Cypress.env('organisation_id')}",\n "meta": {\n "user": {\n "id": "dfbb6366-d88d-416d-9d9c-7ee6420817b3",\n "first_name": "fname",\n "last_name": "lname",\n "email": "user@demo.com"\n }\n }\n}\n`);
312
+ cy.get('.execute')
313
+ .click();
314
+ cy.wait(2000);
315
+ cy.get('.loading-container')
316
+ .should('not.exist');
317
+ });
318
+
319
+ it('Throw validation error while creating short text response question with invalid answer format', () => {
320
+ unique_reference_id_1 = uuid();
321
+ cy.visit('/item-engine/data-api/item-bank/save-questions');
322
+ cy.get('.try-out__btn')
323
+ .click();
324
+ cy.get('textarea[class="body-param__text"]')
325
+ .clear()
326
+ .fill(`{"questions":[{"reference":"${unique_reference_id_1}","type":"short text response","content":{"instruction":"Test","acknowledgements":"","sampleAnswer":""},"correctAnswer":[{"totalPoints":5,"answers":[{"answer":"","points":5,"validateAnsInResponse":false}]}],"scoring":{"points":10,"scoringType":"auto-scored","subScoringType":"partialMatching","penaltyPoints":null,"penaltyPointType":"noPenalty","minScoreType":"noMinScore","minScorePoints":null,"isNegativeRounded":true,"caseSensitive":false,"ignoreSpaces":true,"scoringGuidance":""},"settings":{"studentViewSettings":{"answerType":"text","autoScale":false,"showCharacterCount":false,"showWordCount":false,"spellCheck":false,"setLimitType":"character","maxCharLimit":50,"maxWordLimit":20,"minCharLimit":0,"minWordLimit":0,"showMaxLimit":false,"showMinLimit":false,"customSpecialCharacter":"","enableSpecialChar":true,"specialCharType":"groupByLanguage","selectedSpecialCharLanguages":["icelandic","french","german","portuguese","scandinavian","spanish","italian"]},"additionalSettings":{"fontSize":"default","placeholder":"This is placeholder","ariaLabel":"","selectedClipboardButtons":["cut","copy","paste"],"nonAccessible":false},"printLayoutSettings":{"excludeFromPrint":false,"displayUnderLine":true,"numberOfLine":1,"lineSpacing":"single","printInstruction":""},"toolSettings":[{"resource":"ruler","enabled":true},{"resource":"protractor","enabled":true},{"resource":"readingRuler","enabled":false},{"resource":"simpleCalculator","enabled":false},{"resource":"scientificCalculator","enabled":false},{"resource":"compass","enabled":false}]}}]}`);
327
+ cy.get('.execute')
328
+ .click();
329
+ cy.wait(2000);
330
+ cy.get('.loading-container')
331
+ .should('not.exist');
332
+ cy.get('td[class="response-col_status"]')
333
+ .eq(0)
334
+ .should('have.text', '200');
335
+ cy.get('td.response-col_description')
336
+ .find('code.language-json')
337
+ .eq(0)
338
+ .invoke('text')
339
+ .then((text) => {
340
+ const jsonResponse = JSON.parse(text);
341
+ expect(jsonResponse.meta.status).to.equal(false);
342
+ expect(jsonResponse.meta.message).to.include('Invalid subScoringType "partialMatching" for question 1. "subScoringType" must be a valid subScoringType type');
343
+ });
344
+ });
291
345
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.585",
3
+ "version": "1.0.586",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {