itemengine-cypress-automation 1.0.493-update-script-deb721f.0 → 1.0.496-IEI-3121-3c97b0a.0

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.
@@ -5,7 +5,7 @@
5
5
  "GRAPHQL_URL": "/api/graphql",
6
6
  "SANDBOX_GRAPHQL_SERVICES_URL": "https://itemengine-sandbox-graph.itemengine-prod.il-apps.com/api/graphql",
7
7
  "SANDBOX_SERVICES_URL": "https://sandbox.itemengine-prod.il-apps.com",
8
- "SERVICES_URL": "https://itemengine-graph.itemengine-prod.il-apps.com",
8
+ "SERVICES_URL": "https://itemengine-graph-api.itemengine-prod.il-apps.com",
9
9
  "AUTH_URL": "https://itemengine-sandbox-auth.itemengine-prod.il-apps.com/api/auth",
10
10
  "scriptSrc": "https://assets.itemengine-prod.il-apps.com/Author.loader.js",
11
11
  "admin_username": "demouser-ilc",
@@ -0,0 +1,51 @@
1
+ import { numberLinePage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+
4
+ describe('Create item - Number line : Thousands separator section', () => {
5
+
6
+ before(() => {
7
+ cy.loginAs('admin');
8
+ });
9
+
10
+ describe('Thousands separator - Edit tab content', () => {
11
+ abortEarlySetup();
12
+ before(() => {
13
+ numberLinePage.steps.navigateToCreateQuestion('Number line');
14
+ cy.barsPreLoaderWait();
15
+ numberLinePage.steps.addTextInQuestionInstructionsInputField('Plot points on the number line');
16
+ });
17
+
18
+ numberLinePage.tests.verifyThousandSeparatorContent();
19
+ });
20
+
21
+ describe('Thousands separator - Edit tab functionality', () => {
22
+ abortEarlySetup();
23
+ before(() => {
24
+ numberLinePage.steps.navigateToCreateQuestion('Number line');
25
+ cy.barsPreLoaderWait();
26
+ numberLinePage.steps.addTextInQuestionInstructionsInputField('Plot points on the number line');
27
+ numberLinePage.steps.enterTextInIntervalInputField(500);
28
+ numberLinePage.steps.enterTextInAnnotateEveryInputField(10);
29
+ numberLinePage.steps.enterTextInMinInputField(1000.5);
30
+ numberLinePage.steps.enterTextInMaxInputField(10000.5);
31
+ });
32
+
33
+ numberLinePage.tests.verifyThousandSeparatorFunctionality();
34
+ });
35
+
36
+ describe('Thousands separator - Preview tab functionality', () => {
37
+ abortEarlySetup();
38
+ before(() => {
39
+ numberLinePage.steps.navigateToCreateQuestion('Number line');
40
+ cy.barsPreLoaderWait();
41
+ numberLinePage.steps.addTextInQuestionInstructionsInputField('Plot points on the number line');
42
+ numberLinePage.steps.enterTextInIntervalInputField(500);
43
+ numberLinePage.steps.enterTextInAnnotateEveryInputField(10);
44
+ numberLinePage.steps.enterTextInMinInputField(1000.5);
45
+ numberLinePage.steps.enterTextInMaxInputField(10000.5);
46
+ numberLinePage.steps.switchToPreviewTab();
47
+ });
48
+
49
+ numberLinePage.tests.verifyThousandSeparatorPreviewTabFunctionality();
50
+ });
51
+ });
@@ -0,0 +1,54 @@
1
+ import { numberLineLabelPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+
4
+ describe('Create item - Number line : Thousands separator section', () => {
5
+
6
+ before(() => {
7
+ cy.loginAs('admin');
8
+ });
9
+
10
+ describe('Thousands separator - Edit tab content', () => {
11
+ abortEarlySetup();
12
+ before(() => {
13
+ numberLineLabelPage.steps.navigateToCreateQuestion('Number line');
14
+ cy.barsPreLoaderWait();
15
+ numberLineLabelPage.steps.navigateToLabelNumberLineTab();
16
+ numberLineLabelPage.steps.addTextInQuestionInstructionsInputField('Label on the number line');
17
+ });
18
+
19
+ numberLineLabelPage.tests.verifyThousandSeparatorContent();
20
+ });
21
+
22
+ describe('Thousands separator - Edit tab functionality', () => {
23
+ abortEarlySetup();
24
+ before(() => {
25
+ numberLineLabelPage.steps.navigateToCreateQuestion('Number line');
26
+ cy.barsPreLoaderWait();
27
+ numberLineLabelPage.steps.navigateToLabelNumberLineTab();
28
+ numberLineLabelPage.steps.addTextInQuestionInstructionsInputField('Label on the number line');
29
+ numberLineLabelPage.steps.enterTextInIntervalInputField(500);
30
+ numberLineLabelPage.steps.enterTextInAnnotateEveryInputField(10);
31
+ numberLineLabelPage.steps.enterTextInMinInputField(1000.5);
32
+ numberLineLabelPage.steps.enterTextInMaxInputField(10000.5);
33
+ });
34
+
35
+ numberLineLabelPage.tests.verifyThousandSeparatorFunctionality();
36
+ });
37
+
38
+ describe('Thousands separator - Preview tab functionality', () => {
39
+ abortEarlySetup();
40
+ before(() => {
41
+ numberLineLabelPage.steps.navigateToCreateQuestion('Number line');
42
+ cy.barsPreLoaderWait();
43
+ numberLineLabelPage.steps.navigateToLabelNumberLineTab();
44
+ numberLineLabelPage.steps.addTextInQuestionInstructionsInputField('Label on the number line');
45
+ numberLineLabelPage.steps.enterTextInIntervalInputField(500);
46
+ numberLineLabelPage.steps.enterTextInAnnotateEveryInputField(10);
47
+ numberLineLabelPage.steps.enterTextInMinInputField(1000.5);
48
+ numberLineLabelPage.steps.enterTextInMaxInputField(10000.5);
49
+ numberLineLabelPage.steps.switchToPreviewTab();
50
+ });
51
+
52
+ numberLineLabelPage.tests.verifyThousandSeparatorPreviewTabFunctionality();
53
+ });
54
+ });
@@ -2,8 +2,13 @@ import utilities from "../../support/helpers/utilities";
2
2
  import { createQuestionBasePage } from "./createQuestionBasePage";
3
3
  import { layoutSectionComponent } from "./layoutSectionComponent";
4
4
  import { commonComponents } from "./commonComponents";
5
- const lineSettingsOptions = ['Integers', 'Decimals', 'Fractions', 'Mixed fractions'];
5
+ const lineSettingsOptions = ['Decimals', 'Fractions', 'Mixed fractions', 'Integers'];
6
6
  const numbers = ['-9.50', "-\n19\n2", "-9\n1\n2"]
7
+ const thousandsSeparatorOptions = ['Comma', 'Space', 'None'];
8
+ const decimalValues =['6,000.5', '6 000.5', '6000.5']
9
+ const fractionValues =['12001\n2', '12001\n2', '12001\n2']
10
+ const mixedFractionValues =['6,000\n1\n2', '6 000\n1\n2', '6000\n1\n2']
11
+ const integerNumberValues =['1,000.5', '1 000.5', '1000.5']
7
12
 
8
13
  const selectors = {
9
14
  ...layoutSectionComponent,
@@ -30,6 +35,13 @@ const selectors = {
30
35
  // toleranceThresholdInputField: () => cy.get('[class*="AllocatedPointsstyles__PointsWrapper"] input'),
31
36
  pointsInputField: () => cy.get('.ngie-accordion-detail .points-input-field input[type="text"]'),
32
37
  pointsInputFieldForManualScoring: () => cy.get('.points-input-field input[type="text"]'),
38
+
39
+ //thousand separator section
40
+ thousandSeparatorLabel: () => cy.get('.number-line-grid-setting .single-select-toggle-group-title').eq(2),
41
+ thousandSeparatorToggleButtonContainer: () => cy.get('.number-line-grid-setting [class*="SingleSelectToggleGroupstyles__ButtonContainer"]').eq(2),
42
+ thousandSeparatorToggleButton: (ariaLabel) => {
43
+ return cy.get(`div[role="group"] button[aria-label="Thousands separator ${ariaLabel}"]`);
44
+ },
33
45
  }
34
46
 
35
47
  const steps = {
@@ -392,6 +404,123 @@ const steps = {
392
404
  .blur();
393
405
  },
394
406
 
407
+ /**
408
+ * Verifies that the toggle button with the specified ARIA label is selected.
409
+ * @param {string} ariaLabel - The ARIA label of the toggle button to verify.
410
+ */
411
+ verifyThousandSeparatorToggleButtonSelected: (ariaLabel) => {
412
+ numberLineCommonComponent.thousandSeparatorToggleButton(ariaLabel)
413
+ .should('have.attr', 'aria-pressed', 'true');
414
+ },
415
+
416
+ /**
417
+ * Selects the toggle button with the specified ARIA label.
418
+ * @param {string} ariaLabel - The ARIA label of the toggle button to select.
419
+ */
420
+ selectThousandSeparatorToggleButton: (ariaLabel) => {
421
+ numberLineCommonComponent.thousandSeparatorToggleButton(ariaLabel)
422
+ .click();
423
+ },
424
+
425
+ /**
426
+ * Verifies the label on the number line.
427
+ * @param {Array} values - An array of objects containing the value and index of each label.
428
+ */
429
+ verifyThousandSeparatorLabelOnNumberLineNumberLineSection: (values) => {
430
+ values.forEach(({ value, index }) => {
431
+ utilities.verifyInnerText(numberLineCommonComponent.numberLineNumberLineSection()
432
+ .parents('.ngie-jxgbox')
433
+ .find('.number-line-tick-font')
434
+ .eq(index)
435
+ , value
436
+ );
437
+ });
438
+ },
439
+
440
+ /**
441
+ * Verifies the label on the number line PreviewTab.
442
+ * @param {Array} values - An array of objects containing the value and index of each label.
443
+ */
444
+ verifyThousandSeparatorLabelOnNumberLineNumberLineSectionPreviewTab: (values) => {
445
+ values.forEach(({ value, index }) => {
446
+ utilities.verifyInnerText(numberLineCommonComponent.numberLinePreviewTab()
447
+ .parents('.ngie-jxgbox')
448
+ .find('.number-line-tick-font')
449
+ .eq(index)
450
+ , value
451
+ );
452
+ });
453
+ },
454
+
455
+ /**
456
+ * Verifies the label on the number line in specify correct answer section.
457
+ * @param {Array} values - An array of objects containing the value and index of each label.
458
+ */
459
+ verifyThousandSeparatorLabelOnNumberLineSpecifyCorrectAnswerSection: (values) => {
460
+ values.forEach(({ value, index }) => {
461
+ utilities.verifyInnerText(numberLineCommonComponent.numberLineSpecifyCorrectAnswer()
462
+ .parents('.ngie-jxgbox')
463
+ .find('.number-line-tick-font')
464
+ .eq(index)
465
+ , value
466
+ );
467
+ });
468
+ },
469
+
470
+ /**
471
+ * Returns the value and its corresponding index on the number line
472
+ * based on the selected line settings option and inner index.
473
+ *
474
+ * @param {string} option - The selected line settings option ('Decimals', 'Fractions', etc.).
475
+ * @param {number} innerIndex - The index used to retrieve the correct value from the data array.
476
+ * @returns {{ value: string, index: number } | null} An object containing the value and index, or null if option is unrecognized.
477
+ */
478
+ getThousandSeparatorValue:(option, innerIndex) =>{
479
+ switch (option) {
480
+ case 'Integers':
481
+ return { value: integerNumberValues[innerIndex], index: 0 };
482
+ case 'Decimals':
483
+ return { value: decimalValues[innerIndex], index: 10 };
484
+ case 'Fractions':
485
+ return { value: fractionValues[innerIndex], index: 10 };
486
+ case 'Mixed fractions':
487
+ return { value: mixedFractionValues[innerIndex], index: 10 };
488
+ default:
489
+ console.log(`Unrecognized option: ${option}`);
490
+ }
491
+ },
492
+
493
+ /**
494
+ * Verifies the presence of the correct thousand separator label in one or more UI sections
495
+ * based on the selected line settings option and inner index.
496
+ *
497
+ * @param {string} option - The selected line settings option ('Decimals', 'Fractions', etc.).
498
+ * @param {number} innerIndex - The index used to retrieve the correct value from the data array.
499
+ * @param {string[]} sections - The list of sections to perform verification in.
500
+ * Valid values: ['preview', 'numberLine', 'correctAnswer']
501
+ */
502
+ verifyThousandSeparatorForSections: (option, innerIndex, sections = []) => {
503
+ const valueObj = numberLineCommonComponent.steps.getThousandSeparatorValue(option, innerIndex);
504
+ if (!valueObj) return;
505
+
506
+ sections.forEach((section) => {
507
+ switch (section) {
508
+ case 'preview':
509
+ numberLineCommonComponent.steps.verifyThousandSeparatorLabelOnNumberLineNumberLineSectionPreviewTab([valueObj]);
510
+ break;
511
+ case 'numberLine':
512
+ numberLineCommonComponent.steps.verifyThousandSeparatorLabelOnNumberLineNumberLineSection([valueObj]);
513
+ break;
514
+ case 'correctAnswer':
515
+ numberLineCommonComponent.steps.verifyThousandSeparatorLabelOnNumberLineSpecifyCorrectAnswerSection([valueObj]);
516
+ break;
517
+ default:
518
+ console.log(`Unknown verification section: ${section}`);
519
+ break;
520
+ }
521
+ });
522
+ },
523
+
395
524
  }
396
525
 
397
526
  const tests = {
@@ -758,7 +887,7 @@ const tests = {
758
887
  });
759
888
 
760
889
  it('When user enters value in Display specific annotation (use semicolons to separate) input field then it should be displayed on number line in Number line section and Specify correct answer section', () => {
761
- numberLineCommonComponent.steps.selectLineSettingsToggleButton(lineSettingsOptions[1]);
890
+ numberLineCommonComponent.steps.selectLineSettingsToggleButton(lineSettingsOptions[0]);
762
891
  numberLineCommonComponent.steps.enterTextInDisplaySpecificAnnotationInputField('-9.25;');
763
892
  numberLineCommonComponent.steps.verifyTextInDisplaySpecificAnnotationInputField('-9.25;');
764
893
  cy.wait(200);
@@ -789,7 +918,7 @@ const tests = {
789
918
 
790
919
  it('When user enters value in Display specific annotation (use semicolons to separate) input field then it should be displayed on number line in preview tab', () => {
791
920
  numberLineCommonComponent.steps.switchToEditTab();
792
- numberLineCommonComponent.steps.selectLineSettingsToggleButton(lineSettingsOptions[1]);
921
+ numberLineCommonComponent.steps.selectLineSettingsToggleButton(lineSettingsOptions[0]);
793
922
  numberLineCommonComponent.steps.enterTextInDisplaySpecificAnnotationInputField('-9.25;');
794
923
  numberLineCommonComponent.steps.verifyTextInDisplaySpecificAnnotationInputField('-9.25;');
795
924
  numberLineCommonComponent.steps.switchToPreviewTab();
@@ -819,6 +948,49 @@ const tests = {
819
948
  // numberLineCommonComponent.steps.setToleranceThresholdValue(2);
820
949
  // });
821
950
  // }
951
+
952
+ verifyThousandSeparatorContent: () => {
953
+ it(`Thousand separator label and 3 options ${thousandsSeparatorOptions} should be displayed and by default ${thousandsSeparatorOptions[0]} should be selected`, () => {
954
+ utilities.verifyInnerText(numberLineCommonComponent.thousandSeparatorLabel(), 'Thousands separator');
955
+ utilities.verifyElementVisibilityState(numberLineCommonComponent.thousandSeparatorLabel(), 'visible');
956
+ utilities.verifyElementVisibilityState(numberLineCommonComponent.thousandSeparatorToggleButtonContainer(), 'visible');
957
+ thousandsSeparatorOptions.forEach((label) => {
958
+ utilities.verifyInnerText(numberLineCommonComponent.thousandSeparatorToggleButton(label), label);
959
+ utilities.verifyElementVisibilityState(numberLineCommonComponent.thousandSeparatorToggleButton(label), 'visible');
960
+ });
961
+ numberLineCommonComponent.steps.verifyThousandSeparatorToggleButtonSelected(thousandsSeparatorOptions[2]);
962
+ });
963
+ },
964
+
965
+ verifyThousandSeparatorFunctionality: () => {
966
+ lineSettingsOptions.forEach((option, index) => {
967
+ thousandsSeparatorOptions.forEach((thousandsOption, innerIndex) => {
968
+ it(`When user selects ${option} in line settings section and selects ${thousandsOption} in thousands separator section, then number displayed on number line should be updated to ${thousandsOption} in number line section and specify correct answer section`, () => {
969
+ numberLineCommonComponent.steps.selectLineSettingsToggleButton(option);
970
+ numberLineCommonComponent.steps.verifyLineSettingsToggleButtonSelected(option);
971
+ numberLineCommonComponent.steps.selectThousandSeparatorToggleButton(thousandsOption);
972
+ numberLineCommonComponent.steps.verifyThousandSeparatorToggleButtonSelected(thousandsOption);
973
+ numberLineCommonComponent.steps.verifyThousandSeparatorForSections(option, innerIndex, ['numberLine', 'correctAnswer']);
974
+ });
975
+ });
976
+ });
977
+ },
978
+
979
+ verifyThousandSeparatorPreviewTabFunctionality: () => {
980
+ lineSettingsOptions.forEach((option, index) => {
981
+ thousandsSeparatorOptions.forEach((thousandsOption, innerIndex) => {
982
+ it(`When user selects ${option} in line settings section and selects ${thousandsOption} in thousands separator section, then number displayed on number line should be updated to ${thousandsOption} in preview tab`, () => {
983
+ numberLineCommonComponent.steps.switchToEditTab();
984
+ numberLineCommonComponent.steps.selectLineSettingsToggleButton(option);
985
+ numberLineCommonComponent.steps.verifyLineSettingsToggleButtonSelected(option);
986
+ numberLineCommonComponent.steps.selectThousandSeparatorToggleButton(thousandsOption);
987
+ numberLineCommonComponent.steps.verifyThousandSeparatorToggleButtonSelected(thousandsOption);
988
+ numberLineCommonComponent.steps.switchToPreviewTab();
989
+ numberLineCommonComponent.steps.verifyThousandSeparatorForSections(option, innerIndex, ['preview']);
990
+ });
991
+ });
992
+ });
993
+ }
822
994
  }
823
995
 
824
996
  export const numberLineCommonComponent = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.493-update-script-deb721f.0",
3
+ "version": "1.0.496-IEI-3121-3c97b0a.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {