itemengine-cypress-automation 1.0.110 → 1.0.112

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ import { autoScoredScoringPreviewTab } from "../../pages/components";
2
2
  import utilities from "../../support/helpers/utilities";
3
3
  import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
4
4
  import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
5
- import { verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
5
+ import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
6
6
 
7
7
  Cypress.Commands.add('learnosityLoaderWait', () => {
8
8
  // cy.get('.lrn-spinner')
@@ -15,13 +15,13 @@ Cypress.Commands.add('learnosityLoaderWait', () => {
15
15
  });
16
16
 
17
17
  Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
- cy.get('.question-instruction')
18
+ iePage.questionWrapper()
19
19
  .then((elements) => {
20
20
  if (retries <= 0) {
21
21
  throw new Error('Element did not load in time')
22
22
  };
23
23
  if (elements.length < count) {
24
- cy.get('.question-instruction')
24
+ iePage.questionWrapper()
25
25
  .last()
26
26
  .scrollIntoView()
27
27
  .wait(1000);
@@ -29,20 +29,19 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
29
29
  };
30
30
  cy.log('All question parts loaded')
31
31
  });
32
- //cy.barsPreLoaderWait();
33
- cy.get('[id="question-item-instruction-loader"]')
32
+ iePage.barsPreloader()
34
33
  .should('not.exist');
35
34
  cy.learnosityLoaderWait();
36
35
  })
37
36
 
38
- const migrationQuestionTypes = Cypress.env('migrationQuestionTypes'); /* ['singleSelection', 'multipleSelection', 'trueOrFalse']; */
37
+ const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
39
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
40
 
41
41
  let lrnQuestionDataArr = [];
42
42
  let lrnGradingDataArr = [];
43
43
 
44
44
  let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(0, 100);
45
- /* ["c18e3a7d-d386-4765-a9d3-14b8ab7548bd", "6809707f-77bd-4e8d-8c3d-baf3d38611cf","ad5dd21c-50d5-4c20-8348-30000b7d911c",'c3100724-dbfc-4950-aeb4-e8d65dfbecf2'] */;
46
45
 
47
46
  if (referenceIds.length > 0) {
48
47
  describe('Migration item check for MCQ questions', () => {
@@ -74,12 +73,12 @@ if (referenceIds.length > 0) {
74
73
  lrnPage.questionTypeDiv()
75
74
  .each(($el, index) => {
76
75
  let currQuestionType = $el[0].innerText
76
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
77
+ currQuestionType = lrnQuestionTypesENUM.mcq
78
+ }
77
79
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
78
80
  switch (currQuestionType) {
79
- case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
80
- case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelection(lrnQuestionDataArr, index);
81
- case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalse(lrnQuestionDataArr, index);
82
- case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
81
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
83
82
  default: throw new Error('Invalid lrn question type');
84
83
  }
85
84
  }
@@ -93,10 +92,7 @@ if (referenceIds.length > 0) {
93
92
  currQuestionTypeArr.forEach((questionData, index) => {
94
93
  cy.log(`Verifying data for ${questionType} ${index}`);
95
94
  switch (questionType) {
96
- case 'singleSelection': return verifyIeQuestionData.singleSelection(questionData, index);
97
- case 'multipleSelection': return verifyIeQuestionData.multipleSelection(questionData, index);
98
- case 'trueOrFalse': return verifyIeQuestionData.trueOrFalse(questionData, index);
99
- case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
95
+ case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
100
96
  default: throw new Error('Invalid ngie question type');
101
97
  }
102
98
  });
@@ -108,12 +104,12 @@ if (referenceIds.length > 0) {
108
104
  lrnPage.questionTypeDiv()
109
105
  .each(($el, index) => {
110
106
  let currQuestionType = $el[0].innerText
107
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
108
+ currQuestionType = lrnQuestionTypesENUM.mcq
109
+ }
111
110
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
112
111
  switch (currQuestionType) {
113
- case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
114
- case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelectionGrading(lrnGradingDataArr, index);
115
- case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalseGrading(lrnGradingDataArr, index);
116
- // case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
112
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
117
113
  default: throw new Error('Invalid lrn question type');
118
114
  }
119
115
  }
@@ -129,10 +125,7 @@ if (referenceIds.length > 0) {
129
125
  currQuestionTypeArr.forEach((questionData, index) => {
130
126
  cy.log(`Verifying grading data for ${questionType} ${index}`);
131
127
  switch (questionType) {
132
- case 'singleSelection': return verifyIeQuestionData.singleSelectionGrading(questionData, index);
133
- case 'multipleSelection': return verifyIeQuestionData.multipleSelectionGrading(questionData, index);
134
- case 'trueOrFalse': return verifyIeQuestionData.trueOrFalseGrading(questionData, index);
135
- // case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
128
+ case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
136
129
  default: throw new Error('Invalid ngie question type');
137
130
  }
138
131
  });
@@ -2,7 +2,7 @@ import { autoScoredScoringPreviewTab } from "../../pages/components";
2
2
  import utilities from "../../support/helpers/utilities";
3
3
  import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
4
4
  import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
5
- import { verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
5
+ import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
6
6
 
7
7
  Cypress.Commands.add('learnosityLoaderWait', () => {
8
8
  // cy.get('.lrn-spinner')
@@ -15,13 +15,13 @@ Cypress.Commands.add('learnosityLoaderWait', () => {
15
15
  });
16
16
 
17
17
  Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
- cy.get('.question-instruction')
18
+ iePage.questionWrapper()
19
19
  .then((elements) => {
20
20
  if (retries <= 0) {
21
21
  throw new Error('Element did not load in time')
22
22
  };
23
23
  if (elements.length < count) {
24
- cy.get('.question-instruction')
24
+ iePage.questionWrapper()
25
25
  .last()
26
26
  .scrollIntoView()
27
27
  .wait(1000);
@@ -29,17 +29,14 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
29
29
  };
30
30
  cy.log('All question parts loaded')
31
31
  });
32
- //cy.barsPreLoaderWait();
33
- cy.get('[id="question-item-instruction-loader"]')
32
+ iePage.barsPreloader()
34
33
  .should('not.exist');
35
34
  cy.learnosityLoaderWait();
36
35
  })
37
36
 
38
- const migrationQuestionTypes = Cypress.env('migrationQuestionTypes'); /* ['singleSelection', 'essayResponseMath']; */
37
+ const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
39
38
  const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
40
-
41
- console.log('migrationQuestionTypes', Cypress.env('migrationQuestionTypes'))
42
- console.log('referenceIds', Cypress.env('referenceIds'))
39
+ let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
43
40
 
44
41
  let lrnQuestionDataArr = [];
45
42
  let lrnGradingDataArr = [];
@@ -76,12 +73,12 @@ if (referenceIds.length > 0) {
76
73
  lrnPage.questionTypeDiv()
77
74
  .each(($el, index) => {
78
75
  let currQuestionType = $el[0].innerText
76
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
77
+ currQuestionType = lrnQuestionTypesENUM.mcq
78
+ }
79
79
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
80
80
  switch (currQuestionType) {
81
- case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
82
- case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelection(lrnQuestionDataArr, index);
83
- case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalse(lrnQuestionDataArr, index);
84
- case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
81
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
85
82
  default: throw new Error('Invalid lrn question type');
86
83
  }
87
84
  }
@@ -95,10 +92,7 @@ if (referenceIds.length > 0) {
95
92
  currQuestionTypeArr.forEach((questionData, index) => {
96
93
  cy.log(`Verifying data for ${questionType} ${index}`);
97
94
  switch (questionType) {
98
- case 'singleSelection': return verifyIeQuestionData.singleSelection(questionData, index);
99
- case 'multipleSelection': return verifyIeQuestionData.multipleSelection(questionData, index);
100
- case 'trueOrFalse': return verifyIeQuestionData.trueOrFalse(questionData, index);
101
- case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
95
+ case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
102
96
  default: throw new Error('Invalid ngie question type');
103
97
  }
104
98
  });
@@ -110,12 +104,12 @@ if (referenceIds.length > 0) {
110
104
  lrnPage.questionTypeDiv()
111
105
  .each(($el, index) => {
112
106
  let currQuestionType = $el[0].innerText
107
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
108
+ currQuestionType = lrnQuestionTypesENUM.mcq
109
+ }
113
110
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
114
111
  switch (currQuestionType) {
115
- case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
116
- case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelectionGrading(lrnGradingDataArr, index);
117
- case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalseGrading(lrnGradingDataArr, index);
118
- // case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
112
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
119
113
  default: throw new Error('Invalid lrn question type');
120
114
  }
121
115
  }
@@ -131,10 +125,7 @@ if (referenceIds.length > 0) {
131
125
  currQuestionTypeArr.forEach((questionData, index) => {
132
126
  cy.log(`Verifying grading data for ${questionType} ${index}`);
133
127
  switch (questionType) {
134
- case 'singleSelection': return verifyIeQuestionData.singleSelectionGrading(questionData, index);
135
- case 'multipleSelection': return verifyIeQuestionData.multipleSelectionGrading(questionData, index);
136
- case 'trueOrFalse': return verifyIeQuestionData.trueOrFalseGrading(questionData, index);
137
- // case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
128
+ case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
138
129
  default: throw new Error('Invalid ngie question type');
139
130
  }
140
131
  });
@@ -2,7 +2,7 @@ import { autoScoredScoringPreviewTab } from "../../pages/components";
2
2
  import utilities from "../../support/helpers/utilities";
3
3
  import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
4
4
  import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
5
- import { verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
5
+ import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
6
6
 
7
7
  Cypress.Commands.add('learnosityLoaderWait', () => {
8
8
  // cy.get('.lrn-spinner')
@@ -15,13 +15,13 @@ Cypress.Commands.add('learnosityLoaderWait', () => {
15
15
  });
16
16
 
17
17
  Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
- cy.get('.question-instruction')
18
+ iePage.questionWrapper()
19
19
  .then((elements) => {
20
20
  if (retries <= 0) {
21
21
  throw new Error('Element did not load in time')
22
22
  };
23
23
  if (elements.length < count) {
24
- cy.get('.question-instruction')
24
+ iePage.questionWrapper()
25
25
  .last()
26
26
  .scrollIntoView()
27
27
  .wait(1000);
@@ -29,14 +29,14 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
29
29
  };
30
30
  cy.log('All question parts loaded')
31
31
  });
32
- //cy.barsPreLoaderWait();
33
- cy.get('[id="question-item-instruction-loader"]')
32
+ iePage.barsPreloader()
34
33
  .should('not.exist');
35
34
  cy.learnosityLoaderWait();
36
35
  })
37
36
 
38
- const migrationQuestionTypes = /* ['singleSelection', 'essayResponseMath']; */ Cypress.env('migrationQuestionTypes');
37
+ const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
39
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
40
 
41
41
  let lrnQuestionDataArr = [];
42
42
  let lrnGradingDataArr = [];
@@ -73,12 +73,12 @@ if (referenceIds.length > 0) {
73
73
  lrnPage.questionTypeDiv()
74
74
  .each(($el, index) => {
75
75
  let currQuestionType = $el[0].innerText
76
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
77
+ currQuestionType = lrnQuestionTypesENUM.mcq
78
+ }
76
79
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
77
80
  switch (currQuestionType) {
78
- case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
79
- case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelection(lrnQuestionDataArr, index);
80
- case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalse(lrnQuestionDataArr, index);
81
- case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
81
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
82
82
  default: throw new Error('Invalid lrn question type');
83
83
  }
84
84
  }
@@ -92,10 +92,7 @@ if (referenceIds.length > 0) {
92
92
  currQuestionTypeArr.forEach((questionData, index) => {
93
93
  cy.log(`Verifying data for ${questionType} ${index}`);
94
94
  switch (questionType) {
95
- case 'singleSelection': return verifyIeQuestionData.singleSelection(questionData, index);
96
- case 'multipleSelection': return verifyIeQuestionData.multipleSelection(questionData, index);
97
- case 'trueOrFalse': return verifyIeQuestionData.trueOrFalse(questionData, index);
98
- case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
95
+ case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
99
96
  default: throw new Error('Invalid ngie question type');
100
97
  }
101
98
  });
@@ -107,12 +104,12 @@ if (referenceIds.length > 0) {
107
104
  lrnPage.questionTypeDiv()
108
105
  .each(($el, index) => {
109
106
  let currQuestionType = $el[0].innerText
107
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
108
+ currQuestionType = lrnQuestionTypesENUM.mcq
109
+ }
110
110
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
111
111
  switch (currQuestionType) {
112
- case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
113
- case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelectionGrading(lrnGradingDataArr, index);
114
- case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalseGrading(lrnGradingDataArr, index);
115
- // case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
112
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
116
113
  default: throw new Error('Invalid lrn question type');
117
114
  }
118
115
  }
@@ -128,10 +125,7 @@ if (referenceIds.length > 0) {
128
125
  currQuestionTypeArr.forEach((questionData, index) => {
129
126
  cy.log(`Verifying grading data for ${questionType} ${index}`);
130
127
  switch (questionType) {
131
- case 'singleSelection': return verifyIeQuestionData.singleSelectionGrading(questionData, index);
132
- case 'multipleSelection': return verifyIeQuestionData.multipleSelectionGrading(questionData, index);
133
- case 'trueOrFalse': return verifyIeQuestionData.trueOrFalseGrading(questionData, index);
134
- // case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
128
+ case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
135
129
  default: throw new Error('Invalid ngie question type');
136
130
  }
137
131
  });
@@ -2,7 +2,7 @@ import { autoScoredScoringPreviewTab } from "../../pages/components";
2
2
  import utilities from "../../support/helpers/utilities";
3
3
  import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
4
4
  import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
5
- import { verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
5
+ import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
6
6
 
7
7
  Cypress.Commands.add('learnosityLoaderWait', () => {
8
8
  // cy.get('.lrn-spinner')
@@ -15,13 +15,13 @@ Cypress.Commands.add('learnosityLoaderWait', () => {
15
15
  });
16
16
 
17
17
  Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
- cy.get('.question-instruction')
18
+ iePage.questionWrapper()
19
19
  .then((elements) => {
20
20
  if (retries <= 0) {
21
21
  throw new Error('Element did not load in time')
22
22
  };
23
23
  if (elements.length < count) {
24
- cy.get('.question-instruction')
24
+ iePage.questionWrapper()
25
25
  .last()
26
26
  .scrollIntoView()
27
27
  .wait(1000);
@@ -29,14 +29,14 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
29
29
  };
30
30
  cy.log('All question parts loaded')
31
31
  });
32
- //cy.barsPreLoaderWait();
33
- cy.get('[id="question-item-instruction-loader"]')
32
+ iePage.barsPreloader()
34
33
  .should('not.exist');
35
34
  cy.learnosityLoaderWait();
36
35
  })
37
36
 
38
37
  const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
39
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
40
 
41
41
  let lrnQuestionDataArr = [];
42
42
  let lrnGradingDataArr = [];
@@ -73,12 +73,12 @@ if (referenceIds.length > 0) {
73
73
  lrnPage.questionTypeDiv()
74
74
  .each(($el, index) => {
75
75
  let currQuestionType = $el[0].innerText
76
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
77
+ currQuestionType = lrnQuestionTypesENUM.mcq
78
+ }
76
79
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
77
80
  switch (currQuestionType) {
78
- case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
79
- case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelection(lrnQuestionDataArr, index);
80
- case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalse(lrnQuestionDataArr, index);
81
- case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
81
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
82
82
  default: throw new Error('Invalid lrn question type');
83
83
  }
84
84
  }
@@ -92,10 +92,7 @@ if (referenceIds.length > 0) {
92
92
  currQuestionTypeArr.forEach((questionData, index) => {
93
93
  cy.log(`Verifying data for ${questionType} ${index}`);
94
94
  switch (questionType) {
95
- case 'singleSelection': return verifyIeQuestionData.singleSelection(questionData, index);
96
- case 'multipleSelection': return verifyIeQuestionData.multipleSelection(questionData, index);
97
- case 'trueOrFalse': return verifyIeQuestionData.trueOrFalse(questionData, index);
98
- case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
95
+ case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
99
96
  default: throw new Error('Invalid ngie question type');
100
97
  }
101
98
  });
@@ -107,12 +104,12 @@ if (referenceIds.length > 0) {
107
104
  lrnPage.questionTypeDiv()
108
105
  .each(($el, index) => {
109
106
  let currQuestionType = $el[0].innerText
107
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
108
+ currQuestionType = lrnQuestionTypesENUM.mcq
109
+ }
110
110
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
111
111
  switch (currQuestionType) {
112
- case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
113
- case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelectionGrading(lrnGradingDataArr, index);
114
- case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalseGrading(lrnGradingDataArr, index);
115
- // case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
112
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
116
113
  default: throw new Error('Invalid lrn question type');
117
114
  }
118
115
  }
@@ -128,10 +125,7 @@ if (referenceIds.length > 0) {
128
125
  currQuestionTypeArr.forEach((questionData, index) => {
129
126
  cy.log(`Verifying grading data for ${questionType} ${index}`);
130
127
  switch (questionType) {
131
- case 'singleSelection': return verifyIeQuestionData.singleSelectionGrading(questionData, index);
132
- case 'multipleSelection': return verifyIeQuestionData.multipleSelectionGrading(questionData, index);
133
- case 'trueOrFalse': return verifyIeQuestionData.trueOrFalseGrading(questionData, index);
134
- // case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
128
+ case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
135
129
  default: throw new Error('Invalid ngie question type');
136
130
  }
137
131
  });
@@ -2,7 +2,7 @@ import { autoScoredScoringPreviewTab } from "../../pages/components";
2
2
  import utilities from "../../support/helpers/utilities";
3
3
  import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
4
4
  import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
5
- import { verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
5
+ import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
6
6
 
7
7
  Cypress.Commands.add('learnosityLoaderWait', () => {
8
8
  // cy.get('.lrn-spinner')
@@ -15,13 +15,13 @@ Cypress.Commands.add('learnosityLoaderWait', () => {
15
15
  });
16
16
 
17
17
  Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
- cy.get('.question-instruction')
18
+ iePage.questionWrapper()
19
19
  .then((elements) => {
20
20
  if (retries <= 0) {
21
21
  throw new Error('Element did not load in time')
22
22
  };
23
23
  if (elements.length < count) {
24
- cy.get('.question-instruction')
24
+ iePage.questionWrapper()
25
25
  .last()
26
26
  .scrollIntoView()
27
27
  .wait(1000);
@@ -29,14 +29,14 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
29
29
  };
30
30
  cy.log('All question parts loaded')
31
31
  });
32
- //cy.barsPreLoaderWait();
33
- cy.get('[id="question-item-instruction-loader"]')
32
+ iePage.barsPreloader()
34
33
  .should('not.exist');
35
34
  cy.learnosityLoaderWait();
36
35
  })
37
36
 
38
37
  const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
39
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
40
 
41
41
  let lrnQuestionDataArr = [];
42
42
  let lrnGradingDataArr = [];
@@ -73,12 +73,12 @@ if (referenceIds.length > 0) {
73
73
  lrnPage.questionTypeDiv()
74
74
  .each(($el, index) => {
75
75
  let currQuestionType = $el[0].innerText
76
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
77
+ currQuestionType = lrnQuestionTypesENUM.mcq
78
+ }
76
79
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
77
80
  switch (currQuestionType) {
78
- case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
79
- case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelection(lrnQuestionDataArr, index);
80
- case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalse(lrnQuestionDataArr, index);
81
- case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
81
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
82
82
  default: throw new Error('Invalid lrn question type');
83
83
  }
84
84
  }
@@ -92,10 +92,7 @@ if (referenceIds.length > 0) {
92
92
  currQuestionTypeArr.forEach((questionData, index) => {
93
93
  cy.log(`Verifying data for ${questionType} ${index}`);
94
94
  switch (questionType) {
95
- case 'singleSelection': return verifyIeQuestionData.singleSelection(questionData, index);
96
- case 'multipleSelection': return verifyIeQuestionData.multipleSelection(questionData, index);
97
- case 'trueOrFalse': return verifyIeQuestionData.trueOrFalse(questionData, index);
98
- case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
95
+ case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
99
96
  default: throw new Error('Invalid ngie question type');
100
97
  }
101
98
  });
@@ -107,12 +104,12 @@ if (referenceIds.length > 0) {
107
104
  lrnPage.questionTypeDiv()
108
105
  .each(($el, index) => {
109
106
  let currQuestionType = $el[0].innerText
107
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
108
+ currQuestionType = lrnQuestionTypesENUM.mcq
109
+ }
110
110
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
111
111
  switch (currQuestionType) {
112
- case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
113
- case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelectionGrading(lrnGradingDataArr, index);
114
- case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalseGrading(lrnGradingDataArr, index);
115
- // case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
112
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
116
113
  default: throw new Error('Invalid lrn question type');
117
114
  }
118
115
  }
@@ -128,10 +125,7 @@ if (referenceIds.length > 0) {
128
125
  currQuestionTypeArr.forEach((questionData, index) => {
129
126
  cy.log(`Verifying grading data for ${questionType} ${index}`);
130
127
  switch (questionType) {
131
- case 'singleSelection': return verifyIeQuestionData.singleSelectionGrading(questionData, index);
132
- case 'multipleSelection': return verifyIeQuestionData.multipleSelectionGrading(questionData, index);
133
- case 'trueOrFalse': return verifyIeQuestionData.trueOrFalseGrading(questionData, index);
134
- // case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
128
+ case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
135
129
  default: throw new Error('Invalid ngie question type');
136
130
  }
137
131
  });
@@ -115,7 +115,7 @@ Cypress.Commands.add('pageLoadWait', (operationName = null) => {
115
115
  } else {
116
116
  cy.wait(`@${operationName}`);
117
117
  }
118
- cy.get('.MuiCircularProgress-svg')
118
+ cy.get('.MuiCircularProgress-svg', { timeout: 60000 })
119
119
  .should('not.be.visible');
120
120
  });
121
121
 
@@ -16,11 +16,11 @@ export const lrnPage = {
16
16
  }
17
17
 
18
18
  export const extractLrnQuestionData = {
19
- singleSelection: (lrnQuestionDataArr, index) => {
19
+ mcq: (lrnQuestionDataArr, index) => {
20
20
  let obj = {};
21
21
  cy.log(`Extracting the question instructions and options from question ${index}`);
22
22
  obj.questionIndex = index;
23
- obj.questionType = 'singleSelection'
23
+ obj.questionType = 'mcq'
24
24
  lrnPage.questionWrapper()
25
25
  .eq(index)
26
26
  .within(() => {
@@ -47,147 +47,11 @@ export const extractLrnQuestionData = {
47
47
  lrnQuestionDataArr.push(obj);
48
48
  },
49
49
 
50
- singleSelectionGrading: (lrnGradingDataArr, index) => {
51
- //get the option main div, check for the isvalid class and store the index
52
- //store blank array if there isn't any option that would imply that the question is manual scored
53
- //verify the respective option in the itemengine if blank then no option should have tickmark
54
- //if index then at that index there should be a tick mark but also check in other options for no tickmark
50
+ mcqGrading: (lrnGradingDataArr, index) => {
55
51
  let obj = {};
56
52
  cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
57
53
  obj.questionIndex = index;
58
- obj.questionType = 'singleSelection'
59
- lrnPage.questionWrapper()
60
- .eq(index)
61
- .within(() => {
62
- lrnPage.questionInstructions()
63
- .then(($ins) => {
64
- let text = $ins[0].innerText;
65
- obj.gradingQuestionInstructions = text;
66
- });
67
-
68
- let optionsText = [];
69
- let correctAnswersIndex = [];
70
- lrnPage.mcqOptionWrapper()
71
- .each(($optionWrapper, index) => {
72
- if ($optionWrapper[0].className.includes('lrn_valid')) {
73
- correctAnswersIndex.push(index)
74
- }
75
- cy.wrap($optionWrapper)
76
- .within(() => {
77
- lrnPage.mcqOptionContent()
78
- .then(($el) => {
79
- optionsText.push($el[0].innerText);
80
- });
81
- });
82
- });
83
- obj.gradingOptionsText = optionsText;
84
- obj.correctAnswersIndex = correctAnswersIndex;
85
- });
86
- lrnGradingDataArr.push(obj);
87
- },
88
-
89
- multipleSelection: (lrnQuestionDataArr, index) => {
90
- let obj = {};
91
- cy.log(`Extracting the question instructions and options from question ${index}`);
92
- obj.questionIndex = index;
93
- obj.questionType = 'multipleSelection'
94
- lrnPage.questionWrapper()
95
- .eq(index)
96
- .within(() => {
97
- lrnPage.questionInstructions()
98
- .then(($ins) => {
99
- let text = $ins[0].innerText;
100
- obj.previewQuestionInstructions = text;
101
- });
102
-
103
- let optionsText = [];
104
- lrnPage.mcqOptionWrapper()
105
- .each(($options) => {
106
- cy.wrap($options)
107
- .within(() => {
108
- lrnPage.mcqOptionContent()
109
- .then(($el) => {
110
- let text = $el[0].innerText;
111
- optionsText.push(text);
112
- });
113
- });
114
- });
115
- obj.previewOptionsText = optionsText;
116
- })
117
- lrnQuestionDataArr.push(obj);
118
- },
119
-
120
- multipleSelectionGrading: (lrnGradingDataArr, index) => {
121
- let obj = {};
122
- cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
123
- obj.questionIndex = index;
124
- obj.questionType = 'multipleSelection'
125
- lrnPage.questionWrapper()
126
- .eq(index)
127
- .within(() => {
128
- lrnPage.questionInstructions()
129
- .then(($ins) => {
130
- let text = $ins[0].innerText;
131
- obj.gradingQuestionInstructions = text;
132
- });
133
-
134
- let optionsText = [];
135
- let correctAnswersIndex = [];
136
- lrnPage.mcqOptionWrapper()
137
- .each(($optionWrapper, index) => {
138
- if ($optionWrapper[0].className.includes('lrn_valid')) {
139
- correctAnswersIndex.push(index)
140
- }
141
- cy.wrap($optionWrapper)
142
- .within(() => {
143
- lrnPage.mcqOptionContent()
144
- .then(($el) => {
145
- optionsText.push($el[0].innerText);
146
- });
147
- });
148
- });
149
- obj.gradingOptionsText = optionsText;
150
- obj.correctAnswersIndex = correctAnswersIndex;
151
- });
152
- lrnGradingDataArr.push(obj);
153
- },
154
-
155
- trueOrFalse: (lrnQuestionDataArr, index) => {
156
- let obj = {};
157
- cy.log(`Extracting the question instructions and options from question ${index}`);
158
- obj.questionIndex = index;
159
- obj.questionType = 'trueOrFalse';
160
- lrnPage.questionWrapper()
161
- .eq(index)
162
- .within(() => {
163
- lrnPage.questionInstructions()
164
- .then(($ins) => {
165
- let text = $ins[0].innerText;
166
- obj.previewQuestionInstructions = text;
167
- });
168
-
169
- let optionsText = [];
170
- lrnPage.mcqOptionWrapper()
171
- .each(($options) => {
172
- cy.wrap($options)
173
- .within(() => {
174
- lrnPage.mcqOptionContent()
175
- .then(($el) => {
176
- let text = $el[0].innerText;
177
- optionsText.push(text);
178
- });
179
- });
180
- });
181
- obj.previewOptionsText = optionsText;
182
- })
183
- lrnQuestionDataArr.push(obj);
184
- },
185
-
186
- trueOrFalseGrading: (lrnGradingDataArr, index) => {
187
- let obj = {};
188
- cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
189
- obj.questionIndex = index;
190
- obj.questionType = 'trueOrFalse'
54
+ obj.questionType = 'mcq'
191
55
  lrnPage.questionWrapper()
192
56
  .eq(index)
193
57
  .within(() => {
@@ -233,5 +97,203 @@ export const extractLrnQuestionData = {
233
97
  });
234
98
  })
235
99
  lrnQuestionDataArr.push(obj);
236
- }
100
+ },
101
+
102
+ /* singleSelection: (lrnQuestionDataArr, index) => {
103
+ let obj = {};
104
+ cy.log(`Extracting the question instructions and options from question ${index}`);
105
+ obj.questionIndex = index;
106
+ obj.questionType = 'singleSelection'
107
+ lrnPage.questionWrapper()
108
+ .eq(index)
109
+ .within(() => {
110
+ lrnPage.questionInstructions()
111
+ .then(($ins) => {
112
+ let text = $ins[0].innerText;
113
+ obj.previewQuestionInstructions = text;
114
+ });
115
+
116
+ let optionsText = [];
117
+ lrnPage.mcqOptionWrapper()
118
+ .each(($options) => {
119
+ cy.wrap($options)
120
+ .within(() => {
121
+ lrnPage.mcqOptionContent()
122
+ .then(($el) => {
123
+ let text = $el[0].innerText;
124
+ optionsText.push(text);
125
+ });
126
+ });
127
+ });
128
+ obj.previewOptionsText = optionsText;
129
+ })
130
+ lrnQuestionDataArr.push(obj);
131
+ },
132
+
133
+ singleSelectionGrading: (lrnGradingDataArr, index) => {
134
+ let obj = {};
135
+ cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
136
+ obj.questionIndex = index;
137
+ obj.questionType = 'singleSelection'
138
+ lrnPage.questionWrapper()
139
+ .eq(index)
140
+ .within(() => {
141
+ lrnPage.questionInstructions()
142
+ .then(($ins) => {
143
+ let text = $ins[0].innerText;
144
+ obj.gradingQuestionInstructions = text;
145
+ });
146
+
147
+ let optionsText = [];
148
+ let correctAnswersIndex = [];
149
+ lrnPage.mcqOptionWrapper()
150
+ .each(($optionWrapper, index) => {
151
+ if ($optionWrapper[0].className.includes('lrn_valid')) {
152
+ correctAnswersIndex.push(index)
153
+ }
154
+ cy.wrap($optionWrapper)
155
+ .within(() => {
156
+ lrnPage.mcqOptionContent()
157
+ .then(($el) => {
158
+ optionsText.push($el[0].innerText);
159
+ });
160
+ });
161
+ });
162
+ obj.gradingOptionsText = optionsText;
163
+ obj.correctAnswersIndex = correctAnswersIndex;
164
+ });
165
+ lrnGradingDataArr.push(obj);
166
+ },
167
+
168
+ multipleSelection: (lrnQuestionDataArr, index) => {
169
+ let obj = {};
170
+ cy.log(`Extracting the question instructions and options from question ${index}`);
171
+ obj.questionIndex = index;
172
+ obj.questionType = 'multipleSelection'
173
+ lrnPage.questionWrapper()
174
+ .eq(index)
175
+ .within(() => {
176
+ lrnPage.questionInstructions()
177
+ .then(($ins) => {
178
+ let text = $ins[0].innerText;
179
+ obj.previewQuestionInstructions = text;
180
+ });
181
+
182
+ let optionsText = [];
183
+ lrnPage.mcqOptionWrapper()
184
+ .each(($options) => {
185
+ cy.wrap($options)
186
+ .within(() => {
187
+ lrnPage.mcqOptionContent()
188
+ .then(($el) => {
189
+ let text = $el[0].innerText;
190
+ optionsText.push(text);
191
+ });
192
+ });
193
+ });
194
+ obj.previewOptionsText = optionsText;
195
+ })
196
+ lrnQuestionDataArr.push(obj);
197
+ },
198
+
199
+ multipleSelectionGrading: (lrnGradingDataArr, index) => {
200
+ let obj = {};
201
+ cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
202
+ obj.questionIndex = index;
203
+ obj.questionType = 'multipleSelection'
204
+ lrnPage.questionWrapper()
205
+ .eq(index)
206
+ .within(() => {
207
+ lrnPage.questionInstructions()
208
+ .then(($ins) => {
209
+ let text = $ins[0].innerText;
210
+ obj.gradingQuestionInstructions = text;
211
+ });
212
+
213
+ let optionsText = [];
214
+ let correctAnswersIndex = [];
215
+ lrnPage.mcqOptionWrapper()
216
+ .each(($optionWrapper, index) => {
217
+ if ($optionWrapper[0].className.includes('lrn_valid')) {
218
+ correctAnswersIndex.push(index)
219
+ }
220
+ cy.wrap($optionWrapper)
221
+ .within(() => {
222
+ lrnPage.mcqOptionContent()
223
+ .then(($el) => {
224
+ optionsText.push($el[0].innerText);
225
+ });
226
+ });
227
+ });
228
+ obj.gradingOptionsText = optionsText;
229
+ obj.correctAnswersIndex = correctAnswersIndex;
230
+ });
231
+ lrnGradingDataArr.push(obj);
232
+ },
233
+
234
+ trueOrFalse: (lrnQuestionDataArr, index) => {
235
+ let obj = {};
236
+ cy.log(`Extracting the question instructions and options from question ${index}`);
237
+ obj.questionIndex = index;
238
+ obj.questionType = 'trueOrFalse';
239
+ lrnPage.questionWrapper()
240
+ .eq(index)
241
+ .within(() => {
242
+ lrnPage.questionInstructions()
243
+ .then(($ins) => {
244
+ let text = $ins[0].innerText;
245
+ obj.previewQuestionInstructions = text;
246
+ });
247
+
248
+ let optionsText = [];
249
+ lrnPage.mcqOptionWrapper()
250
+ .each(($options) => {
251
+ cy.wrap($options)
252
+ .within(() => {
253
+ lrnPage.mcqOptionContent()
254
+ .then(($el) => {
255
+ let text = $el[0].innerText;
256
+ optionsText.push(text);
257
+ });
258
+ });
259
+ });
260
+ obj.previewOptionsText = optionsText;
261
+ })
262
+ lrnQuestionDataArr.push(obj);
263
+ },
264
+
265
+ trueOrFalseGrading: (lrnGradingDataArr, index) => {
266
+ let obj = {};
267
+ cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
268
+ obj.questionIndex = index;
269
+ obj.questionType = 'trueOrFalse'
270
+ lrnPage.questionWrapper()
271
+ .eq(index)
272
+ .within(() => {
273
+ lrnPage.questionInstructions()
274
+ .then(($ins) => {
275
+ let text = $ins[0].innerText;
276
+ obj.gradingQuestionInstructions = text;
277
+ });
278
+
279
+ let optionsText = [];
280
+ let correctAnswersIndex = [];
281
+ lrnPage.mcqOptionWrapper()
282
+ .each(($optionWrapper, index) => {
283
+ if ($optionWrapper[0].className.includes('lrn_valid')) {
284
+ correctAnswersIndex.push(index)
285
+ }
286
+ cy.wrap($optionWrapper)
287
+ .within(() => {
288
+ lrnPage.mcqOptionContent()
289
+ .then(($el) => {
290
+ optionsText.push($el[0].innerText);
291
+ });
292
+ });
293
+ });
294
+ obj.gradingOptionsText = optionsText;
295
+ obj.correctAnswersIndex = correctAnswersIndex;
296
+ });
297
+ lrnGradingDataArr.push(obj);
298
+ }, */
237
299
  }
@@ -1,4 +1,5 @@
1
1
  const lrnQuestionTypesENUM = {
2
+ mcq: 'mcq',
2
3
  singleSelection: 'Multiple choice – standard',
3
4
  multipleSelection: 'Multiple choice – multiple response',
4
5
  trueOrFalse: 'True or false',
@@ -2,137 +2,71 @@ import { multipleSelectionPage } from "../../pages";
2
2
  import { singleSelectionPage } from "../../pages/singleSelectionPage"
3
3
  import utilities from "../helpers/utilities";
4
4
 
5
+ export const iePage = {
6
+ mcqOption: () => cy.get('.mcq_Label'),
7
+ mcqOptionWrapper: () => cy.get('div[class*="option-wrapper"]'),
8
+ questionWrapper: () => cy.get('.ngie-question-wrapper'),
9
+ barsPreloader: () => cy.get('[id="question-item-instruction-loader"]'),
10
+ };
11
+
5
12
  export const verifyIeQuestionData = {
6
- singleSelection: (expectedQuestionData, index) => {
7
- cy.get('.ngie-single-select')
8
- .eq(index)
9
- .within(() => {
10
- utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
11
- singleSelectionPage.optionTextPreviewTab()
12
- .then(($elements) => {
13
- expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
14
- });
15
- singleSelectionPage.optionTextPreviewTab()
16
- .each((optionElem, optionIndex) => {
17
- utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
18
- });
19
- });
20
- },
21
-
22
- singleSelectionGrading: (expectedQuestionData, index) => {
23
- cy.get('.ngie-single-select')
24
- .eq(index)
25
- .within(() => {
26
- singleSelectionPage.questionInstructionsText()
27
- .verifyInnerText(expectedQuestionData.gradingQuestionInstructions);
28
- singleSelectionPage.optionsWrapperGradingView()
29
- .then(($elements) => {
30
- expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
31
- });
32
- singleSelectionPage.optionsWrapperGradingView()
33
- .each(($optionWrapper, optionIndex) => {
34
- cy.wrap($optionWrapper)
35
- .within(() => {
36
- if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
37
- cy.get('.tick-icon-wrapper')
38
- .should('exist');
39
- } else {
40
- cy.get('.tick-icon-wrapper')
41
- .should('not.exist');
42
- }
43
- singleSelectionPage.optionTextPreviewTab()
44
- .verifyInnerText(expectedQuestionData.gradingOptionsText[optionIndex])
13
+ mcq: (expectedQuestionData, index) => {
14
+ let ieMcqQuestionWrapperClassRegex = /ngie-single-select|ngie-mcq|ngie-true-or-false|ngie-mcq-block|ngie-single-select-block/i;
15
+ iePage.questionWrapper()
16
+ .then(($questionWrappers) => {
17
+ const $mcqQuestionWrappers = $questionWrappers.filter((index, element) => {
18
+ return ieMcqQuestionWrapperClassRegex.test(element.className);
19
+ });
20
+ cy.wrap($mcqQuestionWrappers)
21
+ .eq(index)
22
+ .within(() => {
23
+ utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
24
+ iePage.mcqOption()
25
+ .then(($elements) => {
26
+ expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
45
27
  });
46
- });
47
- });
48
- },
49
-
50
- multipleSelection: (expectedQuestionData, index) => {
51
- cy.get('.ngie-mcq')
52
- .eq(index)
53
- .within(() => {
54
- utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
55
- singleSelectionPage.optionTextPreviewTab()
56
- .then(($elements) => {
57
- expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
58
- });
59
- singleSelectionPage.optionTextPreviewTab()
60
- .each((optionElem, optionIndex) => {
61
- utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
62
- });
63
- });
64
- },
65
-
66
- multipleSelectionGrading: (expectedQuestionData, index) => {
67
- cy.get('.ngie-mcq')
68
- .eq(index)
69
- .within(() => {
70
- utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.gradingQuestionInstructions);
71
- multipleSelectionPage.optionsWrapperGradingView()
72
- .then(($elements) => {
73
- expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
74
- });
75
- multipleSelectionPage.optionsWrapperGradingView()
76
- .each(($optionWrapper, optionIndex) => {
77
- cy.wrap($optionWrapper)
78
- .within(() => {
79
- if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
80
- cy.get('.tick-icon-wrapper')
81
- .should('exist');
82
- } else {
83
- cy.get('.tick-icon-wrapper')
84
- .should('not.exist');
85
- }
86
- utilities.verifyInnerText(singleSelectionPage.optionTextPreviewTab(), expectedQuestionData.gradingOptionsText[optionIndex]);
28
+ iePage.mcqOption()
29
+ .each((optionElem, optionIndex) => {
30
+ utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
87
31
  });
88
32
  });
89
33
  });
90
34
  },
91
35
 
92
- trueOrFalse: (expectedQuestionData, index) => {
93
- cy.get('.ngie-true-or-false')
94
- .eq(index)
95
- .within(() => {
96
- utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
97
- singleSelectionPage.optionTextPreviewTab()
98
- .then(($elements) => {
99
- expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
100
- });
101
- singleSelectionPage.optionTextPreviewTab()
102
- .each((optionElem, optionIndex) => {
103
- utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
104
- });
105
- });
106
- },
107
-
108
- trueOrFalseGrading: (expectedQuestionData, index) => {
109
- cy.get('.ngie-true-or-false')
110
- .eq(index)
111
- .within(() => {
112
- singleSelectionPage.questionInstructionsText()
113
- .verifyInnerText(expectedQuestionData.gradingQuestionInstructions);
114
- singleSelectionPage.optionsWrapperGradingView()
115
- .then(($elements) => {
116
- expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
117
- });
118
- singleSelectionPage.optionsWrapperGradingView()
119
- .each(($optionWrapper, optionIndex) => {
120
- cy.wrap($optionWrapper)
121
- .within(() => {
122
- if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
123
- cy.get('.tick-icon-wrapper')
124
- .should('exist');
125
- } else {
126
- cy.get('.tick-icon-wrapper')
127
- .should('not.exist');
128
- }
129
- singleSelectionPage.optionTextPreviewTab()
130
- .verifyInnerText(expectedQuestionData.gradingOptionsText[optionIndex])
36
+ mcqGrading: (expectedQuestionData, index) => {
37
+ let ieMcqQuestionWrapperClassRegex = /ngie-single-select|ngie-mcq|ngie-true-or-false|ngie-mcq-block|ngie-single-select-block/i;
38
+ iePage.questionWrapper()
39
+ .then(($questionWrappers) => {
40
+ const $mcqQuestionWrappers = $questionWrappers.filter((index, element) => {
41
+ return ieMcqQuestionWrapperClassRegex.test(element.className);
42
+ });
43
+ cy.wrap($mcqQuestionWrappers)
44
+ .eq(index)
45
+ .within(() => {
46
+ utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.gradingQuestionInstructions);
47
+ iePage.mcqOptionWrapper()
48
+ .then(($elements) => {
49
+ expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
50
+ });
51
+ iePage.mcqOptionWrapper()
52
+ .each(($optionWrapper, optionIndex) => {
53
+ cy.wrap($optionWrapper)
54
+ .within(() => {
55
+ if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
56
+ cy.get('.tick-icon-wrapper')
57
+ .should('exist');
58
+ } else {
59
+ cy.get('.tick-icon-wrapper')
60
+ .should('not.exist');
61
+ }
62
+ utilities.verifyInnerText(iePage.mcqOption(), expectedQuestionData.gradingOptionsText[optionIndex]);
63
+ });
131
64
  });
132
65
  });
133
66
  });
134
67
  },
135
68
 
69
+
136
70
  textEntryMath: (expectedQuestionData, index) => {
137
71
 
138
72
  },
@@ -144,5 +78,135 @@ export const verifyIeQuestionData = {
144
78
  singleSelectionPage.questionInstructionsText()
145
79
  .verifyInnerText(expectedQuestionData.previewQuestionInstructions);
146
80
  });
147
- }
81
+ },
82
+
83
+ /* singleSelection: (expectedQuestionData, index) => {
84
+ cy.get('.ngie-single-select')
85
+ .eq(index)
86
+ .within(() => {
87
+ utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
88
+ singleSelectionPage.optionTextPreviewTab()
89
+ .then(($elements) => {
90
+ expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
91
+ });
92
+ singleSelectionPage.optionTextPreviewTab()
93
+ .each((optionElem, optionIndex) => {
94
+ utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
95
+ });
96
+ });
97
+ },
98
+
99
+ singleSelectionGrading: (expectedQuestionData, index) => {
100
+ cy.get('.ngie-single-select')
101
+ .eq(index)
102
+ .within(() => {
103
+ singleSelectionPage.questionInstructionsText()
104
+ .verifyInnerText(expectedQuestionData.gradingQuestionInstructions);
105
+ singleSelectionPage.optionsWrapperGradingView()
106
+ .then(($elements) => {
107
+ expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
108
+ });
109
+ singleSelectionPage.optionsWrapperGradingView()
110
+ .each(($optionWrapper, optionIndex) => {
111
+ cy.wrap($optionWrapper)
112
+ .within(() => {
113
+ if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
114
+ cy.get('.tick-icon-wrapper')
115
+ .should('exist');
116
+ } else {
117
+ cy.get('.tick-icon-wrapper')
118
+ .should('not.exist');
119
+ }
120
+ singleSelectionPage.optionTextPreviewTab()
121
+ .verifyInnerText(expectedQuestionData.gradingOptionsText[optionIndex])
122
+ });
123
+ });
124
+ });
125
+ },
126
+
127
+ multipleSelection: (expectedQuestionData, index) => {
128
+ cy.get('.ngie-mcq')
129
+ .eq(index)
130
+ .within(() => {
131
+ utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
132
+ singleSelectionPage.optionTextPreviewTab()
133
+ .then(($elements) => {
134
+ expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
135
+ });
136
+ singleSelectionPage.optionTextPreviewTab()
137
+ .each((optionElem, optionIndex) => {
138
+ utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
139
+ });
140
+ });
141
+ },
142
+
143
+ multipleSelectionGrading: (expectedQuestionData, index) => {
144
+ cy.get('.ngie-mcq')
145
+ .eq(index)
146
+ .within(() => {
147
+ utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.gradingQuestionInstructions);
148
+ multipleSelectionPage.optionsWrapperGradingView()
149
+ .then(($elements) => {
150
+ expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
151
+ });
152
+ multipleSelectionPage.optionsWrapperGradingView()
153
+ .each(($optionWrapper, optionIndex) => {
154
+ cy.wrap($optionWrapper)
155
+ .within(() => {
156
+ if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
157
+ cy.get('.tick-icon-wrapper')
158
+ .should('exist');
159
+ } else {
160
+ cy.get('.tick-icon-wrapper')
161
+ .should('not.exist');
162
+ }
163
+ utilities.verifyInnerText(singleSelectionPage.optionTextPreviewTab(), expectedQuestionData.gradingOptionsText[optionIndex]);
164
+ });
165
+ });
166
+ });
167
+ },
168
+
169
+ trueOrFalse: (expectedQuestionData, index) => {
170
+ cy.get('.ngie-true-or-false')
171
+ .eq(index)
172
+ .within(() => {
173
+ utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
174
+ singleSelectionPage.optionTextPreviewTab()
175
+ .then(($elements) => {
176
+ expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
177
+ });
178
+ singleSelectionPage.optionTextPreviewTab()
179
+ .each((optionElem, optionIndex) => {
180
+ utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
181
+ });
182
+ });
183
+ },
184
+
185
+ trueOrFalseGrading: (expectedQuestionData, index) => {
186
+ cy.get('.ngie-true-or-false')
187
+ .eq(index)
188
+ .within(() => {
189
+ singleSelectionPage.questionInstructionsText()
190
+ .verifyInnerText(expectedQuestionData.gradingQuestionInstructions);
191
+ singleSelectionPage.optionsWrapperGradingView()
192
+ .then(($elements) => {
193
+ expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
194
+ });
195
+ singleSelectionPage.optionsWrapperGradingView()
196
+ .each(($optionWrapper, optionIndex) => {
197
+ cy.wrap($optionWrapper)
198
+ .within(() => {
199
+ if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
200
+ cy.get('.tick-icon-wrapper')
201
+ .should('exist');
202
+ } else {
203
+ cy.get('.tick-icon-wrapper')
204
+ .should('not.exist');
205
+ }
206
+ singleSelectionPage.optionTextPreviewTab()
207
+ .verifyInnerText(expectedQuestionData.gradingOptionsText[optionIndex])
208
+ });
209
+ });
210
+ });
211
+ }, */
148
212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.110",
3
+ "version": "1.0.112",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  import fetch from "node-fetch";
2
2
  export async function getS3Object() {
3
3
  try {
4
- const objectUrl = 'https://namespace-itemengine-qa-integration-tests-artifacts.s3.us-west-2.amazonaws.com/migrationFixtures.json?response-content-disposition=inline&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEOD%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCmFwLXNvdXRoLTEiRzBFAiEAhJBdPZO2qmuQeXUMq50Ck%2B%2Fddrk6GFjKmCAe95RGPNsCIFDpqSL7cAONDj28pYxCRNaaukvNPiBA%2BpmoxTe9%2B0nFKv8DCLn%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQAxoMOTY1MzMxMTExMTY2Igz1SVrd3atKQhdexv8q0wNlVxmXpHIEFFXmikuMJHdyUGwYFh8Uw3WSq7zoHtC2Oq7dZ6rhbERSttG25Xx6Lpw3LE%2FkEQ0URKZLaIo7WXgAvmmnc%2F5EFFFyOejBE2R7xmBHFrgdoAYpMQlZEnF4kE9Y1OQhkyygLSIyqyOxLzdDHJ8gcwouezC6UuXMc0BMMzzHL5oWE1VaY71uVVignBOQ%2Brmw%2BziuiyFiczzFy3GxUV7RfFqGjDOcuwDGqEpcmd5CDYu1Q3mJFmoeoNKSAWib%2BJcZLt6%2F7zxjwVA9kcrhQOrd5S6zoVZyPePCWCHVjku8itUiJkOR2LSBcvWYp17AIC7fUgPoLA0l%2BshNzo13TyP71QPOnGHHezkGf4kh82bXPmieTN2ydyoDh1N9urgQsFmI%2ByXky6awPjgjofwKN3xhZXBZhVWMWql74cUNjgonKZD4o9DqDpNWc1D4En7LJT9%2BnTiw7%2BOSrUIa5GFsbLJsucWP%2FWmEPZoGNxLf%2F13smSCLPdUIK3VpmbxB5Wjg89mmiyyV8xrtOGmjStKP0DWBZAr%2BRt2AyHaChT4AxCAOiLdQB59vinaVHezK411MPzvDbymdKa6bDsYF4IztVatTHAGasiNYXp1khcGo0OR%2FqDDos7yuBjqUAmVKtLrz6Ms7MxUrmj%2FRAJWEDmqXDq2lri6nKc6jaf6rq56OoqOZf5PlYvJCRXoyjgcMbBGEwy9r0X1AioMFmdE5iB%2BUTP4joFhcekcBol5%2F1X85RXtPAbh7%2FqYTybaz59jLROl1uB8DB3IgM1mgd%2F0fV0pSl6KNNjmpd50FFGRlDVBaOhRce6430x%2F2GX2KSuWBRsVol0H5wAKhZtQXrDxKy2pn7JVc0JDKEgfJPNppyOJAH3KtR2ZQGzgp9IN2M1lhTgUnDMRME6xo649lFV8D%2B4hAkCPhoa18ljlRlD1WTb3FPBhOOIWgJjgudvGV5LRIrfg9xTGnggk3OQvLCo%2BH%2FoZOyeclEqMnmikJL2mTi7NIEQ%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240216T081731Z&X-Amz-SignedHeaders=host&X-Amz-Expires=43200&X-Amz-Credential=ASIA6BQRXZT7DHXURHQ6%2F20240216%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Signature=b7d5e57eea218d685e0aff74fd3222b0c1c9716a2d0485e9c9ac24e0c464ff7e';
4
+ const objectUrl = 'https://namespace-itemengine-qa-integration-tests-artifacts.s3.us-west-2.amazonaws.com/migrationFixtures.json?response-content-disposition=inline&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEC4aCmFwLXNvdXRoLTEiRjBEAiAzs3p3Eb38xTURyy%2BzGkMsV1nxANOptrrzd7pZ6iAapwIgHpZVw9VcuNpA87fURgmnZrVWII5dWALIJp4Us2R9wVkq9gMIFxADGgw5NjUzMzExMTExNjYiDGMP8gRDAsGnzcR3NCrTA%2FFUSCHiht9CU6cpIRyJksnWvlGdYzaVxsoBnYC2S1NtWdO8PY4ENIiHWry6LuXFRmKwF6wzYlSog18nbxzni4R5F8uBxlcQv1iTFuu8ROpBrimbsx3tqtnY9nRr%2FbXeOb9tAAAVJY1M6irQnyOwDnUc58Yt%2BiPGWlXrrgn6BVYnsfN8w5mIXiWi7NZQ8PYYKEuH8yytwkQtmF%2F5j5RT%2FQh%2BQvEFucXu1WADo90gW4jZzATOcBDr5%2FIWmggbM0KE1ARBr3plDe3Z3x8j8dLi0VvMbqP9iFR4Y1%2FGaoEEIrM8Bk8JC5UwHbqFz6dtQYotM4GKxFYc21VwcIHv6SC%2FMWla1LLfAaiNFGaSDruK3tLBngwnH0x8R4pqhmd0NI2fig4s9hCOFtXUS%2FtCUUTEVszEwUSyarcPQfGggODAdy84rpZ2UDhU%2FUL5anKGCX8NfeohqCdlQ7eLpfs0K0nv6O9gsebo1Z4Ij5BS%2B1GjiZ1pciLjebMLEr7C%2BUqEZNakqOSmZJn9wveDkEnZxYEr0poMidMvIR9LiCNoJP8faUIGX1qm2yUVpJWsMqbTt70u%2FvwMbtPtWJ2FFKsK5DxA%2FYgPtM6OIYWBtdHul71IllpY4eqVMPu2za4GOpUCGvF12jUa6Tnnu6pQK0tUwWt8Ae7O3TCbalKXGq%2BOppcblsba43WTBVpM6Qzunb68aYGIepwVET6yMp87JwP52lh51ZFOvC8ow%2FIYSZmx9VW2gnVrCr6cQ0VT5F4t1m7ouLwjJxILBhyzKRgW%2FWfYiLjrYBLnVVJkba7j5uOemH%2BogTHyuzlLqEq%2F%2BS%2F5jqc8Lt4e%2BsBmVfl1Glz7iRwWSqYUGabIVm6fmviXjOGuLPnw%2BsztvMDQAxuOOyjgmAgIz1U%2Fzkzxa%2BcrtpZHeMQKS1bsrc7Tl4xTE63mqlMDMjOaZdqNd6xGzj1%2FzZX7gapwTfJXGxBYE6Pp3%2BruHVzNKOy9mtCT07Wnf%2BR1uU5yoM4cxVg5Zw%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240219T134827Z&X-Amz-SignedHeaders=host&X-Amz-Expires=43200&X-Amz-Credential=ASIA6BQRXZT7HUVETSNV%2F20240219%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Signature=dc72c12ca4740b4206e02cc3e3ebbac0ea0bc04b030b2015493c371be92b0211';
5
5
  const res = await fetch(objectUrl);
6
6
  if (!res.ok) {
7
7
  throw new Error(`Failed to fetch JSON file (${objectUrl}): ${res.statusText}`);