itemengine-cypress-automation 1.0.434-thinksphere-cypress-failing-cases-4e37af1.0 → 1.0.436-ITEM-1309-disable-question-mcq-d308e76.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.
@@ -4,7 +4,9 @@ import utilities from "../../../support/helpers/utilities";
|
|
4
4
|
const options = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production'];
|
5
5
|
const grepTags = Cypress.env('grepTags');
|
6
6
|
let correctAnswerViews = ['Question preview', 'Item preview', 'Grading view'];
|
7
|
+
let questionMethodsViews = ['Question preview','Grading view'];
|
7
8
|
const views = utilities.getViews(correctAnswerViews);
|
9
|
+
const viewsForQuestionMethods = utilities.getViews(questionMethodsViews);
|
8
10
|
var itemReferenceID = "";
|
9
11
|
|
10
12
|
describe('Create Item page - Multiple selection: All or nothing ', () => {
|
@@ -477,4 +479,78 @@ describe('Create Item page - Multiple selection: All or nothing ', () => {
|
|
477
479
|
});
|
478
480
|
});
|
479
481
|
};
|
482
|
+
viewsForQuestionMethods.forEach((view) => {
|
483
|
+
describe(`Multiple selection: Question methods Accordion - ${view}`, { tags: 'smoke' }, () => {
|
484
|
+
abortEarlySetup();
|
485
|
+
let responseId;
|
486
|
+
before(() => {
|
487
|
+
switch (view) {
|
488
|
+
case 'Question preview':
|
489
|
+
multipleSelectionPage.steps.navigateToCreateQuestion('multiple selection');
|
490
|
+
cy.barsPreLoaderWait();
|
491
|
+
multipleSelectionPage.steps.addTextInQuestionInstructionsInputField('Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.')
|
492
|
+
multipleSelectionPage.steps.addInputToOptionsInputField(options);
|
493
|
+
multipleSelectionPage.steps.allotPoints(20);
|
494
|
+
multipleSelectionPage.steps.checkOptionsCheckboxInSpecifyCorrectAnswerSection(0);
|
495
|
+
multipleSelectionPage.steps.checkOptionsCheckboxInSpecifyCorrectAnswerSection(1);
|
496
|
+
break;
|
497
|
+
case 'Grading view':
|
498
|
+
cy.interceptGraphql('fetchActivity');
|
499
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
500
|
+
cy.wait('@fetchActivity').then((resp) => {
|
501
|
+
responseId = resp.response.body.data.fetchActivity.playerData.questions[0].questionParts[0].response.responseId;
|
502
|
+
});
|
503
|
+
break;
|
504
|
+
}
|
505
|
+
});
|
506
|
+
|
507
|
+
beforeEach(() => {
|
508
|
+
switch (view) {
|
509
|
+
case 'Question preview':
|
510
|
+
break;
|
511
|
+
case 'Grading view':
|
512
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
513
|
+
break;
|
514
|
+
}
|
515
|
+
});
|
516
|
+
|
517
|
+
if (view === 'Question preview') {
|
518
|
+
after(() => {
|
519
|
+
multipleSelectionPage.steps.clickOnSaveQuestionButton();
|
520
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
521
|
+
itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
|
522
|
+
});
|
523
|
+
};
|
524
|
+
|
525
|
+
it('When the user expands the Question methods accordion, then the user should be able to see the responseId and Method Name input fields', () => {
|
526
|
+
if (view === 'Grading view') {
|
527
|
+
multipleSelectionPage.steps.toggleQuestionMethodsAccordion();
|
528
|
+
multipleSelectionPage.steps.verifyResponseIdsInputField();
|
529
|
+
multipleSelectionPage.steps.verifyMethodNameInputField();
|
530
|
+
multipleSelectionPage.steps.verifyExecuteMethodButton();
|
531
|
+
}
|
532
|
+
});
|
533
|
+
|
534
|
+
it('When the user enters the responseId of the current question and calls the disable method, then the response returned should be visible and true and all the checkboxes should be disabled and when the user calls the enable method, then the response returned should be visible and true and all the checkboxes should be enabled', () => {
|
535
|
+
if (view === 'Grading view') {
|
536
|
+
multipleSelectionPage.steps.toggleQuestionMethodsAccordion();
|
537
|
+
multipleSelectionPage.steps.enterResponseIds(responseId);
|
538
|
+
multipleSelectionPage.steps.enterMethodName('disable');
|
539
|
+
multipleSelectionPage.steps.clickExecuteMethodButton();
|
540
|
+
multipleSelectionPage.steps.verifyCompleteMethodExecutionResults('disable', responseId, 'true');
|
541
|
+
multipleSelectionPage.steps.verifyOptionInPreviewTabIsDisabled(0);
|
542
|
+
multipleSelectionPage.steps.verifyOptionInPreviewTabIsDisabled(1);
|
543
|
+
multipleSelectionPage.steps.verifyOptionInPreviewTabIsDisabled(2);
|
544
|
+
multipleSelectionPage.steps.verifyOptionInPreviewTabIsDisabled(3);
|
545
|
+
multipleSelectionPage.steps.enterMethodName('enable');
|
546
|
+
multipleSelectionPage.steps.clickExecuteMethodButton();
|
547
|
+
multipleSelectionPage.steps.verifyCompleteMethodExecutionResults('enable', responseId, 'true');
|
548
|
+
multipleSelectionPage.steps.verifyOptionInPreviewTabIsNotDisabled(0);
|
549
|
+
multipleSelectionPage.steps.verifyOptionInPreviewTabIsNotDisabled(1);
|
550
|
+
multipleSelectionPage.steps.verifyOptionInPreviewTabIsNotDisabled(2);
|
551
|
+
multipleSelectionPage.steps.verifyOptionInPreviewTabIsNotDisabled(3);
|
552
|
+
}
|
553
|
+
});
|
554
|
+
});
|
555
|
+
});
|
480
556
|
});
|
@@ -81,6 +81,13 @@ const selectors = {
|
|
81
81
|
answerStatusBanner: () => cy.get('[class*="StatusContainer"]'),
|
82
82
|
cancelButton: () => cy.get('.save-action-btn-wrapper .MuiButtonBase-root').eq(1),
|
83
83
|
optionsInputFieldInQuestionPreviewTab: () => cy.get('.mcq-option-wrapper [data-testid="question-instruction-element"]'),
|
84
|
+
questionMethodsAccordion: () => cy.get('[data-ngie-testid="question-method-test-accordion"]'),
|
85
|
+
studentViewQuestionMethodsInputWrapper: () => cy.get('[class*="StudentViewstyles__InputWrapper"] input'),
|
86
|
+
executeMethodButton: () => cy.get('[class*="StudentViewstyles__ButtonWrapper"] button'),
|
87
|
+
methodResultsWrapper: () => cy.get('[class*="StudentViewstyles__MethodResultsWrapper"]'),
|
88
|
+
methodResultsHeading: () => cy.get('[class*="StudentViewstyles__MethodResultsHeading"]'),
|
89
|
+
methodResultItem: () => cy.get('[class*="StudentViewstyles__MethodResultItem"]'),
|
90
|
+
methodResultMessage: () => cy.get('[class*="StudentViewstyles__MethodResultMessage"]'),
|
84
91
|
}
|
85
92
|
|
86
93
|
const steps = {
|
@@ -900,6 +907,90 @@ const steps = {
|
|
900
907
|
createQuestionBasePage.saveQuestionButton()
|
901
908
|
.click({force:true});
|
902
909
|
},
|
910
|
+
/**
|
911
|
+
* Toggle the Question Methods Accordion.
|
912
|
+
*/
|
913
|
+
toggleQuestionMethodsAccordion: () => {
|
914
|
+
multipleSelectionPage.questionMethodsAccordion()
|
915
|
+
.click();
|
916
|
+
},
|
917
|
+
|
918
|
+
/**
|
919
|
+
* Enter response IDs in the question methods accordion
|
920
|
+
* @param {string} responseIds - Comma-separated response IDs
|
921
|
+
*/
|
922
|
+
enterResponseIds: (responseIds) => {
|
923
|
+
multipleSelectionPage.studentViewQuestionMethodsInputWrapper().eq(0)
|
924
|
+
.clear()
|
925
|
+
.type(responseIds);
|
926
|
+
},
|
927
|
+
|
928
|
+
/**
|
929
|
+
* Enter method name in the question methods accordion
|
930
|
+
* @param {string} methodName - Name of the method to execute
|
931
|
+
*/
|
932
|
+
enterMethodName: (methodName) => {
|
933
|
+
multipleSelectionPage.studentViewQuestionMethodsInputWrapper().eq(1)
|
934
|
+
.clear()
|
935
|
+
.type(methodName);
|
936
|
+
},
|
937
|
+
|
938
|
+
/**
|
939
|
+
* Click the execute method button in the question methods accordion
|
940
|
+
*/
|
941
|
+
clickExecuteMethodButton: () => {
|
942
|
+
multipleSelectionPage.executeMethodButton()
|
943
|
+
.click();
|
944
|
+
},
|
945
|
+
|
946
|
+
/**
|
947
|
+
* Verify that the response IDs input field is visible and empty
|
948
|
+
*/
|
949
|
+
verifyResponseIdsInputField: () => {
|
950
|
+
multipleSelectionPage.studentViewQuestionMethodsInputWrapper().eq(0)
|
951
|
+
.should('be.visible')
|
952
|
+
.and('have.value', '');
|
953
|
+
},
|
954
|
+
|
955
|
+
/**
|
956
|
+
* Verify that the method name input field is visible and empty
|
957
|
+
*/
|
958
|
+
verifyMethodNameInputField: () => {
|
959
|
+
multipleSelectionPage.studentViewQuestionMethodsInputWrapper().eq(1)
|
960
|
+
.should('be.visible')
|
961
|
+
.and('have.value', '');
|
962
|
+
},
|
963
|
+
|
964
|
+
/**
|
965
|
+
* Verify that the execute method button is visible and enabled
|
966
|
+
*/
|
967
|
+
verifyExecuteMethodButton: () => {
|
968
|
+
multipleSelectionPage.executeMethodButton()
|
969
|
+
.should('be.visible');
|
970
|
+
},
|
971
|
+
|
972
|
+
/**
|
973
|
+
* Verify complete method execution results
|
974
|
+
* @param {string} methodName - The name of the method that was executed
|
975
|
+
* @param {string} responseId - The response ID that was used
|
976
|
+
* @param {string} expectedResult - The expected result value
|
977
|
+
*/
|
978
|
+
verifyCompleteMethodExecutionResults: (methodName, responseId, expectedResult) => {
|
979
|
+
multipleSelectionPage.methodResultsWrapper()
|
980
|
+
.should('be.visible');
|
981
|
+
multipleSelectionPage.methodResultsHeading()
|
982
|
+
.should('be.visible')
|
983
|
+
.and('contain.text', 'Method Execution Results:');
|
984
|
+
multipleSelectionPage.methodResultMessage().eq(0)
|
985
|
+
.should('be.visible')
|
986
|
+
.and('contain.text', `Method name: ${methodName}`);
|
987
|
+
multipleSelectionPage.methodResultMessage().eq(1)
|
988
|
+
.should('be.visible')
|
989
|
+
.and('contain.text', `Response Id: ${responseId}`);
|
990
|
+
multipleSelectionPage.methodResultMessage().eq(2)
|
991
|
+
.should('be.visible')
|
992
|
+
.and('contain.text', `Method Output: ${expectedResult}`);
|
993
|
+
}
|
903
994
|
}
|
904
995
|
|
905
996
|
const tests = {
|