itemengine-cypress-automation 1.0.550 → 1.0.551-IEI-5835-4b5c9f4.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.
| 
         @@ -0,0 +1,56 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import abortEarlySetup from "../../../support/helpers/abortEarly";
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { liveItemPage } from "../../../pages/components/liveItemPage";
         
     | 
| 
      
 3 
     | 
    
         
            +
            import utilities from "../../../support/helpers/utilities";
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            describe('Navigate to Live item page and view the page contents', () => {
         
     | 
| 
      
 6 
     | 
    
         
            +
                before(() => {
         
     | 
| 
      
 7 
     | 
    
         
            +
                    cy.loginAs('admin');
         
     | 
| 
      
 8 
     | 
    
         
            +
                });
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                describe('Live item page', () => {
         
     | 
| 
      
 11 
     | 
    
         
            +
                    abortEarlySetup();
         
     | 
| 
      
 12 
     | 
    
         
            +
                    before(() => {
         
     | 
| 
      
 13 
     | 
    
         
            +
                        liveItemPage.steps.navigateToLiveItemPage();
         
     | 
| 
      
 14 
     | 
    
         
            +
                    });
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                    it('Live item heading should be displayed', () => {
         
     | 
| 
      
 17 
     | 
    
         
            +
                        utilities.verifyElementVisibilityState(liveItemPage.liveItemHeaderText(), 'visible');
         
     | 
| 
      
 18 
     | 
    
         
            +
                        utilities.verifyInnerText(liveItemPage.liveItemHeaderText(), 'Live Item Demo');
         
     | 
| 
      
 19 
     | 
    
         
            +
                    });
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                    it('Item id should be displayed', () => {
         
     | 
| 
      
 22 
     | 
    
         
            +
                        utilities.verifyElementVisibilityState(liveItemPage.liveItemItemId(), 'visible');
         
     | 
| 
      
 23 
     | 
    
         
            +
                        utilities.verifyInnerText(liveItemPage.liveItemItemId(), 'Item: a61f2-1a16-eff1-421d-ba3defd3e643');
         
     | 
| 
      
 24 
     | 
    
         
            +
                    });
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                    it('Student preview should be displayed', () => {
         
     | 
| 
      
 27 
     | 
    
         
            +
                        utilities.verifyElementVisibilityState(liveItemPage.liveItemStudentPreview(), 'visible');
         
     | 
| 
      
 28 
     | 
    
         
            +
                        utilities.verifyInnerText(liveItemPage.liveItemStudentPreview(), 'Student Preview');
         
     | 
| 
      
 29 
     | 
    
         
            +
                    });
         
     | 
| 
      
 30 
     | 
    
         
            +
                    
         
     | 
| 
      
 31 
     | 
    
         
            +
                    it('Teacher preview should be displayed', () => {
         
     | 
| 
      
 32 
     | 
    
         
            +
                        utilities.verifyElementVisibilityState(liveItemPage.liveItemTeacherPreview(), 'visible');
         
     | 
| 
      
 33 
     | 
    
         
            +
                        utilities.verifyInnerText(liveItemPage.liveItemTeacherPreview(), 'Teacher Preview');
         
     | 
| 
      
 34 
     | 
    
         
            +
                    });
         
     | 
| 
      
 35 
     | 
    
         
            +
                });
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                describe.only('Student preview content', () => {
         
     | 
| 
      
 38 
     | 
    
         
            +
                    abortEarlySetup();
         
     | 
| 
      
 39 
     | 
    
         
            +
                    before(() => {
         
     | 
| 
      
 40 
     | 
    
         
            +
                        liveItemPage.steps.navigateToLiveItemPage();
         
     | 
| 
      
 41 
     | 
    
         
            +
                    });
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                    it('Student preview should be displayed', () => {
         
     | 
| 
      
 44 
     | 
    
         
            +
                        utilities.verifyElementVisibilityState(liveItemPage.liveItemStudentPreview(), 'visible');
         
     | 
| 
      
 45 
     | 
    
         
            +
                        utilities.verifyInnerText(liveItemPage.liveItemStudentPreview(), 'Student Preview');
         
     | 
| 
      
 46 
     | 
    
         
            +
                        cy.wait(2000);
         
     | 
| 
      
 47 
     | 
    
         
            +
                        liveItemPage.steps.checkOptionForQuestion(0, 1);
         
     | 
| 
      
 48 
     | 
    
         
            +
                        liveItemPage.steps.checkOptionForQuestion(1, 3);
         
     | 
| 
      
 49 
     | 
    
         
            +
                        liveItemPage.steps.checkOptionForQuestion(2, [1, 3]);
         
     | 
| 
      
 50 
     | 
    
         
            +
                        liveItemPage.steps.checkOptionForQuestion(3, 0);
         
     | 
| 
      
 51 
     | 
    
         
            +
                        liveItemPage.steps.checkOptionForQuestion(4, [0, 2]);
         
     | 
| 
      
 52 
     | 
    
         
            +
                        liveItemPage.steps.checkOptionForQuestion(5, 0);
         
     | 
| 
      
 53 
     | 
    
         
            +
                        liveItemPage.steps.checkOptionForQuestion(6, [1, 2, 3]);
         
     | 
| 
      
 54 
     | 
    
         
            +
                    });
         
     | 
| 
      
 55 
     | 
    
         
            +
                });
         
     | 
| 
      
 56 
     | 
    
         
            +
            });
         
     | 
| 
         @@ -0,0 +1,58 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import utilities from "../../support/helpers/utilities";
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { commonComponents } from "./commonComponents";
         
     | 
| 
      
 3 
     | 
    
         
            +
            const css = Cypress.env('css');
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            const selectors = {
         
     | 
| 
      
 6 
     | 
    
         
            +
                liveItemHeaderText: () => cy.get('[class*="HeaderTitleComponentstyles__HeaderTitleWrapper"]'),
         
     | 
| 
      
 7 
     | 
    
         
            +
                liveItemItemId: () => cy.get('[class*="LiveItemDemostyles__ViewInfoWrapper"]'),
         
     | 
| 
      
 8 
     | 
    
         
            +
                liveItemStudentPreview: () => cy.get('[class*="LiveItemDemostyles__LiveStudentHeader"]'),
         
     | 
| 
      
 9 
     | 
    
         
            +
                liveItemTeacherPreview: () => cy.get('[class*="LiveTeacherPreviewstyles__LiveTeacherHeader"]'),
         
     | 
| 
      
 10 
     | 
    
         
            +
                optionsRadioButtonForCorrectAnswer: () => cy.get('.radio-option-wrapper'),
         
     | 
| 
      
 11 
     | 
    
         
            +
                optionsCheckboxForCorrectAnswer: () => cy.get('.mcq-option-wrapper'),
         
     | 
| 
      
 12 
     | 
    
         
            +
                selectQuestion: ()=> cy.get('[class*="SinglePageAssessmentQuestionsstyles__QuestionPartContainer"]'),
         
     | 
| 
      
 13 
     | 
    
         
            +
            };
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            const steps = {
         
     | 
| 
      
 16 
     | 
    
         
            +
                navigateToLiveItemPage: () => {
         
     | 
| 
      
 17 
     | 
    
         
            +
                    cy.visit('/item-engine/demo/live-item-demo');
         
     | 
| 
      
 18 
     | 
    
         
            +
                },
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                /**
         
     | 
| 
      
 21 
     | 
    
         
            +
                 * @description Checks the options checkbox in the 'Specify correct answer' section for single selection questions.
         
     | 
| 
      
 22 
     | 
    
         
            +
                 * @param {number} optionIndex - The index of the option checkbox to be checked.
         
     | 
| 
      
 23 
     | 
    
         
            +
                 */
         
     | 
| 
      
 24 
     | 
    
         
            +
                checkRadioOptionInStudentPreview: (optionIndex) => {
         
     | 
| 
      
 25 
     | 
    
         
            +
                    liveItemPage.optionsRadioButtonForCorrectAnswer()
         
     | 
| 
      
 26 
     | 
    
         
            +
                        .eq(optionIndex)
         
     | 
| 
      
 27 
     | 
    
         
            +
                        .click()
         
     | 
| 
      
 28 
     | 
    
         
            +
                },
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                checkCheckboxInStudentPreview: (optionIndex) => {
         
     | 
| 
      
 31 
     | 
    
         
            +
                    liveItemPage.optionsCheckboxForCorrectAnswer()
         
     | 
| 
      
 32 
     | 
    
         
            +
                        .eq(optionIndex)
         
     | 
| 
      
 33 
     | 
    
         
            +
                        .click()
         
     | 
| 
      
 34 
     | 
    
         
            +
                },
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                checkOptionForQuestion: (questionNumber, optionIndex) => {
         
     | 
| 
      
 37 
     | 
    
         
            +
                    liveItemPage.selectQuestion()
         
     | 
| 
      
 38 
     | 
    
         
            +
                    .eq(questionNumber)
         
     | 
| 
      
 39 
     | 
    
         
            +
                    .within(() => {
         
     | 
| 
      
 40 
     | 
    
         
            +
                        if (Array.isArray(optionIndex)) {
         
     | 
| 
      
 41 
     | 
    
         
            +
                            optionIndex.forEach((index) => {
         
     | 
| 
      
 42 
     | 
    
         
            +
                                liveItemPage.steps.checkCheckboxInStudentPreview(index);
         
     | 
| 
      
 43 
     | 
    
         
            +
                            });
         
     | 
| 
      
 44 
     | 
    
         
            +
                        } else {
         
     | 
| 
      
 45 
     | 
    
         
            +
                            liveItemPage.steps.checkRadioOptionInStudentPreview(optionIndex);
         
     | 
| 
      
 46 
     | 
    
         
            +
                        }
         
     | 
| 
      
 47 
     | 
    
         
            +
                    });
         
     | 
| 
      
 48 
     | 
    
         
            +
                },
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            };
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            const tests = {};
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            export const liveItemPage = {
         
     | 
| 
      
 55 
     | 
    
         
            +
                ...selectors,
         
     | 
| 
      
 56 
     | 
    
         
            +
                steps,
         
     | 
| 
      
 57 
     | 
    
         
            +
                tests,
         
     | 
| 
      
 58 
     | 
    
         
            +
            };
         
     |