itemengine-cypress-automation 1.0.121 → 1.0.122

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.
@@ -18,7 +18,7 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
18
  iePage.questionWrapper()
19
19
  .then((elements) => {
20
20
  if (retries <= 0) {
21
- throw new Error('Element did not load in time')
21
+ throw new Error('Itemengine questions did not lazy load in time');
22
22
  };
23
23
  if (elements.length < count) {
24
24
  iePage.questionWrapper()
@@ -27,21 +27,23 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
27
27
  .wait(1000);
28
28
  cy.lazyLoadPreviewQuestions(count, retries - 1)
29
29
  };
30
- cy.log('All question parts loaded')
30
+ cy.log('All question parts loaded');
31
31
  });
32
32
  iePage.barsPreloader()
33
33
  .should('not.exist');
34
34
  cy.learnosityLoaderWait();
35
35
  })
36
36
 
37
- const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["textEntryMathImage"]
37
+ const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["essayResponse"]
38
38
  const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
39
39
  let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
40
+ let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
41
+
40
42
 
41
43
  let lrnQuestionDataArr = [];
42
44
  let lrnGradingDataArr = [];
43
45
 
44
- let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(0, 100);//["d526a378-de9e-4086-90ba-405057c48c3d", "9ee38abc-9c1c-4c10-9467-85f5823b7b17", "6521f6a7-4a9f-441f-8fc6-314ba7bf2386"]
46
+ let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(0, 100);//["0715a48c-4c1f-4eed-8058-793ad9402f89", "c476e9ca-2ac6-4ebc-b548-241ef3cd13bb"]
45
47
 
46
48
  if (referenceIds.length > 0) {
47
49
  describe('Migration item check for MCQ questions', () => {
@@ -74,13 +76,18 @@ if (referenceIds.length > 0) {
74
76
  .each(($el, index) => {
75
77
  let currQuestionType = $el[0].innerText
76
78
  if (lrnMcqTypesRegex.test(currQuestionType)) {
77
- currQuestionType = lrnQuestionTypesENUM.mcq
79
+ currQuestionType = lrnQuestionTypesENUM.mcq;
80
+ }
81
+ if (lrnEssayResponseRegex.test(currQuestionType)) {
82
+ ;
83
+ currQuestionType = lrnQuestionTypesENUM.essayResponse;
78
84
  }
79
85
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
80
86
  switch (currQuestionType) {
81
87
  case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
82
88
  case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
83
89
  case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
90
+ case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
84
91
  default: throw new Error('Invalid lrn question type');
85
92
  }
86
93
  }
@@ -97,6 +104,7 @@ if (referenceIds.length > 0) {
97
104
  case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
98
105
  case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
99
106
  case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
107
+ case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
100
108
  default: throw new Error('Invalid ngie question type');
101
109
  }
102
110
  });
@@ -104,20 +112,25 @@ if (referenceIds.length > 0) {
104
112
  });
105
113
 
106
114
  it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
107
- lrnPage.steps.checkShowAnswersToggle();
108
- lrnPage.questionTypeDiv()
109
- .each(($el, index) => {
110
- let currQuestionType = $el[0].innerText
111
- if (lrnMcqTypesRegex.test(currQuestionType)) {
112
- currQuestionType = lrnQuestionTypesENUM.mcq
113
- }
114
- if (migrationQuestionTypesLrn.includes(currQuestionType)) {
115
- switch (currQuestionType) {
116
- case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
117
- case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
118
- case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
119
- default: throw new Error('Invalid lrn question type');
120
- }
115
+ lrnPage.authorItemToolbarControlsWrapper()
116
+ .then(($element) => {
117
+ if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
118
+ lrnPage.steps.checkShowAnswersToggle();
119
+ lrnPage.questionTypeDiv()
120
+ .each(($el, index) => {
121
+ let currQuestionType = $el[0].innerText
122
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
123
+ currQuestionType = lrnQuestionTypesENUM.mcq
124
+ }
125
+ if (migrationQuestionTypesLrn.includes(currQuestionType)) {
126
+ switch (currQuestionType) {
127
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
128
+ case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
129
+ case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
130
+ default: throw new Error('Invalid lrn question type');
131
+ }
132
+ }
133
+ });
121
134
  }
122
135
  });
123
136
  });
@@ -0,0 +1,160 @@
1
+ import { autoScoredScoringPreviewTab } from "../../pages/components";
2
+ import utilities from "../../support/helpers/utilities";
3
+ import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
4
+ import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
5
+ import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
6
+
7
+ Cypress.Commands.add('learnosityLoaderWait', () => {
8
+ // cy.get('.lrn-spinner')
9
+ // .should('be.visible');
10
+ lrnPage.questionsLoader()
11
+ .should('not.be.visible');
12
+ lrnPage.questionWrapper()
13
+ .eq(0)
14
+ .should('be.visible');
15
+ });
16
+
17
+ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
+ iePage.questionWrapper()
19
+ .then((elements) => {
20
+ if (retries <= 0) {
21
+ throw new Error('Itemengine questions did not lazy load in time');
22
+ };
23
+ if (elements.length < count) {
24
+ iePage.questionWrapper()
25
+ .last()
26
+ .scrollIntoView()
27
+ .wait(1000);
28
+ cy.lazyLoadPreviewQuestions(count, retries - 1)
29
+ };
30
+ cy.log('All question parts loaded');
31
+ });
32
+ iePage.barsPreloader()
33
+ .should('not.exist');
34
+ cy.learnosityLoaderWait();
35
+ })
36
+
37
+ const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["essayResponse"]
38
+ const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
39
+ let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
40
+ let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
41
+
42
+
43
+ let lrnQuestionDataArr = [];
44
+ let lrnGradingDataArr = [];
45
+
46
+ let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(900, 1000);//["0715a48c-4c1f-4eed-8058-793ad9402f89", "c476e9ca-2ac6-4ebc-b548-241ef3cd13bb"]
47
+
48
+ if (referenceIds.length > 0) {
49
+ describe('Migration item check for MCQ questions', () => {
50
+ before(() => {
51
+ cy.loginAs('technicalTester');
52
+ });
53
+
54
+ referenceIds.forEach((referenceId) => {
55
+ describe(`Migration item check for item "${referenceId}"`, () => {
56
+ before(() => {
57
+ cy.interceptGraphql('getItemPreview');
58
+ cy.setGraphqlWait();
59
+ cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
60
+ cy.pageLoadWait('getItemPreview');
61
+ cy.get('@getItemPreview').then((req) => {
62
+ let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
63
+ cy.lazyLoadPreviewQuestions(questionCount);
64
+ });
65
+ });
66
+
67
+ after(() => {
68
+ console.log(lrnQuestionDataArr)
69
+ console.log(lrnGradingDataArr)
70
+ lrnQuestionDataArr = [];
71
+ lrnGradingDataArr = [];
72
+ });
73
+
74
+ it(`Extracting learnosity preview data for item "${referenceId}"`, () => {
75
+ lrnPage.questionTypeDiv()
76
+ .each(($el, index) => {
77
+ let currQuestionType = $el[0].innerText
78
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
79
+ currQuestionType = lrnQuestionTypesENUM.mcq;
80
+ }
81
+ if (lrnEssayResponseRegex.test(currQuestionType)) {
82
+ ;
83
+ currQuestionType = lrnQuestionTypesENUM.essayResponse;
84
+ }
85
+ if (migrationQuestionTypesLrn.includes(currQuestionType)) {
86
+ switch (currQuestionType) {
87
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
88
+ case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
89
+ case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
90
+ case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
91
+ default: throw new Error('Invalid lrn question type');
92
+ }
93
+ }
94
+ });
95
+ });
96
+
97
+ it(`Verifying itemengine preview data for item "${referenceId}"`, () => {
98
+ migrationQuestionTypes.forEach((questionType) => {
99
+ cy.log(`Verifying data for all ${questionType} question type`);
100
+ let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
101
+ currQuestionTypeArr.forEach((questionData, index) => {
102
+ cy.log(`Verifying data for ${questionType} ${index}`);
103
+ switch (questionType) {
104
+ case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
105
+ case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
106
+ case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
107
+ case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
108
+ default: throw new Error('Invalid ngie question type');
109
+ }
110
+ });
111
+ });
112
+ });
113
+
114
+ it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
115
+ lrnPage.authorItemToolbarControlsWrapper()
116
+ .then(($element) => {
117
+ if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
118
+ lrnPage.steps.checkShowAnswersToggle();
119
+ lrnPage.questionTypeDiv()
120
+ .each(($el, index) => {
121
+ let currQuestionType = $el[0].innerText
122
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
123
+ currQuestionType = lrnQuestionTypesENUM.mcq
124
+ }
125
+ if (migrationQuestionTypesLrn.includes(currQuestionType)) {
126
+ switch (currQuestionType) {
127
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
128
+ case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
129
+ case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
130
+ default: throw new Error('Invalid lrn question type');
131
+ }
132
+ }
133
+ });
134
+ }
135
+ });
136
+ });
137
+
138
+ it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
139
+ autoScoredScoringPreviewTab.steps.switchToGradingView();
140
+ cy.wait(500);
141
+ migrationQuestionTypes.forEach((questionType) => {
142
+ cy.log(`Verifying grading data for all ${questionType} question type`);
143
+ let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
144
+ currQuestionTypeArr.forEach((questionData, index) => {
145
+ cy.log(`Verifying grading data for ${questionType} ${index}`);
146
+ switch (questionType) {
147
+ case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
148
+ case 'textEntryMath': return verifyIeQuestionData.textEntryMathGrading(questionData, index);
149
+ case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImageGrading(questionData, index);
150
+ default: throw new Error('Invalid ngie question type');
151
+ }
152
+ });
153
+ });
154
+ });
155
+ });
156
+ });
157
+ });
158
+ }
159
+
160
+ //https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json
@@ -18,7 +18,7 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
18
  iePage.questionWrapper()
19
19
  .then((elements) => {
20
20
  if (retries <= 0) {
21
- throw new Error('Element did not load in time')
21
+ throw new Error('Itemengine questions did not lazy load in time');
22
22
  };
23
23
  if (elements.length < count) {
24
24
  iePage.questionWrapper()
@@ -27,21 +27,23 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
27
27
  .wait(1000);
28
28
  cy.lazyLoadPreviewQuestions(count, retries - 1)
29
29
  };
30
- cy.log('All question parts loaded')
30
+ cy.log('All question parts loaded');
31
31
  });
32
32
  iePage.barsPreloader()
33
33
  .should('not.exist');
34
34
  cy.learnosityLoaderWait();
35
35
  })
36
36
 
37
- const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
37
+ const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["essayResponse"]
38
38
  const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
39
39
  let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
40
+ let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
41
+
40
42
 
41
43
  let lrnQuestionDataArr = [];
42
44
  let lrnGradingDataArr = [];
43
45
 
44
- let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(100, 200);
46
+ let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(100, 200);//["0715a48c-4c1f-4eed-8058-793ad9402f89", "c476e9ca-2ac6-4ebc-b548-241ef3cd13bb"]
45
47
 
46
48
  if (referenceIds.length > 0) {
47
49
  describe('Migration item check for MCQ questions', () => {
@@ -74,13 +76,18 @@ if (referenceIds.length > 0) {
74
76
  .each(($el, index) => {
75
77
  let currQuestionType = $el[0].innerText
76
78
  if (lrnMcqTypesRegex.test(currQuestionType)) {
77
- currQuestionType = lrnQuestionTypesENUM.mcq
79
+ currQuestionType = lrnQuestionTypesENUM.mcq;
80
+ }
81
+ if (lrnEssayResponseRegex.test(currQuestionType)) {
82
+ ;
83
+ currQuestionType = lrnQuestionTypesENUM.essayResponse;
78
84
  }
79
85
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
80
86
  switch (currQuestionType) {
81
87
  case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
82
88
  case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
83
89
  case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
90
+ case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
84
91
  default: throw new Error('Invalid lrn question type');
85
92
  }
86
93
  }
@@ -97,6 +104,7 @@ if (referenceIds.length > 0) {
97
104
  case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
98
105
  case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
99
106
  case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
107
+ case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
100
108
  default: throw new Error('Invalid ngie question type');
101
109
  }
102
110
  });
@@ -104,20 +112,25 @@ if (referenceIds.length > 0) {
104
112
  });
105
113
 
106
114
  it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
107
- lrnPage.steps.checkShowAnswersToggle();
108
- lrnPage.questionTypeDiv()
109
- .each(($el, index) => {
110
- let currQuestionType = $el[0].innerText
111
- if (lrnMcqTypesRegex.test(currQuestionType)) {
112
- currQuestionType = lrnQuestionTypesENUM.mcq
113
- }
114
- if (migrationQuestionTypesLrn.includes(currQuestionType)) {
115
- switch (currQuestionType) {
116
- case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
117
- case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
118
- case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
119
- default: throw new Error('Invalid lrn question type');
120
- }
115
+ lrnPage.authorItemToolbarControlsWrapper()
116
+ .then(($element) => {
117
+ if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
118
+ lrnPage.steps.checkShowAnswersToggle();
119
+ lrnPage.questionTypeDiv()
120
+ .each(($el, index) => {
121
+ let currQuestionType = $el[0].innerText
122
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
123
+ currQuestionType = lrnQuestionTypesENUM.mcq
124
+ }
125
+ if (migrationQuestionTypesLrn.includes(currQuestionType)) {
126
+ switch (currQuestionType) {
127
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
128
+ case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
129
+ case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
130
+ default: throw new Error('Invalid lrn question type');
131
+ }
132
+ }
133
+ });
121
134
  }
122
135
  });
123
136
  });
@@ -143,3 +156,5 @@ if (referenceIds.length > 0) {
143
156
  });
144
157
  });
145
158
  }
159
+
160
+ //https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json
@@ -18,7 +18,7 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
18
  iePage.questionWrapper()
19
19
  .then((elements) => {
20
20
  if (retries <= 0) {
21
- throw new Error('Element did not load in time')
21
+ throw new Error('Itemengine questions did not lazy load in time');
22
22
  };
23
23
  if (elements.length < count) {
24
24
  iePage.questionWrapper()
@@ -27,21 +27,23 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
27
27
  .wait(1000);
28
28
  cy.lazyLoadPreviewQuestions(count, retries - 1)
29
29
  };
30
- cy.log('All question parts loaded')
30
+ cy.log('All question parts loaded');
31
31
  });
32
32
  iePage.barsPreloader()
33
33
  .should('not.exist');
34
34
  cy.learnosityLoaderWait();
35
35
  })
36
36
 
37
- const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
37
+ const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["essayResponse"]
38
38
  const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
39
39
  let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
40
+ let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
41
+
40
42
 
41
43
  let lrnQuestionDataArr = [];
42
44
  let lrnGradingDataArr = [];
43
45
 
44
- let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(200, 300);
46
+ let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(200, 300);//["0715a48c-4c1f-4eed-8058-793ad9402f89", "c476e9ca-2ac6-4ebc-b548-241ef3cd13bb"]
45
47
 
46
48
  if (referenceIds.length > 0) {
47
49
  describe('Migration item check for MCQ questions', () => {
@@ -74,13 +76,18 @@ if (referenceIds.length > 0) {
74
76
  .each(($el, index) => {
75
77
  let currQuestionType = $el[0].innerText
76
78
  if (lrnMcqTypesRegex.test(currQuestionType)) {
77
- currQuestionType = lrnQuestionTypesENUM.mcq
79
+ currQuestionType = lrnQuestionTypesENUM.mcq;
80
+ }
81
+ if (lrnEssayResponseRegex.test(currQuestionType)) {
82
+ ;
83
+ currQuestionType = lrnQuestionTypesENUM.essayResponse;
78
84
  }
79
85
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
80
86
  switch (currQuestionType) {
81
87
  case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
82
88
  case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
83
89
  case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
90
+ case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
84
91
  default: throw new Error('Invalid lrn question type');
85
92
  }
86
93
  }
@@ -97,6 +104,7 @@ if (referenceIds.length > 0) {
97
104
  case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
98
105
  case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
99
106
  case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
107
+ case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
100
108
  default: throw new Error('Invalid ngie question type');
101
109
  }
102
110
  });
@@ -104,20 +112,25 @@ if (referenceIds.length > 0) {
104
112
  });
105
113
 
106
114
  it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
107
- lrnPage.steps.checkShowAnswersToggle();
108
- lrnPage.questionTypeDiv()
109
- .each(($el, index) => {
110
- let currQuestionType = $el[0].innerText
111
- if (lrnMcqTypesRegex.test(currQuestionType)) {
112
- currQuestionType = lrnQuestionTypesENUM.mcq
113
- }
114
- if (migrationQuestionTypesLrn.includes(currQuestionType)) {
115
- switch (currQuestionType) {
116
- case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
117
- case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
118
- case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
119
- default: throw new Error('Invalid lrn question type');
120
- }
115
+ lrnPage.authorItemToolbarControlsWrapper()
116
+ .then(($element) => {
117
+ if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
118
+ lrnPage.steps.checkShowAnswersToggle();
119
+ lrnPage.questionTypeDiv()
120
+ .each(($el, index) => {
121
+ let currQuestionType = $el[0].innerText
122
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
123
+ currQuestionType = lrnQuestionTypesENUM.mcq
124
+ }
125
+ if (migrationQuestionTypesLrn.includes(currQuestionType)) {
126
+ switch (currQuestionType) {
127
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
128
+ case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
129
+ case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
130
+ default: throw new Error('Invalid lrn question type');
131
+ }
132
+ }
133
+ });
121
134
  }
122
135
  });
123
136
  });
@@ -143,3 +156,5 @@ if (referenceIds.length > 0) {
143
156
  });
144
157
  });
145
158
  }
159
+
160
+ //https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json
@@ -18,7 +18,7 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
18
  iePage.questionWrapper()
19
19
  .then((elements) => {
20
20
  if (retries <= 0) {
21
- throw new Error('Element did not load in time')
21
+ throw new Error('Itemengine questions did not lazy load in time');
22
22
  };
23
23
  if (elements.length < count) {
24
24
  iePage.questionWrapper()
@@ -27,21 +27,23 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
27
27
  .wait(1000);
28
28
  cy.lazyLoadPreviewQuestions(count, retries - 1)
29
29
  };
30
- cy.log('All question parts loaded')
30
+ cy.log('All question parts loaded');
31
31
  });
32
32
  iePage.barsPreloader()
33
33
  .should('not.exist');
34
34
  cy.learnosityLoaderWait();
35
35
  })
36
36
 
37
- const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
37
+ const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["essayResponse"]
38
38
  const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
39
39
  let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
40
+ let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
41
+
40
42
 
41
43
  let lrnQuestionDataArr = [];
42
44
  let lrnGradingDataArr = [];
43
45
 
44
- let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(300, 400);
46
+ let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(300, 400);//["0715a48c-4c1f-4eed-8058-793ad9402f89", "c476e9ca-2ac6-4ebc-b548-241ef3cd13bb"]
45
47
 
46
48
  if (referenceIds.length > 0) {
47
49
  describe('Migration item check for MCQ questions', () => {
@@ -74,13 +76,18 @@ if (referenceIds.length > 0) {
74
76
  .each(($el, index) => {
75
77
  let currQuestionType = $el[0].innerText
76
78
  if (lrnMcqTypesRegex.test(currQuestionType)) {
77
- currQuestionType = lrnQuestionTypesENUM.mcq
79
+ currQuestionType = lrnQuestionTypesENUM.mcq;
80
+ }
81
+ if (lrnEssayResponseRegex.test(currQuestionType)) {
82
+ ;
83
+ currQuestionType = lrnQuestionTypesENUM.essayResponse;
78
84
  }
79
85
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
80
86
  switch (currQuestionType) {
81
87
  case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
82
88
  case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
83
89
  case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
90
+ case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
84
91
  default: throw new Error('Invalid lrn question type');
85
92
  }
86
93
  }
@@ -97,6 +104,7 @@ if (referenceIds.length > 0) {
97
104
  case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
98
105
  case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
99
106
  case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
107
+ case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
100
108
  default: throw new Error('Invalid ngie question type');
101
109
  }
102
110
  });
@@ -104,20 +112,25 @@ if (referenceIds.length > 0) {
104
112
  });
105
113
 
106
114
  it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
107
- lrnPage.steps.checkShowAnswersToggle();
108
- lrnPage.questionTypeDiv()
109
- .each(($el, index) => {
110
- let currQuestionType = $el[0].innerText
111
- if (lrnMcqTypesRegex.test(currQuestionType)) {
112
- currQuestionType = lrnQuestionTypesENUM.mcq
113
- }
114
- if (migrationQuestionTypesLrn.includes(currQuestionType)) {
115
- switch (currQuestionType) {
116
- case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
117
- case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
118
- case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
119
- default: throw new Error('Invalid lrn question type');
120
- }
115
+ lrnPage.authorItemToolbarControlsWrapper()
116
+ .then(($element) => {
117
+ if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
118
+ lrnPage.steps.checkShowAnswersToggle();
119
+ lrnPage.questionTypeDiv()
120
+ .each(($el, index) => {
121
+ let currQuestionType = $el[0].innerText
122
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
123
+ currQuestionType = lrnQuestionTypesENUM.mcq
124
+ }
125
+ if (migrationQuestionTypesLrn.includes(currQuestionType)) {
126
+ switch (currQuestionType) {
127
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
128
+ case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
129
+ case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
130
+ default: throw new Error('Invalid lrn question type');
131
+ }
132
+ }
133
+ });
121
134
  }
122
135
  });
123
136
  });
@@ -143,3 +156,5 @@ if (referenceIds.length > 0) {
143
156
  });
144
157
  });
145
158
  }
159
+
160
+ //https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json