itemengine-cypress-automation 1.0.170 → 1.0.171-uploadResponseMigration-45e0037.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/support/migrationHelpers/extractLrnQuestionData.js +35 -3
- package/cypress/support/migrationHelpers/lrnQestionTypesENUM.js +2 -1
- package/cypress/support/migrationHelpers/migrationScript.js +4 -0
- package/cypress/support/migrationHelpers/verifyIeQuestionData.js +33 -1
- package/package.json +2 -2
@@ -29,6 +29,9 @@ export const lrnPage = {
|
|
29
29
|
specialCharactersButton: () => cy.get('.lrn_charactermapbutton'),
|
30
30
|
shortTextAnswerInputField: () => cy.get('.lrn_textinput input'),
|
31
31
|
shortTextCorrectAnswerText: () => cy.get('.lrn_correctAnswerList .lrn_responseText'),
|
32
|
+
uploadResponseSupportedFileTypes: () => cy.get('.lrn-fileupload-support-copy'),
|
33
|
+
uploadResponseFileLimit: () => cy.get('.lrn-limit-status'),
|
34
|
+
uploadResponseToolbar: () => cy.get('[data-lrn-component="toolbar"]'),
|
32
35
|
steps: {
|
33
36
|
checkShowAnswersToggle: () => {
|
34
37
|
lrnPage.showAnswersToggle()
|
@@ -557,7 +560,6 @@ export const extractLrnQuestionData = {
|
|
557
560
|
cy.log(`Extracting the question instructions and answer input field attributes from question ${index}`);
|
558
561
|
obj.questionIndex = index;
|
559
562
|
obj.questionType = 'shortTextResponse'
|
560
|
-
lrnPage.steps.extractQuestionInstructions(obj, index);
|
561
563
|
lrnPage.questionWrapper()
|
562
564
|
.eq(index)
|
563
565
|
.within(() => {
|
@@ -574,7 +576,7 @@ export const extractLrnQuestionData = {
|
|
574
576
|
obj.specialCharactersEnabled = true;
|
575
577
|
}
|
576
578
|
});
|
577
|
-
})
|
579
|
+
});
|
578
580
|
lrnQuestionDataArr.push(obj);
|
579
581
|
},
|
580
582
|
|
@@ -595,7 +597,37 @@ export const extractLrnQuestionData = {
|
|
595
597
|
};
|
596
598
|
});
|
597
599
|
lrnQuestionDataArr.push(obj);
|
598
|
-
}
|
600
|
+
},
|
601
|
+
|
602
|
+
uploadResponse: (lrnQuestionDataArr, index) => {
|
603
|
+
let obj = {};
|
604
|
+
cy.log(`Extracting the question instructions, question, response count, response field properties from question ${index}`);
|
605
|
+
obj.questionIndex = index;
|
606
|
+
obj.questionType = 'uploadResponse';
|
607
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
608
|
+
lrnPage.uploadResponseSupportedFileTypes()
|
609
|
+
.invoke('text')
|
610
|
+
.then((text) => {
|
611
|
+
const supportedFormatsText = text.trim().replace('Supported file formats:', '').replace(/\.$/, '').trim();
|
612
|
+
const supportedFormatsArray = supportedFormatsText.split(',').map(format => format.trim());
|
613
|
+
obj.supportedFormatsArray = supportedFormatsArray;
|
614
|
+
});
|
615
|
+
lrnPage.uploadResponseFileLimit()
|
616
|
+
.then(($element) => {
|
617
|
+
let innerText = $element[0].innerText;
|
618
|
+
let normalizedFileUploadLimitText = innerText.trim().replace(/\s+/g, '');
|
619
|
+
obj.fileLimit = normalizedFileUploadLimitText;
|
620
|
+
});
|
621
|
+
lrnPage.uploadResponseToolbar()
|
622
|
+
.then(($element) => {
|
623
|
+
if ($element[0].innerHTML.includes('lrn-icon-camera')) {
|
624
|
+
obj.captureImage = true;
|
625
|
+
} else {
|
626
|
+
obj.captureImage = false;
|
627
|
+
}
|
628
|
+
});
|
629
|
+
lrnQuestionDataArr.push(obj);
|
630
|
+
},
|
599
631
|
|
600
632
|
/* singleSelection: (lrnQuestionDataArr, index) => {
|
601
633
|
let obj = {};
|
@@ -10,7 +10,8 @@ const lrnQuestionTypesENUM = {
|
|
10
10
|
multipleSelection: 'Multiple choice – multiple response',
|
11
11
|
trueOrFalse: 'True or false',
|
12
12
|
figText: 'Cloze with text',
|
13
|
-
shortTextResponse: 'Short text'
|
13
|
+
shortTextResponse: 'Short text',
|
14
|
+
uploadResponse: 'File upload'
|
14
15
|
}
|
15
16
|
|
16
17
|
export default lrnQuestionTypesENUM;
|
@@ -25,6 +25,7 @@ const extractLrnPreviewData = (currQuestionType, lrnQuestionDataArr, index) => {
|
|
25
25
|
case lrnQuestionTypesENUM.dndIntoCategories: return extractLrnQuestionData.dndIntoCategories(lrnQuestionDataArr, index);
|
26
26
|
case lrnQuestionTypesENUM.figText: return extractLrnQuestionData.figText(lrnQuestionDataArr, index);
|
27
27
|
case lrnQuestionTypesENUM.shortTextResponse: return extractLrnQuestionData.shortTextResponse(lrnQuestionDataArr, index);
|
28
|
+
case lrnQuestionTypesENUM.uploadResponse: return extractLrnQuestionData.uploadResponse(lrnQuestionDataArr, index);
|
28
29
|
default: throw new Error('Invalid lrn question type');
|
29
30
|
}
|
30
31
|
}
|
@@ -40,6 +41,7 @@ const verifyIePreviewData = (questionType, questionData, index) => {
|
|
40
41
|
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategories(questionData, index);
|
41
42
|
case 'figText': return verifyIeQuestionData.figText(questionData, index);
|
42
43
|
case 'shortTextResponse': return verifyIeQuestionData.shortTextResponse(questionData, index);
|
44
|
+
case 'uploadResponse': return verifyIeQuestionData.uploadResponse(questionData, index);
|
43
45
|
default: throw new Error('Invalid ngie question type');
|
44
46
|
}
|
45
47
|
}
|
@@ -52,6 +54,7 @@ const extractLrnGradingData = (currQuestionType, lrnGradingDataArr, index) => {
|
|
52
54
|
case lrnQuestionTypesENUM.dndIntoCategories: return extractLrnQuestionData.dndIntoCategoriesGrading(lrnGradingDataArr, index);
|
53
55
|
case lrnQuestionTypesENUM.figText: return extractLrnQuestionData.figTextGrading(lrnGradingDataArr, index);
|
54
56
|
case lrnQuestionTypesENUM.shortTextResponse: return extractLrnQuestionData.shortTextResponseGrading(lrnGradingDataArr, index);
|
57
|
+
case lrnQuestionTypesENUM.uploadResponse: return cy.log('Manually Graded Question Type');
|
55
58
|
default: throw new Error('Invalid lrn question type');
|
56
59
|
}
|
57
60
|
}
|
@@ -64,6 +67,7 @@ const verifyIeGradingData = (questionType, questionData, index) => {
|
|
64
67
|
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategoriesGrading(questionData, index);
|
65
68
|
case 'figText': return verifyIeQuestionData.figTextGrading(questionData, index);
|
66
69
|
case 'shortTextResponse': return verifyIeQuestionData.shortTextResponseGrading(questionData, index);
|
70
|
+
case 'uploadResponse': return cy.log('Manually Graded Question Type');
|
67
71
|
default: throw new Error('Invalid ngie question type');
|
68
72
|
}
|
69
73
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { essayResponsePage, fillInTheGapsTextPage, multipleSelectionPage,
|
1
|
+
import { essayResponsePage, fillInTheGapsTextPage, multipleSelectionPage, textEntryMathPage, uploadResponsePage } from "../../pages";
|
2
2
|
import { draggableOptionContainer } from "../../pages/components";
|
3
3
|
import { singleSelectionPage } from "../../pages/singleSelectionPage"
|
4
4
|
import utilities from "../helpers/utilities";
|
@@ -26,6 +26,7 @@ export const iePage = {
|
|
26
26
|
shortTextResponseAnswerInputField: () => cy.get('[class*="response"][class*="-input"] .MuiInputBase-input'),
|
27
27
|
shortTextResponseCorrectAnswerText: () => cy.get('[class*="CorrectAnswerValueWrapper"]'),
|
28
28
|
specialCharactersButtonPreviewTab: () => cy.get('.custon-special-character-button'),
|
29
|
+
uploadResponseCaptureImage: () => cy.get('[aria-label="capture an image"]'),
|
29
30
|
steps: {
|
30
31
|
verifyQuestionInstructions: (expectedQuestionData) => {
|
31
32
|
if (expectedQuestionData.previewQuestionInstructions) {
|
@@ -555,6 +556,37 @@ export const verifyIeQuestionData = {
|
|
555
556
|
});
|
556
557
|
} else {
|
557
558
|
utilities.verifyElementVisibilityState(iePage.shortTextResponseCorrectAnswerText(), 'notExist');
|
559
|
+
};
|
560
|
+
});
|
561
|
+
},
|
562
|
+
|
563
|
+
uploadResponse: (expectedQuestionData, index) => {
|
564
|
+
cy.get('.ngie-upload-response')
|
565
|
+
.eq(index)
|
566
|
+
.within(() => {
|
567
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
568
|
+
uploadResponsePage.supportedFileInfoIcon()
|
569
|
+
.invoke('attr', 'aria-label')
|
570
|
+
.then((ariaLabel) => {
|
571
|
+
let supportedFormatsText = ariaLabel.replace('Supported file formats: ', '').replace(/\.$/, '').trim();
|
572
|
+
let supportedFormatsArray = supportedFormatsText.split(', ');
|
573
|
+
expect(supportedFormatsArray).to.have.lengthOf(expectedQuestionData.supportedFormatsArray.length);
|
574
|
+
cy.wrap(supportedFormatsArray).each((element) => {
|
575
|
+
expect(expectedQuestionData.supportedFormatsArray).to.include(element);
|
576
|
+
});
|
577
|
+
});
|
578
|
+
uploadResponsePage.uploadedFileCount()
|
579
|
+
.then(($element) => {
|
580
|
+
let fileLimit = $element[0].innerText;
|
581
|
+
let normalizedFileUploadLimitText = fileLimit.trim().replace(/\s+/g, '');
|
582
|
+
expect(normalizedFileUploadLimitText).to.be.eq(expectedQuestionData.fileLimit);
|
583
|
+
});
|
584
|
+
if (expectedQuestionData.captureImage) {
|
585
|
+
uploadResponsePage.fileUploadOptionsLabel()
|
586
|
+
.within(() => {
|
587
|
+
iePage.uploadResponseCaptureImage()
|
588
|
+
.should('exist');
|
589
|
+
});
|
558
590
|
}
|
559
591
|
});
|
560
592
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "itemengine-cypress-automation",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.171-uploadResponseMigration-45e0037.0",
|
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
|
+
}
|