itemengine-cypress-automation 1.0.594-ITEM-1388-55a6c32.0 → 1.0.594

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.
@@ -3,6 +3,7 @@ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
3
  import utilities from "../../../support/helpers/utilities";
4
4
  const css = Cypress.env('css');
5
5
  const grepTags = Cypress.env('grepTags');
6
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT');
6
7
  let correctAnswerViews = ['Question preview', 'Item preview', 'Grading view'];
7
8
  const views = utilities.getViews(correctAnswerViews);
8
9
  var itemReferenceID = "";
@@ -71,11 +72,11 @@ describe('Create item page - Image highlight: All or nothing ', () => {
71
72
  imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
72
73
  imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
73
74
  imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
74
- imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
75
75
  imageHighlightPage.steps.highlightRegionInImage(leafHighlightRegion);
76
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
76
77
  imageHighlightPage.steps.selectMultipleSelectionToggle();
77
78
  imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(0);
78
- imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(2);
79
+ imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(1);
79
80
  imageHighlightPage.steps.allotPoints(20);
80
81
  imageHighlightPage.steps.checkShowAvailableOptionsToStudentsCheckbox();
81
82
  imageHighlightPage.steps.switchToPreviewTab();
@@ -130,13 +131,17 @@ describe('Create item page - Image highlight: All or nothing ', () => {
130
131
  imageHighlightPage.steps.verifyCorrectHighlightRegionNotAttemptedGradingView(0);
131
132
  imageHighlightPage.steps.verifyCorrectHighlightRegionNotAttemptedGradingView(1);
132
133
  imageHighlightPage.steps.verifyDefaultHighlightRegion(2);
133
- utilities.verifyInnerText(imageHighlightPage.correctAnswersLabel(), 'Correct answers');
134
- imageHighlightPage.steps.verifyCorrectAnswerContainerContents(['Option 1', 'Option 2'], [1, 2]);
134
+ if (alternativeAnswerCheck === 'true') {
135
+ imageHighlightPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0)
136
+ } else {
137
+ utilities.verifyInnerText(imageHighlightPage.correctAnswersLabel(), 'Correct answers');
138
+ imageHighlightPage.steps.verifyCorrectAnswerContainerContents(['Option 1', 'Option 2'], [1, 2]);
139
+ }
135
140
 
136
141
  });
137
142
 
138
143
  it('When the user attempts the question incorrectly, then the user should be awarded 0 points and on switching to \'Grading\' view, incorrect icons should be displayed besides all incorrect responses, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with numeration should be displayed', () => {
139
- imageHighlightPage.steps.highlightARegionInPreviewTab(1);
144
+ imageHighlightPage.steps.highlightARegionInPreviewTab(2);
140
145
  if (view === 'Grading view') {
141
146
  studentViewPage.steps.submitResponse();
142
147
  utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
@@ -182,7 +187,7 @@ describe('Create item page - Image highlight: All or nothing ', () => {
182
187
  if (view === 'Grading view') {
183
188
  studentViewPage.steps.clearResponses();
184
189
  };
185
- imageHighlightPage.steps.highlightARegionInPreviewTab(1);
190
+ imageHighlightPage.steps.highlightARegionInPreviewTab(0);
186
191
  imageHighlightPage.steps.highlightARegionInPreviewTab(2);
187
192
  if (view === 'Grading view') {
188
193
  studentViewPage.steps.submitResponse();
@@ -208,7 +213,7 @@ describe('Create item page - Image highlight: All or nothing ', () => {
208
213
  studentViewPage.steps.clearResponses();
209
214
  };
210
215
  imageHighlightPage.steps.highlightARegionInPreviewTab(0);
211
- imageHighlightPage.steps.highlightARegionInPreviewTab(2);
216
+ imageHighlightPage.steps.highlightARegionInPreviewTab(1);
212
217
  if (view === 'Grading view') {
213
218
  studentViewPage.steps.submitResponse();
214
219
  utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
@@ -321,11 +326,11 @@ describe('Create item page - Image highlight: All or nothing ', () => {
321
326
  imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
322
327
  imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
323
328
  imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
324
- imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
325
329
  imageHighlightPage.steps.highlightRegionInImage(leafHighlightRegion);
330
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
326
331
  imageHighlightPage.steps.selectMultipleSelectionToggle();
327
332
  imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(0);
328
- imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(2);
333
+ imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(1);
329
334
  imageHighlightPage.steps.expandScoringTypeDropdown();
330
335
  imageHighlightPage.steps.selectOptionFromScoringTypeDropdown('Non scored');
331
336
  imageHighlightPage.steps.switchToPreviewTab();
@@ -377,13 +382,17 @@ describe('Create item page - Image highlight: All or nothing ', () => {
377
382
  }
378
383
  imageHighlightPage.steps.verifyCorrectIncorrectIconsNotExist(0);
379
384
  imageHighlightPage.steps.verifyCorrectIncorrectIconsNotExist(2);
380
- imageHighlightPage.steps.verifyCorrectAnswerSectionExist();
385
+ if (alternativeAnswerCheck === 'true') {
386
+ imageHighlightPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(0 points)', 0)
387
+ } else {
388
+ imageHighlightPage.steps.verifyCorrectAnswerSectionExist();
389
+ }
381
390
  imageHighlightPage.steps.verifyCorrectIncorrectAnswerLabelNotExist();
382
391
  imageHighlightPage.steps.verifyCorrectAnswerContainerContents(['Option 1', 'Option 2'], [1, 2]);
383
392
  });
384
393
 
385
394
  it('When the user attempts the question incorrectly, then non-scoring label should be displayed and on switching to "Grading" view, incorrect icon should be displayed for the incorrect region, correct icon should be displayed for the correct region, and a status message with text "Your answer is incorrect" should be displayed', () => {
386
- imageHighlightPage.steps.highlightARegionInPreviewTab(1);
395
+ imageHighlightPage.steps.highlightARegionInPreviewTab(2);
387
396
  if (view === 'Grading view') {
388
397
  studentViewPage.steps.submitResponse();
389
398
  utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
@@ -424,7 +433,7 @@ describe('Create item page - Image highlight: All or nothing ', () => {
424
433
  studentViewPage.steps.clearResponses();
425
434
  };
426
435
  imageHighlightPage.steps.highlightARegionInPreviewTab(0);
427
- imageHighlightPage.steps.highlightARegionInPreviewTab(2);
436
+ imageHighlightPage.steps.highlightARegionInPreviewTab(1);
428
437
  if (view === 'Grading view') {
429
438
  studentViewPage.steps.submitResponse();
430
439
  utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
@@ -453,11 +462,11 @@ describe('Create item page - Image highlight: All or nothing ', () => {
453
462
  imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
454
463
  imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
455
464
  imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
456
- imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
457
465
  imageHighlightPage.steps.highlightRegionInImage(leafHighlightRegion);
466
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
458
467
  imageHighlightPage.steps.selectMultipleSelectionToggle();
459
468
  imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(0);
460
- imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(2);
469
+ imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(1);
461
470
  imageHighlightPage.steps.allotPoints(20);
462
471
  });
463
472
 
@@ -36,12 +36,12 @@ describe('Create item page - Image highlight - Preview contents in all views', (
36
36
  imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
37
37
  imageHighlightPage.steps.enterAndVerifyImageAlternativeTextInInputField('Image alternative text');
38
38
  imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
39
- imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
40
39
  imageHighlightPage.steps.highlightRegionInImage(leafHighlightRegion);
40
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
41
41
  imageHighlightPage.steps.selectMultipleSelectionToggle();
42
42
  imageHighlightPage.steps.allotPoints(10);
43
43
  imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(0);
44
- imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(2);
44
+ imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(1);
45
45
  imageHighlightPage.steps.switchToPreviewTab();
46
46
  break;
47
47
  case 'Item view':
@@ -93,8 +93,8 @@ describe('Create item page - Image highlight - Preview contents in all views', (
93
93
  if (view !== 'Grading view' && view !== 'Correct answer view') {
94
94
  it(`The highlighted regions should be displayed`, () => {
95
95
  imageHighlightPage.steps.verifyHighlightRegionsInPreviewTab(0, flowerHighlightRegion);
96
- imageHighlightPage.steps.verifyHighlightRegionsInPreviewTab(1, branchesHighlightRegion);
97
- imageHighlightPage.steps.verifyHighlightRegionsInPreviewTab(2, leafHighlightRegion);
96
+ imageHighlightPage.steps.verifyHighlightRegionsInPreviewTab(1, leafHighlightRegion);
97
+ imageHighlightPage.steps.verifyHighlightRegionsInPreviewTab(2, branchesHighlightRegion);
98
98
  });
99
99
 
100
100
  it('By default the highlighted sections should be hidden and when the user hovers over any highlighted section it should be visible', () => {
@@ -1,5 +1,5 @@
1
1
  import utilities from "../support/helpers/utilities";
2
- import { additionalSettingsAccessibilitySectionComponent, additionalSettingsPanel, autoScoredScoringPreviewTab, autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, autoScoredStudentViewSettings, backgroundImageUploadComponent, commonComponents, createQuestionBasePage, enableOuterBorderComponent, gradingViewEnumerationComponent, imageActionsComponent, imageCanvasComponent, questionInstructionsComponent, scoringSectionBaseEditTab, showAvailableOptionsToStudents, showStudentMaximumNumberOfPossibleSelections, singleMultipleSelectionModeComponent, colorPopupComponent } from "./components";
2
+ import { additionalSettingsAccessibilitySectionComponent, additionalSettingsPanel, autoScoredScoringPreviewTab, autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, autoScoredStudentViewSettings, backgroundImageUploadComponent, commonComponents, createQuestionBasePage, enableOuterBorderComponent, gradingViewEnumerationComponent, imageActionsComponent, imageCanvasComponent, questionInstructionsComponent, scoringSectionBaseEditTab, showAvailableOptionsToStudents, showStudentMaximumNumberOfPossibleSelections, singleMultipleSelectionModeComponent, colorPopupComponent, showAlternativeAnswersComponent } from "./components";
3
3
  import { createItemPage } from "./createItemPage";
4
4
  import { itemPreviewPage } from "./itemPreviewPage";
5
5
  const css = Cypress.env('css');
@@ -20,6 +20,7 @@ const selectors = {
20
20
  ...additionalSettingsPanel,
21
21
  ...gradingViewEnumerationComponent,
22
22
  ...itemPreviewPage,
23
+ ...showAlternativeAnswersComponent,
23
24
 
24
25
  //Image selection style section.
25
26
  imageSelectionStyleLabel: () => cy.get('.options-label'),
@@ -44,6 +45,7 @@ const selectors = {
44
45
  specifyPossibleOptionsToolbar: () => cy.get('.drawing-tool__toolbar'),
45
46
  toolTipText: () => cy.get('.react-tooltip'),
46
47
  //Specify correct answer section
48
+ correctAnswerLabelWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]'),
47
49
  specifyCorrectAnswerSectionImage: () => cy.get('.ngie-accordion .highlight-svg-responseive image'),
48
50
  specifyCorrectAnswerSectionHighlight: () => cy.get('.ngie-accordion [class*="HighlightImageControlstyles__ShapeWrapper"] a'),
49
51
  specifyCorrectAnswerSectionHighlightPolygon: () => cy.get('[class*="HighlightImageControlstyles__PolygonWrapper"]'),
@@ -138,6 +140,7 @@ const steps = {
138
140
  ...gradingViewEnumerationComponent.steps,
139
141
  ...createItemPage.steps,
140
142
  ...commonComponents.steps,
143
+ ...showAlternativeAnswersComponent.steps,
141
144
 
142
145
  //Specify possible options
143
146
  verifyToolbarDisabled: () => {
@@ -1756,6 +1759,15 @@ const steps = {
1756
1759
  .click();
1757
1760
  },
1758
1761
 
1762
+ verifyAnswerLabelAndPoints: (expectedLabel, expectedPoints, sectionIndex = 0) => {
1763
+ imageHighlightPage.correctAnswerLabelWrapper()
1764
+ .eq(sectionIndex)
1765
+ .within(() => {
1766
+ cy.contains(expectedLabel).should('be.visible');
1767
+ cy.get('p').should('contain.text', expectedPoints);
1768
+ });
1769
+ },
1770
+
1759
1771
  /**
1760
1772
  * @param {string} enumerationPlacement placement of the enumeration.
1761
1773
  * @param {number} index index of highlight region
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.594-ITEM-1388-55a6c32.0",
3
+ "version": "1.0.594",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {