Skip to content

Commit

Permalink
Merge pull request #14 from concord-consortium/187305230-lara-automation
Browse files Browse the repository at this point in the history
LARA Automation
saravanan-udayakumar authored Apr 5, 2024
2 parents c9c627b + dd75672 commit 4358694
Showing 8 changed files with 594 additions and 4 deletions.
66 changes: 66 additions & 0 deletions cypress/e2e/authoring/bar-graph-question.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import AuthoringPage from "../../support/authoring-page.cy.js";
import BarGraphAuthoringPage from "../../support/bar-graph-authoring.cy.js";

const authoringPage = new AuthoringPage;
const barGraphAuthoringPage = new BarGraphAuthoringPage;

context("Test Authoring Preview", () => {
before(() => {
cy.visit("");
cy.loginLARAWithSSO(Cypress.config().username, Cypress.env("password"));
authoringPage.launchActivity("Test Automation Bar Graph Activity");
cy.deleteItem();
});

describe("LARA Bar Graph Authoring Preview", () => {
it("Add Bar Graph Item", () => {
authoringPage.getAddItem().click();
authoringPage.getItemPickerSearch().type("Bar Graph");
authoringPage.getItemPickerList().contains("Bar Graph AWS S3").click();
authoringPage.getAddItemButton().click();
authoringPage.getEditItemDialog().should("exist");
authoringPage.getNameField().type("Bar Graph Question");
authoringPage.getPromptField(" Bar Graphe Prompt");
authoringPage.getHintField(" Bar Graph Hint");
barGraphAuthoringPage.getGraphTitleField("Graph Title");
barGraphAuthoringPage.getXAxisLabelField("X axis label");
barGraphAuthoringPage.getYAxisLabelField("Y axis label");
barGraphAuthoringPage.getShowValuesAboveBarsCheckbox().click();
barGraphAuthoringPage.getBarsAddButton().click();
barGraphAuthoringPage.getBarLabel(0, "Bar 1");
barGraphAuthoringPage.getBarValue(0, "10");
barGraphAuthoringPage.getBarsAddButton().click();
barGraphAuthoringPage.getBarLabel(1, "Bar 2");
barGraphAuthoringPage.getBarValue(1, "20");
cy.wait(2000);
authoringPage.getSaveButton().click();
});
it("Verify Added Bar Graph Item In Authoring Preview", () => {
cy.wait(6000);
authoringPage.getSectionItemHeader().should("contain", "Bar Graph Question");
barGraphAuthoringPage.verifyAuthoringPreviewPrompt("Bar Graphe Prompt");
barGraphAuthoringPage.verifyAuthoringPreviewTitle("Graph Title");
barGraphAuthoringPage.verifyAuthoringPreviewXAxisLabel("X axis label");
barGraphAuthoringPage.verifyAuthoringPreviewYAxisLabel("Y axis label");
barGraphAuthoringPage.verifyAuthoringPreviewBarValue(0, "10");
barGraphAuthoringPage.verifyAuthoringPreviewBarValue(1, "20");

});
it("Verify Added Bar Graph Item In Item Preview", () => {
cy.wait(2000);
authoringPage.getSectionMenuEdit().click();
cy.wait(6000);
barGraphAuthoringPage.verifyEditItemPreviewPrompt("Bar Graphe Prompt");
barGraphAuthoringPage.verifyEditItemPreviewTitle("Graph Title");
barGraphAuthoringPage.verifyEditItemPreviewXAxisLabel("X axis label");
barGraphAuthoringPage.verifyEditItemPreviewYAxisLabel("Y axis label");
barGraphAuthoringPage.verifyEditItemPreviewBarValue(0, "10");
barGraphAuthoringPage.verifyEditItemPreviewBarValue(1, "20");
authoringPage.getSaveButton().click();
});
it("Delete Item", () => {
cy.wait(6000);
authoringPage.getSectionMenuDelete().click();
});
});
});
57 changes: 57 additions & 0 deletions cypress/e2e/authoring/image-interactive-question.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import AuthoringPage from "../../support/authoring-page.cy.js";
import ImageInteractiveAuthoringPage from "../../support/image-interactive-authoring.cy.js";

const authoringPage = new AuthoringPage;
const imageInteractiveAuthoringPage = new ImageInteractiveAuthoringPage;

context("Test Authoring Preview", () => {
before(() => {
cy.visit("");
cy.loginLARAWithSSO(Cypress.config().username, Cypress.env("password"));
authoringPage.launchActivity("Test Automation Image Interactive Activity");
cy.deleteItem();
});

describe("LARA Image Interactive Authoring Preview", () => {
it("Add Image Interactive Item", () => {
authoringPage.getAddItem().click();
authoringPage.getItemPickerSearch().type("Image Interactive");
authoringPage.getItemPickerList().contains("Image Interactive AWS").click();
authoringPage.getAddItemButton().click();
authoringPage.getEditItemDialog().should("exist");
authoringPage.getNameField().type("Image Interactive Question");
imageInteractiveAuthoringPage.getURLField("https://learn-resources.concord.org/tutorials/images/brogan-acadia.jpg");
imageInteractiveAuthoringPage.getAltTextField("Image Alt Text");
imageInteractiveAuthoringPage.getCaptionField("Image Caption");
imageInteractiveAuthoringPage.getCreditField("Image Credit");
imageInteractiveAuthoringPage.getExportToMediaLibraryCheckbox().should("exist");
cy.wait(2000);
authoringPage.getSaveButton().click();
});
it("Verify Added Image Interactive In Authoring Preview", () => {
cy.wait(6000);
authoringPage.getSectionItemHeader().should("contain", "Image Interactive Question");
imageInteractiveAuthoringPage.verifyAuthoringPreviewImage("https://learn-resources.concord.org/tutorials/images/brogan-acadia.jpg");
imageInteractiveAuthoringPage.verifyAuthoringPreviewImageAltText("Image Alt Text");
imageInteractiveAuthoringPage.verifyAuthoringPreviewCaption("Image Caption");
imageInteractiveAuthoringPage.verifyAuthoringPreviewCredit("Image Credit");
imageInteractiveAuthoringPage.getZoomInIcon().should("exist");

});
it("Verify Added Image Interactive In Item Preview", () => {
cy.wait(2000);
authoringPage.getSectionMenuEdit().click();
cy.wait(6000);
imageInteractiveAuthoringPage.verifyEditItemPreviewImage("https://learn-resources.concord.org/tutorials/images/brogan-acadia.jpg");
imageInteractiveAuthoringPage.verifyEditItemPreviewImageAltText("Image Alt Text");
imageInteractiveAuthoringPage.verifyEditItemPreviewCaption("Image Caption");
imageInteractiveAuthoringPage.verifyEditItemPreviewCredit("Image Credit");
imageInteractiveAuthoringPage.getEditItemZoomInIcon().should("exist");
authoringPage.getSaveButton().click();
});
it("Delete Item", () => {
cy.wait(6000);
authoringPage.getSectionMenuDelete().click();
});
});
});
9 changes: 7 additions & 2 deletions cypress/e2e/authoring/open-response-question.cy.js
Original file line number Diff line number Diff line change
@@ -25,15 +25,17 @@ context("Test Authoring Preview", () => {
authoringPage.selectRequiredCheckBox();
authoringPage.enterPostSubmissionFeedback(" Answer Submitted");
orAuthoringPage.selectRecordAudioResponseCheckBox();
orAuthoringPage.selectVoiceTypingResponseCheckBox();
authoringPage.getSaveButton().click();
cy.wait(6000);
});
it("Verify Added OR Item In Authoring Preview", () => {
cy.wait(2000);
authoringPage.getSectionItemHeader().should("contain", "Open Response Question");
authoringPage.getAuthoringPreviewPrompt("Open Response Prompt");
orAuthoringPage.getAuthoringPreviewResponseTextArea().invoke("attr", "placeholder").should("contain", "Please type your answer here, or record your answer using the microphone.");
orAuthoringPage.getAuthoringPreviewResponseTextArea().invoke("attr", "placeholder").should("contain", "Please type or voice type your answer here, or record your answer using the microphone.");
orAuthoringPage.getAuthoringPreviewAudioControls().should("exist");
orAuthoringPage.getAuthoringPreviewVoiceTypingControls().should("exist");
});
it("Verify Required Answer In Authoring Preview", () => {
authoringPage.getAuthoringPreviewSubmitButton().should("be.disabled");
@@ -43,14 +45,16 @@ context("Test Authoring Preview", () => {
authoringPage.getAuthoringPreviewLockedInfoHeader().should("contain", "Your answer has been submitted and is locked. ");
authoringPage.getAuthoringPreviewLockedInfoFeedback().should("contain", "Answer Submitted");
orAuthoringPage.getAuthoringPreviewAudioControls().should("not.exist");
orAuthoringPage.getAuthoringPreviewVoiceTypingControls().should("not.exist");
});
it("Verify Added OR Item In Item Preview", () => {
cy.wait(6000);
authoringPage.getSectionMenuEdit().click();
cy.wait(6000);
authoringPage.getPrompt("Open Response Prompt");
orAuthoringPage.getResponseTextArea().invoke("attr", "placeholder").should("contain", "Please type your answer here, or record your answer using the microphone.");
orAuthoringPage.getResponseTextArea().invoke("attr", "placeholder").should("contain", "Please type or voice type your answer here, or record your answer using the microphone.");
orAuthoringPage.getAudioControls().should("exist");
orAuthoringPage.getVoiceTypingControls().should("exist");
});
it("Verify Default Answer In Item Preview", () => {
orAuthoringPage.enterDeafultAnswer("Default OR Answer")
@@ -66,6 +70,7 @@ context("Test Authoring Preview", () => {
authoringPage.getLockedInfoHeader().should("contain", "Your answer has been submitted and is locked. ");
authoringPage.getLockedInfoFeedback().should("contain", "Answer Submitted");
orAuthoringPage.getAudioControls().should("not.exist");
orAuthoringPage.getVoiceTypingControls().should("not.exist");
authoringPage.getCancelButton().click();
});
it("Delete Item", () => {
57 changes: 57 additions & 0 deletions cypress/e2e/authoring/video-interactive-question.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import AuthoringPage from "../../support/authoring-page.cy.js";
import VideoInteractiveAuthoringPage from "../../support/video-interactive-authoring.cy.js";

const authoringPage = new AuthoringPage;
const videoInteractiveAuthoringPage = new VideoInteractiveAuthoringPage;

context("Test Authoring Preview", () => {
before(() => {
cy.visit("");
cy.loginLARAWithSSO(Cypress.config().username, Cypress.env("password"));
authoringPage.launchActivity("Test Automation Video Interactive Activity");
cy.deleteItem();
});

describe("LARA Video Interactive Authoring Preview", () => {
it("Add Video Interactive Item", () => {
authoringPage.getAddItem().click();
authoringPage.getItemPickerSearch().type("Video Player");
authoringPage.getItemPickerList().contains("Video Player AWS").click();
authoringPage.getAddItemButton().click();
authoringPage.getEditItemDialog().should("exist");
authoringPage.getNameField().type("Video Player Question");
videoInteractiveAuthoringPage.getVideoURLField("https://cc-project-resources.s3.amazonaws.com/waters/Glossary/movies/aquatic.mp4");
videoInteractiveAuthoringPage.getVideoCaptionURLField("https://project-resources.concord.org/waters/Lesson1/Movies/L1USDAWatershedLearningVideo.vtt");
videoInteractiveAuthoringPage.getDescriptionField("Video Description");
videoInteractiveAuthoringPage.getCaptionField("Video Caption");
videoInteractiveAuthoringPage.getCreditField("Video Credit");
cy.wait(2000);
authoringPage.getSaveButton().click();
});
it("Verify Added Video Interactive In Authoring Preview", () => {
cy.wait(6000);
authoringPage.getSectionItemHeader().should("contain", "Video Player Question");
videoInteractiveAuthoringPage.verifyAuthoringPreviewVideo("https://cc-project-resources.s3.amazonaws.com/waters/Glossary/movies/aquatic.mp4");
videoInteractiveAuthoringPage.getAuthoringPreviewPlayButton().should("exist");
videoInteractiveAuthoringPage.verifyAuthoringPreviewDescription("Video Description");
videoInteractiveAuthoringPage.verifyAuthoringPreviewCaption("Video Caption");
videoInteractiveAuthoringPage.verifyAuthoringPreviewCredit("Video Credit");

});
it("Verify Added Video Interactive In Item Preview", () => {
cy.wait(2000);
authoringPage.getSectionMenuEdit().click();
cy.wait(6000);
videoInteractiveAuthoringPage.verifyEditItemPreviewVideo("https://cc-project-resources.s3.amazonaws.com/waters/Glossary/movies/aquatic.mp4");
videoInteractiveAuthoringPage.getEditItemPreviewPlayButton().should("exist");
videoInteractiveAuthoringPage.verifyEditItemPreviewDescription("Video Description");
videoInteractiveAuthoringPage.verifyEditItemPreviewCaption("Video Caption");
videoInteractiveAuthoringPage.verifyEditItemPreviewCredit("Video Credit");
authoringPage.getSaveButton().click();
});
it("Delete Item", () => {
cy.wait(6000);
authoringPage.getSectionMenuDelete().click();
});
});
});
138 changes: 138 additions & 0 deletions cypress/support/bar-graph-authoring.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
class BarGraphAuthoringPage {
getEditItemDialog() {
return cy.get(".modalContainer.itemEditDialog");
}

getEditItemForm() {
return this.getEditItemDialog().find('#itemEditForm');
}

getEditItemPreview() {
return this.getEditItemDialog().find('.itemEditPreview');
}
getGraphTitleField(title) {
cy.wait(500);
this.getEditItemForm().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('#root_title').type(title);
});
}
getXAxisLabelField(label) {
cy.wait(500);
this.getEditItemForm().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('#root_xAxisLabel').type(label);
});
}
getYAxisLabelField(label) {
cy.wait(500);
this.getEditItemForm().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('#root_yAxisLabel').type(label);
});
}
getShowValuesAboveBarsCheckbox() {
cy.wait(500);
return this.getEditItemForm().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('#root_showValuesAboveBars');
});
}
getBarsAddButton() {
cy.wait(500);
return this.getEditItemForm().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('#root_bars .btn-add');
});
}
getBarLabel(index, label) {
cy.wait(500);
this.getEditItemForm().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('#root_bars_'+index+'_label').type(label);
});
}
getBarValue(index, value) {
cy.wait(500);
this.getEditItemForm().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('#root_bars_'+index+'_value').type(value);
});
}

//***************************************************************************************************************

getInteractive() {
return cy.get(".itemsContainer .sectionItemContainer");
}
verifyAuthoringPreviewPrompt(prompt) {
this.getInteractive().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('.base-app--runtime--question-int').should("contain", prompt);
});
}
verifyAuthoringPreviewTitle(title) {
this.getInteractive().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('[data-cy=title]').should("contain", title);
});
}
verifyAuthoringPreviewXAxisLabel(label) {
this.getInteractive().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('[data-cy=xAxisLabel]').should("contain", label);
});
}
verifyAuthoringPreviewYAxisLabel(label) {
this.getInteractive().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('[data-cy=yAxisLabel]').should("contain", label);
});
}
verifyAuthoringPreviewBarValue(index, value) {
this.getInteractive().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('[data-cy=barValue'+index+']').should("contain", value);
});
}

//***************************************************************************************************************

getEditItemPreview() {
return this.getEditItemDialog().find('.itemEditPreview');
}

verifyEditItemPreviewPrompt(prompt) {
this.getInteractive().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('.base-app--runtime--question-int').should("contain", prompt);
});
}
verifyEditItemPreviewTitle(title) {
this.getInteractive().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('[data-cy=title]').should("contain", title);
});
}
verifyEditItemPreviewXAxisLabel(label) {
this.getInteractive().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('[data-cy=xAxisLabel]').should("contain", label);
});
}
verifyEditItemPreviewYAxisLabel(label) {
this.getInteractive().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('[data-cy=yAxisLabel]').should("contain", label);
});
}
verifyEditItemPreviewBarValue(index, value) {
this.getInteractive().find('iframe').then($iframe => {
const $body = $iframe.contents().find('#app')
cy.wrap($body).find('[data-cy=barValue'+index+']').should("contain", value);
});
}


}
export default BarGraphAuthoringPage;
Loading

0 comments on commit 4358694

Please sign in to comment.