itemengine-cypress-automation 1.0.170-fixes10April-45deaac.0 → 1.0.170
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/support/migrationHelpers/extractLrnQuestionData.js +48 -1
- package/cypress/support/migrationHelpers/lrnQestionTypesENUM.js +1 -0
- package/cypress/support/migrationHelpers/migrationScript.js +4 -0
- package/cypress/support/migrationHelpers/verifyIeQuestionData.js +52 -3
- package/package.json +2 -2
@@ -27,6 +27,8 @@ export const lrnPage = {
|
|
27
27
|
draggableResponseMathMl: () => cy.get('[aria-label="Possible responses"] .lrn_btn_drag math'),
|
28
28
|
questionContainerPreviewTab: () => cy.get('.lrn_response_input'),
|
29
29
|
specialCharactersButton: () => cy.get('.lrn_charactermapbutton'),
|
30
|
+
shortTextAnswerInputField: () => cy.get('.lrn_textinput input'),
|
31
|
+
shortTextCorrectAnswerText: () => cy.get('.lrn_correctAnswerList .lrn_responseText'),
|
30
32
|
steps: {
|
31
33
|
checkShowAnswersToggle: () => {
|
32
34
|
lrnPage.showAnswersToggle()
|
@@ -496,7 +498,7 @@ export const extractLrnQuestionData = {
|
|
496
498
|
.parent()
|
497
499
|
.then(($responseField) => {
|
498
500
|
obj.isMultiline = $responseField[0].type === 'textarea' ? true : false;
|
499
|
-
if($responseField[0].innerHTML.includes('lrn_charactermapbutton')) {
|
501
|
+
if ($responseField[0].innerHTML.includes('lrn_charactermapbutton')) {
|
500
502
|
obj.specialCharactersEnabled = true;
|
501
503
|
}
|
502
504
|
});
|
@@ -550,6 +552,51 @@ export const extractLrnQuestionData = {
|
|
550
552
|
lrnQuestionDataArr.push(obj);
|
551
553
|
},
|
552
554
|
|
555
|
+
shortTextResponse: (lrnQuestionDataArr, index) => {
|
556
|
+
let obj = {};
|
557
|
+
cy.log(`Extracting the question instructions and answer input field attributes from question ${index}`);
|
558
|
+
obj.questionIndex = index;
|
559
|
+
obj.questionType = 'shortTextResponse'
|
560
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
561
|
+
lrnPage.questionWrapper()
|
562
|
+
.eq(index)
|
563
|
+
.within(() => {
|
564
|
+
lrnPage.shortTextAnswerInputField()
|
565
|
+
.then(($answerField) => {
|
566
|
+
let responseObj = {}
|
567
|
+
responseObj.placeholder = $answerField[0].placeholder;
|
568
|
+
responseObj.maxLength = $answerField[0].maxLength;
|
569
|
+
responseObj.type = $answerField[0].type;
|
570
|
+
responseObj.spellcheck = $answerField[0].spellcheck;
|
571
|
+
responseObj.ariaLabel = $answerField[0].ariaLabel;
|
572
|
+
obj.answerInputField = [responseObj];
|
573
|
+
if ($answerField.parent()[0].innerHTML.includes('lrn_charactermapbutton')) {
|
574
|
+
obj.specialCharactersEnabled = true;
|
575
|
+
}
|
576
|
+
});
|
577
|
+
})
|
578
|
+
lrnQuestionDataArr.push(obj);
|
579
|
+
},
|
580
|
+
|
581
|
+
shortTextResponseGrading: (lrnQuestionDataArr, index) => {
|
582
|
+
let obj = {};
|
583
|
+
cy.log(`Extracting the question instructions and correct answers from question ${index}`);
|
584
|
+
obj.questionIndex = index;
|
585
|
+
obj.questionType = 'shortTextResponse';
|
586
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
587
|
+
lrnPage.questionWrapper()
|
588
|
+
.eq(index)
|
589
|
+
.then(($responseWrapper) => {
|
590
|
+
if ($responseWrapper[0].innerHTML.includes('lrn_correctAnswers')) {
|
591
|
+
lrnPage.shortTextCorrectAnswerText().then(($element) => {
|
592
|
+
let innerText = $element[0].innerText;
|
593
|
+
obj.correctAnswersText = innerText;
|
594
|
+
});
|
595
|
+
};
|
596
|
+
});
|
597
|
+
lrnQuestionDataArr.push(obj);
|
598
|
+
}
|
599
|
+
|
553
600
|
/* singleSelection: (lrnQuestionDataArr, index) => {
|
554
601
|
let obj = {};
|
555
602
|
cy.log(`Extracting the question instructions and options from question ${index}`);
|
@@ -24,6 +24,7 @@ const extractLrnPreviewData = (currQuestionType, lrnQuestionDataArr, index) => {
|
|
24
24
|
case lrnQuestionTypesENUM.drawingResponse: return extractLrnQuestionData.drawingResponse(lrnQuestionDataArr, index);
|
25
25
|
case lrnQuestionTypesENUM.dndIntoCategories: return extractLrnQuestionData.dndIntoCategories(lrnQuestionDataArr, index);
|
26
26
|
case lrnQuestionTypesENUM.figText: return extractLrnQuestionData.figText(lrnQuestionDataArr, index);
|
27
|
+
case lrnQuestionTypesENUM.shortTextResponse: return extractLrnQuestionData.shortTextResponse(lrnQuestionDataArr, index);
|
27
28
|
default: throw new Error('Invalid lrn question type');
|
28
29
|
}
|
29
30
|
}
|
@@ -38,6 +39,7 @@ const verifyIePreviewData = (questionType, questionData, index) => {
|
|
38
39
|
case 'drawingResponse': return verifyIeQuestionData.drawingResponse(questionData, index);
|
39
40
|
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategories(questionData, index);
|
40
41
|
case 'figText': return verifyIeQuestionData.figText(questionData, index);
|
42
|
+
case 'shortTextResponse': return verifyIeQuestionData.shortTextResponse(questionData, index);
|
41
43
|
default: throw new Error('Invalid ngie question type');
|
42
44
|
}
|
43
45
|
}
|
@@ -49,6 +51,7 @@ const extractLrnGradingData = (currQuestionType, lrnGradingDataArr, index) => {
|
|
49
51
|
case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
|
50
52
|
case lrnQuestionTypesENUM.dndIntoCategories: return extractLrnQuestionData.dndIntoCategoriesGrading(lrnGradingDataArr, index);
|
51
53
|
case lrnQuestionTypesENUM.figText: return extractLrnQuestionData.figTextGrading(lrnGradingDataArr, index);
|
54
|
+
case lrnQuestionTypesENUM.shortTextResponse: return extractLrnQuestionData.shortTextResponseGrading(lrnGradingDataArr, index);
|
52
55
|
default: throw new Error('Invalid lrn question type');
|
53
56
|
}
|
54
57
|
}
|
@@ -60,6 +63,7 @@ const verifyIeGradingData = (questionType, questionData, index) => {
|
|
60
63
|
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImageGrading(questionData, index);
|
61
64
|
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategoriesGrading(questionData, index);
|
62
65
|
case 'figText': return verifyIeQuestionData.figTextGrading(questionData, index);
|
66
|
+
case 'shortTextResponse': return verifyIeQuestionData.shortTextResponseGrading(questionData, index);
|
63
67
|
default: throw new Error('Invalid ngie question type');
|
64
68
|
}
|
65
69
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { essayResponsePage, fillInTheGapsTextPage, multipleSelectionPage, textEntryMathPage } from "../../pages";
|
1
|
+
import { essayResponsePage, fillInTheGapsTextPage, multipleSelectionPage, shortTextResponsePage, textEntryMathPage } from "../../pages";
|
2
2
|
import { draggableOptionContainer } from "../../pages/components";
|
3
3
|
import { singleSelectionPage } from "../../pages/singleSelectionPage"
|
4
4
|
import utilities from "../helpers/utilities";
|
@@ -23,7 +23,9 @@ export const iePage = {
|
|
23
23
|
drawingResponseLowerCanvas: () => cy.get('.lower-canvas'),
|
24
24
|
figCorrectAnswerBlock: () => cy.get('[class*="AnswerCell"]'),
|
25
25
|
figTextResponseField: () => cy.get('[class*="response"][class*="-input"] .MuiInputBase-input'),
|
26
|
-
|
26
|
+
shortTextResponseAnswerInputField: () => cy.get('[class*="response"][class*="-input"] .MuiInputBase-input'),
|
27
|
+
shortTextResponseCorrectAnswerText: () => cy.get('[class*="CorrectAnswerValueWrapper"]'),
|
28
|
+
specialCharactersButtonPreviewTab: () => cy.get('.custon-special-character-button'),
|
27
29
|
steps: {
|
28
30
|
verifyQuestionInstructions: (expectedQuestionData) => {
|
29
31
|
if (expectedQuestionData.previewQuestionInstructions) {
|
@@ -476,7 +478,7 @@ export const verifyIeQuestionData = {
|
|
476
478
|
.eq(0)
|
477
479
|
.click()
|
478
480
|
.then(() => {
|
479
|
-
if(expectedQuestionData.specialCharactersEnabled) {
|
481
|
+
if (expectedQuestionData.specialCharactersEnabled) {
|
480
482
|
utilities.verifyElementVisibilityState(fillInTheGapsTextPage.specialCharactersButtonPreviewTab(), 'visible');
|
481
483
|
} else {
|
482
484
|
utilities.verifyElementVisibilityState(fillInTheGapsTextPage.specialCharactersButtonPreviewTab(), 'notExist');
|
@@ -510,6 +512,53 @@ export const verifyIeQuestionData = {
|
|
510
512
|
});
|
511
513
|
},
|
512
514
|
|
515
|
+
shortTextResponse: (expectedQuestionData, index) => {
|
516
|
+
cy.get('.ngie-short-text-response')
|
517
|
+
.eq(index)
|
518
|
+
.within(() => {
|
519
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
520
|
+
iePage.shortTextResponseAnswerInputField()
|
521
|
+
.then(($answerField) => {
|
522
|
+
expect($answerField[0].placeholder).to.be.eq(expectedQuestionData.answerInputField[0].placeholder);
|
523
|
+
expect($answerField[0].maxLength).to.be.eq(expectedQuestionData.answerInputField[0].maxLength);
|
524
|
+
expect($answerField[0].type).to.be.eq(expectedQuestionData.answerInputField[0].type);
|
525
|
+
expect($answerField[0].spellcheck).to.be.eq(expectedQuestionData.answerInputField[0].spellcheck);
|
526
|
+
const ariaLabel = $answerField[0].ariaLabel;
|
527
|
+
const ariaLabelParts = ariaLabel.split('Maximum');
|
528
|
+
const trimmedAriaLabel = ariaLabelParts[0].trim();
|
529
|
+
expect(trimmedAriaLabel).to.be.eq(expectedQuestionData.answerInputField[0].ariaLabel);
|
530
|
+
});
|
531
|
+
iePage.shortTextResponseAnswerInputField()
|
532
|
+
.click()
|
533
|
+
.then(() => {
|
534
|
+
if (expectedQuestionData.specialCharactersEnabled) {
|
535
|
+
utilities.verifyElementVisibilityState(iePage.specialCharactersButtonPreviewTab(), 'visible');
|
536
|
+
} else {
|
537
|
+
utilities.verifyElementVisibilityState(iePage.specialCharactersButtonPreviewTab(), 'notExist');
|
538
|
+
}
|
539
|
+
});
|
540
|
+
});
|
541
|
+
},
|
542
|
+
|
543
|
+
shortTextResponseGrading: (expectedQuestionData, index) => {
|
544
|
+
cy.get('.ngie-short-text-response')
|
545
|
+
.eq(index)
|
546
|
+
.within(() => {
|
547
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
548
|
+
});
|
549
|
+
cy.get('.ngie-short-text-response')
|
550
|
+
.eq(index)
|
551
|
+
.then(($previewWrapper) => {
|
552
|
+
if ($previewWrapper[0].innerHTML.includes('CorrectAnswerWrapper')) {
|
553
|
+
iePage.shortTextResponseCorrectAnswerText().then(($element) => {
|
554
|
+
utilities.verifyInnerText(cy.wrap($element), expectedQuestionData.correctAnswersText);
|
555
|
+
});
|
556
|
+
} else {
|
557
|
+
utilities.verifyElementVisibilityState(iePage.shortTextResponseCorrectAnswerText(), 'notExist');
|
558
|
+
}
|
559
|
+
});
|
560
|
+
}
|
561
|
+
|
513
562
|
/* singleSelection: (expectedQuestionData, index) => {
|
514
563
|
cy.get('.ngie-single-select')
|
515
564
|
.eq(index)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "itemengine-cypress-automation",
|
3
|
-
"version": "1.0.170
|
3
|
+
"version": "1.0.170",
|
4
4
|
"description": "",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -35,4 +35,4 @@
|
|
35
35
|
"node-fetch": "^3.3.2",
|
36
36
|
"react-uuid": "^2.0.0"
|
37
37
|
}
|
38
|
-
}
|
38
|
+
}
|