diff --git a/client/cypress/e2e/Activities/sharingActivities.cy.ts b/client/cypress/e2e/Activities/sharingActivities.cy.ts new file mode 100644 index 0000000000..8ede5621cb --- /dev/null +++ b/client/cypress/e2e/Activities/sharingActivities.cy.ts @@ -0,0 +1,58 @@ +describe("Share Activities Tests", function () { + before(() => {}); + + beforeEach(() => {}); + + it("create, share, and copy public activity", () => { + let code = Date.now().toString(); + const scrappyEmail = `scrappy${code}@doo`; + const scoobyEmail = `scooby${code}@doo`; + + cy.loginAsTestUser({ + email: scoobyEmail, + firstNames: "Scooby", + lastNames: "Doo", + }); + + cy.visit("/"); + + cy.get('[data-test="Activities"]').click(); + cy.get('[data-test="New Button"]').click(); + cy.get('[data-test="Add Activity Button"]').click(); + + cy.get('[data-test="Editable Title"]').type( + `My new activity${code}{enter}`, + ); + + cy.iframe().find(".cm-editor").type(`{ctrl+A}Hello there!{enter}{ctrl+S}`); + + cy.iframe().find(".doenet-viewer").should("contain.text", `Hello there!`); + + cy.get('[data-test="Sharing Button"]').click(); + cy.get('[data-test="Public Checkbox"]').click(); + cy.get('[data-test="Status message"]').should( + "have.text", + "Successfully shared publicly", + ); + + cy.get('[data-test="Close Share Drawer Button"]').click(); + + cy.loginAsTestUser({ + email: scrappyEmail, + }); + cy.visit("/"); + + cy.get('[data-test="Community"]').click(); + cy.get('[data-test="Search"]').type(`activity${code}{enter}`); + + cy.get( + '[data-test="Results All Matches"] [data-test="Activity Link"]', + ).click(); + + cy.get('[data-test="Copy to Activities Button"]').click(); + cy.get('[data-test="Go to Activities"]').click(); + + cy.get(`[data-test="Activity Link"]`).eq(0).click(); + cy.iframe().find(".doenet-viewer").should("contain.text", `Hello there!`); + }); +}); diff --git a/client/cypress/e2e/AlertQueue/assignmentAlertQueue.cy.js b/client/cypress/e2e/AlertQueue/assignmentAlertQueue.cy.js deleted file mode 100644 index 8ea7e6e0d6..0000000000 --- a/client/cypress/e2e/AlertQueue/assignmentAlertQueue.cy.js +++ /dev/null @@ -1,288 +0,0 @@ -import { cesc } from "../../../src/_utils/url"; - -describe("Assignment Alert Queue Tests", function () { - before(() => {}); - - beforeEach(() => {}); - - Cypress.on("uncaught:exception", (err, runnable) => { - // returning false here prevents Cypress from - // failing the test - return false; - }); - - it("No Alert", () => { - const userId = "cyuserId"; - const studentUserId = "cyStudentUserId"; - const courseId = "aaq_courseid1"; - const doenetML = ` - -

1+1 = 2

-
- `; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - cy.signin({ userId }); - cy.visit(`course?tool=navigation&courseId=${courseId}`); - - cy.log("Assign a single page activity"); - cy.get('[data-test="Add Activity Button"]').click(); - cy.get(".navigationRow").last().dblclick(); - cy.get(".cm-content").type(doenetML); - cy.get('[data-test="Viewer Update Button"]').click(); - cy.get(".doenet-viewer").contains("Problem 1"); - - cy.get('[data-test="Controls Button"]').click(); - cy.get('[data-test="Assign Tab"]').click(); - cy.get('[data-test="Assign Button"]').eq(1).click(); - cy.log("alert queue should show message and then be dismissed"); - cy.get('[data-test="Alert Title"]').should( - "have.text", - "Activity is assigned.", - ); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - cy.get('[data-test="Close Settings Button"]').click(); - - cy.log("sign in as student"); - cy.signin({ userId: studentUserId }); - cy.visit(`course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").last().dblclick(); - cy.get(".mq-root-block").type("2{enter}"); - - // cy.get('[data-test="Alert Title"]').contains("No credit awarded since the due date has passed."); - // cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - }); - - it("Solution Shown Alert", () => { - const userId = "cyuserId"; - const studentUserId = "cyStudentUserId"; - const courseId = "aaq_courseid2"; - const doenetML = ` - -

1+1 = 2

-2 -
- `; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - cy.signin({ userId }); - cy.visit(`course?tool=navigation&courseId=${courseId}`); - - cy.log("Assign a single page activity"); - cy.get('[data-test="Add Activity Button"]').click(); - cy.get(".navigationRow").last().dblclick(); - cy.get(".cm-content").type(doenetML); - cy.get('[data-test="Viewer Update Button"]').click(); - cy.get(".doenet-viewer").contains("Problem 1"); - - cy.get('[data-test="Controls Button"]').click(); - cy.get('[data-test="Assign Tab"]').click(); - cy.get('[data-test="Assign Button"]').eq(1).click(); - cy.log("alert queue should show message and then be dismissed"); - cy.get('[data-test="Alert Title"]').should( - "have.text", - "Activity is assigned.", - ); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - - cy.log("Set due date to a date in the past"); - cy.get('[data-test="due date"]').type("2023-09-01T04:56").blur(); - cy.get('[data-test="Alert Title"]').contains("Due date set."); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - cy.get('[data-test="Close Settings Button"]').click(); - - cy.log("sign in as student"); - cy.signin({ userId: studentUserId }); - cy.visit(`course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").last().dblclick(); - cy.get(cesc("#\\/_solution1_button")).click(); - - cy.get(".mq-root-block").type("2{enter}"); - cy.get('[data-test="Alert Title"]').contains( - "No credit awarded since the solution has been viewed.", - ); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - }); - - it("Due Date Alert", () => { - const userId = "cyuserId"; - const studentUserId = "cyStudentUserId"; - const courseId = "aaq_courseid2"; - const doenetML = ` - -

1+1 = 2

-
- `; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - cy.signin({ userId }); - cy.visit(`course?tool=navigation&courseId=${courseId}`); - - cy.log("Assign a single page activity"); - cy.get('[data-test="Add Activity Button"]').click(); - cy.get(".navigationRow").last().dblclick(); - cy.get(".cm-content").type(doenetML); - cy.get('[data-test="Viewer Update Button"]').click(); - cy.get(".doenet-viewer").contains("Problem 1"); - - cy.get('[data-test="Controls Button"]').click(); - cy.get('[data-test="Assign Tab"]').click(); - cy.get('[data-test="Assign Button"]').eq(1).click(); - cy.log("alert queue should show message and then be dismissed"); - cy.get('[data-test="Alert Title"]').should( - "have.text", - "Activity is assigned.", - ); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - - cy.log("Set due date to a date in the past"); - cy.get('[data-test="due date"]').type("2023-09-01T04:56").blur(); - cy.get('[data-test="Alert Title"]').contains("Due date set."); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - cy.get('[data-test="Close Settings Button"]').click(); - - cy.log("sign in as student"); - cy.signin({ userId: studentUserId }); - cy.visit(`course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").last().dblclick(); - cy.get(".mq-root-block").type("2{enter}"); - - cy.get('[data-test="Alert Title"]').contains( - "No credit awarded since the due date has passed.", - ); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - }); - - //TODO: finish this implementation - it.skip("No Attempts Left Alert", () => { - const userId = "cyuserId"; - const studentUserId = "cyStudentUserId"; - const courseId = "aaq_courseid2"; - const doenetML = ` - -

1+1 = 2

-2 -
- `; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - cy.signin({ userId }); - cy.visit(`course?tool=navigation&courseId=${courseId}`); - - cy.log("Assign a single page activity"); - cy.get('[data-test="Add Activity Button"]').click(); - cy.get(".navigationRow").last().dblclick(); - cy.get(".cm-content").type(doenetML); - cy.get('[data-test="Viewer Update Button"]').click(); - cy.get(".doenet-viewer").contains("Problem 1"); - - cy.get('[data-test="Controls Button"]').click(); - cy.get('[data-test="Assign Tab"]').click(); - cy.get('[data-test="Assign Button"]').eq(1).click(); - cy.log("alert queue should show message and then be dismissed"); - cy.get('[data-test="Alert Title"]').should( - "have.text", - "Activity is assigned.", - ); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - - cy.log("Set max attempts to 1"); - cy.get('[data-test="Grade Tab"]').click(); - cy.get('[data-test="Number of Attempts Allowed Checkbox"]').click(); - cy.get('[data-test="Alert Title"]').contains("1 attempt allowed."); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - cy.get('[data-test="Close Settings Button"]').click(); - - cy.log("sign in as student"); - cy.signin({ userId: studentUserId }); - cy.visit(`course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").last().dblclick(); - - cy.get(".mq-root-block").type("2{enter}"); - cy.get('[data-test="New Attempt"').click(); - cy.get(".mq-root-block").type("2{enter}"); - cy.get('[data-test="Alert Title"]').contains( - "No credit awarded since the number of attempts allowed has been exceeded.", - ); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - }); - - //TODO: finish this implementation - it.skip("Timed Out Alert", () => { - const userId = "cyuserId"; - const studentUserId = "cyStudentUserId"; - const courseId = "aaq_courseid2"; - const doenetML = ` - -

1+1 = 2

-2 -
- `; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - cy.signin({ userId }); - cy.visit(`course?tool=navigation&courseId=${courseId}`); - - cy.log("Assign a single page activity"); - cy.get('[data-test="Add Activity Button"]').click(); - cy.get(".navigationRow").last().dblclick(); - cy.get(".cm-content").type(doenetML); - cy.get('[data-test="Viewer Update Button"]').click(); - cy.get(".doenet-viewer").contains("Problem 1"); - - cy.get('[data-test="Controls Button"]').click(); - cy.get('[data-test="Assign Tab"]').click(); - cy.get('[data-test="Assign Button"]').eq(1).click(); - - cy.log("alert queue should show message and then be dismissed"); - cy.get('[data-test="Alert Title"]').should( - "have.text", - "Activity is assigned.", - ); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - - cy.log("Set due date to a date in the past"); - cy.get('[data-test="Presentation Tab"]').click(); - cy.get('[data-test="Time Limit"]').click("2023-09-01T04:56").blur(); - cy.get('[data-test="Time Limit"]').click("2023-09-01T04:56").blur(); - cy.get('[data-test="Alert Title"]').contains("Due date set."); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - cy.get('[data-test="Close Settings Button"]').click(); - - cy.log("sign in as student"); - cy.signin({ userId: studentUserId }); - cy.visit(`course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").last().dblclick(); - cy.get(cesc("#\\/_solution1_button")).click(); - - cy.get(".mq-root-block").type("2{enter}"); - cy.get('[data-test="Alert Title"]').contains( - "No credit awarded since the time allowed has expired.", - ); - cy.get('[data-test="Alert Close Button"]').click(); - cy.get('[data-test="Alert Title"]').should("not.exist"); - }); -}); diff --git a/client/cypress/e2e/AsStudent/assignedActivity.cy.js b/client/cypress/e2e/AsStudent/assignedActivity.cy.js deleted file mode 100644 index 711837c76c..0000000000 --- a/client/cypress/e2e/AsStudent/assignedActivity.cy.js +++ /dev/null @@ -1,165 +0,0 @@ -describe("Assigned Activity Tests", function () { - const userId = "cyuserId"; - const studentUserId = "cyStudentUserId"; - const courseId = "courseid1"; - const doenetId = "activity1id"; - const pageDoenetId = "_page1id"; - - before(() => { - cy.signin({ userId }); - cy.clearAllOfAUsersCoursesAndItems({ userId }); - cy.clearAllOfAUsersCoursesAndItems({ userId: studentUserId }); - cy.createCourse({ userId, courseId, studentUserId }); - }); - beforeEach(() => { - cy.signin({ userId }); - cy.clearIndexedDB(); - cy.clearAllOfAUsersActivities({ userId }); - cy.clearAllOfAUsersActivities({ userId: studentUserId }); - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - }); - cy.visit(`/course?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`); - }); - - Cypress.on("uncaught:exception", (err, runnable) => { - // Returning false here prevents Cypress from failing the test - return false; - }); - - /* Methods to get/set the date and time */ - - // Formatting the date to be 'mm/dd/yyyy' WITH leading zeros - // Ex: '09/12/2022' for September 12, 2022 - function formatDateWithYear(date, prefixZero) { - const yyyy = date.getFullYear(); - let mm = date.getMonth() + 1; // Months start at 0! - let dd = date.getDate(); - if (prefixZero) { - if (mm < 10) mm = "0" + mm; - if (dd < 10) dd = "0" + dd; - } - - return mm + "/" + dd + "/" + yyyy; - } - - // Formatting the date to be 'mm/dd' WITHOUT leading zeros - // Ex: '9/12' for September 12, 2022 - function formatDateWithoutYear(date) { - let mm = date.getMonth() + 1; // Months start at 0! - let dd = date.getDate(); - - return mm + "/" + dd; - } - - function getDayOfWeek(date) { - const weekday = [ - "Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", - ]; - return weekday[date.getDay()]; - } - - function getAmPm(hour) { - return hour >= 12 ? "PM" : "AM"; - } - - function formatHours(date) { - let hr = date.getHours(); - hr = hr % 12; - return hr ? hr : 12; // Hour '0' should be '12 - } - - function formatMinutes(date) { - let min = date.getMinutes(); - return min < 10 ? "0" + min : min; - } - - // Formatting the time to be 'hh:mm A/P' - // Ex: '4:02 P' for '04:02:00 PM' - function formatTime(date) { - let hr = formatHours(date); - let min = formatMinutes(date); - const ampm = date.getHours() >= 12 ? "PM" : "AM"; // Datetime component automatically adds the 'M' - - return hr + ":" + min + " " + ampm; - } - - it("Activity contains due date in Content page", () => { - const assignedDate = new Date(); - let dueDate = new Date(assignedDate.getTime() + 7 * 24 * 60 * 60 * 1000); // One week from now - dueDate.setSeconds(0); //To prevent rounding up false tests - - // Update the activity as the owner - cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); - cy.get('[data-test="Due Date Checkbox"]').click(); - cy.get('[data-test="Due Date"]').should( - "have.value", - formatDateWithYear(dueDate, true) + " " + formatTime(dueDate), - ); - cy.get('[data-test="Assigned Date Checkbox"]').click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); //Wait for activity to be saved - - // Sign in as a student - cy.signin({ userId: studentUserId }); - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - // Check if the Content page contains the correct activity with the due date - cy.get(".navigationRow").should("have.length", 1); // Need this to wait for the row to appear - cy.get('[data-test="rowLabel"]').contains("Cypress Activity"); - cy.get(".navigationRow") - .eq(0) - .get(".navigationColumn2") - .contains( - formatDateWithYear(dueDate, false) + - ", " + - formatHours(dueDate) + - ":" + - formatMinutes(dueDate) + - ":00", - ); - }); - - it("Activity contains assigned date and due date in Content By Week page", () => { - const assignedDate = new Date(); - let dueDate = new Date(new Date().getTime() + 7 * 24 * 60 * 60 * 1000); // One week from now - - // Update the activity as the owner - cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); - cy.get('[data-test="Assigned Date Checkbox"]').click(); - cy.get('[data-test="Assigned Date"]').should( - "have.value", - formatDateWithYear(assignedDate, true) + " " + formatTime(assignedDate), - ); - cy.get('[data-test="Due Date Checkbox"]').click(); - cy.get('[data-test="Due Date"]').should( - "have.value", - formatDateWithYear(dueDate, true) + " " + formatTime(dueDate), - ); - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); //Wait for activity to be saved - - // Sign in as a student - // Check if the Content By Week page contains the correct activity with the assigned date and due date - cy.signin({ userId: studentUserId }); - cy.visit(`/course?tool=dashboard&courseId=${courseId}`); - cy.get('[data-test="next week button"]').click(); - cy.get("table").should("have.length", 1); // Need this to wait for the row to appear - cy.get('[data-test="cbw assignment label 0"]').contains("Cypress Activity"); - cy.get('[data-test="cbw assigned date 0"]').contains( - formatDateWithoutYear(assignedDate) + " " + formatTime(assignedDate), - ); // Add the 'M' back to AM/PM - cy.get('[data-test="cbw due date 0"]').contains( - formatDateWithoutYear(dueDate) + " " + formatTime(dueDate), - ); - }); -}); diff --git a/client/cypress/e2e/AsStudent/previousAndNext.cy.js b/client/cypress/e2e/AsStudent/previousAndNext.cy.js deleted file mode 100644 index 050bcacc26..0000000000 --- a/client/cypress/e2e/AsStudent/previousAndNext.cy.js +++ /dev/null @@ -1,236 +0,0 @@ -describe("Previous and Next Activty Button Tests", () => { - const userId = "cyuserId"; - const studentUserId = "cyStudentUserId"; - //TODO: create these randomly or from server - const courseId = "_cypressCourse"; - const section1DoenetId = "_section1"; - const activityOptions = [ - { - parent: courseId, - isAssigned: true, - isMultiPage: false, - settingOverrides: {}, - }, - { - parent: courseId, - isAssigned: true, - isMultiPage: false, - settingOverrides: {}, - }, - { - parent: courseId, - isAssigned: true, - isMultiPage: false, - settingOverrides: { proctorMakesAvailable: 1 }, - }, - { - parent: courseId, - isAssigned: false, - isMultiPage: false, - settingOverrides: {}, - }, - { - parent: section1DoenetId, - isAssigned: true, - isMultiPage: false, - settingOverrides: {}, - }, - { - parent: section1DoenetId, - isAssigned: false, - isMultiPage: false, - settingOverrides: {}, - }, - { - parent: courseId, - isAssigned: true, - isMultiPage: true, - settingOverrides: {}, - }, - { - parent: courseId, - isAssigned: true, - isMultiPage: true, - settingOverrides: {}, - }, - ]; - const activitySettings = { - assignedDate: "2024-01-01 00:00:00", - dueDate: "2025-12-31 00:00:00", - timeLimit: 70, - numberOfAttemptsAllowed: 10, - attemptAggregation: "l", - totalPointsOrPercent: 10, - gradeCategory: "problem sets", - itemWeights: [5], - individualize: 0, - showSolution: 0, - showSolutionInGradebook: 0, - showFeedback: 0, - showHints: 0, - showCorrectness: 0, - showCreditAchievedMenu: 0, - paginate: 0, - showFinishButton: 1, - proctorMakesAvailable: 0, - autoSubmit: 0, - pinnedAfterDate: "2024-01-01 00:00:00", - pinnedUntilDate: "2025-12-31 00:00:00", - }; - const genIdsInContnetOrder = []; - - before(() => { - cy.signin({ userId }); - //TODO: remove once Ids are random - cy.clearAllOfAUsersCoursesAndItems({ userId }); - cy.clearAllOfAUsersCoursesAndItems({ userId: studentUserId }); - cy.createCourse({ userId, courseId, studentUserId }); - // create activites, first two will be assigned, - // third left alone, a seciton child, firth a multi page - // cy.createSection({ - // courseId, - // doenetId: section1DoenetId, - // parentDoenetId: courseId, - // }); - for (let i in activityOptions) { - let { isMultiPage, isAssigned, parent, settingOverrides } = - activityOptions[i]; - const doenetId = `_doenetId${i}`; - genIdsInContnetOrder[i] = { doenetId }; - if (isMultiPage) { - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: parent, - pageDoenetId1: `_pageDoenetId${i}.1`, - doenetML1: `${i}.1: ${i}.1`, - pageDoenetId2: `_pageDoenetId${i}.2`, - doenetML2: `${i}.2: ${i}.2`, - }); - genIdsInContnetOrder[i]["firstPageId"] = `_pageDoenetId${i}.1`; - } else { - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: parent, - pageDoenetId: `_pageDoenetId${i}.1`, - doenetML: `${i}: ${i}`, - }); - genIdsInContnetOrder[i]["firstPageId"] = `_pageDoenetId${i}.1`; - } - cy.updateActivitySettings({ - courseId, - doenetId, - //TODO: current date instead of hardcoded - activitySettings: JSON.stringify({ - ...activitySettings, - ...settingOverrides, - }), - }); - if (isAssigned) { - cy.visit( - `/course?tool=editor&doenetId=${doenetId}&pageId=${`_pageDoenetId${i}.1`}`, - ); - cy.get('[data-test="AssignmentSettingsMenu Menu"]') - .should("be.visible") - .click(); - cy.get('[data-test="Assign Activity"]').should("be.enabled").click(); - cy.get('[data-test="Unassign Activity"]').should("be.enabled"); - } - } - }); - beforeEach(() => { - cy.signin({ userId: studentUserId }); - }); - - Cypress.on("uncaught:exception", () => { - // Returning false here prevents Cypress from failing the test - return false; - }); - - it("Next button goes to from first to second", () => { - cy.visit( - `/course?tool=assignment&doenetId=${genIdsInContnetOrder[0].doenetId}&pageId=${genIdsInContnetOrder[0].firstPageId}`, - ); - cy.get('[data-test="Previous Activity Button"]').should("be.disabled"); - cy.get('[data-test="Next Activity Button"]').should("be.enabled").click(); - cy.url() - .should("include", `doenetId=${genIdsInContnetOrder[1].doenetId}`) - .should("contain", `pageId=${genIdsInContnetOrder[1].firstPageId}`); - }); - - it("Previous button goes to from second to first", () => { - cy.visit( - `/course?tool=assignment&doenetId=${genIdsInContnetOrder[1].doenetId}&pageId=${genIdsInContnetOrder[1].firstPageId}`, - ); - cy.get('[data-test="Next Activity Button"]').should("be.enabled"); - cy.get('[data-test="Previous Activity Button"]') - .should("be.enabled") - .click(); - cy.url() - .should("include", `doenetId=${genIdsInContnetOrder[0].doenetId}`) - .should("contain", `pageId=${genIdsInContnetOrder[0].firstPageId}`); - }); - - it("Both button are disabled in proctored content", () => { - const procIdx = activityOptions.findIndex( - (options) => options?.settingOverrides?.proctorMakesAvailable === 1, - ); - expect(procIdx).to.not.equal(-1); - cy.visit( - `/course?tool=assignment&doenetId=${genIdsInContnetOrder[procIdx].doenetId}&pageId=${genIdsInContnetOrder[procIdx].firstPageId}`, - ); - cy.get('[data-test="Next Activity Button"]').should("be.disabled"); - cy.get('[data-test="Previous Activity Button"]').should("be.disabled"); - }); - - it("Next button from first to last, skipping unassigned", () => { - cy.visit( - `/course?tool=assignment&doenetId=${genIdsInContnetOrder[0].doenetId}&pageId=${genIdsInContnetOrder[0].firstPageId}`, - ); - cy.get('[data-test="Previous Activity Button"]').should("be.disabled"); - let i; - for (i = 1; i < activityOptions.length; i++) { - let options = activityOptions[i]; - - if ( - !options.isAssigned || - options?.settingOverrides?.proctorMakesAvailable === 1 - ) { - continue; - } - cy.get('[data-test="Next Activity Button"]').should("be.enabled").click(); - cy.url() - .should("include", `doenetId=${genIdsInContnetOrder[i].doenetId}`) - .should("contain", `pageId=${genIdsInContnetOrder[i].firstPageId}`); - cy.get('[data-test="Previous Activity Button"]').should("be.enabled"); - } - cy.get('[data-test="Next Activity Button"]').should("be.disabled"); - }); - - it("Previous button goes to from last to first, skipping unassigned and proctored", () => { - cy.visit( - `/course?tool=assignment&doenetId=${ - genIdsInContnetOrder[activityOptions.length - 1].doenetId - }&pageId=${genIdsInContnetOrder[activityOptions.length - 1].firstPageId}`, - ); - cy.get('[data-test="Next Activity Button"]').should("be.disabled"); - let i; - for (i = 2; i <= activityOptions.length; i++) { - let options = activityOptions[activityOptions.length - i]; - if ( - !options.isAssigned || - options?.settingOverrides?.proctorMakesAvailable === 1 - ) - continue; - cy.get('[data-test="Previous Activity Button"]') - .should("be.enabled") - .click(); - cy.url().should( - "include", - `doenetId=${genIdsInContnetOrder[activityOptions.length - i].doenetId}`, - ); - } - cy.get('[data-test="Previous Activity Button"]').should("be.disabled"); - }); -}); diff --git a/client/cypress/e2e/AsStudent/signIn.cy.js b/client/cypress/e2e/AsStudent/signIn.cy.js deleted file mode 100644 index 65f3f19852..0000000000 --- a/client/cypress/e2e/AsStudent/signIn.cy.js +++ /dev/null @@ -1,56 +0,0 @@ -describe("Student Sign-In Test", function () { - const userId = "cyuserId"; - // const studentUserId = "cyStudentUserId"; - const courseId = "courseid1"; - // const doenetId = "activity1id"; - // const pageDoenetId = "_page1id"; - - before(() => { - cy.signin({ userId }); - cy.clearAllOfAUsersCoursesAndItems({ userId }); - // cy.clearAllOfAUsersCoursesAndItems({ userId: studentUserId }); - cy.createCourse({ userId, courseId }); - }); - beforeEach(() => { - cy.signin({ userId }); - cy.clearIndexedDB(); - cy.clearAllOfAUsersActivities({ userId }); - // cy.clearAllOfAUsersActivities({ userId: studentUserId }); - // cy.createActivity({ courseId, doenetId, parentDoenetId:courseId, pageDoenetId }); - cy.visit(`/course?tool=people&courseId=${courseId}`); - }); - - Cypress.on("uncaught:exception", (err, runnable) => { - // Returning false here prevents Cypress from failing the test - return false; - }); - - it("Student can sign in after being added to a course", () => { - const emailAddress = "scoobydoo@doenet.org"; - cy.get('[data-test="First"]').type("Scooby"); - cy.get('[data-test="Last"]').type("Doo"); - cy.get('[data-test="Email"]').type(emailAddress); - cy.get('[data-test="Add User"]').click(); - cy.visit(`/settings`); - cy.get('[data-test="sign out button"]').click(); - cy.get('[data-test="homepage button"]').should("be.visible"); - cy.visit(`/SignIn`); - cy.get('[data-test="email input"]').type(emailAddress); - cy.get('[data-test="sendEmailButton"]').click(); - cy.task( - "queryDb", - `SELECT signInCode FROM user_device ORDER BY id DESC LIMIT 1`, - ).then((result) => { - const code = result[0].signInCode; - cy.get('[data-test="signinCodeInput"]').type(code); - cy.get('[data-test="signInButton"]').click(); - cy.get('[data-test="My Courses"]').click(); - cy.get('[data-test="Course Label"]').should( - "have.text", - "Cypress Generated", - ); - cy.get('[data-test="Card Image Link"]').click(); - cy.document().should("contain.text", "Welcome"); - }); - }); -}); diff --git a/client/cypress/e2e/AssignedActivity/activitySettings.cy.js b/client/cypress/e2e/AssignedActivity/activitySettings.cy.js deleted file mode 100644 index 691ec9dd15..0000000000 --- a/client/cypress/e2e/AssignedActivity/activitySettings.cy.js +++ /dev/null @@ -1,371 +0,0 @@ -describe("Activity Settings Test", function () { - const userId = "cyuserId"; - const studentUserId = "cyStudentUserId"; - const courseId = "courseid1"; - const doenetId = "activity1id"; - const pageDoenetId = "_page1id"; - - before(() => { - cy.signin({ userId }); - cy.clearAllOfAUsersCoursesAndItems({ userId }); - cy.clearAllOfAUsersCoursesAndItems({ userId: studentUserId }); - cy.createCourse({ userId, courseId, studentUserId }); - }); - - beforeEach(() => { - cy.signin({ userId }); - cy.clearIndexedDB(); - cy.clearAllOfAUsersActivities({ userId }); - cy.clearAllOfAUsersActivities({ userId: studentUserId }); - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - }); - cy.visit(`course?tool=navigation&courseId=${courseId}`); - cy.get(".navigationRow").click(); - }); - - // how to test time? - it("Set Assigned Date", () => { - // assign date to 01/15/2024 - // cypress might cause error due to diff time zone, - // so if time set is 01/15/2024, that means the test is successful - cy.get('[data-test="Assigned Date Checkbox"]').click(); - - cy.get('[data-test="Assigned Date"]').click(); - cy.get(".rdtSwitch").click(); - cy.get(".rdtSwitch").click(); - cy.get('[data-value="2024"]').click(); - cy.get('[data-value="0"]').click(); - cy.get('[data-value="15"]').click(); - cy.get('[data-test="Menu Panel"]').click({ force: true }); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT assignedDate FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - let utcDateTime = new Date(result[0].assignedDate); - let localDateTime = utcDateTime.toLocaleDateString(); - expect(localDateTime).contains("1/15/2024"); - }); - }); - - it("Set Due Date", () => { - // set due date to 03/18/2025 - // cypress might cause error due to diff time zone, - // so if time set is 03/19/2025, that means the test is successful - cy.get('[data-test="Due Date Checkbox"]').click(); - - cy.get('[data-test="Due Date"]').click(); - cy.get(".rdtSwitch").click(); - cy.get(".rdtSwitch").click(); - cy.get('[data-value="2025"]').click(); - cy.get('[data-value="2"]').click(); - cy.get('[data-value="18"]').click(); - cy.get('[data-test="Menu Panel"]').click({ force: true }); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT dueDate FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - let utcDateTime = new Date(result[0].dueDate); - let localDateTime = utcDateTime.toLocaleDateString(); - expect(localDateTime).contains("3/18/2025"); - }); - }); - - it("Set Time Limit", () => { - // default time limit is 60 - cy.get('[data-test="Time Limit Checkbox"]').click(); - - // check increment time limit to 61 - cy.get('[data-test="Increment Time Limit"]').click(); - cy.get('[data-test="Menu Panel"]').click({ force: true }); - - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT timeLimit FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].timeLimit).to.equals(61); - }); - - //check decrement time limit to 60 - cy.get('[data-test="Decrement Time Limit"]').click(); - cy.get('[data-test="Menu Panel"]').click({ force: true }); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT timeLimit FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].timeLimit).to.equals(60); - }); - }); - - it("Set Attempts", () => { - // default attempt limit is 1 - cy.get('[data-test="Attempt Limit Checkbox"]').click(); - - // check increment attempt limit to 2 - cy.get('[data-test="Increment Attempt Limit"]').click(); - cy.get('[data-test="Menu Panel"]').click({ force: true }); - - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT numberOfAttemptsAllowed FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].numberOfAttemptsAllowed).to.equals(2); - }); - - //check decrement attempt limit to 1 - cy.get('[data-test="Decrement Attempt Limit"]').click(); - cy.get('[data-test="Menu Panel"]').click({ force: true }); - - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT numberOfAttemptsAllowed FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].numberOfAttemptsAllowed).to.equals(1); - }); - }); - - // how to click dropdown? - // it('Set Attempt Aggregation',()=>{ - // cy.get('[data-test="Attempt Aggregation"]').click() - // // cy.get('[data-test="Attempt Limit"]') - // }) - - it("Set Total Points or Percent", () => { - // default Total Points or Percent is 0 - - // check increment Total Points or Percent to 1 - cy.get('[data-test="Increment Total Points Or Percent"]').click(); - cy.get('[data-test="Menu Panel"]').click({ force: true }); - - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT totalPointsOrPercent FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].totalPointsOrPercent).to.equals(1); - }); - - //check decrement Total Points or Percent to 0 - cy.get('[data-test="Decrement Total Points Or Percent"]').click(); - cy.get('[data-test="Menu Panel"]').click({ force: true }); - - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT totalPointsOrPercent FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].totalPointsOrPercent).to.equals(0); - }); - }); - - // how to click dropdown? - // it('Set Grade Category',()=>{ - // cy.get('[data-test="Grade Category"]').click() - // // cy.get('[data-test="Attempt Limit"]') - // }) - - // in tbl course content - it("Set Item Weights", () => { - let itemWeights = 5; - cy.get('[data-test="Item Weights"]').clear(); - cy.get('[data-test="Item Weights"]').type(itemWeights, { force: true }); - cy.get('[data-test="Menu Panel"]').click({ force: true }); - - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT jsonDefinition FROM course_content WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].jsonDefinition.itemWeights).eqls([itemWeights]); - }); - }); - - it("Individualize", () => { - cy.get('[data-test="Individualize"]').click(); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT individualize FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].individualize).to.equal(1); - }); - }); - - it("Show Solution", () => { - cy.get('[data-test="Show Solution"]').click(); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT showSolution FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].showSolution).to.equal(0); - }); - }); - - it("Show Solution In Gradebook", () => { - cy.get('[data-test="Show Solution In Gradebook"]').click(); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT showSolutionInGradebook FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].showSolutionInGradebook).to.equal(0); - }); - }); - - it("Show Feedback", () => { - cy.get('[data-test="Show Feedback"]').click(); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT showFeedback FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].showFeedback).to.equal(0); - }); - }); - - it("Show Hints", () => { - cy.get('[data-test="Show Hints"]').click(); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT showHints FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].showHints).to.equal(0); - }); - }); - - it("Show Correctness", () => { - cy.get('[data-test="Show Correctness"]').click(); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT showCorrectness FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].showCorrectness).to.equal(0); - }); - }); - - it("Show Credit Achieved Menu", () => { - cy.get('[data-test="Show Credit Achieved Menu"]').click(); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT showCreditAchievedMenu FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].showCreditAchievedMenu).to.equal(0); - }); - }); - - it("Paginate", () => { - cy.get('[data-test="Paginate"]').click(); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT paginate FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].paginate).to.equal(0); - }); - }); - - it("Show Finish Button", () => { - cy.get('[data-test="Show Finish Button"]').click(); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT showFinishButton FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].showFinishButton).to.equal(1); - }); - }); - - it("Proctor Makes Available", () => { - cy.get('[data-test="Proctor Makes Available"]').click(); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT proctorMakesAvailable FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].proctorMakesAvailable).to.equal(1); - }); - }); - - it("Auto Submit", () => { - cy.get('[data-test="Auto Submit"]').click(); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT autoSubmit FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - expect(result[0].autoSubmit).to.equal(1); - }); - }); - - // db located where? - // it('Make Publicly Visible',()=>{ - // cy.get('[data-test="Make Publicly Visible"]').click() - // }) - - // db located where? - // it('Show DoenetML Source',()=>{ - // cy.get('[data-test="Show DoenetML Source"]').click() - // }) - - // checkbox not named (data-test) yet - it("Pin Assignment", () => { - cy.get('[data-test="Pin Assignment Checkbox"]').click(); - - // assign pin after date to 01/03/2024 - // cypress might cause error due to diff time zone, - // so if time set in db is 01/04/2024, that means the test is actually successful - cy.get('[data-test="Pinned After Date"]').click(); - cy.get( - ".rdtOpen > .rdtPicker > .rdtDays > table > thead > :nth-child(1) > .rdtSwitch", - ).click(); - cy.get(".rdtMonths > :nth-child(1) > thead > tr > .rdtSwitch").click(); - cy.get('[data-value="2024"]').click(); - cy.get('[data-value="0"]').click(); - cy.get( - '.rdtOpen > .rdtPicker > .rdtDays > table > tbody > :nth-child(1) > [data-value="3"]', - ).click(); - cy.get('[data-test="Menu Panel"]').click({ force: true }); - - // set pin until date to 07/20/2025 - // cypress might cause error due to diff time zone, - // so if time set in db is 07/21/2025, that means the test is actually successful - cy.get('[data-test="Pinned Until Date"]').click(); - cy.get( - ".rdtOpen > .rdtPicker > .rdtDays > table > thead > :nth-child(1) > .rdtSwitch", - ).click(); - cy.get(".rdtMonths > :nth-child(1) > thead > tr > .rdtSwitch").click(); - cy.get('[data-value="2025"]').click(); - cy.get(':nth-child(2) > [data-value="6"]').click(); - cy.get(':nth-child(4) > [data-value="20"]').click(); - cy.get('[data-test="Menu Panel"]').click({ force: true }); - cy.wait(500); //TODO: need the UI to let us know this was successful - cy.task( - "queryDb", - `SELECT pinnedAfterDate, pinnedUntilDate FROM assignment WHERE doenetId="${doenetId}"`, - ).then((result) => { - let pinnedAfterUtcDateTime = new Date(result[0].pinnedAfterDate); - let pinnedAfterLocalDateTime = - pinnedAfterUtcDateTime.toLocaleDateString(); - cy.log(pinnedAfterLocalDateTime); - expect(pinnedAfterLocalDateTime).contains("1/3/2024"); - let pinnedUntilUtcDateTime = new Date(result[0].pinnedUntilDate); - let pinnedUntilLocalDateTime = - pinnedUntilUtcDateTime.toLocaleDateString(); - cy.log(pinnedUntilLocalDateTime); - expect(pinnedUntilLocalDateTime).contains("7/20/2025"); - }); - }); -}); diff --git a/client/cypress/e2e/AssignedActivity/creditAchievedMenu.cy.js b/client/cypress/e2e/AssignedActivity/creditAchievedMenu.cy.js deleted file mode 100644 index fe7975c40b..0000000000 --- a/client/cypress/e2e/AssignedActivity/creditAchievedMenu.cy.js +++ /dev/null @@ -1,630 +0,0 @@ -// import {signIn} from '../DoenetSignin/DoenetSignin.cy'; -import { cesc } from "../../../src/_utils/url"; - -describe("Credit achieved menu tests", function () { - const userId = "cyuserId"; - const studentUserId = "cyStudentUserId"; - // const userId = "devuserId"; - const courseId = "courseid1"; - const doenetId = "activity1id"; - const doenetId2 = "activity2id"; - const pageDoenetId = "_page1id"; - const pageDoenetId2 = "_page2id"; - const pageDoenetId3 = "_page3id"; - const pageDoenetId4 = "_page4id"; - - const headerPixels = 40; - - before(() => { - // cy.clearAllOfAUsersActivities({userId}) - cy.signin({ userId }); - cy.clearAllOfAUsersCoursesAndItems({ userId }); - cy.clearAllOfAUsersCoursesAndItems({ userId: studentUserId }); - cy.createCourse({ userId, courseId, studentUserId }); - }); - beforeEach(() => { - cy.signin({ userId }); - cy.clearIndexedDB(); - cy.clearAllOfAUsersActivities({ userId }); - cy.clearAllOfAUsersActivities({ userId: studentUserId }); - }); - - Cypress.on("uncaught:exception", (err, runnable) => { - // returning false here prevents Cypress from - // failing the test - return false; - }); - - it("Show item credits immediately", () => { - const doenetML = ` - -

Enter x: x

-
`; - - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/_problem1_title")).should("have.text", "Problem 1"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - - cy.get(cesc("#\\/ans") + " textarea").type("x{enter}", { force: true }); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - }); - - it("Pages without graded content", () => { - const doenetML1 = ` - -

Enter x: x

-
`; - - const doenetML2 = ` - -

No questions here

-
`; - - const doenetML3 = ` - -

Enter y: y

-
`; - - const doenetML4 = `

No questions here, either

`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1: pageDoenetId, - pageDoenetId2, - pageDoenetId3, - pageDoenetId4, - doenetML1, - doenetML2, - doenetML3, - doenetML4, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_problem1_title")).should("have.text", "Problem 1"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "0%"); - - cy.get(cesc("#page1\\/ans") + " textarea").type("x{enter}", { - force: true, - }); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "25%"); - - cy.get('[data-test="next"]').click(); - - cy.get(cesc("#page2\\/_problem1_title")).should("have.text", "Problem 2"); - - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "50%"); - - cy.get('[data-test="next"]').click(); - - cy.get(cesc("#page3\\/_problem1_title")).should("have.text", "Problem 3"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "50%"); - - cy.get(cesc("#page3\\/ans") + " textarea").type("y{enter}", { - force: true, - }); - - cy.get('[data-test="Item 3 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "75%"); - - cy.get('[data-test="next"]').click(); - cy.get(cesc("#page4\\/_p1")).should( - "have.text", - "No questions here, either", - ); - - cy.get('[data-test="Item 3 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - }); - - it("Pages without graded content, non-paginated", () => { - const doenetML1 = ` - -

Enter x: x

- -
`; - - const doenetML2 = ` - -

No questions here

- -
`; - - const doenetML3 = ` - -

Enter y: y

- -
`; - - const doenetML4 = ` -

No questions here, either

- -`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1: pageDoenetId, - pageDoenetId2, - pageDoenetId3, - pageDoenetId4, - doenetML1, - doenetML2, - doenetML3, - doenetML4, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.wait(100); - cy.get('[data-test="Paginate"').click(); - cy.wait(100); //TODO: need the UI to let us know this was successful - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_problem1_title")).should("have.text", "Problem 1"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "0%"); - - cy.get(cesc("#page1\\/ans") + " textarea").type("x{enter}", { - force: true, - }); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "25%"); - - cy.get("#page2").scrollIntoView(); - cy.get(cesc("#page2\\/_problem1_title")).should("have.text", "Problem 2"); - - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "50%"); - - cy.get("#page3").scrollIntoView(); - - cy.get(cesc("#page3\\/_problem1_title")).should("have.text", "Problem 3"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "50%"); - - cy.get(cesc("#page3\\/ans") + " textarea").type("y{enter}", { - force: true, - }); - - cy.get('[data-test="Item 3 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "75%"); - - cy.get("#page4").scrollIntoView(); - - cy.get(cesc("#page4\\/_p1")).should( - "have.text", - "No questions here, either", - ); - - cy.get('[data-test="Item 3 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - }); - - it("Pages without graded content and zero item weight", () => { - const doenetML1 = ` - -

Enter x: x

-
`; - - const doenetML2 = ` - -

No questions here

-
`; - - const doenetML3 = ` - -

Enter y: y

-
`; - - const doenetML4 = `

No questions here, either

`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1: pageDoenetId, - pageDoenetId2, - pageDoenetId3, - pageDoenetId4, - doenetML1, - doenetML2, - doenetML3, - doenetML4, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Item Weights"]') - .clear() - .type("2 0 1 0", { force: true }) - .blur(); - cy.wait(100); //TODO: need the UI to let us know this was successful - - cy.get('[data-test="Assign Activity"]').click(); - - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_problem1_title")).should("have.text", "Problem 1"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "Not started"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "Not started"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "0%"); - - cy.get(cesc("#page1\\/ans") + " textarea").type("x{enter}", { - force: true, - }); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "Not started"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "Not started"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - - cy.get('[data-test="next"]').click(); - - cy.get(cesc("#page2\\/_problem1_title")).should("have.text", "Problem 2"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "Complete"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "Not started"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - - cy.get('[data-test="next"]').click(); - - cy.get(cesc("#page3\\/_problem1_title")).should("have.text", "Problem 3"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "Complete"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "Not started"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - - cy.get(cesc("#page3\\/ans") + " textarea").type("y{enter}", { - force: true, - }); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "Complete"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "Not started"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="next"]').click(); - cy.get(cesc("#page4\\/_p1")).should( - "have.text", - "No questions here, either", - ); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "Complete"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "Complete"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - }); - - it("Item credit achieved are links", () => { - const doenetML1 = ` - -

Enter x: x

-
`; - - const doenetML2 = ` - -

Enter y: y

-
`; - - const doenetML3 = ` - -

Enter z: z

-
`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1: pageDoenetId, - pageDoenetId2, - pageDoenetId3, - doenetML1, - doenetML2, - doenetML3, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_problem1_title")).should("have.text", "Problem 1"); - cy.get(cesc("#page2\\/_problem1_title")).should("not.exist"); - cy.get(cesc("#page3\\/_problem1_title")).should("not.exist"); - - cy.url().should("match", /#page1$/); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "0%"); - - cy.get(cesc("#page1\\/ans") + " textarea").type("x{enter}", { - force: true, - }); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "33.3%"); - - cy.get('[data-test="Item 3 Credit"]').click(); - - cy.get(cesc("#page3\\/_problem1_title")).should("have.text", "Problem 3"); - cy.get(cesc("#page1\\/_problem1_title")).should("not.exist"); - cy.get(cesc("#page2\\/_problem1_title")).should("not.exist"); - - cy.url().should("match", /#page3$/); - - cy.get(cesc("#page3\\/ans") + " textarea").type("z{enter}", { - force: true, - }); - - cy.get('[data-test="Item 3 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - - cy.get('[data-test="Item 2 Credit"]').click(); - - cy.get(cesc("#page2\\/_problem1_title")).should("have.text", "Problem 2"); - cy.get(cesc("#page1\\/_problem1_title")).should("not.exist"); - cy.get(cesc("#page3\\/_problem1_title")).should("not.exist"); - - cy.url().should("match", /#page2$/); - - cy.get(cesc("#page2\\/ans") + " textarea").type("y{enter}", { - force: true, - }); - - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="Item 1 Credit"]').click(); - - cy.get(cesc("#page1\\/_problem1_title")).should("have.text", "Problem 1"); - cy.get(cesc("#page2\\/_problem1_title")).should("not.exist"); - cy.get(cesc("#page3\\/_problem1_title")).should("not.exist"); - - cy.url().should("match", /#page1$/); - }); - - it("Item credit achieved are links, non-paginated", () => { - const doenetML1 = ` - -

Enter x: x

- -
`; - - const doenetML2 = ` - -

Enter y: y

- -
`; - - const doenetML3 = ` - -

Enter z: z

- -
`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1: pageDoenetId, - pageDoenetId2, - pageDoenetId3, - doenetML1, - doenetML2, - doenetML3, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.wait(100); - cy.get('[data-test="Paginate"').click(); - cy.wait(100); //TODO: need the UI to let us know this was successful - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_problem1_title")).should("have.text", "Problem 1"); - - cy.get("#page2").scrollIntoView(); - cy.get(cesc("#page2\\/_problem1_title")).should("have.text", "Problem 2"); - - cy.get("#page3").scrollIntoView(); - cy.get(cesc("#page3\\/_problem1_title")).should("have.text", "Problem 3"); - - cy.get("#page1").scrollIntoView(); - - cy.url().should("match", /#page1$/); - - // cy.get('[data-test="CreditAchieved Menu"]').click(); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "0%"); - - cy.get(cesc("#page1\\/ans") + " textarea").type("x{enter}", { - force: true, - }); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "33.3%"); - - cy.get('[data-test="Item 3 Credit"]').click(); - - cy.get(cesc("#page3\\/_problem1_title")).should("have.text", "Problem 3"); - - cy.url().should("match", /#page3$/); - - cy.get(cesc("#page3\\/ans") + " textarea").type("z{enter}", { - force: true, - }); - - cy.get('[data-test="Item 3 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - - cy.get('[data-test="Item 2 Credit"]').click(); - - cy.get(cesc("#page2\\/_problem1_title")).should("have.text", "Problem 2"); - - cy.url().should("match", /#page2$/); - - cy.get(cesc("#page2\\/ans") + " textarea").type("y{enter}", { - force: true, - }); - - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="Item 1 Credit"]').click(); - - cy.get(cesc("#page1\\/_problem1_title")).should("have.text", "Problem 1"); - - cy.url().should("match", /#page1$/); - }); -}); diff --git a/client/cypress/e2e/AssignedActivity/multipageActivities.cy.js b/client/cypress/e2e/AssignedActivity/multipageActivities.cy.js deleted file mode 100644 index 7a2bbd3c34..0000000000 --- a/client/cypress/e2e/AssignedActivity/multipageActivities.cy.js +++ /dev/null @@ -1,3094 +0,0 @@ -// import {signIn} from '../DoenetSignin/DoenetSignin.cy'; -import { cesc, cesc2 } from "../../../src/_utils/url"; - -describe("Multipage activity tests", function () { - const userId = "cyuserId"; - const studentUserId = "cyStudentUserId"; - // const userId = "devuserId"; - const courseId = "courseid1"; - const doenetId = "activity1id"; - const doenetId2 = "activity2id"; - const pageDoenetId1 = "_page1id"; - const pageDoenetId2 = "_page2id"; - const pageDoenetId3 = "_page3id"; - const pageDoenetId4 = "_page4id"; - - const headerPixels = 40; - - before(() => { - // cy.clearAllOfAUsersActivities({userId}) - cy.signin({ userId }); - cy.clearAllOfAUsersCoursesAndItems({ userId }); - cy.clearAllOfAUsersCoursesAndItems({ userId: studentUserId }); - cy.createCourse({ userId, courseId, studentUserId }); - }); - beforeEach(() => { - cy.signin({ userId }); - cy.clearIndexedDB(); - cy.clearAllOfAUsersActivities({ userId }); - cy.clearAllOfAUsersActivities({ userId: studentUserId }); - }); - - Cypress.on("uncaught:exception", (err, runnable) => { - // returning false here prevents Cypress from - // failing the test - return false; - }); - - it("Changing paginated pages changes hash, does not add to url history", () => { - const doenetML1 = `Page 1`; - - const doenetML2 = `Page 2`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="View Assigned Activity"]').click(); - - cy.get("#page1").should("contain.text", "Page 1"); - - cy.url().should("match", /#page1$/); - - cy.get("[data-test=next]").click(); - - cy.get("#page2").should("contain.text", "Page 2"); - - cy.url().should("match", /#page2$/); - - cy.go("back"); - - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - }); - - it("Changing non-paginated pages changes hash, does not add to url history", () => { - const doenetML1 = `

top 1

bottom 1

`; - const doenetML2 = `

top 2

bottom 2

`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.wait(100); //TODO: is there a reason we need to wait before clicking paginate? - - cy.get('[data-test="Paginate"').click(); - cy.wait(100); //TODO: need the UI to let us know this was successful - - cy.get('[data-test="View Assigned Activity"]').click(); - - cy.get(cesc("#page1\\/top")).should("contain.text", "top 1"); - cy.get(cesc("#page2\\/top")).should("contain.text", "top 2"); - - cy.url().should("match", /#page1$/); - - cy.get(cesc("#page1\\/bottom")).scrollIntoView(); - - cy.url().should("match", /#page1$/); - - cy.get(cesc("#page2\\/top")).scrollIntoView(); - - cy.waitUntil(() => cy.url().should("match", /#page2$/)); - - cy.get(cesc("#page2\\/bottom")).scrollIntoView(); - cy.url().should("match", /#page2$/); - - cy.get(cesc("#page1\\/bottom")).scrollIntoView(); - cy.waitUntil(() => cy.url().should("match", /#page1$/)); - - cy.go("back"); - - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - }); - - it("New attempt starts at page 1, paginated", () => { - const doenetML1 = `

top 1

bottom 1

`; - const doenetML2 = `

top 2

bottom 2

`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/top")).should("contain.text", "top 1"); - - cy.url().should("match", /#page1$/); - - cy.get('[data-test="next"]').click(); - - cy.get(cesc("#page2\\/top")).should("contain.text", "top 2"); - - cy.url().should("match", /#page2$/); - - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 1:", - ); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get(cesc("#page1\\/top")).should("contain.text", "top 1"); - - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 2:", - ); - - cy.url().should("match", /#page1$/); - - cy.log("did not add to url history"); - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - }); - - it("New attempt starts at page 1, non-paginated", () => { - const doenetML1 = `

top 1

bottom 1

`; - const doenetML2 = `

top 2

bottom 2

`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.wait(100); - cy.get('[data-test="Paginate"').click(); - cy.wait(100); //TODO: need the UI to let us know this was successful - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/top")).should("contain.text", "top 1"); - cy.get(cesc("#page2\\/top")).should("contain.text", "top 2"); - - cy.url().should("match", /#page1$/); - - cy.get(cesc("#page2\\/bottom")).scrollIntoView(); - - cy.waitUntil(() => cy.url().should("match", /#page2$/)); - - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 1:", - ); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get(cesc("#page1\\/top")).should("contain.text", "top 1"); - cy.get(cesc("#page2\\/top")).should("contain.text", "top 2"); - - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 2:", - ); - - cy.url().should("match", /#page1$/); - - cy.log("did not add to url history"); - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - }); - - it("Two page activity, paginated, with mutual links", () => { - const doenetML1 = ` -
-

Link to paragraph above aside

-

Link to aside

-

Link to page 2

-

Link to paragraph above page 2 aside

-

Link to page 2 aside

-

Checkbox to make it save state:

- - -

Paragraph above aside

- - - - -
`; - - const doenetML2 = ` -
-

Link to paragraph above aside

-

Link to aside

-

Link to page 1

-

Link to paragraph above page 1 aside

-

Link to page 1 aside

-

Checkbox to make it save state:

- - - -

Paragraph above aside

- - - - -
`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - cy.wait(200); - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("not.exist"); - cy.url().should("match", /#page1$/); - - cy.get('[data-test="Main Panel"]').then((el) => { - expect(el.scrollTop()).eq(0); - }); - - cy.get(cesc("#page1\\/bi")).click(); - cy.get(cesc("#page1\\/b")).should("have.text", "true"); - - cy.get(cesc("#page1\\/toAbove")).click(); - cy.url().should("match", /#page1\\\/pAbove$/); - - cy.get(cesc("#page1\\/pAbove")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should("not.exist"); - - cy.wait(1000); // for debounce - - cy.reload(); - - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should("not.exist"); - - cy.url().should("match", /#page1\\\/pAbove$/); - - cy.get(cesc("#page1\\/pAbove")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2`); - - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/_section1_title")).should("not.exist"); - - cy.url().should("match", /#page2$/); - - cy.get('[data-test="Main Panel"]').then((el) => { - expect(el.scrollTop()).eq(0); - }); - - cy.get(cesc("#page2\\/bi")).click(); - cy.get(cesc("#page2\\/b")).should("have.text", "true"); - - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.get(cesc("#page2\\/toAside1")).click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("not.exist"); - - cy.url().should("match", /#page1\\\/aside$/); - - cy.get(cesc("#page1\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should( - "have.text", - "Content in aside", - ); - - cy.wait(1000); // for debounce - - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2\\/aside`); - - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/_section1_title")).should("not.exist"); - - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should( - "have.text", - "Content in aside", - ); - - cy.url().should("match", /#page2\\\/aside$/); - - cy.waitUntil(() => - cy.get(cesc("#page2\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - return rect.top > headerPixels - 1 && rect.top < headerPixels + 1; - }), - ); - - cy.get(cesc("#page2\\/asideTitle")).click(); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.get("[data-test=previous]").click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("not.exist"); - - cy.url().should("match", /#page1$/); - - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should( - "have.text", - "Content in aside", - ); - - cy.get(cesc("#page1\\/toAbove2")).click(); - - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/_section1_title")).should("not.exist"); - - cy.url().should("match", /#page2\\\/pAbove$/); - - cy.waitUntil(() => - cy.get(cesc("#page2\\/pAbove")).then((el) => { - let rect = el[0].getBoundingClientRect(); - return rect.top > headerPixels - 1 && rect.top < headerPixels + 1; - }), - ); - - cy.get(cesc("#page2\\/bi")).click(); - cy.get(cesc("#page2\\/b")).should("have.text", "false"); - - cy.wait(2000); - - cy.visit(`/course?tool=assignment&doenetId=${doenetId}`); - - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/_section1_title")).should("not.exist"); - - cy.get(cesc("#page2\\/b")).should("have.text", "false"); - - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.url().should("match", /#page2$/); - - cy.get('[data-test="Main Panel"]').then((el) => { - expect(el.scrollTop()).eq(0); - }); - - cy.get(cesc("#page2\\/toAside")).click(); - - cy.get(cesc("#page2\\/insideAside")).should( - "have.text", - "Content in aside", - ); - - cy.url().should("match", /#page2\\\/aside$/); - - cy.get(cesc("#page2\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - }); - - it("Two page activity, non-paginated, with mutual links", () => { - const doenetML1 = ` -
-

Link to paragraph above aside

-

Link to aside

-

Link to page 2

-

Link to paragraph above page 2 aside

-

Link to page 2 aside

-

Checkbox to make it save state:

- - -

Paragraph above aside

- - - - -
`; - - const doenetML2 = ` -
-

Link to paragraph above aside

-

Link to aside

-

Link to page 1

-

Link to paragraph above page 1 aside

-

Link to page 1 aside

-

Checkbox to make it save state:

- - - -

Paragraph above aside

- - - - -
`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="Paginate"').click(); - cy.wait(100); //TODO: need the UI to let us know this was successful - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.url().should("match", /#page1$/); - - cy.get('[data-test="Main Panel"]').then((el) => { - expect(el.scrollTop()).eq(0); - }); - - cy.get(cesc("#page1\\/bi")).click(); - cy.get(cesc("#page1\\/b")).should("have.text", "true"); - - cy.log("scroll to page 2 to initialize it"); - cy.get(cesc("#page1\\/toPage2")).click(); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - - cy.get(cesc("#page2\\/bi")).click(); - cy.get(cesc("#page2\\/b")).should("have.text", "true"); - - cy.get(cesc("#page2\\/toAbove1")).click(); - cy.url().should("match", /#page1\\\/pAbove$/); - - cy.get(cesc("#page1\\/pAbove")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should("not.exist"); - - cy.wait(1000); // for debounce - - cy.reload(); - - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should("not.exist"); - - cy.url().should("match", /#page1\\\/pAbove$/); - - cy.get(cesc("#page1\\/pAbove")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.wait(100); - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2`); - - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - - cy.url().should("match", /#page2$/); - - cy.get("#page2").then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should("not.exist"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.get(cesc("#page2\\/toAside1")).click(); - - cy.get(cesc("#page1\\/insideAside")).should( - "have.text", - "Content in aside", - ); - - cy.url().should("match", /#page1\\\/aside$/); - - cy.get(cesc("#page1\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.wait(1000); // for debounce - - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2\\/aside`); - - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should( - "have.text", - "Content in aside", - ); - - cy.url().should("match", /#page2\\\/aside$/); - - cy.get(cesc("#page2\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#page2\\/asideTitle")).click(); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.get("#page1").scrollIntoView(); - - cy.url().should("match", /#page1$/); - - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should( - "have.text", - "Content in aside", - ); - - cy.get(cesc("#page1\\/toAbove2")).click(); - - cy.url().should("match", /#page2\\\/pAbove$/); - - cy.get(cesc("#page2\\/pAbove")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#page2\\/bi")).click(); - cy.get(cesc("#page2\\/b")).should("have.text", "false"); - - cy.wait(2000); - - cy.visit(`/course?tool=assignment&doenetId=${doenetId}`); - - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - - cy.get(cesc("#page2\\/b")).should("have.text", "false"); - - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.waitUntil(() => cy.url().should("match", /#page2$/)); - - // Note sure why the rect of page2 does not appear to be at the top - // cy.get('#page2').then(el => { - // let rect = el[0].getBoundingClientRect(); - // expect(rect.top).gt(headerPixels-1).lt(headerPixels+1) - // }) - - cy.get(cesc("#page2\\/toAside")).click(); - - cy.get(cesc("#page2\\/insideAside")).should( - "have.text", - "Content in aside", - ); - - cy.url().should("match", /#page2\\\/aside$/); - - cy.get(cesc("#page2\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - }); - - it("Links to paginated two-page activity", () => { - const doenetML1 = ` -
-

Checkbox to make it save state:

- - -

Paragraph above aside

- - - - -
`; - - const doenetML2 = ` -
-

Checkbox to make it save state:

- - - -

Paragraph above aside

- - - - -
`; - - const doenetMLother = ` -

Link to page 1

-

Link to page 1 aside

-

Link to page 2

-

Link to page 2 aside

-

Alternative link to page 2

-

Link to page 2 aside

-`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - cy.createActivity({ - courseId, - doenetId: doenetId2, - parentDoenetId: courseId, - pageDoenetId: pageDoenetId3, - doenetML: doenetMLother, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 2); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.wait(100); - // TODO: should not have to wait here. It seems like this a bug - // Without the wait get into an inconsistent situation where the activity does appear for the student, - // but when click "View Activity" it says the assignment is not assigned - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.url().should("match", /#page1$/); - - cy.get(cesc("#page1\\/bi")).click(); - cy.get(cesc("#page1\\/b")).should("have.text", "true"); - - cy.log("move to page 2 to initialize it"); - cy.get("[data-test=next]").click(); - cy.get("#page2").scrollIntoView(); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - - cy.get(cesc("#page2\\/bi")).click(); - cy.get(cesc("#page2\\/b")).should("have.text", "true"); - - cy.wait(1500); // for debounce - - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - - cy.signin({ userId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 2); //Need this to wait for the row to appear - - cy.get(".navigationRow").eq(1).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.wait(100); - // TODO: should not have to wait here. It seems like this a bug - // Without the wait get into an inconsistent situation where the activity does appear for the student, - // but when click "View Activity" it says the assignment is not assigned - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 2); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(1).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/_p1")).should("have.text", "Link to page 1"); - - cy.log("click link to page 1, remove target so uses same tab"); - cy.get(cesc("#\\/toPage1")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("not.exist"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should("not.exist"); - - cy.url().should("match", /#page1$/); - cy.url().should("contain", doenetId); - - cy.go("back"); - cy.url().should("contain", doenetId2); - - cy.log("click link to page 2, remove target so uses same tab"); - cy.get(cesc("#\\/toPage2")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/_section1_title")).should("not.exist"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.url().should("match", /#page2$/); - cy.url().should("contain", doenetId); - - cy.go("back"); - cy.url().should("contain", doenetId2); - - cy.log("click link to aside from page 1, remove target so uses same tab"); - cy.get(cesc("#\\/toAside1")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#page1\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("not.exist"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#page1\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.get(cesc("#page1\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.wait(1500); // wait for debounce - - cy.go("back"); - cy.url().should("contain", doenetId2); - - cy.log("click link to aside from page 2, remove target so uses same tab"); - cy.get(cesc("#\\/toAside2")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#page2\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/_section1_title")).should("not.exist"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#page2\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.get(cesc("#page2\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#page2\\/aside_title")).click(); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.wait(1500); // wait for debounce - - cy.go("back"); - cy.url().should("contain", doenetId2); - - cy.wait(100); - cy.log("click link b to page 2, remove target so uses same tab"); - cy.get(cesc("#\\/toPage2b")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/_section1_title")).should("not.exist"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.url().should("match", /#page2$/); - cy.url().should("contain", doenetId); - - cy.go("back"); - cy.url().should("contain", doenetId2); - - cy.log("click link b to aside from page 2, remove target so uses same tab"); - cy.get(cesc("#\\/toAside2b")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#page2\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/_section1_title")).should("not.exist"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#page2\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.get(cesc("#page2\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - }); - - it("Links to non-paginated two-page activity", () => { - const doenetML1 = ` -
-

Checkbox to make it save state:

- - -

Paragraph above aside

- - - - -
`; - - const doenetML2 = ` -
-

Checkbox to make it save state:

- - - -

Paragraph above aside

- - - - -
`; - - const doenetMLother = ` -

Link to page 1

-

Link to page 1 aside

-

Link to page 2

-

Link to page 2 aside

-

Alternative link to page 2

-

Link to page 2 aside

-`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - cy.createActivity({ - courseId, - doenetId: doenetId2, - parentDoenetId: courseId, - pageDoenetId: pageDoenetId3, - doenetML: doenetMLother, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 2); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="Paginate"]').click(); - cy.wait(100); //TODO: need the UI to let us know this was successful - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.url().should("match", /#page1$/); - - cy.get(cesc("#page1\\/bi")).click(); - cy.get(cesc("#page1\\/b")).should("have.text", "true"); - - cy.log("scroll to page 2 to initialize it"); - cy.get("#page2").scrollIntoView(); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - - cy.get(cesc("#page2\\/bi")).click(); - cy.get(cesc("#page2\\/b")).should("have.text", "true"); - - cy.wait(1500); // for debounce - - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - - cy.signin({ userId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 2); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(1).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - cy.wait(100); - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 2); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(1).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/_p1")).should("have.text", "Link to page 1"); - - cy.wait(100); - - cy.log("click link to page 1, remove target so uses same tab"); - cy.get(cesc("#\\/toPage1")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should("not.exist"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - // cy.url().should('match', /#page1$/) // don't know why this randomly fails - cy.url().should("contain", doenetId); - - cy.go("back"); - cy.url().should("contain", doenetId2); - - cy.log("click link to page 2, remove target so uses same tab"); - cy.get(cesc("#\\/toPage2")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should("not.exist"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.url().should("match", /#page2$/); - cy.url().should("contain", doenetId); - - cy.go("back"); - cy.url().should("contain", doenetId2); - - cy.wait(100); - cy.log("click link to aside from page 1, remove target so uses same tab"); - cy.get(cesc("#\\/toAside1")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#page1\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.url().should("match", /#page1\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.get(cesc("#page1\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.wait(1500); // wait for debounce - - cy.go("back"); - cy.url().should("contain", doenetId2); - - cy.wait(100); - cy.log("click link to aside from page 2, remove target so uses same tab"); - cy.get(cesc("#\\/toAside2")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#page2\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#page2\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.get(cesc("#page2\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#page2\\/aside_title")).click(); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.wait(1500); // wait for debounce - - cy.go("back"); - cy.url().should("contain", doenetId2); - - cy.log("click link b to page 2, remove target so uses same tab"); - cy.get(cesc("#\\/toPage2b")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.url().should("match", /#page2$/); - cy.url().should("contain", doenetId); - - cy.go("back"); - cy.url().should("contain", doenetId2); - - cy.log("click link b to aside from page 2, remove target so uses same tab"); - cy.get(cesc("#\\/toAside2b")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#page2\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#page2\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.get(cesc("#page2\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - }); - - it("Go directly to URLs of paginated two-page activity", () => { - const doenetML1 = ` -
-

Checkbox to make it save state:

- - -

Paragraph above aside

- - - - -
`; - - const doenetML2 = ` -
-

Checkbox to make it save state:

- - - -

Paragraph above aside

- - - - -
`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - cy.wait(100); - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.log("go to page 1 url"); - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page1`); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("not.exist"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should("not.exist"); - - cy.get(cesc("#page1\\/bi")).click(); - cy.get(cesc("#page1\\/b")).should("have.text", "true"); - - cy.url().should("match", /#page1$/); - cy.url().should("contain", doenetId); - - cy.wait(1500); // for debounce - - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - - cy.log("go to page 2 url"); - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2`); - - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/_section1_title")).should("not.exist"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.get(cesc("#page2\\/bi")).click(); - cy.get(cesc("#page2\\/b")).should("have.text", "true"); - - cy.url().should("match", /#page2$/); - cy.url().should("contain", doenetId); - - cy.wait(1500); // for debounce - - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - - cy.log("go to page 1 aside url"); - cy.wait(100); - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page1\\/aside`); - - cy.get(cesc("#page1\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("not.exist"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#page1\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.get(cesc("#page1\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.wait(1500); // wait for debounce - - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - - cy.log("go to page 2 aside url"); - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2\\/aside`); - - cy.get(cesc("#page2\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/_section1_title")).should("not.exist"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#page2\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.get(cesc("#page2\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - }); - - it("Go directly to URLs of non-paginated two-page activity", () => { - const doenetML1 = ` -
-

Checkbox to make it save state:

- - -

Paragraph above aside

- - - - -
`; - - const doenetML2 = ` -
-

Checkbox to make it save state:

- - - -

Paragraph above aside

- - - - -
`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="Paginate"').click(); - cy.wait(100); //TODO: need the UI to let us know this was successful - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.url().should("match", /#page1$/); - - cy.get(cesc("#page1\\/bi")).click(); - cy.get(cesc("#page1\\/b")).should("have.text", "true"); - - cy.log("scroll to page 2 to initialize it"); - cy.get("#page2").scrollIntoView(); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - - cy.get(cesc("#page2\\/bi")).click(); - cy.get(cesc("#page2\\/b")).should("have.text", "true"); - - cy.wait(1500); // for debounce - - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - - cy.wait(200); - - cy.log("go to page 1 url"); - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page1`); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should("not.exist"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - // cy.url().should('match', /#page1$/) // don't know why this randomly fails - cy.url().should("contain", doenetId); - - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - - cy.log("go to page 2 url"); - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2`); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page1\\/insideAside")).should("not.exist"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.url().should("match", /#page2$/); - cy.url().should("contain", doenetId); - - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - - cy.log("go to page 1 aside url"); - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page1\\/aside`); - - cy.get(cesc("#page1\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/insideAside")).should("not.exist"); - - cy.url().should("match", /#page1\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.get(cesc("#page1\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.wait(1500); // wait for debounce - - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - - cy.log("go to page 2 aside url"); - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2\\/aside`); - - cy.get(cesc("#page2\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/insideAside")).should( - "have.text", - "Content in aside", - ); - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#page2\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#page2\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.get(cesc("#page2\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - }); - - it("Switching pages scrolls to top", () => { - const doenetML1 = ` -Page 1 -

To bottom link

- - - -

Go to page 2

- - -`; - - const doenetML2 = ` -Page 2 -

To bottom link

- - - -

Go to page 1

- - -`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="View Assigned Activity"]').click(); - - cy.log("make sure both pages are rendered"); - cy.get(cesc("#page1\\/_title1")).should("have.text", "Page 1"); - cy.get("[data-test=next]").click(); - - cy.get(cesc("#page2\\/_title1")).should("have.text", "Page 2"); - cy.url().should("match", /#page2$/); - - cy.get(cesc("#page2\\/toBottom")).click(); - cy.url().should("match", /#page2\\\/pBottom$/); - - cy.get(cesc("#page2\\/pBottom")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.log("go to page 1 via bottom button"); - cy.get("[data-test=previous-bottom").click(); - - cy.get(cesc("#page1\\/_title1")).should("have.text", "Page 1"); - cy.url().should("match", /#page1$/); - - cy.get('[data-test="Main Panel"]').then((el) => { - expect(el.scrollTop()).eq(0); - }); - - cy.get(cesc("#page1\\/toBottom")).click(); - cy.url().should("match", /#page1\\\/pBottom$/); - - cy.get(cesc("#page1\\/pBottom")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.log("go to page 2 via bottom button"); - cy.get("[data-test=next-bottom").click(); - - cy.get(cesc("#page2\\/_title1")).should("have.text", "Page 2"); - cy.url().should("match", /#page2$/); - - cy.get('[data-test="Main Panel"]').then((el) => { - expect(el.scrollTop()).eq(0); - }); - - cy.get(cesc("#page2\\/toBottom")).click(); - cy.url().should("match", /#page2\\\/pBottom$/); - - cy.get(cesc("#page2\\/pBottom")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.log("go to page 1 via bottom link"); - cy.get(cesc("#page2\\/toPage1")).click(); - - cy.get(cesc("#page1\\/_title1")).should("have.text", "Page 1"); - cy.url().should("match", /#page1$/); - - cy.get('[data-test="Main Panel"]').then((el) => { - expect(el.scrollTop()).eq(0); - }); - - cy.get(cesc("#page1\\/toBottom")).click(); - cy.url().should("match", /#page1\\\/pBottom$/); - - cy.get(cesc("#page1\\/pBottom")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.log("go to page 2 via bottom link"); - cy.get(cesc("#page1\\/toPage2")).click(); - - cy.get(cesc("#page2\\/_title1")).should("have.text", "Page 2"); - cy.url().should("match", /#page2$/); - - cy.get('[data-test="Main Panel"]').then((el) => { - expect(el.scrollTop()).eq(0); - }); - }); - - it("paginated two-page activity remembers page", () => { - const doenetML1 = ` -
-

Checkbox to make it save state:

- - -

Paragraph above aside

- - - - -
`; - - const doenetML2 = ` -
-

Checkbox to make it save state:

- - - -

Paragraph above aside

- - - - -
`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - cy.wait(100); - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.url().should("match", /#page1$/); - - cy.get(cesc("#page1\\/bi")).click(); - cy.get(cesc("#page1\\/b")).should("have.text", "true"); - - cy.log("go to page 2"); - cy.get("[data-test=next").click(); - - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - - cy.get(cesc("#page2\\/bi")).click(); - cy.get(cesc("#page2\\/b")).should("have.text", "true"); - - cy.wait(1500); // for debounce - - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - - cy.log("remembers were last on page 2"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - cy.get(cesc("#page1\\/_section1_title")).should("not.exist"); - - cy.url().should("match", /#page2$/); - cy.url().should("contain", doenetId); - }); - - it("non-paginated two-page activity remembers page", () => { - const doenetML1 = ` -
-

Checkbox to make it save state:

- - -

Paragraph above aside

- - - - -
`; - - const doenetML2 = ` -
-

Checkbox to make it save state:

- - - -

Paragraph above aside

- - - - -
`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="Paginate"').click(); - cy.wait(100); //TODO: need the UI to let us know this was successful - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.url().should("match", /#page1$/); - - cy.get(cesc("#page1\\/bi")).click(); - cy.get(cesc("#page1\\/b")).should("have.text", "true"); - - cy.log("scroll to page 2 to initialize it"); - cy.get("#page2").scrollIntoView(); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - - cy.get(cesc("#page2\\/bi")).click(); - cy.get(cesc("#page2\\/b")).should("have.text", "true"); - - cy.wait(1500); // for debounce - - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - - cy.log("remembers were last on page 2"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#page2\\/_section1_title")).should("have.text", "Section 2"); - - cy.waitUntil(() => cy.url().should("match", /#page2$/)); - - cy.url().should("contain", doenetId); - }); - - it("Update to new version", () => { - const doenetML1 = ` - -

What is 1+1? 2

-

Current response:

-

Credit:

-
`; - - const doenetML2 = ` - -

What is 2+2? 4

-

Current response:

-

Credit:

-
`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/ans") + " textarea").type("2{enter}", { - force: true, - }); - cy.get(cesc("#page1\\/credit")).should("have.text", "1"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "50%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "50%"); - - cy.go("back"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/cr")).should("contain.text", "2"); - cy.get(cesc("#page1\\/credit")).should("have.text", "1"); - - cy.get(cesc("#page1\\/ans") + " textarea").type( - "{end}{backspace}1{enter}", - { force: true }, - ); - - cy.log( - "At least for now, hitting enter before core is intialized does not submit response", - ); - cy.get(cesc("#page1\\/cr")).should("contain.text", "1"); - cy.get(cesc("#page1\\/ans") + " textarea").type("{enter}", { force: true }); - - cy.get(cesc("#page1\\/credit")).should("have.text", "0"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "50%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "50%"); - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+2? 3

{enter}{ctrl+s}", - ); - - cy.go("back"); - - cy.get(".navigationRow").eq(0).click(); - cy.get('[data-test="Assign Activity"]').click(); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/cr")).should("contain.text", "1"); - cy.get(cesc("#page1\\/ans2")).should("not.exist"); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - - cy.get("[data-test=CancelNewVersion]").click(); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - "new version", - ); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - cy.get("[data-test=ConfirmNewVersion]").click(); - - cy.get(cesc("#page1\\/cr")).should("contain.text", "\uff3f"); //Times out here - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "50%"); - - cy.get(cesc("#page1\\/ans2") + " textarea").type("3{enter}", { - force: true, - }); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "50%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "25%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "50%"); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get(cesc("#page1\\/cr")).should("contain.text", "\uff3f"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "50%"); - - cy.get("[data-test=next]").click(); - cy.get(cesc("#page2\\/cr")).should("contain.text", "\uff3f"); - - cy.get("[data-test=previous]").click(); - cy.get(cesc("#page1\\/cr")).should("contain.text", "\uff3f"); - - cy.get("[data-test=next]").click(); - cy.get(cesc("#page2\\/cr")).should("contain.text", "\uff3f"); - - cy.wait(1500); // just making sure nothing gets saved even if wait for debounce - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+3? 4

{enter}{ctrl+s}", - ); - - cy.go("back"); - - cy.get(".navigationRow").eq(0).click(); - cy.get('[data-test="Assign Activity"]').click(); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.log("immediately get new version"); - cy.get('[data-test="View Activity"]').click(); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "50%"); - - cy.get(cesc("#page1\\/ans3") + " textarea").type("4{enter}", { - force: true, - }); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "33.3%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "16.7%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "50%"); - - cy.get("[data-test=next]").click(); - - cy.get(cesc("#page2\\/ans") + " textarea").type("4{enter}", { - force: true, - }); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "33.3%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "66.7%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - - cy.go("back"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page2\\/cr")).should("contain.text", "4"); - cy.get(cesc("#page2\\/credit")).should("have.text", "1"); - - cy.get(cesc("#page2\\/ans") + " textarea").type( - "{end}{backspace}1{enter}", - { force: true }, - ); - - cy.log( - "At least for now, hitting enter before core is intialized does not submit response", - ); - cy.get(cesc("#page2\\/cr")).should("contain.text", "1"); - cy.get(cesc("#page2\\/ans") + " textarea").type("{enter}", { force: true }); - - cy.get(cesc("#page2\\/credit")).should("have.text", "0"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "33.3%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "66.7%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get('[data-test="folderToggleOpenIcon"]').click(); - - cy.get(".navigationRow").eq(2).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Page"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 2+3? 5

{enter}{ctrl+s}", - ); - - cy.go("back"); - - cy.get(".navigationRow").eq(0).click(); - cy.get('[data-test="Assign Activity"]').click(); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page2\\/cr")).should("contain.text", "1"); - cy.get(cesc("#page2\\/ans2")).should("not.exist"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "33.3%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "66.7%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - - cy.get("[data-test=CancelNewVersion]").click(); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - "new version", - ); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - cy.get("[data-test=ConfirmNewVersion]").click(); - - cy.get(cesc("#page1\\/cr")).should("contain.text", "\uff3f"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - - cy.get("[data-test=next]").click(); - - cy.get(cesc("#page2\\/ans2") + " textarea").type( - "{end}{backspace}5{enter}", - { force: true }, - ); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "50%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "25%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get(cesc("#page1\\/cr")).should("contain.text", "\uff3f"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - - cy.get("[data-test=next]").click(); - cy.get(cesc("#page2\\/cr")).should("contain.text", "\uff3f"); - - cy.get("[data-test=previous]").click(); - cy.get(cesc("#page1\\/cr")).should("contain.text", "\uff3f"); - - cy.get("[data-test=next]").click(); - cy.get(cesc("#page2\\/cr")).should("contain.text", "\uff3f"); - - cy.wait(1500); // just making sure nothing gets saved even if wait for debounce - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(2).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Page"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 2+4? 6

{enter}{ctrl+s}", - ); - - cy.go("back"); - - cy.get(".navigationRow").eq(0).click(); - cy.get('[data-test="Assign Activity"]').click(); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/cr")).should("contain.text", "\uff3f"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - - cy.get("[data-test=next]").click(); - - cy.get(cesc("#page2\\/ans3") + " textarea").type( - "{end}{backspace}6{enter}", - { force: true }, - ); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "33.3%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "16.7%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "66.7%"); - }); - - it("Clicking links does not give update version prompt", () => { - const doenetML = ` -
- Info only -

This activity is just information only, with no interactive content. - Go to page 1. - Go to page 2. - Go to page 3. -

- - -
-`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - pageDoenetId3, - doenetML1: doenetML, - doenetML2: doenetML, - doenetML3: doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/sect_title")).should( - "have.text", - "Section 1: Info only", - ); - - cy.get(cesc("#page1\\/goPage2")).click(); - cy.get(cesc("#page2\\/sect_title")).should( - "have.text", - "Section 2: Info only", - ); - - cy.get(cesc("#page2\\/goPage3")).click(); - cy.get(cesc("#page3\\/sect_title")).should( - "have.text", - "Section 3: Info only", - ); - - cy.get("[data-test=previous]").click(); - cy.get(cesc("#page2\\/sect_title")).should( - "have.text", - "Section 2: Info only", - ); - - cy.get(cesc("#page2\\/goPage1")).click(); - cy.get(cesc("#page1\\/sect_title")).should( - "have.text", - "Section 1: Info only", - ); - - cy.wait(2000); // wait for debounce - cy.get('[data-test="Crumb 2"]').click(); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

Extra content 1

{enter}", - ); - - cy.go("back"); - - cy.get('[data-test="folderToggleOpenIcon"]').click(); - - cy.get(".navigationRow").eq(2).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Page"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

Extra content 2

{enter}", - ); - - cy.go("back"); - - cy.get(".navigationRow").eq(3).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Page"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

Extra content 3

{enter}", - ); - - cy.go("back"); - - cy.get(".navigationRow").eq(0).click(); - cy.get('[data-test="Assign Activity"]').click(); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/extra1")).should("have.text", "Extra content 1"); - - cy.get("[data-test=NewVersionAvailable]").should("not.exist"); - - cy.get(cesc("#page1\\/goPage3")).click(); - cy.get(cesc("#page3\\/extra3")).should("have.text", "Extra content 3"); - - cy.get(cesc("#page3\\/goPage2")).click(); - cy.get(cesc("#page2\\/extra2")).should("have.text", "Extra content 2"); - - cy.get("[data-test=NewVersionAvailable]").should("not.exist"); - }); - - it("Increase from one to two page activity, page one info only", () => { - const doenetML = ` -
- Info only -
-`; - - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId: pageDoenetId1, - doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/sect_title")).should("have.text", "Info only"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("not.exist"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.wait(2000); // wait for debounce - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Add Page"]').click(); - cy.get(".navigationRow") - .eq(0) - .get('[data-test="folderToggleOpenIcon"]') - .click(); - - cy.get(".navigationRow").eq(2).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Page"]').click(); - - cy.get(".cm-content").type( - 'Page 1{enter}

x: x

{enter}', - ); - - cy.go("back"); - - cy.get(".navigationRow").eq(0).click(); - cy.get('[data-test="Assign Activity"]').click(); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/sect_title")).should("have.text", "Info only"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - - // assignment and attempt percent are still at 100%, but don't insist on it - - cy.get("[data-test=NewVersionAvailable]").should("not.exist"); - - cy.get("[data-test=next]").click(); - - cy.get(cesc("#page2\\/_title1")).should("have.text", "Page 1"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "50%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "50%"); - - cy.get(cesc("#page2\\/ans") + " textarea").type("x{enter}", { - force: true, - }); - - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get("[data-test=NewVersionAvailable]").should("not.exist"); - }); - - it("Change number of pages in activity", () => { - const doenetML = ` - -

1: 1

-
-`; - - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId: pageDoenetId1, - doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - cy.wait(1500); - - cy.get(cesc("#\\/prob_title")).should("have.text", "Problem 1"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("not.exist"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "0%"); - - cy.wait(1500); // wait for debounce - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.log("increase to two pages, no new version prompt"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Add Page"]').click(); - cy.get(".navigationRow") - .eq(0) - .get('[data-test="folderToggleOpenIcon"]') - .click(); - - cy.get(".navigationRow").eq(2).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Page"]').click(); - - cy.get(".cm-content").type( - '{enter}

2: 2

{enter}
{enter}', - ); - - cy.go("back"); - - cy.get(".navigationRow").eq(0).click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); // wait for update - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/prob_title")).should("have.text", "Problem 1"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "0%"); - - cy.get("[data-test=NewVersionAvailable]").should("not.exist"); - - cy.get("[data-test=next]").click(); - - cy.get(cesc("#page2\\/prob_title")).should("have.text", "Problem 2"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "0%"); - - cy.get("[data-test=NewVersionAvailable]").should("not.exist"); - - cy.wait(2000); // wait for debounce - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.log("decrease to one page, no new version prompt"); - cy.get(".navigationRow").eq(2).find(".navigationColumn1").click(); - cy.get('[data-test="Delete Page"]').click(); - - cy.get('[data-test="Main Panel"]').click(); //Deselect selection - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); // wait for update - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/prob_title")).should("have.text", "Problem 1"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("not.exist"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "0%"); - - cy.get("[data-test=NewVersionAvailable]").should("not.exist"); - - cy.get(cesc("#\\/ans") + " textarea").type("1{enter}", { force: true }); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.log("Add second page, get new version prompt"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Add Page"]').click(); - - cy.get(".navigationRow").should("have.length", 3); - cy.get(".navigationRow").eq(2).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Page"]').click(); - - cy.get(".cm-content").type( - '{enter}

2: 2

{enter}
{enter}', - ); - - cy.go("back"); - - cy.get(".navigationRow").eq(0).click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); // wait for update - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/prob_title")).should("have.text", "Problem 1"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("not.exist"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get("[data-test=next]").should("not.exist"); - - cy.get("[data-test=NewVersionAvailable]").click(); - - cy.get("[data-test=ConfirmNewVersion]").click(); - - cy.get(cesc("#page1\\/prob_title")).should("have.text", "Problem 1"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get("[data-test=next]").click(); - - cy.get(cesc("#page2\\/prob_title")).should("have.text", "Problem 2"); - - cy.get(cesc("#page2\\/ans") + " textarea").type("2{enter}", { - force: true, - }); - - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "50%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.go("back"); - - cy.log("Delete second page, get new version prompt"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(2).find(".navigationColumn1").click(); - cy.get('[data-test="Delete Page"]').click(); - - cy.get('[data-test="Main Panel"]').click(); //Deselect selection - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); // wait for update - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page2\\/prob_title")).should("have.text", "Problem 2"); - - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "50%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get("[data-test=NewVersionAvailable]").click(); - - cy.get("[data-test=ConfirmNewVersion]").click(); - - cy.get(cesc("#\\/prob_title")).should("have.text", "Problem 1"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("not.exist"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans") + " textarea").type("1{enter}", { force: true }); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - }); - - // TODO: figure out how to get the gradebook to reload and show the new attempt - it.skip("Finish button submits and saves state ", () => { - const doenetML1 = `1: 11`; - const doenetML2 = `2: 22`; - const doenetML3 = `3: 33`; - const doenetML4 = `4: 44`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - pageDoenetId3, - pageDoenetId4, - doenetML1, - doenetML2, - doenetML3, - doenetML4, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Show Finish Button"]').click(); - - cy.get('[data-test="Show Solution"]').click(); - - cy.get('[data-test="Show Correctness"]').click(); - - cy.get('[data-test="Show Credit Achieved Menu"]').click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - cy.wait(100); - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#page1\\/_answer1") + " textarea").type("1", { force: true }); //Times out here - - cy.get('[data-test="Item 1 Credit"]').should("not.exist"); - cy.get('[data-test="Item 2 Credit"]').should("not.exist"); - cy.get('[data-test="Item 3 Credit"]').should("not.exist"); - cy.get('[data-test="Item 4 Credit"]').should("not.exist"); - cy.get('[data-test="Assignment Percent"]').should("not.exist"); - cy.get(cesc("#page1\\/_solution1")).should("not.exist"); - - cy.get("[data-test=next]").click(); - - cy.get(cesc("#page2\\/_answer1") + " textarea").type("2", { force: true }); - cy.get(cesc("#page2\\/_solution1")).should("not.exist"); - - cy.get("[data-test=next]").click(); - - cy.get(cesc("#page3\\/_answer1") + " textarea").type("3", { force: true }); - cy.get(cesc("#page3\\/_solution1")).should("not.exist"); - - cy.get("[data-test=next]").click(); - - cy.get(cesc("#page4\\/_answer1") + " textarea").type("4", { force: true }); - cy.get(cesc("#page4\\/_solution1")).should("not.exist"); - - cy.get("[data-test=FinishAssessmentPrompt]").click(); - cy.get("[data-test=CancelFinishAssessment]").click(); - cy.get("[data-test=FinishAssessmentPrompt]").click(); - cy.get("[data-test=ConfirmFinishAssessment]").click(); - - cy.get("h1").should("contain.text", "finished"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.visit( - `/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`, - ); - - cy.get(cesc(`#page4\\/_answer1`) + ` .mq-editable-field`).should( - "have.text", - "4", - ); - cy.get(cesc(`#page4\\/_answer1_correct`)).should("be.visible"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#page4\\/_solution1")).click(); - cy.get(cesc("#page4\\/_solution1")).should("contain.text", "4"); - - cy.get("[data-test=previous]").click(); - - cy.get(cesc(`#page3\\/_answer1`) + ` .mq-editable-field`).should( - "have.text", - "3", - ); - cy.get(cesc(`#page3\\/_answer1_correct`)).should("be.visible"); - - cy.get(cesc("#page3\\/_solution1")).click(); - cy.get(cesc("#page3\\/_solution1")).should("contain.text", "3"); - - cy.get('[data-test="Item 1 Credit"]').click(); - - cy.get(cesc(`#page1\\/_answer1`) + ` .mq-editable-field`).should( - "have.text", - "1", - ); - cy.get(cesc(`#page1\\/_answer1_correct`)).should("be.visible"); - - cy.get(cesc("#page1\\/_solution1")).click(); - cy.get(cesc("#page1\\/_solution1")).should("contain.text", "1"); - - cy.get("[data-test=next]").click(); - - cy.get(cesc(`#page2\\/_answer1`) + ` .mq-editable-field`).should( - "have.text", - "2", - ); - cy.get(cesc(`#page2\\/_answer1_correct`)).should("be.visible"); - - cy.get(cesc("#page2\\/_solution1")).click(); - cy.get(cesc("#page2\\/_solution1")).should("contain.text", "2"); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc(`#page4\\/_answer1`) + ` .mq-editable-field`).should( - "have.text", - "4", - ); - cy.get(cesc(`#page4\\/_answer1_saved`)).should("be.visible"); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get(cesc(`#page1\\/_answer1`)).should("be.visible"); - cy.get(cesc(`#page1\\/_answer1_submit`)).should("be.visible"); - cy.get(cesc("#page1\\/_solution1")).should("not.exist"); - - cy.get("[data-test=next]").click(); - - cy.get(cesc("#page2\\/_answer1") + " textarea").type("2", { force: true }); - cy.get(cesc("#page2\\/_solution1")).should("not.exist"); - - cy.get("[data-test=FinishAssessmentPrompt]").click(); - cy.get("[data-test=ConfirmFinishAssessment]").click(); - - cy.get("h1").should("contain.text", "finished"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "25%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - // TODO: how do we get the gradebook to reload and show the new attempt? - cy.reload(); - cy.visit( - `/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`, - ); - cy.reload(); - cy.visit( - `/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`, - ); - - cy.get(cesc(`#page2\\/_answer1`) + ` .mq-editable-field`).should( - "have.text", - "2", - ); - cy.get(cesc(`#page2\\/_answer1_correct`)).should("be.visible"); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%"); - cy.get('[data-test="Item 3 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Item 4 Credit"]').should("have.text", "0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "25%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#page2\\/_solution1")).click(); - cy.get(cesc("#page2\\/_solution1")).should("contain.text", "2"); - - cy.get("[data-test=next]").click(); - }); - - it("Change pages with navigateToTarget action and choiceinput", () => { - const doenetML1 = ` - - - - - - -

Page 1

- - - Page 1 - Page 2 - Page 3 - - - - - - `; - - const doenetML2 = `Page 2`; - const doenetML3 = `Page 3`; - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - pageDoenetId3, - doenetML1, - doenetML2, - doenetML3, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="View Assigned Activity"]').click(); - - cy.get("#page1").should("contain.text", "Page 1"); - - cy.url().should("match", /#page1$/); - - cy.get(cesc(`#page1\\/moveToPage`)).select("2"); - - cy.get("#page2").should("contain.text", "Page 2"); - - cy.url().should("match", /#page2$/); - - cy.get("[data-test=previous]").click(); - - cy.get("#page1").should("contain.text", "Page 1"); - - cy.url().should("match", /#page1$/); - - cy.get(cesc(`#page1\\/moveToPage`)).select("3"); - - cy.get("#page3").should("contain.text", "Page 3"); - - cy.url().should("match", /#page3$/); - - cy.get("[data-test=previous]").click(); - - cy.get("#page2").should("contain.text", "Page 2"); - - cy.url().should("match", /#page2$/); - - cy.get("[data-test=previous]").click(); - - cy.get("#page1").should("contain.text", "Page 1"); - - cy.url().should("match", /#page1$/); - }); - - it("Finish assessment button", () => { - const doenetML1 = ` -

What is 1+1? 2

-

What is 1+2? 3

- `; - const doenetML2 = ` -

What is 2+2? 4

-

What is 2+3? 5

- `; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - - cy.createMultipageActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId1, - pageDoenetId2, - doenetML1, - doenetML2, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).get(".navigationColumn1").click(); - - cy.get('[data-test="Show Finish Button"]').click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.wait(100); - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc2("#page1/ans2") + " textarea").type("2", { - force: true, - }); - - cy.get('[data-test="FinishAssessmentPrompt"]').click(); - - cy.get('[data-test="CancelFinishAssessment"]').click(); - cy.get('[data-test="FinishAssessmentPrompt"]').click(); - - cy.get('[data-test="ConfirmFinishAssessment"]').click(); - - // Note: we have two places where credit achieved shows up, so their values are concatenated - cy.get('[data-test="Item 1 Credit"]').should("have.text", "50%50%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "0%0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "25%25%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "25%25%"); - cy.get('[data-test="Final Score"]').should("have.text", "2.52.5"); - - cy.log("go back to assignment"); - cy.visit(`/course?tool=assignment&doenetId=${doenetId}`); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "50%"); - - cy.log("take second attempt"); - cy.get('[data-test="New Attempt"]').click(); - - cy.get(cesc2("#page1/ans3") + " textarea").type("3", { - force: true, - }); - - cy.get("[data-test=next]").click(); - cy.get(cesc2("#page2/ans4") + " textarea").type("4{enter}", { - force: true, - }); - - cy.get('[data-test="Item 2 Credit"]').should("have.text", "50%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%"); - - cy.get(cesc2("#page2/ans5") + " textarea").type("5", { - force: true, - }); - - cy.get('[data-test="FinishAssessmentPrompt"]').click(); - cy.get('[data-test="ConfirmFinishAssessment"]').click(); - - // Note: we have two places where credit achieved shows up, so their values are concatenated - cy.get('[data-test="Item 1 Credit"]').should("have.text", "50%50%"); - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%100%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "75%75%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "75%75%"); - cy.get('[data-test="Final Score"]').should("have.text", "7.57.5"); - - cy.log("go back to assignment"); - - cy.visit(`/course?tool=assignment&doenetId=${doenetId}`); - - cy.get('[data-test="Item 1 Credit"]').should("have.text", "50%"); - - cy.log("take third attempt"); - cy.get('[data-test="New Attempt"]').click(); - - cy.get("[data-test=next]").click(); - cy.get(cesc2("#page2/ans4") + " textarea").type("4{enter}", { - force: true, - }); - - cy.get(cesc2("#page2/ans5") + " textarea").type("5", { - force: true, - }); - - cy.get('[data-test="FinishAssessmentPrompt"]').click(); - cy.get('[data-test="ConfirmFinishAssessment"]').click(); - - // Note: we have two places where credit achieved shows up, so their values are concatenated - cy.get('[data-test="Item 2 Credit"]').should("have.text", "100%100%"); - cy.get('[data-test="Item 1 Credit"]').should("have.text", "0%0%"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "50%50%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "75%75%"); - cy.get('[data-test="Final Score"]').should("have.text", "7.57.5"); - }); -}); diff --git a/client/cypress/e2e/AssignedActivity/singlepageActivities.cy.js b/client/cypress/e2e/AssignedActivity/singlepageActivities.cy.js deleted file mode 100644 index 11e854c5f4..0000000000 --- a/client/cypress/e2e/AssignedActivity/singlepageActivities.cy.js +++ /dev/null @@ -1,2013 +0,0 @@ -import { cesc } from "../../../src/_utils/url"; - -describe("Single page activity tests", function () { - const userId = "cyuserId"; - const studentUserId = "cyStudentUserId"; - - const headerPixels = 40; - - before(() => {}); - - beforeEach(() => { - cy.signin({ userId }); - cy.clearIndexedDB(); - cy.clearAllOfAUsersActivities({ userId }); //Needed to be removed for parallel - cy.clearAllOfAUsersActivities({ userId: studentUserId }); //Needed to be removed for parallel - }); - - Cypress.on("uncaught:exception", (err, runnable) => { - // returning false here prevents Cypress from - // failing the test - return false; - }); - - it("Repeatedly select same internal link", () => { - const doenetML = ` -
-

Link to aside

- - - - - - - -
`; - - const studentUserId = "cyStudentUserId"; - const courseId = "spa_courseid1"; - const doenetId = "spa_activity1id"; - const pageDoenetId = "spa_page1id"; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="View Assigned Activity"]').click(); - - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.url().should("match", /[^#]/); - - cy.get('[data-test="Main Panel"]').then((el) => { - expect(el.scrollTop()).eq(0); - }); - - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#\\/insideAside")).should("not.exist"); - - cy.get(cesc("#\\/toAside")).click(); - cy.url().should("match", /#\\\/aside$/); - - cy.get(cesc("#\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#\\/insideAside")).should("have.text", "Content in aside"); - - cy.get(cesc("#\\/asideTitle")).click(); - cy.get(cesc("#\\/insideAside")).should("not.exist"); - - cy.get(cesc("#\\/toAside")).scrollIntoView(); - - cy.get(cesc("#\\/toAside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.url().should("match", /#\\\/aside$/); - - cy.get(cesc("#\\/toAside")).click(); - cy.get(cesc("#\\/insideAside")).should("have.text", "Content in aside"); - - cy.url().should("match", /#\\\/aside$/); - - cy.get(cesc("#\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - }); - - it("Internal link to content in aside opens it", () => { - const doenetML = ` -
-

Link inside aside

- - - - - - - -
`; - - const studentUserId = "cyStudentUserId"; - const courseId = "spa_courseid2"; - const doenetId = "spa_activity2id"; - const pageDoenetId = "spa_page2id"; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="View Assigned Activity"]').click(); - - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.url().should("match", /[^#]/); - - cy.get('[data-test="Main Panel"]').then((el) => { - expect(el.scrollTop()).eq(0); - }); - - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#\\/insideAside")).should("not.exist"); - - cy.get(cesc("#\\/toInsideAside")).click(); - cy.url().should("match", /#\\\/insideAside$/); - - cy.wait(200); - - cy.get(cesc("#\\/insideAside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#\\/insideAside")).should("have.text", "Content in aside"); - - cy.wait(100); - cy.get(cesc("#\\/asideTitle")).click(); - cy.get(cesc("#\\/insideAside")).should("not.exist"); - - cy.get(cesc("#\\/toInsideAside")).scrollIntoView(); - - cy.get(cesc("#\\/toInsideAside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.url().should("match", /#\\\/insideAside$/); - - cy.get(cesc("#\\/toInsideAside")).click(); - cy.get(cesc("#\\/insideAside")).should("have.text", "Content in aside"); - - cy.url().should("match", /#\\\/insideAside$/); - - cy.wait(200); - - cy.get(cesc("#\\/insideAside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - }); - - it.skip("Navigating back remembers position where clicked internal link", () => { - const doenetML = ` -
- - -

Link to aside

- - - - - - - -

bottom

- - - -
`; - - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="View Assigned Activity"]').click(); - - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.url().should("match", /[^#]/); - - cy.get('[data-test="Main Panel"]').then((el) => { - expect(el.scrollTop()).eq(0); - }); - - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#\\/insideAside")).should("not.exist"); - - cy.get(cesc("#\\/toAside")).scrollIntoView(); - - cy.get(cesc("#\\/toAside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#\\/toAside")).click(); - cy.url().should("match", /#\\\/aside$/); - - cy.get(cesc("#\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#\\/insideAside")).should("have.text", "Content in aside"); - - cy.get(cesc("#\\/bottom")).scrollIntoView(); - - cy.get(cesc("#\\/bottom")).then((el) => { - let rect = el[0].getBoundingClientRect(); - cy.log(rect.top); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - cy.go("back"); - cy.url().should("match", /[^#]/); - - cy.get(cesc("#\\/toAside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - cy.log(rect.top); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - }); - - it("Links to activity", () => { - const studentUserId = "cyStudentUserId"; - const courseId = "spa_courseid3"; - const doenetId = "spa_activity3id"; - const pageDoenetId = "spa_page3id"; - const doenetId2 = "spa_activity3idb"; - const pageDoenetId2 = "spa_page3idb"; - - const doenetML = ` -
-

Link to aside

- - - - - - - -
`; - - const doenetMLother = ` -

Link to top

-

Link to aside

-

Link to aside

-`; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - doenetML, - }); - cy.createActivity({ - courseId, - doenetId: doenetId2, - parentDoenetId: courseId, - pageDoenetId: pageDoenetId2, - doenetML: doenetMLother, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 2); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get(".navigationRow").eq(1).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.wait(200); - // TODO: should not have to wait here. It seems like this a bug - // Without the wait get into an inconsistent situation where the activity does appear for the student, - // but when click "View Activity" it says the assignment is not assigned - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 2); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(1).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/_p1")).should("have.text", "Link to top"); - - cy.log("click link to top, remove target so uses same tab"); - cy.get(cesc("#\\/toTop")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#\\/insideAside")).should("not.exist"); - - cy.url().should("contain", doenetId); - - cy.go("back"); - - cy.get(cesc("#\\/_p1")).should("have.text", "Link to top"); - cy.url().should("contain", doenetId2); - - cy.log("click link to aside, remove target so uses same tab"); - cy.get(cesc("#\\/toAside")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#\\/insideAside")).should("have.text", "Content in aside"); - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.get(cesc("#\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.wait(1500); // wait for debounce - - cy.go("back"); - - cy.get(cesc("#\\/_p1")).should("have.text", "Link to top"); - cy.url().should("contain", doenetId2); - - cy.log("click link to top, remove target so uses same tab"); - cy.get(cesc("#\\/toTop")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#\\/insideAside")).should("have.text", "Content in aside"); - - cy.get(cesc("#\\/asideTitle")).click(); - cy.get(cesc("#\\/insideAside")).should("not.exist"); - - cy.wait(1500); // wait for debounce - - cy.go("back"); - - cy.get(cesc("#\\/_p1")).should("have.text", "Link to top"); - cy.url().should("contain", doenetId2); - - cy.log("click link b to aside, remove target so uses same tab"); - cy.get(cesc("#\\/toAsideb")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#\\/insideAside")).should("have.text", "Content in aside"); - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.get(cesc("#\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - }); - - it("Links to activity, inside aside", () => { - const studentUserId = "cyStudentUserId"; - const courseId = "spa_courseid4"; - const doenetId = "spa_activity4id"; - const pageDoenetId = "spa_page4id"; - const doenetId2 = "spa_activity4idb"; - const pageDoenetId2 = "spa_page4idb"; - const doenetML = ` -
-

Link to aside

- - - - - - - -
`; - - const doenetMLother = ` -

Link to top

-

Link to inside aside

-

Link to inside aside

-`; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - doenetML, - }); - cy.createActivity({ - courseId, - doenetId: doenetId2, - parentDoenetId: courseId, - pageDoenetId: pageDoenetId2, - doenetML: doenetMLother, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 2); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get(".navigationRow").eq(1).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.wait(200); - // TODO: should not have to wait here. It seems like this a bug - // Without the wait get into an inconsistent situation where the activity does appear for the student, - // but when click "View Activity" it says the assignment is not assigned - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 2); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(1).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/_p1")).should("have.text", "Link to top"); - - cy.log("click link to top, remove target so uses same tab"); - cy.get(cesc("#\\/toTop")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#\\/insideAside")).should("not.exist"); - - cy.url().should("contain", doenetId); - - cy.go("back"); - - cy.get(cesc("#\\/_p1")).should("have.text", "Link to top"); - cy.url().should("contain", doenetId2); - - cy.log("click link to inside aside, remove target so uses same tab"); - cy.get(cesc("#\\/toInsideAside")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#\\/insideAside")).should("have.text", "Content in aside"); - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#\\\/insideAside$/); - cy.url().should("contain", doenetId); - - cy.waitUntil(() => - cy.get(cesc("#\\/insideAside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - return rect.top > headerPixels - 1 && rect.top < headerPixels + 1; - }), - ); - - cy.wait(1500); // wait for debounce - - cy.go("back"); - - cy.get(cesc("#\\/_p1")).should("have.text", "Link to top"); - cy.url().should("contain", doenetId2); - - cy.log("click link to top, remove target so uses same tab"); - cy.get(cesc("#\\/toTop")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#\\/insideAside")).should("have.text", "Content in aside"); - - cy.get(cesc("#\\/asideTitle")).click(); - cy.get(cesc("#\\/insideAside")).should("not.exist"); - - cy.wait(1500); // wait for debounce - - cy.go("back"); - - cy.get(cesc("#\\/_p1")).should("have.text", "Link to top"); - cy.url().should("contain", doenetId2); - - cy.log("click link b to inside aside, remove target so uses same tab"); - cy.get(cesc("#\\/toInsideAsideb")).invoke("removeAttr", "target").click(); - - cy.get(cesc("#\\/insideAside")).should("have.text", "Content in aside"); - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#\\\/insideAside$/); - cy.url().should("contain", doenetId); - - cy.waitUntil(() => - cy.get(cesc("#\\/insideAside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - return rect.top > headerPixels - 1 && rect.top < headerPixels + 1; - }), - ); - }); - - it("Go directly to URLs of activity", () => { - const studentUserId = "cyStudentUserId"; - const courseId = "spa_courseid5"; - const doenetId = "spa_activity5id"; - const pageDoenetId = "spa_page5id"; - const doenetML = ` -
-

Link to aside

- - - - - - - -
`; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - cy.wait(100); - - cy.log("go to url"); - cy.visit(`/course?tool=assignment&doenetId=${doenetId}`); - - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - cy.get(cesc("#\\/insideAside")).should("not.exist"); - - cy.url().should("contain", doenetId); - - cy.go("back"); - cy.url().should("contain", `course?tool=navigation&courseId=${courseId}`); - - cy.log("go to aside url"); - cy.visit(`/course?tool=assignment&doenetId=${doenetId}#\\/aside`); - - cy.get(cesc("#\\/insideAside")).should("have.text", "Content in aside"); - cy.get(cesc("#\\/_section1_title")).should("have.text", "Section 1"); - cy.get(cesc("#\\/asideTitle")).should("have.text", "The aside"); - - cy.url().should("match", /#\\\/aside$/); - cy.url().should("contain", doenetId); - - cy.waitUntil(() => - cy.get(cesc("#\\/aside")).then((el) => { - let rect = el[0].getBoundingClientRect(); - return rect.top > headerPixels - 1 && rect.top < headerPixels + 1; - }), - ); - }); - - it("Update to new version, infinite attempts allowed, separate student signin", () => { - const studentUserId = "cyStudentUserId"; - const courseId = "spa_courseid15"; - const doenetId = "spa_activity15id"; - const pageDoenetId = "spa_page15id"; - const doenetML = ` - -

What is 1+1? 2

-

Current response:

-

Credit:

-
`; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - cy.wait(100); - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - cy.wait(2000); - - cy.get(cesc("#\\/ans") + " textarea").type("2{enter}", { force: true }); - - cy.get(cesc("#\\/credit")).should("have.text", "1"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.go("back"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/ans") + " textarea") - .type("{end}{backspace}1{enter}", { - force: true, - }) - .then((x) => console.log("we typed in the 1")); - - cy.log( - "At least for now, hitting enter before core is intialized does not submit response", - ); - cy.get(cesc("#\\/cr")).should("contain.text", "1"); - cy.get(cesc("#\\/ans") + " textarea").type("{enter}", { force: true }); - - cy.get(cesc("#\\/credit")).should("have.text", "0"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.go("back"); - - // Have to wait to make sure Core has saved the changes to continue - // TODO: ideally wouldn't have to wait here - cy.wait(1000); - - cy.signin({ userId }); - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+2? 3

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1000); - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - cy.get(cesc("#\\/cr")).should("contain.text", "1"); - cy.get(cesc("#\\/ans2")).should("not.exist"); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - " and the number of available attempts", - ); - - cy.get("[data-test=CancelNewVersion]").click(); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - "new version", - ); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - " and the number of available attempts", - ); - cy.get("[data-test=ConfirmNewVersion]").click(); - - cy.get(cesc("#\\/cr")).should("contain.text", "\uff3f"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans2") + " textarea").type("3{enter}", { force: true }); - cy.get('[data-test="Attempt Percent"]').should("have.text", "50%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get(cesc("#\\/cr")).should("contain.text", "\uff3f"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.wait(1500); // just making sure nothing gets saved even if wait for debounce - - cy.go("back"); - - cy.signin({ userId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+3? 4

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); - - cy.signin({ userId: studentUserId }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.log("immediately get new version"); - cy.get('[data-test="View Activity"]').click(); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans3") + " textarea").type("4{enter}", { force: true }); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "33.3%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - }); - - it("Update to new version, infinite attempts allowed, change roles", () => { - const studentUserId = "cyStudentUserId"; - const courseId = "spa_courseid6"; - const doenetId = "spa_activity6id"; - const pageDoenetId = "spa_page6id"; - const doenetML = ` - -

What is 1+1? 2

-

Current response:

-

Credit:

-
`; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/ans") + " textarea").type("2{enter}", { force: true }); - cy.get(cesc("#\\/credit")).should("have.text", "1"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.go("back"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/ans") + " textarea").type("{end}{backspace}1{enter}", { - force: true, - }); - - cy.log( - "At least for now, hitting enter before core is intialized does not submit response", - ); - cy.get(cesc("#\\/cr")).should("contain.text", "1"); - cy.get(cesc("#\\/ans") + " textarea").type("{enter}", { force: true }); - - cy.get(cesc("#\\/credit")).should("have.text", "0"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+2? 3

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/cr")).should("contain.text", "1"); - cy.get(cesc("#\\/ans2")).should("not.exist"); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - " and the number of available attempts", - ); - - cy.get("[data-test=CancelNewVersion]").click(); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - "new version", - ); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - " and the number of available attempts", - ); - cy.get("[data-test=ConfirmNewVersion]").click(); - - cy.get(cesc("#\\/cr")).should("contain.text", "\uff3f"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans2") + " textarea").type("3{enter}", { force: true }); - cy.get('[data-test="Attempt Percent"]').should("have.text", "50%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get(cesc("#\\/cr")).should("contain.text", "\uff3f"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.wait(1500); // just making sure nothing gets saved even if wait for debounce - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+3? 4

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.log("immediately get new version"); - cy.get('[data-test="View Activity"]').click(); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans3") + " textarea").type("4{enter}", { force: true }); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "33.3%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - }); - - //Note: only runs once - needs work - it("Update to new version, one attempt allowed", () => { - const studentUserId = "cyStudentUserId"; - const courseId = "spa_courseid8"; - const doenetId = "spa_activity8id"; - const pageDoenetId = "spa_page8id"; - const doenetML = ` - -

What is 1+1? 2

-

Current response:

-

Credit:

-
`; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Attempt Limit Checkbox"]').click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/ans") + " textarea").type("2{enter}", { force: true }); - cy.get(cesc("#\\/credit")).should("have.text", "1"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').should("be.disabled"); - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+2? 3

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/cr")).should("contain.text", "2"); - cy.get(cesc("#\\/ans2")).should("not.exist"); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - " and the number of available attempts", - ); - - cy.get("[data-test=CancelNewVersion]").click(); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - "new version", - ); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - " and the number of available attempts", - ); - - cy.get('[data-test="New Attempt"]').should("not.be.disabled"); - cy.get("[data-test=ConfirmNewVersion]").click(); - - cy.get(cesc("#\\/cr")).should("contain.text", "\uff3f"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans2") + " textarea").type("3{enter}", { force: true }); - cy.get('[data-test="Attempt Percent"]').should("have.text", "50%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').should("be.disabled"); - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+3? 4

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.log("get updated new version but do not interact with it"); - cy.get('[data-test="View Activity"]').click(); - - cy.get('[data-test="New Attempt"]').should("be.disabled"); - cy.get(cesc("#\\/ans2")).should("be.visible"); - cy.get(cesc("#\\/ans3")).should("not.exist"); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - " and the number of available attempts", - ); - - cy.get("[data-test=ConfirmNewVersion]").click(); - - cy.get(cesc("#\\/ans3")).should("be.visible"); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - cy.get('[data-test="New Attempt"]').should("be.disabled"); - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+4? 5

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - cy.wait(1500); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.log("immediately get new version"); - cy.get('[data-test="View Activity"]').click(); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans4") + " textarea").type("5{enter}", { force: true }); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "25%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - cy.get('[data-test="New Attempt"]').should("be.disabled"); - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+5? 6

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.log("Can use New Attempt Button to get new content"); - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/ans4")).should("be.visible"); - cy.get(cesc("#\\/ans5")).should("not.exist"); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "25%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans5") + " textarea").type("6{enter}", { force: true }); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "20%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - cy.get('[data-test="New Attempt"]').should("be.disabled"); - }); - - it("Update to new version, two attempts allowed", () => { - const studentUserId = "cyStudentUserId"; - const courseId = "spa_courseid10"; - const doenetId = "spa_activity10id"; - const pageDoenetId = "spa_page10id"; - const doenetML = ` - -

What is 1+1? 2

-

Current response:

-

Credit:

-
`; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Attempt Limit Checkbox"]').click(); - - cy.get('[data-test="Attempt Limit"]').type("{end}{backspace}2{enter}"); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/ans") + " textarea").type("2{enter}", { force: true }); - cy.get(cesc("#\\/credit")).should("have.text", "1"); - cy.get(cesc("#\\/cr")).should("contain.text", "2"); - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 1:", - ); - cy.get('[data-test="Attempt Percent"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get(cesc("#\\/credit")).should("have.text", "0"); - cy.get(cesc("#\\/cr")).should("contain.text", "\uff3f"); - - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 2:", - ); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans") + " textarea").type("2{enter}", { force: true }); - - cy.get(cesc("#\\/credit")).should("have.text", "1"); - cy.get(cesc("#\\/cr")).should("contain.text", "2"); - cy.get('[data-test="Attempt Percent"]').should("have.text", "100%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').should("be.disabled"); - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+2? 3

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/cr")).should("contain.text", "2"); - cy.get(cesc("#\\/ans2")).should("not.exist"); - - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 2:", - ); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - cy.get('[data-test="Main Panel"]').should( - "contain.text", - " and the number of available attempts", - ); - - cy.get("[data-test=CancelNewVersion]").click(); - cy.get('[data-test="Main Panel"]').should( - "not.contain.text", - "new version", - ); - - cy.get("[data-test=NewVersionAvailable]").click(); - cy.get('[data-test="Main Panel"]').should("contain.text", "new version"); - cy.get('[data-test="Main Panel"]').should( - "contain.text", - " and the number of available attempts", - ); - - cy.get('[data-test="New Attempt"]').should("not.be.disabled"); - cy.get("[data-test=ConfirmNewVersion]").click(); - - cy.get(cesc("#\\/cr")).should("contain.text", "\uff3f"); - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 3:", - ); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans2") + " textarea").type("3{enter}", { force: true }); - cy.get('[data-test="Attempt Percent"]').should("have.text", "50%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 4:", - ); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - cy.get('[data-test="New Attempt"]').should("be.disabled"); - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+3? 4

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.log("immediately get new version and two more attempts"); - cy.get('[data-test="View Activity"]').click(); - - cy.get('[data-test="New Attempt"]').should("not.be.disabled"); - cy.get(cesc("#\\/ans2")).should("be.visible"); - cy.get(cesc("#\\/ans3")).should("be.visible"); - - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 4:", - ); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').click(); - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 5:", - ); - cy.get('[data-test="New Attempt"]').should("be.disabled"); - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+4? 5

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.log("again, immediately get new version and two more attempts"); - cy.get('[data-test="View Activity"]').click(); - - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 5:", - ); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans4") + " textarea").type("5{enter}", { force: true }); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "25%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').click(); - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 6:", - ); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans4") + " textarea").type("5{enter}", { force: true }); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "25%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

What is 1+5? 6

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.log("Can use New Attempt Button to get new content"); - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/ans4")).should("be.visible"); - cy.get(cesc("#\\/ans5")).should("not.exist"); - - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 6:", - ); - cy.get('[data-test="Attempt Percent"]').should("have.text", "25%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 7:", - ); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans5") + " textarea").type("6{enter}", { force: true }); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "20%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get('[data-test="New Attempt"]').click(); - - cy.get('[data-test="Attempt Container"]').should( - "contain.text", - "Attempt 8:", - ); - cy.get('[data-test="Attempt Percent"]').should("have.text", "0%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - - cy.get(cesc("#\\/ans5") + " textarea").type("6{enter}", { force: true }); - - cy.get('[data-test="Attempt Percent"]').should("have.text", "20%"); - cy.get('[data-test="Assignment Percent"]').should("have.text", "100%"); - cy.get('[data-test="New Attempt"]').should("be.disabled"); - }); - - it("Clicking links does not give update version prompt", () => { - const studentUserId = "cyStudentUserId"; - const courseId = "spa_courseid11"; - const doenetId = "spa_activity11id"; - const pageDoenetId = "spa_page11id"; - const doenetML = ` -
- Info only -

This activity is just information only, with no interactive content. - Go to middle. - Go to bottom. -

- - - -

A paragraph in the middle. - Go to top. - Go to bottom. -

- - - -

A paragraph near the bottom. - Go to top. - Go to middle. -

- - - -
-`; - - cy.deleteCourseDBRows({ courseId }); - cy.createCourse({ userId, courseId, studentUserId }); - - cy.createActivity({ - courseId, - doenetId, - parentDoenetId: courseId, - pageDoenetId, - doenetML, - }); - - cy.visit(`/course?tool=navigation&courseId=${courseId}`); - - cy.get(".navigationRow").should("have.length", 1); //Need this to wait for the row to appear - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should("be.visible"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/sect_title")).should("have.text", "Info only"); - cy.get('[data-test="Main Panel"]').then((el) => { - expect(el.scrollTop()).eq(0); - }); - - cy.get(cesc("#\\/goMiddle1")).click(); - cy.url().should("match", /#\\\/middle$/); - - cy.get(cesc("#\\/middle")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.get(cesc("#\\/goBottom2")).click(); - cy.url().should("match", /#\\\/bottom$/); - - cy.get(cesc("#\\/bottom")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.wait(2000); // wait for debounce - - cy.go("back"); - - cy.get(cesc("#\\/middle")).then((el) => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top) - .gt(headerPixels - 1) - .lt(headerPixels + 1); - }); - - cy.go("back"); - cy.go("back"); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{upArrow}{upArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Edit Activity"]').click(); - - cy.get(".cm-content").type( - "{moveToEnd}{enter}

Extra content

{enter}{ctrl+s}", - ); - - cy.go("back"); - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.wait(1500); - - cy.get('[data-test="RoleDropDown"] > div:nth-child(2)') - .click() - .type("{downArrow}{downArrow}{enter}"); - - cy.get(".navigationRow").eq(0).find(".navigationColumn1").click(); - - cy.get('[data-test="View Activity"]').click(); - - cy.get(cesc("#\\/extra")).should("have.text", "Extra content"); - - cy.get("[data-test=NewVersionAvailable]").should("not.exist"); - }); - - it("Presence of video does not give update version prompt", () => { - const studentUserId = "cyStudentUserId"; - const courseId = "spa_courseid12"; - const doenetId = "spa_activity12id"; - const pageDoenetId = "spa_page12id"; - const doenetML = ` -A video -