From 541f71f44910d734355a4b3ac3a70d91a30c0585 Mon Sep 17 00:00:00 2001 From: Duane Nykamp Date: Mon, 3 Apr 2023 23:11:54 -0500 Subject: [PATCH] dark mode support in core styles and test environments (#2006) --- cypress.config.js | 2 +- .../e2e/ActivityViewer/activityVariants.cy.js | 2 +- .../e2e/ActivityViewer/compiledActivity.cy.js | 2 +- .../relationshipsAmongPages.cy.js | 2 +- cypress/e2e/AsStudent/assignedActivity.cy.js | 34 +- cypress/e2e/AsStudent/previousAndNext.cy.js | 13 +- cypress/e2e/AsStudent/signIn.cy.js | 90 +- .../AssignedActivity/creditAchievedMenu.cy.js | 12 +- .../multipageActivities.cy.js | 101 +- .../singlepageActivities.cy.js | 64 +- cypress/e2e/Dashboard/classTimesMenu.cy.js | 82 +- .../answerValidation/errorinnumbers.cy.js | 2 +- .../DoenetML/answerValidation/factoring.cy.js | 2 +- .../factoringOldAlgorithm.cy.js | 2 +- .../answerValidation/functionanswers.cy.js | 2 +- .../answerValidation/matchingpatterns.cy.js | 2 +- .../answerValidation/matchpartial.cy.js | 2 +- .../answerValidation/pointlocation.cy.js | 2 +- .../answerValidation/symbolicequality.cy.js | 4 +- .../answerValidation/videoProgress.cy.js | 2 +- .../e2e/DoenetML/assignNames/basiccopy.cy.js | 2 +- .../DoenetML/assignNames/collections.cy.js | 2 +- .../e2e/DoenetML/assignNames/selects.cy.js | 2 +- .../e2e/DoenetML/assignNames/sequences.cy.js | 2 +- .../basecomponentproperties.cy.js | 4 +- .../DoenetML/baseComponent/doenetMLtext.cy.js | 2 +- cypress/e2e/DoenetML/chemistry/atom.cy.js | 2 +- cypress/e2e/DoenetML/chemistry/ion.cy.js | 22 +- .../DoenetML/chemistry/ioniccompound.cy.js | 24 +- .../dynamicalsystem/cobwebpolyline.cy.js | 2 +- .../dynamicalsystem/equilibriumcurve.cy.js | 2 +- .../dynamicalsystem/equilibriumline.cy.js | 2 +- .../dynamicalsystem/equilibriumpoint.cy.js | 2 +- .../DoenetML/dynamicalsystem/odesystem.cy.js | 2 +- .../DoenetML/equality/mathexpressions.cy.js | 2 +- .../DoenetML/graphing/graphreferences.cy.js | 2 +- .../DoenetML/graphing/graphreferences2.cy.js | 2 +- .../linearAlgebra/eigenDecomposition.cy.js | 4 +- cypress/e2e/DoenetML/tagSpecific/angle.cy.js | 2 +- .../tagSpecific/animatefromsequence.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/answer.cy.js | 2 +- .../DoenetML/tagSpecific/bestfitline.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/boolean.cy.js | 2 +- .../DoenetML/tagSpecific/booleaninput.cy.js | 2 +- .../DoenetML/tagSpecific/booleanlist.cy.js | 2 +- .../tagSpecific/booleanoperators.cy.js | 2 +- .../tagSpecific/booleanoperatorsonmath.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/callaction.cy.js | 2 +- .../DoenetML/tagSpecific/choiceinput.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/circle.cy.js | 60 +- .../e2e/DoenetML/tagSpecific/codeeditor.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/collect.cy.js | 2 +- .../DoenetML/tagSpecific/componentsize.cy.js | 2 +- .../tagSpecific/conditionalcontent.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/copy.cy.js | 2 +- .../DoenetML/tagSpecific/curve.bezier.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/curve.cy.js | 42 +- .../DoenetML/tagSpecific/curve.function.cy.js | 2 +- .../tagSpecific/curve.parametrized.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/document.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/endpoint.cy.js | 8 +- .../e2e/DoenetML/tagSpecific/evaluate.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/extract.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/feedback.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/function.cy.js | 42 +- .../tagSpecific/functioniterates.cy.js | 2 +- .../tagSpecific/functionoperators.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/graph.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/group.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/hint.cy.js | 4 +- cypress/e2e/DoenetML/tagSpecific/image.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/integer.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/label.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/legend.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/line.cy.js | 42 +- .../DoenetML/tagSpecific/linesegment.cy.js | 42 +- cypress/e2e/DoenetML/tagSpecific/lorem.cy.js | 4 +- cypress/e2e/DoenetML/tagSpecific/map.cy.js | 2 +- .../DoenetML/tagSpecific/matchespattern.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/math.cy.js | 2 +- .../DoenetML/tagSpecific/mathdisplay.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/mathinput.cy.js | 2 +- .../DoenetML/tagSpecific/mathinputgraph.cy.js | 34 +- .../e2e/DoenetML/tagSpecific/mathlist.cy.js | 36 +- .../DoenetML/tagSpecific/mathoperators.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/matrix.cy.js | 2 +- .../DoenetML/tagSpecific/matrixinput.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/module.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/number.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/numberlist.cy.js | 6 +- cypress/e2e/DoenetML/tagSpecific/p.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/paginator.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/parabola.cy.js | 2 +- .../tagSpecific/paragraphmarkup.cy.js | 2 +- .../DoenetML/tagSpecific/periodicset.cy.js | 4 +- .../tagSpecific/piecewisefunction.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/pluralize.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/point.cy.js | 6184 +--------------- cypress/e2e/DoenetML/tagSpecific/point2.cy.js | 6239 +++++++++++++++++ .../e2e/DoenetML/tagSpecific/polygon.cy.js | 60 +- .../e2e/DoenetML/tagSpecific/polyline.cy.js | 42 +- .../e2e/DoenetML/tagSpecific/problem.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/ray.cy.js | 42 +- .../e2e/DoenetML/tagSpecific/rectangle.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/ref.cy.js | 2 +- .../DoenetML/tagSpecific/regularPolygon.cy.js | 669 +- .../tagSpecific/regularPolygon2.cy.js | 1493 ++++ .../tagSpecific/samplerandomnumbers.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/sectioning.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/select.cy.js | 2 +- .../tagSpecific/selectfromsequence.cy.js | 2 +- .../tagSpecific/selectrandomnumbers.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/sequence.cy.js | 8 +- .../e2e/DoenetML/tagSpecific/shuffle.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/sidebyside.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/slider.cy.js | 20 +- .../e2e/DoenetML/tagSpecific/solution.cy.js | 6 +- .../DoenetML/tagSpecific/solveequations.cy.js | 34 +- cypress/e2e/DoenetML/tagSpecific/sort.cy.js | 10 +- .../DoenetML/tagSpecific/spreadsheet.cy.js | 14 +- .../DoenetML/tagSpecific/subsetofreals.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/substitute.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/text.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/textinput.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/textlist.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/triangle.cy.js | 2 +- .../e2e/DoenetML/tagSpecific/triggerset.cy.js | 2 +- .../DoenetML/tagSpecific/updatevalue.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/vector.cy.js | 42 +- cypress/e2e/DoenetML/tagSpecific/video.cy.js | 2 +- cypress/e2e/DoenetML/tagSpecific/when.cy.js | 2 +- .../variants/specifysinglevariant.cy.js | 6 +- .../DoenetML/variants/uniquevariants.cy.js | 2 +- cypress/e2e/Editor/Editor.cy.js | 598 +- cypress/e2e/Events/Events.cy.js | 50 +- cypress/e2e/Events/videoEvents.cy.js | 8 +- cypress/e2e/Events/visibilityEvents.cy.js | 10 +- cypress/e2e/Gradebook/Gradebook.cy.js | 8 +- cypress/e2e/Navigation/Activity.cy.js | 70 +- cypress/e2e/Navigation/Navigation.cy.js | 80 +- cypress/e2e/Public/publicActivities.cy.js | 32 +- cypress/e2e/UIComponents/ActionButton.cy.js | 40 +- cypress/e2e/course/courseTiming.cy.js | 72 +- src/Core/Core.js | 24 + src/Core/components/Circle.js | 87 +- src/Core/components/Curve.js | 15 +- .../DiscreteSimulationResultPolyline.js | 14 +- src/Core/components/Document.js | 44 +- src/Core/components/Function.js | 14 +- src/Core/components/Line.js | 15 +- src/Core/components/LineSegment.js | 14 +- src/Core/components/Point.js | 19 +- src/Core/components/Polygon.js | 89 +- src/Core/components/Polyline.js | 14 +- src/Core/components/Ray.js | 14 +- .../components/RegionBetweenCurveXAxis.js | 14 +- src/Core/components/StyleDefinitions.js | 2 +- src/Core/components/Vector.js | 14 +- src/Core/utils/style.js | 69 + src/Tools/cypressTest/CypressTest.jsx | 17 +- src/Tools/cypressTest/index.html | 180 +- src/Tools/cypressTest/index.jsx | 17 +- src/Tools/test/DoenetTest.jsx | 20 +- src/Tools/test/index.html | 34 +- src/Tools/test/index.jsx | 5 +- src/Viewer/PageViewer.jsx | 17 +- src/Viewer/renderers/circle.jsx | 36 +- src/Viewer/renderers/curve.jsx | 27 +- src/Viewer/renderers/graph.jsx | 32 +- src/Viewer/renderers/line.jsx | 29 +- src/Viewer/renderers/lineSegment.jsx | 30 +- src/Viewer/renderers/point.jsx | 26 +- src/Viewer/renderers/polygon.jsx | 37 +- src/Viewer/renderers/polyline.jsx | 28 +- src/Viewer/renderers/ray.jsx | 29 +- .../renderers/regionBetweenCurveXAxis.jsx | 13 +- src/Viewer/renderers/vector.jsx | 29 +- src/Viewer/useDoenetRenderer.jsx | 2 +- 178 files changed, 9894 insertions(+), 7979 deletions(-) create mode 100644 cypress/e2e/DoenetML/tagSpecific/point2.cy.js create mode 100644 cypress/e2e/DoenetML/tagSpecific/regularPolygon2.cy.js diff --git a/cypress.config.js b/cypress.config.js index 0b6cff0af5..b1272fd448 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -36,7 +36,7 @@ module.exports = defineConfig({ on('task', { queryDb: query => { return queryTestDb(query, config) }, }); //For running sql query }, - baseUrl: 'http://localhost', + baseUrl: 'http://localhost:8000', }, env: { db: { diff --git a/cypress/e2e/ActivityViewer/activityVariants.cy.js b/cypress/e2e/ActivityViewer/activityVariants.cy.js index 8f253fb6f5..7a29717974 100644 --- a/cypress/e2e/ActivityViewer/activityVariants.cy.js +++ b/cypress/e2e/ActivityViewer/activityVariants.cy.js @@ -14,7 +14,7 @@ describe('Activity variants tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/ActivityViewer/compiledActivity.cy.js b/cypress/e2e/ActivityViewer/compiledActivity.cy.js index 1588bb97e4..4cae31da29 100644 --- a/cypress/e2e/ActivityViewer/compiledActivity.cy.js +++ b/cypress/e2e/ActivityViewer/compiledActivity.cy.js @@ -12,7 +12,7 @@ describe('Compiled activity tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/ActivityViewer/relationshipsAmongPages.cy.js b/cypress/e2e/ActivityViewer/relationshipsAmongPages.cy.js index e40b51c249..9eafa4ab52 100644 --- a/cypress/e2e/ActivityViewer/relationshipsAmongPages.cy.js +++ b/cypress/e2e/ActivityViewer/relationshipsAmongPages.cy.js @@ -12,7 +12,7 @@ describe('Relationships among pages tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it("Problem numbering continues across pages", () => { diff --git a/cypress/e2e/AsStudent/assignedActivity.cy.js b/cypress/e2e/AsStudent/assignedActivity.cy.js index ae96e9b85b..8f83294441 100644 --- a/cypress/e2e/AsStudent/assignedActivity.cy.js +++ b/cypress/e2e/AsStudent/assignedActivity.cy.js @@ -5,7 +5,7 @@ describe('Assigned Activity Tests', function () { const doenetId = "activity1id"; const pageDoenetId = "_page1id"; - before(()=>{ + before(() => { cy.signin({ userId }); cy.clearAllOfAUsersCoursesAndItems({ userId }); cy.clearAllOfAUsersCoursesAndItems({ userId: studentUserId }); @@ -16,8 +16,8 @@ describe('Assigned Activity Tests', function () { cy.clearIndexedDB(); cy.clearAllOfAUsersActivities({ userId }); cy.clearAllOfAUsersActivities({ userId: studentUserId }); - cy.createActivity({ courseId, doenetId, parentDoenetId:courseId, pageDoenetId }); - cy.visit(`http://localhost/course?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`); + cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId }); + cy.visit(`/course?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`); }) @@ -30,12 +30,12 @@ describe('Assigned Activity Tests', function () { // Formatting the date to be 'mm/dd/yyyy' WITH leading zeros // Ex: '09/12/2022' for September 12, 2022 - function formatDateWithYear(date,prefixZero) { + function formatDateWithYear(date, prefixZero) { const yyyy = date.getFullYear(); let mm = date.getMonth() + 1; // Months start at 0! let dd = date.getDate(); - if (mm < 10) mm = '0' + mm; - if (prefixZero){ + if (prefixZero) { + if (mm < 10) mm = '0' + mm; if (dd < 10) dd = '0' + dd; } @@ -52,7 +52,7 @@ describe('Assigned Activity Tests', function () { } function getDayOfWeek(date) { - const weekday = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; + const weekday = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; return weekday[date.getDay()]; } @@ -82,30 +82,30 @@ describe('Assigned Activity Tests', function () { 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="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(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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'); - + cy.get('.navigationRow').eq(0).get('.navigationColumn2').contains(formatDateWithYear(dueDate, false) + ', ' + formatHours(dueDate) + ':' + formatMinutes(dueDate) + ':00'); + }) @@ -117,9 +117,9 @@ describe('Assigned Activity Tests', function () { // 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="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="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 @@ -127,13 +127,13 @@ describe('Assigned Activity Tests', function () { // 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(`http://localhost/course?tool=dashboard&courseId=${courseId}`); + 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)); - + }) }) \ No newline at end of file diff --git a/cypress/e2e/AsStudent/previousAndNext.cy.js b/cypress/e2e/AsStudent/previousAndNext.cy.js index dd933aaca1..179ff32245 100644 --- a/cypress/e2e/AsStudent/previousAndNext.cy.js +++ b/cypress/e2e/AsStudent/previousAndNext.cy.js @@ -129,7 +129,7 @@ describe('Previous and Next Activty Button Tests', () => { }); if (isAssigned) { cy.visit( - `http://localhost/course?tool=editor&doenetId=${doenetId}&pageId=${`_pageDoenetId${i}.1`}`, + `/course?tool=editor&doenetId=${doenetId}&pageId=${`_pageDoenetId${i}.1`}`, ); cy.get('[data-test="AssignmentSettingsMenu Menu"]') .should('be.visible') @@ -150,7 +150,7 @@ describe('Previous and Next Activty Button Tests', () => { it('Next button goes to from first to second', () => { cy.visit( - `http://localhost/course?tool=assignment&doenetId=${genIdsInContnetOrder[0].doenetId}&pageId=${genIdsInContnetOrder[0].firstPageId}`, + `/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(); @@ -161,7 +161,7 @@ describe('Previous and Next Activty Button Tests', () => { it('Previous button goes to from second to first', () => { cy.visit( - `http://localhost/course?tool=assignment&doenetId=${genIdsInContnetOrder[1].doenetId}&pageId=${genIdsInContnetOrder[1].firstPageId}`, + `/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"]') @@ -178,7 +178,7 @@ describe('Previous and Next Activty Button Tests', () => { ); expect(procIdx).to.not.equal(-1); cy.visit( - `http://localhost/course?tool=assignment&doenetId=${genIdsInContnetOrder[procIdx].doenetId}&pageId=${genIdsInContnetOrder[procIdx].firstPageId}`, + `/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'); @@ -186,7 +186,7 @@ describe('Previous and Next Activty Button Tests', () => { it('Next button from first to last, skipping unassigned', () => { cy.visit( - `http://localhost/course?tool=assignment&doenetId=${genIdsInContnetOrder[0].doenetId}&pageId=${genIdsInContnetOrder[0].firstPageId}`, + `/course?tool=assignment&doenetId=${genIdsInContnetOrder[0].doenetId}&pageId=${genIdsInContnetOrder[0].firstPageId}`, ); cy.get('[data-test="Previous Activity Button"]').should('be.disabled'); let i; @@ -210,8 +210,7 @@ describe('Previous and Next Activty Button Tests', () => { it('Previous button goes to from last to first, skipping unassigned and proctored', () => { cy.visit( - `http://localhost/course?tool=assignment&doenetId=${ - genIdsInContnetOrder[activityOptions.length - 1].doenetId + `/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'); diff --git a/cypress/e2e/AsStudent/signIn.cy.js b/cypress/e2e/AsStudent/signIn.cy.js index 54fa1f6785..aa0ce9311c 100644 --- a/cypress/e2e/AsStudent/signIn.cy.js +++ b/cypress/e2e/AsStudent/signIn.cy.js @@ -1,51 +1,51 @@ 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 }); + 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.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(`http://localhost/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(`http://localhost/settings`) - cy.get('[data-test="sign out button"]').click(); - cy.get('[data-test="homepage button"]').should('be.visible'); - cy.visit(`http://localhost/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="Nav to course"]').should('be.visible'); - }); - - }) + 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="Nav to course"]').should('be.visible'); + }); + + }) }) \ No newline at end of file diff --git a/cypress/e2e/AssignedActivity/creditAchievedMenu.cy.js b/cypress/e2e/AssignedActivity/creditAchievedMenu.cy.js index d6648f7de2..16493e8481 100644 --- a/cypress/e2e/AssignedActivity/creditAchievedMenu.cy.js +++ b/cypress/e2e/AssignedActivity/creditAchievedMenu.cy.js @@ -43,7 +43,7 @@ describe('Credit achieved menu tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -95,7 +95,7 @@ describe('Credit achieved menu tests', function () { doenetML1, doenetML2, doenetML3, doenetML4 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -194,7 +194,7 @@ describe('Credit achieved menu tests', function () { doenetML1, doenetML2, doenetML3, doenetML4 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -292,7 +292,7 @@ describe('Credit achieved menu tests', function () { doenetML1, doenetML2, doenetML3, doenetML4 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -388,7 +388,7 @@ describe('Credit achieved menu tests', function () { doenetML1, doenetML2, doenetML3 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -486,7 +486,7 @@ describe('Credit achieved menu tests', function () { doenetML1, doenetML2, doenetML3 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); diff --git a/cypress/e2e/AssignedActivity/multipageActivities.cy.js b/cypress/e2e/AssignedActivity/multipageActivities.cy.js index e3c91fb05e..adc4188b31 100644 --- a/cypress/e2e/AssignedActivity/multipageActivities.cy.js +++ b/cypress/e2e/AssignedActivity/multipageActivities.cy.js @@ -45,7 +45,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -78,7 +78,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -123,7 +123,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -168,7 +168,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -255,17 +255,18 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -310,7 +311,7 @@ describe('Multipage activity tests', function () { }) - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}#page2`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2`) cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') cy.get('#page1\\/_section1_title').should('not.exist') @@ -347,7 +348,7 @@ describe('Multipage activity tests', function () { cy.wait(1000); // for debounce - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}#page2/aside`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2/aside`) cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') @@ -395,7 +396,7 @@ describe('Multipage activity tests', function () { cy.wait(2000); - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}`) cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') cy.get('#page1\\/_section1_title').should('not.exist') @@ -469,7 +470,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -482,7 +483,7 @@ describe('Multipage activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -534,7 +535,7 @@ describe('Multipage activity tests', function () { }) - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}#page2`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2`) cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') cy.get('#page1\\/_section1_title').should('have.text', 'Section 1') @@ -567,7 +568,7 @@ describe('Multipage activity tests', function () { cy.wait(1000); // for debounce - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}#page2/aside`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2/aside`) cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') @@ -609,7 +610,7 @@ describe('Multipage activity tests', function () { cy.wait(2000); - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}`) cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') cy.get('#page1\\/_section1_title').should('have.text', 'Section 1') @@ -686,7 +687,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); cy.createActivity({ courseId, doenetId: doenetId2, parentDoenetId: courseId, pageDoenetId: pageDoenetId3, doenetML: doenetMLother }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -701,7 +702,7 @@ describe('Multipage activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -729,7 +730,7 @@ describe('Multipage activity tests', function () { cy.signin({ userId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + cy.visit(`/course?tool=navigation&courseId=${courseId}`) cy.get('.navigationRow').should('have.length', 2); //Need this to wait for the row to appear @@ -745,7 +746,7 @@ describe('Multipage activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -912,7 +913,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); cy.createActivity({ courseId, doenetId: doenetId2, parentDoenetId: courseId, pageDoenetId: pageDoenetId3, doenetML: doenetMLother }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -925,7 +926,7 @@ describe('Multipage activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -953,7 +954,7 @@ describe('Multipage activity tests', function () { cy.signin({ userId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -963,7 +964,7 @@ describe('Multipage activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1132,7 +1133,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1143,13 +1144,13 @@ describe('Multipage activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(`http://localhost/course?tool=assignment&doenetId=${doenetId}#page1`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page1`) cy.get('#page1\\/_section1_title').should('have.text', 'Section 1') cy.get('#page2\\/_section1_title').should('not.exist') @@ -1169,7 +1170,7 @@ describe('Multipage activity tests', function () { cy.log('go to page 2 url') - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}#page2`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2`) cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') cy.get('#page1\\/_section1_title').should('not.exist') @@ -1189,7 +1190,7 @@ describe('Multipage activity tests', function () { cy.log('go to page 1 aside url') - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}#page1/aside`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page1/aside`) cy.get('#page1\\/insideAside').should('have.text', 'Content in aside'); cy.get('#page1\\/_section1_title').should('have.text', 'Section 1') @@ -1212,7 +1213,7 @@ describe('Multipage activity tests', function () { cy.log('go to page 2 aside url') - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}#page2/aside`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2/aside`) cy.get('#page2\\/insideAside').should('have.text', 'Content in aside'); cy.get('#page1\\/_section1_title').should('not.exist') @@ -1265,7 +1266,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1278,7 +1279,7 @@ describe('Multipage activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1306,7 +1307,7 @@ describe('Multipage activity tests', function () { cy.log('go to page 1 url') - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}#page1`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page1`) cy.get('#page1\\/_section1_title').should('have.text', 'Section 1') cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') @@ -1323,7 +1324,7 @@ describe('Multipage activity tests', function () { cy.log('go to page 2 url') - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}#page2`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2`) cy.get('#page1\\/_section1_title').should('have.text', 'Section 1') cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') @@ -1341,7 +1342,7 @@ describe('Multipage activity tests', function () { cy.log('go to page 1 aside url') - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}#page1/aside`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page1/aside`) cy.get('#page1\\/insideAside').should('have.text', 'Content in aside'); cy.get('#page1\\/_section1_title').should('have.text', 'Section 1') @@ -1366,7 +1367,7 @@ describe('Multipage activity tests', function () { cy.log('go to page 2 aside url') - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}#page2/aside`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#page2/aside`) cy.get('#page2\\/insideAside').should('have.text', 'Content in aside'); cy.get('#page1\\/insideAside').should('have.text', 'Content in aside'); @@ -1412,7 +1413,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1539,7 +1540,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1550,7 +1551,7 @@ describe('Multipage activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1624,7 +1625,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1637,7 +1638,7 @@ describe('Multipage activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1694,7 +1695,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, doenetML1, doenetML2 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1994,7 +1995,7 @@ describe('Multipage activity tests', function () { doenetML1: doenetML, doenetML2: doenetML, doenetML3: doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -2084,7 +2085,7 @@ describe('Multipage activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId: pageDoenetId1, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -2175,7 +2176,7 @@ describe('Multipage activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId: pageDoenetId1, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -2395,7 +2396,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, pageDoenetId3, pageDoenetId4, doenetML1, doenetML2, doenetML3, doenetML4 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -2413,7 +2414,7 @@ describe('Multipage activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -2459,7 +2460,7 @@ describe('Multipage activity tests', function () { cy.get('[data-test="Item 4 Credit"]').should('have.text', '100%') cy.get('[data-test="Assignment Percent"]').should('have.text', '100%') - cy.visit(`http://localhost/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`) + cy.visit(`/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`) cy.get(`#page4\\/_answer1 .mq-editable-field`).should('have.text', '4') cy.get(`#page4\\/_answer1_correct`).should('be.visible') @@ -2502,7 +2503,7 @@ describe('Multipage activity tests', function () { - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -2540,9 +2541,9 @@ describe('Multipage activity tests', function () { // TODO: how do we get the gradebook to reload and show the new attempt? cy.reload(); - cy.visit(`http://localhost/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`) + cy.visit(`/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`) cy.reload(); - cy.visit(`http://localhost/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`) + cy.visit(`/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`) cy.get(`#page2\\/_answer1 .mq-editable-field`).should('have.text', '2') cy.get(`#page2\\/_answer1_correct`).should('be.visible') @@ -2588,7 +2589,7 @@ describe('Multipage activity tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, pageDoenetId3, doenetML1, doenetML2, doenetML3 }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); diff --git a/cypress/e2e/AssignedActivity/singlepageActivities.cy.js b/cypress/e2e/AssignedActivity/singlepageActivities.cy.js index 8cbb172b89..1cd476552b 100644 --- a/cypress/e2e/AssignedActivity/singlepageActivities.cy.js +++ b/cypress/e2e/AssignedActivity/singlepageActivities.cy.js @@ -53,7 +53,7 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -137,7 +137,7 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -186,7 +186,7 @@ describe('Single page activity tests', function () { }) cy.go("back"); cy.url().should('match', /[^#]/) - + cy.get('#\\/toAside').then(el => { let rect = el[0].getBoundingClientRect(); cy.log(rect.top) @@ -224,7 +224,7 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); cy.createActivity({ courseId, doenetId: doenetId2, parentDoenetId: courseId, pageDoenetId: pageDoenetId3, doenetML: doenetMLother }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -239,7 +239,7 @@ describe('Single page activity tests', function () { cy.get('[data-test="Unassign Activity"]').should('be.visible') - cy.wait(100) + 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 @@ -247,7 +247,7 @@ describe('Single page activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -348,7 +348,7 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -357,7 +357,7 @@ describe('Single page activity tests', function () { cy.get('[data-test="Unassign Activity"]').should('be.visible') cy.log('go to url') - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}`) cy.get('#\\/_section1_title').should('have.text', 'Section 1') cy.get('#\\/asideTitle').should('have.text', 'The aside'); @@ -370,7 +370,7 @@ describe('Single page activity tests', function () { cy.log('go to aside url') - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}#/aside`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}#/aside`) cy.get('#\\/insideAside').should('have.text', 'Content in aside'); cy.get('#\\/_section1_title').should('have.text', 'Section 1') @@ -398,17 +398,18 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -440,7 +441,7 @@ describe('Single page activity tests', function () { cy.signin({ userId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -454,7 +455,7 @@ describe('Single page activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -462,7 +463,7 @@ describe('Single page activity tests', function () { cy.get('#\\/cr').should('contain.text', '1'); cy.get('#\\/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"); @@ -474,7 +475,7 @@ describe('Single page activity tests', function () { 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('#\\/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%') @@ -495,7 +496,7 @@ describe('Single page activity tests', function () { cy.signin({ userId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -510,7 +511,7 @@ describe('Single page activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -520,7 +521,7 @@ describe('Single page activity tests', function () { cy.get('[data-test="Attempt Percent"]').should('have.text', '0%') cy.get('[data-test="Assignment Percent"]').should('have.text', '100%') - cy.get('#\\/ans3 textarea').type("4{enter}", { force: true }); + cy.get('#\\/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%') @@ -537,7 +538,7 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -634,6 +635,7 @@ describe('Single page activity tests', function () { cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); cy.get('[data-test="Assign Activity"]').click(); cy.get('[data-test="Unassign Activity"]').should('be.visible') + cy.wait(1000); cy.go("back") @@ -664,7 +666,7 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -859,7 +861,7 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1124,7 +1126,7 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1212,7 +1214,7 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1305,7 +1307,7 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1326,10 +1328,10 @@ describe('Single page activity tests', function () { cy.get('[data-test="Item 1 Credit"]').should('have.text', '0%') - cy.get('#\\/x textarea').type("x", {force: true}).blur(); + cy.get('#\\/x textarea').type("x", { force: true }).blur(); cy.get('[data-test="Item 1 Credit"]').should('have.text', '25%') - cy.get('#\\/x textarea').type("{end}{backspace}y", {force: true}).blur(); + cy.get('#\\/x textarea').type("{end}{backspace}y", { force: true }).blur(); cy.get('[data-test="Item 1 Credit"]').should('have.text', '0%') cy.get('#\\/hello input').type("hello").blur(); @@ -1358,7 +1360,7 @@ describe('Single page activity tests', function () { args: { x: -2, y: 3 } }) }) - + cy.get('[data-test="Item 1 Credit"]').should('have.text', '25%') cy.window().then(async (win) => { @@ -1385,7 +1387,7 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1399,7 +1401,7 @@ describe('Single page activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1429,7 +1431,7 @@ describe('Single page activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -1443,7 +1445,7 @@ describe('Single page activity tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); diff --git a/cypress/e2e/Dashboard/classTimesMenu.cy.js b/cypress/e2e/Dashboard/classTimesMenu.cy.js index b91e877d54..6461540a5b 100644 --- a/cypress/e2e/Dashboard/classTimesMenu.cy.js +++ b/cypress/e2e/Dashboard/classTimesMenu.cy.js @@ -1,48 +1,48 @@ describe('Dashboard Classtime Menu tests', function () { - const userId = "cyuserId"; - const courseId = "courseid1"; + const userId = "cyuserId"; + const courseId = "courseid1"; - - before(()=>{ - // cy.clearAllOfAUsersActivities({userId}) - cy.signin({userId}); - cy.clearAllOfAUsersCoursesAndItems({userId}); - cy.createCourse({userId,courseId}); - }) - beforeEach(() => { - cy.signin({userId}); - cy.clearIndexedDB(); - cy.clearAllOfAUsersActivities({userId}) - //Just have the database clear this out - cy.task('queryDb', `DELETE FROM class_times WHERE courseId="${courseId}"`); - cy.visit(`http://localhost/course?tool=dashboard&courseId=${courseId}`) - }) - it('Add a default time',()=>{ - cy.get('[data-test="ClassTimes Menu"]').click(); - cy.get('[data-test="Add Classtime"]').click(); - cy.get('[data-test="DOTW Dropdown 0"]').contains('Monday'); - //Not sure why these don't work and component is changing anyways - // cy.get('[data-test="Classtime start time 0"]').contains('9:00 AM'); - // cy.get('[data-test="Classtime end time 0"]').contains('10:00 AM'); - }) + before(() => { + // cy.clearAllOfAUsersActivities({userId}) + cy.signin({ userId }); + cy.clearAllOfAUsersCoursesAndItems({ userId }); + cy.createCourse({ userId, courseId }); + }) + beforeEach(() => { + cy.signin({ userId }); + cy.clearIndexedDB(); + cy.clearAllOfAUsersActivities({ userId }) + //Just have the database clear this out + cy.task('queryDb', `DELETE FROM class_times WHERE courseId="${courseId}"`); + cy.visit(`/course?tool=dashboard&courseId=${courseId}`) + }) - it('Add and Delete a class time',()=>{ - cy.get('[data-test="ClassTimes Menu"]').click(); - cy.get('[data-test="Add Classtime"]').click(); - cy.get('[data-test="DOTW Dropdown 0"]').should('exist'); - cy.get('[data-test="Classtime Delete Button 0"]').click(); - cy.get('[data-test="DOTW Dropdown 0"]').should('not.exist'); - }) + it('Add a default time', () => { + cy.get('[data-test="ClassTimes Menu"]').click(); + cy.get('[data-test="Add Classtime"]').click(); + cy.get('[data-test="DOTW Dropdown 0"]').contains('Monday'); + //Not sure why these don't work and component is changing anyways + // cy.get('[data-test="Classtime start time 0"]').contains('9:00 AM'); + // cy.get('[data-test="Classtime end time 0"]').contains('10:00 AM'); + }) - it('stores in the database',()=>{ - cy.get('[data-test="ClassTimes Menu"]').click(); - cy.get('[data-test="Add Classtime"]').click(); - cy.get('[data-test="DOTW Dropdown 0"]').should('exist'); - cy.wait(200); - cy.task('queryDb', `SELECT * FROM class_times WHERE courseId="${courseId}"`).then((result)=>{ - expect(result.length).eq(1); - }); + it('Add and Delete a class time', () => { + cy.get('[data-test="ClassTimes Menu"]').click(); + cy.get('[data-test="Add Classtime"]').click(); + cy.get('[data-test="DOTW Dropdown 0"]').should('exist'); + cy.get('[data-test="Classtime Delete Button 0"]').click(); + cy.get('[data-test="DOTW Dropdown 0"]').should('not.exist'); + }) - }) + it('stores in the database', () => { + cy.get('[data-test="ClassTimes Menu"]').click(); + cy.get('[data-test="Add Classtime"]').click(); + cy.get('[data-test="DOTW Dropdown 0"]').should('exist'); + cy.wait(200); + cy.task('queryDb', `SELECT * FROM class_times WHERE courseId="${courseId}"`).then((result) => { + expect(result.length).eq(1); + }); + + }) }) \ No newline at end of file diff --git a/cypress/e2e/DoenetML/answerValidation/errorinnumbers.cy.js b/cypress/e2e/DoenetML/answerValidation/errorinnumbers.cy.js index 63f1534867..3ae900f7ef 100644 --- a/cypress/e2e/DoenetML/answerValidation/errorinnumbers.cy.js +++ b/cypress/e2e/DoenetML/answerValidation/errorinnumbers.cy.js @@ -12,7 +12,7 @@ describe('Allow error in numbers validation tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('expression with single number', () => { diff --git a/cypress/e2e/DoenetML/answerValidation/factoring.cy.js b/cypress/e2e/DoenetML/answerValidation/factoring.cy.js index d7f2018bb2..42f076bed4 100644 --- a/cypress/e2e/DoenetML/answerValidation/factoring.cy.js +++ b/cypress/e2e/DoenetML/answerValidation/factoring.cy.js @@ -2,7 +2,7 @@ describe('factor polynomial tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('factor x^2-1', () => { diff --git a/cypress/e2e/DoenetML/answerValidation/factoringOldAlgorithm.cy.js b/cypress/e2e/DoenetML/answerValidation/factoringOldAlgorithm.cy.js index 8b47397c48..18b4cec894 100644 --- a/cypress/e2e/DoenetML/answerValidation/factoringOldAlgorithm.cy.js +++ b/cypress/e2e/DoenetML/answerValidation/factoringOldAlgorithm.cy.js @@ -2,7 +2,7 @@ describe('factor polynomial tests, old algorithm', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) // Note: even through have a better factoring test, diff --git a/cypress/e2e/DoenetML/answerValidation/functionanswers.cy.js b/cypress/e2e/DoenetML/answerValidation/functionanswers.cy.js index 08c52495ea..769a98247c 100644 --- a/cypress/e2e/DoenetML/answerValidation/functionanswers.cy.js +++ b/cypress/e2e/DoenetML/answerValidation/functionanswers.cy.js @@ -2,7 +2,7 @@ describe('Function answer validation tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('simple function of input', () => { diff --git a/cypress/e2e/DoenetML/answerValidation/matchingpatterns.cy.js b/cypress/e2e/DoenetML/answerValidation/matchingpatterns.cy.js index e541dc2de0..e8f54c719a 100644 --- a/cypress/e2e/DoenetML/answerValidation/matchingpatterns.cy.js +++ b/cypress/e2e/DoenetML/answerValidation/matchingpatterns.cy.js @@ -12,7 +12,7 @@ describe('matching patterns answer tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('enter any quadratic', () => { diff --git a/cypress/e2e/DoenetML/answerValidation/matchpartial.cy.js b/cypress/e2e/DoenetML/answerValidation/matchpartial.cy.js index 59545d50e8..a3813bbb5e 100644 --- a/cypress/e2e/DoenetML/answerValidation/matchpartial.cy.js +++ b/cypress/e2e/DoenetML/answerValidation/matchpartial.cy.js @@ -13,7 +13,7 @@ describe('Match partial validation tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('match partial with ordered and unordered tuple', () => { diff --git a/cypress/e2e/DoenetML/answerValidation/pointlocation.cy.js b/cypress/e2e/DoenetML/answerValidation/pointlocation.cy.js index d89fecbda2..ac11c2dca9 100644 --- a/cypress/e2e/DoenetML/answerValidation/pointlocation.cy.js +++ b/cypress/e2e/DoenetML/answerValidation/pointlocation.cy.js @@ -2,7 +2,7 @@ describe('Point location validation tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('point in first quadrant', () => { diff --git a/cypress/e2e/DoenetML/answerValidation/symbolicequality.cy.js b/cypress/e2e/DoenetML/answerValidation/symbolicequality.cy.js index ad29aa38a5..2327fbcf39 100644 --- a/cypress/e2e/DoenetML/answerValidation/symbolicequality.cy.js +++ b/cypress/e2e/DoenetML/answerValidation/symbolicequality.cy.js @@ -12,7 +12,7 @@ describe('Symbolic equality tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('symbolic equality match with no simplification', () => { @@ -868,7 +868,7 @@ describe('Symbolic equality tests', function () { expect(stateVariables['/_answer4'].stateValues.creditAchieved).eq(1); }); - + cy.log("Submit as exp") cy.get(mathinputAnchor).type('{ctrl+home}{shift+end}{backspace}-5exp(-t)', { force: true }); cy.get(mathinputSubmitAnchor).click(); diff --git a/cypress/e2e/DoenetML/answerValidation/videoProgress.cy.js b/cypress/e2e/DoenetML/answerValidation/videoProgress.cy.js index 0957be77cb..fab91c0b58 100644 --- a/cypress/e2e/DoenetML/answerValidation/videoProgress.cy.js +++ b/cypress/e2e/DoenetML/answerValidation/videoProgress.cy.js @@ -12,7 +12,7 @@ describe('Video progress tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('Credit for watching video', () => { diff --git a/cypress/e2e/DoenetML/assignNames/basiccopy.cy.js b/cypress/e2e/DoenetML/assignNames/basiccopy.cy.js index 7f01a02ee3..0edec210e6 100644 --- a/cypress/e2e/DoenetML/assignNames/basiccopy.cy.js +++ b/cypress/e2e/DoenetML/assignNames/basiccopy.cy.js @@ -13,7 +13,7 @@ describe('Basic copy assignName Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('recursively copying and assigning names to text', () => { diff --git a/cypress/e2e/DoenetML/assignNames/collections.cy.js b/cypress/e2e/DoenetML/assignNames/collections.cy.js index e2db94697f..196eeb9bf8 100644 --- a/cypress/e2e/DoenetML/assignNames/collections.cy.js +++ b/cypress/e2e/DoenetML/assignNames/collections.cy.js @@ -14,7 +14,7 @@ describe('Collection assignName Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('name points and coords off a graph', () => { diff --git a/cypress/e2e/DoenetML/assignNames/selects.cy.js b/cypress/e2e/DoenetML/assignNames/selects.cy.js index 24a89a5479..0a0d82c37c 100644 --- a/cypress/e2e/DoenetML/assignNames/selects.cy.js +++ b/cypress/e2e/DoenetML/assignNames/selects.cy.js @@ -13,7 +13,7 @@ describe('selects assignName Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('assignNamesSkip in selects', () => { diff --git a/cypress/e2e/DoenetML/assignNames/sequences.cy.js b/cypress/e2e/DoenetML/assignNames/sequences.cy.js index 6cb58201ee..b9e791f46b 100644 --- a/cypress/e2e/DoenetML/assignNames/sequences.cy.js +++ b/cypress/e2e/DoenetML/assignNames/sequences.cy.js @@ -13,7 +13,7 @@ describe('sequence and map assignName Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('assignNames to dynamic copied sequence', () => { diff --git a/cypress/e2e/DoenetML/baseComponent/basecomponentproperties.cy.js b/cypress/e2e/DoenetML/baseComponent/basecomponentproperties.cy.js index f46c5e5d5d..79746c3f74 100644 --- a/cypress/e2e/DoenetML/baseComponent/basecomponentproperties.cy.js +++ b/cypress/e2e/DoenetML/baseComponent/basecomponentproperties.cy.js @@ -12,7 +12,7 @@ describe('base component property Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('change fixed even when fixed', () => { @@ -498,7 +498,7 @@ describe('base component property Tests', function () { cy.get('#\\/pti1IsDisabled').should('have.text', 'Is ti1 disabled? false'); cy.get('#\\/pti2IsDisabled').should('have.text', 'Is ti2 disabled? false'); - + }) it('change hidden, inverse direction', () => { diff --git a/cypress/e2e/DoenetML/baseComponent/doenetMLtext.cy.js b/cypress/e2e/DoenetML/baseComponent/doenetMLtext.cy.js index 76dabf9bff..f898851639 100644 --- a/cypress/e2e/DoenetML/baseComponent/doenetMLtext.cy.js +++ b/cypress/e2e/DoenetML/baseComponent/doenetMLtext.cy.js @@ -12,7 +12,7 @@ describe('DoenetML tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('doenetML state variable', () => { diff --git a/cypress/e2e/DoenetML/chemistry/atom.cy.js b/cypress/e2e/DoenetML/chemistry/atom.cy.js index 0e708f2ff5..8bff0d89f8 100644 --- a/cypress/e2e/DoenetML/chemistry/atom.cy.js +++ b/cypress/e2e/DoenetML/chemistry/atom.cy.js @@ -13,7 +13,7 @@ describe('Atom Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('information on atom', () => { diff --git a/cypress/e2e/DoenetML/chemistry/ion.cy.js b/cypress/e2e/DoenetML/chemistry/ion.cy.js index 20777caedf..b781a72470 100644 --- a/cypress/e2e/DoenetML/chemistry/ion.cy.js +++ b/cypress/e2e/DoenetML/chemistry/ion.cy.js @@ -13,7 +13,7 @@ describe('Ion Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('ion names and charges', () => { @@ -525,34 +525,34 @@ describe('Ion Tests', function () { let mathinputSCorrectAnchor = cesc('#' + mathinputSName + '_correct'); let mathinputSIncorrectAnchor = cesc('#' + mathinputSName + '_incorrect'); - cy.get(mathinputClAnchor).type("Cl{enter}", {force: true}); + cy.get(mathinputClAnchor).type("Cl{enter}", { force: true }); cy.get(mathinputClIncorrectAnchor).should('be.visible') - cy.get(mathinputClAnchor).type("{end}^-{enter}", {force: true}); + cy.get(mathinputClAnchor).type("{end}^-{enter}", { force: true }); cy.get(mathinputClCorrectAnchor).should('be.visible') - cy.get(mathinputHAnchor).type("H{enter}", {force: true}); + cy.get(mathinputHAnchor).type("H{enter}", { force: true }); cy.get(mathinputHIncorrectAnchor).should('be.visible') - cy.get(mathinputHAnchor).type("{end}^+{enter}", {force: true}); + cy.get(mathinputHAnchor).type("{end}^+{enter}", { force: true }); cy.get(mathinputHCorrectAnchor).should('be.visible') - cy.get(mathinputMgAnchor).type("Mg{enter}", {force: true}); + cy.get(mathinputMgAnchor).type("Mg{enter}", { force: true }); cy.get(mathinputMgIncorrectAnchor).should('be.visible') - cy.get(mathinputMgAnchor).type("{end}^2+{enter}", {force: true}); + cy.get(mathinputMgAnchor).type("{end}^2+{enter}", { force: true }); cy.get(mathinputMgCorrectAnchor).should('be.visible') - cy.get(mathinputPAnchor).type("P{enter}", {force: true}); + cy.get(mathinputPAnchor).type("P{enter}", { force: true }); cy.get(mathinputPIncorrectAnchor).should('be.visible') - cy.get(mathinputPAnchor).type("{end}^3-{enter}", {force: true}); + cy.get(mathinputPAnchor).type("{end}^3-{enter}", { force: true }); cy.get(mathinputPCorrectAnchor).should('be.visible') - cy.get(mathinputSAnchor).type("S{enter}", {force: true}); + cy.get(mathinputSAnchor).type("S{enter}", { force: true }); cy.get(mathinputSIncorrectAnchor).should('be.visible') - cy.get(mathinputSAnchor).type("{end}^2-{enter}", {force: true}); + cy.get(mathinputSAnchor).type("{end}^2-{enter}", { force: true }); cy.get(mathinputSCorrectAnchor).should('be.visible') }) diff --git a/cypress/e2e/DoenetML/chemistry/ioniccompound.cy.js b/cypress/e2e/DoenetML/chemistry/ioniccompound.cy.js index 19d7746467..9b31055ce8 100644 --- a/cypress/e2e/DoenetML/chemistry/ioniccompound.cy.js +++ b/cypress/e2e/DoenetML/chemistry/ioniccompound.cy.js @@ -13,7 +13,7 @@ describe('Ion Compounds Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('answer compounds from atom and ions', () => { @@ -52,13 +52,13 @@ describe('Ion Compounds Tests', function () { let mathinputLiOCorrectAnchor = cesc('#' + mathinputLiOName + '_correct'); let mathinputLiOIncorrectAnchor = cesc('#' + mathinputLiOName + '_incorrect'); - cy.get(mathinputLiOAnchor).type("LiO{enter}", {force: true}); + cy.get(mathinputLiOAnchor).type("LiO{enter}", { force: true }); cy.get(mathinputLiOIncorrectAnchor).should('be.visible') - cy.get(mathinputLiOAnchor).type("{end}{leftarrow} {enter}", {force: true}); + cy.get(mathinputLiOAnchor).type("{end}{leftarrow} {enter}", { force: true }); cy.get(mathinputLiOIncorrectAnchor).should('be.visible') - cy.get(mathinputLiOAnchor).type("{end}{leftarrow}{backspace}_2{enter}", {force: true}); + cy.get(mathinputLiOAnchor).type("{end}{leftarrow}{backspace}_2{enter}", { force: true }); cy.get(mathinputLiOCorrectAnchor).should('be.visible') let mathinputCaPName = stateVariables['/ansCaP'].stateValues.inputChildren[0].componentName @@ -67,13 +67,13 @@ describe('Ion Compounds Tests', function () { let mathinputCaPCorrectAnchor = cesc('#' + mathinputCaPName + '_correct'); let mathinputCaPIncorrectAnchor = cesc('#' + mathinputCaPName + '_incorrect'); - cy.get(mathinputCaPAnchor).type("CaP{enter}", {force: true}); + cy.get(mathinputCaPAnchor).type("CaP{enter}", { force: true }); cy.get(mathinputCaPIncorrectAnchor).should('be.visible') - cy.get(mathinputCaPAnchor).type("{end}{leftarrow}_3{enter}", {force: true}); + cy.get(mathinputCaPAnchor).type("{end}{leftarrow}_3{enter}", { force: true }); cy.get(mathinputCaPIncorrectAnchor).should('be.visible') - cy.get(mathinputCaPAnchor).type("{ctrl+end}_2{enter}", {force: true}); + cy.get(mathinputCaPAnchor).type("{ctrl+end}_2{enter}", { force: true }); cy.get(mathinputCaPCorrectAnchor).should('be.visible') let mathinputMgSName = stateVariables['/ansMgS'].stateValues.inputChildren[0].componentName @@ -82,10 +82,10 @@ describe('Ion Compounds Tests', function () { let mathinputMgSCorrectAnchor = cesc('#' + mathinputMgSName + '_correct'); let mathinputMgSIncorrectAnchor = cesc('#' + mathinputMgSName + '_incorrect'); - cy.get(mathinputMgSAnchor).type("MgS{enter}", {force: true}); + cy.get(mathinputMgSAnchor).type("MgS{enter}", { force: true }); cy.get(mathinputMgSIncorrectAnchor).should('be.visible') - cy.get(mathinputMgSAnchor).type("{end}{leftarrow} {enter}", {force: true}); + cy.get(mathinputMgSAnchor).type("{end}{leftarrow} {enter}", { force: true }); cy.get(mathinputMgSCorrectAnchor).should('be.visible') let mathinputSrIName = stateVariables['/ansSrI'].stateValues.inputChildren[0].componentName @@ -94,13 +94,13 @@ describe('Ion Compounds Tests', function () { let mathinputSrICorrectAnchor = cesc('#' + mathinputSrIName + '_correct'); let mathinputSrIIncorrectAnchor = cesc('#' + mathinputSrIName + '_incorrect'); - cy.get(mathinputSrIAnchor).type("SrI{enter}", {force: true}); + cy.get(mathinputSrIAnchor).type("SrI{enter}", { force: true }); cy.get(mathinputSrIIncorrectAnchor).should('be.visible') - cy.get(mathinputSrIAnchor).type("{end}_2{enter}", {force: true}); + cy.get(mathinputSrIAnchor).type("{end}_2{enter}", { force: true }); cy.get(mathinputSrIIncorrectAnchor).should('be.visible') - cy.get(mathinputSrIAnchor).type("{leftarrow}{leftarrow}{leftarrow} {enter}", {force: true}); + cy.get(mathinputSrIAnchor).type("{leftarrow}{leftarrow}{leftarrow} {enter}", { force: true }); cy.get(mathinputSrICorrectAnchor).should('be.visible') diff --git a/cypress/e2e/DoenetML/dynamicalsystem/cobwebpolyline.cy.js b/cypress/e2e/DoenetML/dynamicalsystem/cobwebpolyline.cy.js index 6262d1bee5..010794fa09 100644 --- a/cypress/e2e/DoenetML/dynamicalsystem/cobwebpolyline.cy.js +++ b/cypress/e2e/DoenetML/dynamicalsystem/cobwebpolyline.cy.js @@ -12,7 +12,7 @@ describe('CobwebPolyline Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/dynamicalsystem/equilibriumcurve.cy.js b/cypress/e2e/DoenetML/dynamicalsystem/equilibriumcurve.cy.js index b3cacdcd93..eeb65dee79 100644 --- a/cypress/e2e/DoenetML/dynamicalsystem/equilibriumcurve.cy.js +++ b/cypress/e2e/DoenetML/dynamicalsystem/equilibriumcurve.cy.js @@ -13,7 +13,7 @@ describe('Equilibriumcurve Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('equilibriumcurve change stable', () => { diff --git a/cypress/e2e/DoenetML/dynamicalsystem/equilibriumline.cy.js b/cypress/e2e/DoenetML/dynamicalsystem/equilibriumline.cy.js index a2fe3788a6..f510eb5e63 100644 --- a/cypress/e2e/DoenetML/dynamicalsystem/equilibriumline.cy.js +++ b/cypress/e2e/DoenetML/dynamicalsystem/equilibriumline.cy.js @@ -13,7 +13,7 @@ describe('Equilibriumline Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('equilibriumline change stable', () => { diff --git a/cypress/e2e/DoenetML/dynamicalsystem/equilibriumpoint.cy.js b/cypress/e2e/DoenetML/dynamicalsystem/equilibriumpoint.cy.js index dc6b611fa0..4983daaa3c 100644 --- a/cypress/e2e/DoenetML/dynamicalsystem/equilibriumpoint.cy.js +++ b/cypress/e2e/DoenetML/dynamicalsystem/equilibriumpoint.cy.js @@ -13,7 +13,7 @@ describe('Equilibriumpoint Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('equilibriumpoint change stable', () => { diff --git a/cypress/e2e/DoenetML/dynamicalsystem/odesystem.cy.js b/cypress/e2e/DoenetML/dynamicalsystem/odesystem.cy.js index bba6375d61..aa164423c4 100644 --- a/cypress/e2e/DoenetML/dynamicalsystem/odesystem.cy.js +++ b/cypress/e2e/DoenetML/dynamicalsystem/odesystem.cy.js @@ -4,7 +4,7 @@ describe('ODEsystem Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/equality/mathexpressions.cy.js b/cypress/e2e/DoenetML/equality/mathexpressions.cy.js index 05f6fbbb01..71915bcd4c 100644 --- a/cypress/e2e/DoenetML/equality/mathexpressions.cy.js +++ b/cypress/e2e/DoenetML/equality/mathexpressions.cy.js @@ -2,7 +2,7 @@ describe('Math expressions equality tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('equivalences', () => { diff --git a/cypress/e2e/DoenetML/graphing/graphreferences.cy.js b/cypress/e2e/DoenetML/graphing/graphreferences.cy.js index 2a69390cfd..965e2d1fac 100644 --- a/cypress/e2e/DoenetML/graphing/graphreferences.cy.js +++ b/cypress/e2e/DoenetML/graphing/graphreferences.cy.js @@ -4,7 +4,7 @@ describe('Graph Reference Test', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/graphing/graphreferences2.cy.js b/cypress/e2e/DoenetML/graphing/graphreferences2.cy.js index 53c46844b5..636c79a486 100644 --- a/cypress/e2e/DoenetML/graphing/graphreferences2.cy.js +++ b/cypress/e2e/DoenetML/graphing/graphreferences2.cy.js @@ -2,7 +2,7 @@ describe('Graph Reference Test 2', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/linearAlgebra/eigenDecomposition.cy.js b/cypress/e2e/DoenetML/linearAlgebra/eigenDecomposition.cy.js index faea7d1933..08e5cf3973 100644 --- a/cypress/e2e/DoenetML/linearAlgebra/eigenDecomposition.cy.js +++ b/cypress/e2e/DoenetML/linearAlgebra/eigenDecomposition.cy.js @@ -4,7 +4,7 @@ describe('EigenDecomposition Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -253,5 +253,5 @@ describe('EigenDecomposition Tag Tests', function () { }) function reviveComplex(num) { - return me.math.complex({re: num.re, im: num.im}) + return me.math.complex({ re: num.re, im: num.im }) } \ No newline at end of file diff --git a/cypress/e2e/DoenetML/tagSpecific/angle.cy.js b/cypress/e2e/DoenetML/tagSpecific/angle.cy.js index 3a08971b11..9c506f0660 100644 --- a/cypress/e2e/DoenetML/tagSpecific/angle.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/angle.cy.js @@ -13,7 +13,7 @@ describe('Angle Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('angle determined by three points, 45-45-90 triangle', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/animatefromsequence.cy.js b/cypress/e2e/DoenetML/tagSpecific/animatefromsequence.cy.js index 3f69e5f6a5..21a3aab070 100644 --- a/cypress/e2e/DoenetML/tagSpecific/animatefromsequence.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/animatefromsequence.cy.js @@ -2,7 +2,7 @@ describe('AnimateFromSequence Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('increase from 1 to 10', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/answer.cy.js b/cypress/e2e/DoenetML/tagSpecific/answer.cy.js index c5820020f9..a70a1278a9 100644 --- a/cypress/e2e/DoenetML/tagSpecific/answer.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/answer.cy.js @@ -12,7 +12,7 @@ describe('Answer Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('answer sugar from one string', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/bestfitline.cy.js b/cypress/e2e/DoenetML/tagSpecific/bestfitline.cy.js index eb34eed1bb..4b590475a8 100644 --- a/cypress/e2e/DoenetML/tagSpecific/bestfitline.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/bestfitline.cy.js @@ -4,7 +4,7 @@ describe('BestFitLine Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/boolean.cy.js b/cypress/e2e/DoenetML/tagSpecific/boolean.cy.js index d3944099d7..583f8d12ff 100644 --- a/cypress/e2e/DoenetML/tagSpecific/boolean.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/boolean.cy.js @@ -3,7 +3,7 @@ describe('Boolean Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/booleaninput.cy.js b/cypress/e2e/DoenetML/tagSpecific/booleaninput.cy.js index 34d792f8a3..e07c3cc089 100644 --- a/cypress/e2e/DoenetML/tagSpecific/booleaninput.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/booleaninput.cy.js @@ -12,7 +12,7 @@ describe('BooleanInput Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('single boolean input', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/booleanlist.cy.js b/cypress/e2e/DoenetML/tagSpecific/booleanlist.cy.js index 9c8d2f6ecb..c53dd9c756 100644 --- a/cypress/e2e/DoenetML/tagSpecific/booleanlist.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/booleanlist.cy.js @@ -2,7 +2,7 @@ describe('BooleanList Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/booleanoperators.cy.js b/cypress/e2e/DoenetML/tagSpecific/booleanoperators.cy.js index c6f9dbdd3c..ab6eb267c5 100644 --- a/cypress/e2e/DoenetML/tagSpecific/booleanoperators.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/booleanoperators.cy.js @@ -2,7 +2,7 @@ describe('Boolean Operator Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('not', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/booleanoperatorsonmath.cy.js b/cypress/e2e/DoenetML/tagSpecific/booleanoperatorsonmath.cy.js index f59e8d8825..b575e66e61 100644 --- a/cypress/e2e/DoenetML/tagSpecific/booleanoperatorsonmath.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/booleanoperatorsonmath.cy.js @@ -2,7 +2,7 @@ describe('Boolean Operator on Math Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('isinteger, is number', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/callaction.cy.js b/cypress/e2e/DoenetML/tagSpecific/callaction.cy.js index 5c63be52e3..f482f33038 100644 --- a/cypress/e2e/DoenetML/tagSpecific/callaction.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/callaction.cy.js @@ -12,7 +12,7 @@ describe('CallAction Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/choiceinput.cy.js b/cypress/e2e/DoenetML/tagSpecific/choiceinput.cy.js index 24b3f5bd9d..9c43ddd2db 100644 --- a/cypress/e2e/DoenetML/tagSpecific/choiceinput.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/choiceinput.cy.js @@ -13,7 +13,7 @@ describe('ChoiceInput Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('default is block format, shuffleOrder', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/circle.cy.js b/cypress/e2e/DoenetML/tagSpecific/circle.cy.js index ddfa87e313..c9e939263f 100644 --- a/cypress/e2e/DoenetML/tagSpecific/circle.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/circle.cy.js @@ -10,7 +10,7 @@ describe('Circle Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -9177,5 +9177,63 @@ describe('Circle Tag Tests', function () { }); + it('style description changes with theme', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + + + + + + + + + + + +

Circle A is $A.styleDescription.

+

B is a $B.styleDescriptionWithNoun.

+

C is a $C.styleDescriptionWithNoun.

+

A has a $A.borderStyleDescription border.

+

B has a $B.borderStyleDescription border.

+

C has a $C.borderStyleDescription border.

+

A has a $A.fillStyleDescription fill.

+

B has a $B.fillStyleDescription fill.

+

C has a $C.fillStyleDescription fill.

+ `}, "*"); + }); + + + cy.get('#\\/Adescrip').should('have.text', 'Circle A is filled brown with thick border.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a filled dark red circle.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a filled black circle with a thin border.'); + cy.get('#\\/Aborderdescrip').should('have.text', 'A has a thick brown border.'); + cy.get('#\\/Bborderdescrip').should('have.text', 'B has a dark red border.'); + cy.get('#\\/Cborderdescrip').should('have.text', 'C has a thin black border.'); + cy.get('#\\/Afilldescrip').should('have.text', 'A has a brown fill.'); + cy.get('#\\/Bfilldescrip').should('have.text', 'B has a dark red fill.'); + cy.get('#\\/Cfilldescrip').should('have.text', 'C has a black fill.'); + + cy.log('set dark mode') + cy.get('#testRunner_toggleControls').click(); + cy.get('#testRunner_darkmode').click() + cy.wait(100) + cy.get('#testRunner_toggleControls').click(); + + + cy.get('#\\/Adescrip').should('have.text', 'Circle A is filled yellow with thick border.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a filled light red circle.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a filled white circle with a thin border.'); + cy.get('#\\/Aborderdescrip').should('have.text', 'A has a thick yellow border.'); + cy.get('#\\/Bborderdescrip').should('have.text', 'B has a light red border.'); + cy.get('#\\/Cborderdescrip').should('have.text', 'C has a thin white border.'); + cy.get('#\\/Afilldescrip').should('have.text', 'A has a yellow fill.'); + cy.get('#\\/Bfilldescrip').should('have.text', 'B has a light red fill.'); + cy.get('#\\/Cfilldescrip').should('have.text', 'C has a white fill.'); + + + }); + }); diff --git a/cypress/e2e/DoenetML/tagSpecific/codeeditor.cy.js b/cypress/e2e/DoenetML/tagSpecific/codeeditor.cy.js index 90566bae4b..87f296df09 100644 --- a/cypress/e2e/DoenetML/tagSpecific/codeeditor.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/codeeditor.cy.js @@ -11,7 +11,7 @@ describe('Code Editor Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/collect.cy.js b/cypress/e2e/DoenetML/tagSpecific/collect.cy.js index 6a5a423d30..a211828d21 100644 --- a/cypress/e2e/DoenetML/tagSpecific/collect.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/collect.cy.js @@ -10,7 +10,7 @@ describe('Collect Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('collect points from graphs', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/componentsize.cy.js b/cypress/e2e/DoenetML/tagSpecific/componentsize.cy.js index 608d89fdad..207b102446 100644 --- a/cypress/e2e/DoenetML/tagSpecific/componentsize.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/componentsize.cy.js @@ -3,7 +3,7 @@ describe('Component Size Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) // Note: skipping all since we moved from widths to sizes diff --git a/cypress/e2e/DoenetML/tagSpecific/conditionalcontent.cy.js b/cypress/e2e/DoenetML/tagSpecific/conditionalcontent.cy.js index bc039b4472..894c2f4d5d 100644 --- a/cypress/e2e/DoenetML/tagSpecific/conditionalcontent.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/conditionalcontent.cy.js @@ -12,7 +12,7 @@ describe('Conditional Content Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/copy.cy.js b/cypress/e2e/DoenetML/tagSpecific/copy.cy.js index 58cb7e9431..d8244c64cb 100644 --- a/cypress/e2e/DoenetML/tagSpecific/copy.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/copy.cy.js @@ -20,7 +20,7 @@ describe('Copy Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/curve.bezier.cy.js b/cypress/e2e/DoenetML/tagSpecific/curve.bezier.cy.js index e84f86cf25..791e9019c1 100644 --- a/cypress/e2e/DoenetML/tagSpecific/curve.bezier.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/curve.bezier.cy.js @@ -2,7 +2,7 @@ describe('Curve Tag Bezier Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) function checkBezierCurve({ curve, throughPoints, directions, controlVectors }) { diff --git a/cypress/e2e/DoenetML/tagSpecific/curve.cy.js b/cypress/e2e/DoenetML/tagSpecific/curve.cy.js index f2e58f57ea..26511b01f0 100644 --- a/cypress/e2e/DoenetML/tagSpecific/curve.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/curve.cy.js @@ -5,7 +5,7 @@ describe('Curve Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('spline through four points, as string with copy', () => { @@ -1426,4 +1426,44 @@ describe('Curve Tag Tests', function () { }); + it('style description changes with theme', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + + + + + + + + + + + +

Curve A is $A.styleDescription.

+

B is a $B.styleDescriptionWithNoun.

+

C is a $C.styleDescriptionWithNoun.

+ `}, "*"); + }); + + + cy.get('#\\/Adescrip').should('have.text', 'Curve A is thick brown.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a dark red curve.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin black curve.'); + + cy.log('set dark mode') + cy.get('#testRunner_toggleControls').click(); + cy.get('#testRunner_darkmode').click() + cy.wait(100) + cy.get('#testRunner_toggleControls').click(); + + + cy.get('#\\/Adescrip').should('have.text', 'Curve A is thick yellow.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a light red curve.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin white curve.'); + + + }); + }); diff --git a/cypress/e2e/DoenetML/tagSpecific/curve.function.cy.js b/cypress/e2e/DoenetML/tagSpecific/curve.function.cy.js index d66a9b6d67..e7c037820e 100644 --- a/cypress/e2e/DoenetML/tagSpecific/curve.function.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/curve.function.cy.js @@ -4,7 +4,7 @@ describe('Function curve Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('a function of x', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/curve.parametrized.cy.js b/cypress/e2e/DoenetML/tagSpecific/curve.parametrized.cy.js index 0628576eab..deb2565284 100644 --- a/cypress/e2e/DoenetML/tagSpecific/curve.parametrized.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/curve.parametrized.cy.js @@ -4,7 +4,7 @@ describe('Parameterized Curve Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('sugar a parameterization in terms of x', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/document.cy.js b/cypress/e2e/DoenetML/tagSpecific/document.cy.js index 6ef5bcc9b8..0da7b05aae 100644 --- a/cypress/e2e/DoenetML/tagSpecific/document.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/document.cy.js @@ -12,7 +12,7 @@ describe('Document Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/endpoint.cy.js b/cypress/e2e/DoenetML/tagSpecific/endpoint.cy.js index 733f7e54f9..9a0cfb4178 100644 --- a/cypress/e2e/DoenetML/tagSpecific/endpoint.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/endpoint.cy.js @@ -13,7 +13,7 @@ describe('Endpoint Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('endpoint change open', () => { @@ -142,7 +142,7 @@ describe('Endpoint Tag Tests', function () { expect(stateVariables["/g2/D"].stateValues.open).eq(true); }) - + cy.log('cannot switch B via action') cy.window().then(async (win) => { await win.callAction1({ @@ -164,7 +164,7 @@ describe('Endpoint Tag Tests', function () { }) - + cy.log('cannot switch C via second action') cy.window().then(async (win) => { await win.callAction1({ @@ -185,7 +185,7 @@ describe('Endpoint Tag Tests', function () { expect(stateVariables["/g2/D"].stateValues.open).eq(true); }) - + cy.log('switch D via second action') cy.window().then(async (win) => { await win.callAction1({ diff --git a/cypress/e2e/DoenetML/tagSpecific/evaluate.cy.js b/cypress/e2e/DoenetML/tagSpecific/evaluate.cy.js index 281d861c9c..b0deec0431 100644 --- a/cypress/e2e/DoenetML/tagSpecific/evaluate.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/evaluate.cy.js @@ -5,7 +5,7 @@ describe('Evaluate Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/extract.cy.js b/cypress/e2e/DoenetML/tagSpecific/extract.cy.js index c544142ff8..14db06c151 100644 --- a/cypress/e2e/DoenetML/tagSpecific/extract.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/extract.cy.js @@ -20,7 +20,7 @@ describe('Extract Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('extract copies properties', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/feedback.cy.js b/cypress/e2e/DoenetML/tagSpecific/feedback.cy.js index 98c3f011f8..a15ddf5ca0 100644 --- a/cypress/e2e/DoenetML/tagSpecific/feedback.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/feedback.cy.js @@ -12,7 +12,7 @@ describe('Feedback Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('feedback from answer value or credit', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/function.cy.js b/cypress/e2e/DoenetML/tagSpecific/function.cy.js index b4a80bd102..93c75d1087 100644 --- a/cypress/e2e/DoenetML/tagSpecific/function.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/function.cy.js @@ -22,7 +22,7 @@ describe('Function Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('function with nothing', () => { @@ -6751,4 +6751,44 @@ describe('Function Tag Tests', function () { }) + it('style description changes with theme', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + + + + + + + + x^2 + x^2+2 + x^2+4 + +

Function A is $A.styleDescription.

+

B is a $B.styleDescriptionWithNoun.

+

C is a $C.styleDescriptionWithNoun.

+ `}, "*"); + }); + + + cy.get('#\\/Adescrip').should('have.text', 'Function A is thick brown.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a dark red function.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin black function.'); + + cy.log('set dark mode') + cy.get('#testRunner_toggleControls').click(); + cy.get('#testRunner_darkmode').click() + cy.wait(100) + cy.get('#testRunner_toggleControls').click(); + + + cy.get('#\\/Adescrip').should('have.text', 'Function A is thick yellow.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a light red function.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin white function.'); + + + }); + }); diff --git a/cypress/e2e/DoenetML/tagSpecific/functioniterates.cy.js b/cypress/e2e/DoenetML/tagSpecific/functioniterates.cy.js index bd9b2135a6..f4676e0492 100644 --- a/cypress/e2e/DoenetML/tagSpecific/functioniterates.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/functioniterates.cy.js @@ -21,7 +21,7 @@ describe('FunctionIterates Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/functionoperators.cy.js b/cypress/e2e/DoenetML/tagSpecific/functionoperators.cy.js index ccda660bf0..07d32d4243 100644 --- a/cypress/e2e/DoenetML/tagSpecific/functionoperators.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/functionoperators.cy.js @@ -22,7 +22,7 @@ describe('Function Operator Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/graph.cy.js b/cypress/e2e/DoenetML/tagSpecific/graph.cy.js index c0d7465df5..2a9c2f0b6d 100644 --- a/cypress/e2e/DoenetML/tagSpecific/graph.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/graph.cy.js @@ -14,7 +14,7 @@ describe('Graph Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/group.cy.js b/cypress/e2e/DoenetML/tagSpecific/group.cy.js index db4c3c0c10..10c0e2c000 100644 --- a/cypress/e2e/DoenetML/tagSpecific/group.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/group.cy.js @@ -2,7 +2,7 @@ describe('Group Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('nested groups, copied', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/hint.cy.js b/cypress/e2e/DoenetML/tagSpecific/hint.cy.js index 528153c3f3..aaff27f116 100644 --- a/cypress/e2e/DoenetML/tagSpecific/hint.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/hint.cy.js @@ -12,7 +12,7 @@ describe('Hints Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -67,7 +67,7 @@ describe('Hints Tag Tests', function () { cy.get('#\\/hint1 [data-test=hint-heading]').should("contain.text", "Hint") cy.get('#\\/hint2 [data-test=hint-heading]').should("contain.text", "Hint 2") cy.get('#\\/_title1').should('have.text', 'Hint 2'); - + }); diff --git a/cypress/e2e/DoenetML/tagSpecific/image.cy.js b/cypress/e2e/DoenetML/tagSpecific/image.cy.js index 9da889f90b..617448922a 100644 --- a/cypress/e2e/DoenetML/tagSpecific/image.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/image.cy.js @@ -13,7 +13,7 @@ describe('Image Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/integer.cy.js b/cypress/e2e/DoenetML/tagSpecific/integer.cy.js index 46be45e872..f5096c6e66 100644 --- a/cypress/e2e/DoenetML/tagSpecific/integer.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/integer.cy.js @@ -13,7 +13,7 @@ describe('Integer Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('1.2+1.1', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/label.cy.js b/cypress/e2e/DoenetML/tagSpecific/label.cy.js index b09948c151..d45fab010b 100644 --- a/cypress/e2e/DoenetML/tagSpecific/label.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/label.cy.js @@ -12,7 +12,7 @@ describe('Label Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/legend.cy.js b/cypress/e2e/DoenetML/tagSpecific/legend.cy.js index 70690233d8..2b4c9fe1a7 100644 --- a/cypress/e2e/DoenetML/tagSpecific/legend.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/legend.cy.js @@ -12,7 +12,7 @@ describe('Legend Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/line.cy.js b/cypress/e2e/DoenetML/tagSpecific/line.cy.js index 2da92ab704..c55fb0ebdd 100644 --- a/cypress/e2e/DoenetML/tagSpecific/line.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/line.cy.js @@ -101,7 +101,7 @@ describe('Line Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('move points copied by line', () => { @@ -9972,4 +9972,44 @@ describe('Line Tag Tests', function () { }); + it('style description changes with theme', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + + + + + + + + + + + +

Line A is $A.styleDescription.

+

B is a $B.styleDescriptionWithNoun.

+

C is a $C.styleDescriptionWithNoun.

+ `}, "*"); + }); + + + cy.get('#\\/Adescrip').should('have.text', 'Line A is thick brown.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a dark red line.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin black line.'); + + cy.log('set dark mode') + cy.get('#testRunner_toggleControls').click(); + cy.get('#testRunner_darkmode').click() + cy.wait(100) + cy.get('#testRunner_toggleControls').click(); + + + cy.get('#\\/Adescrip').should('have.text', 'Line A is thick yellow.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a light red line.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin white line.'); + + + }); + }) diff --git a/cypress/e2e/DoenetML/tagSpecific/linesegment.cy.js b/cypress/e2e/DoenetML/tagSpecific/linesegment.cy.js index 5b0b296e6a..c2bf858906 100644 --- a/cypress/e2e/DoenetML/tagSpecific/linesegment.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/linesegment.cy.js @@ -69,7 +69,7 @@ describe('LineSegment Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('lineSegment with no arguments', () => { @@ -3926,5 +3926,45 @@ describe('LineSegment Tag Tests', function () { }) + it('style description changes with theme', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + + + + + + + + + + + +

Line segment A is $A.styleDescription.

+

B is a $B.styleDescriptionWithNoun.

+

C is a $C.styleDescriptionWithNoun.

+ `}, "*"); + }); + + + cy.get('#\\/Adescrip').should('have.text', 'Line segment A is thick brown.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a dark red line segment.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin black line segment.'); + + cy.log('set dark mode') + cy.get('#testRunner_toggleControls').click(); + cy.get('#testRunner_darkmode').click() + cy.wait(100) + cy.get('#testRunner_toggleControls').click(); + + + cy.get('#\\/Adescrip').should('have.text', 'Line segment A is thick yellow.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a light red line segment.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin white line segment.'); + + + }); + }); \ No newline at end of file diff --git a/cypress/e2e/DoenetML/tagSpecific/lorem.cy.js b/cypress/e2e/DoenetML/tagSpecific/lorem.cy.js index ff1bfecec9..95ddf8945a 100644 --- a/cypress/e2e/DoenetML/tagSpecific/lorem.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/lorem.cy.js @@ -12,7 +12,7 @@ describe('Lorem Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -165,7 +165,7 @@ describe('Lorem Tag Tests', function () { cy.get(cesc('#/_text1')).should('have.text', 'b'); // to wait for page to load - + cy.get(cesc('#/n')).should('have.text', '1'); cy.window().then(async (win) => { let stateVariables = await win.returnAllStateVariables1(); diff --git a/cypress/e2e/DoenetML/tagSpecific/map.cy.js b/cypress/e2e/DoenetML/tagSpecific/map.cy.js index d76ff2e902..ddfbb24918 100644 --- a/cypress/e2e/DoenetML/tagSpecific/map.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/map.cy.js @@ -20,7 +20,7 @@ describe('Map Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('single map of maths', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/matchespattern.cy.js b/cypress/e2e/DoenetML/tagSpecific/matchespattern.cy.js index 0eeadc4ddb..4cfa036c64 100644 --- a/cypress/e2e/DoenetML/tagSpecific/matchespattern.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/matchespattern.cy.js @@ -3,7 +3,7 @@ describe('MatchesPattern Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/math.cy.js b/cypress/e2e/DoenetML/tagSpecific/math.cy.js index 6cafaf223a..7580a9475c 100644 --- a/cypress/e2e/DoenetML/tagSpecific/math.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/math.cy.js @@ -20,7 +20,7 @@ describe('Math Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('1+1', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/mathdisplay.cy.js b/cypress/e2e/DoenetML/tagSpecific/mathdisplay.cy.js index 364bd89f58..f304db2b13 100644 --- a/cypress/e2e/DoenetML/tagSpecific/mathdisplay.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/mathdisplay.cy.js @@ -2,7 +2,7 @@ describe('Math Display Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('inline and display', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/mathinput.cy.js b/cypress/e2e/DoenetML/tagSpecific/mathinput.cy.js index 49d9a9c18a..a82aa9bdf3 100644 --- a/cypress/e2e/DoenetML/tagSpecific/mathinput.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/mathinput.cy.js @@ -12,7 +12,7 @@ describe('MathInput Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('mathinput references', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/mathinputgraph.cy.js b/cypress/e2e/DoenetML/tagSpecific/mathinputgraph.cy.js index 88c7e10252..0e9426976f 100644 --- a/cypress/e2e/DoenetML/tagSpecific/mathinputgraph.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/mathinputgraph.cy.js @@ -13,7 +13,7 @@ describe('MathInput Graph Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('mathinputs specifying point', () => { @@ -96,10 +96,10 @@ describe('MathInput Graph Tests', function () { cy.log(`move point to (5,-6)`) cy.window().then(async (win) => { await win.callAction1({ - actionName: "movePoint", - componentName: "/_point1", - args: { x: 5, y: -6 } - }); + actionName: "movePoint", + componentName: "/_point1", + args: { x: 5, y: -6 } + }); let stateVariables = await win.returnAllStateVariables1(); expect(me.fromAst(stateVariables['/x'].stateValues.value).evaluate_to_constant()).to.eq(5); expect(me.fromAst(stateVariables['/y'].stateValues.value).evaluate_to_constant()).to.eq(-6); @@ -178,10 +178,10 @@ describe('MathInput Graph Tests', function () { cy.log(`try to move point to (5,6)`) cy.window().then(async (win) => { await win.callAction1({ - actionName: "movePoint", - componentName: "/_point1", - args: { x: 5, y: 6 } - }); + actionName: "movePoint", + componentName: "/_point1", + args: { x: 5, y: 6 } + }); let stateVariables = await win.returnAllStateVariables1(); expect(me.fromAst(stateVariables['/x'].stateValues.value).evaluate_to_constant()).to.eq(-1.2); expect(me.fromAst(stateVariables['/y'].stateValues.value).evaluate_to_constant()).to.eq(6); @@ -259,10 +259,10 @@ describe('MathInput Graph Tests', function () { cy.log(`try to move point to (5,6)`) cy.window().then(async (win) => { await win.callAction1({ - actionName: "movePoint", - componentName: "/_point1", - args: { x: 5, y: 6 } - }); + actionName: "movePoint", + componentName: "/_point1", + args: { x: 5, y: 6 } + }); let stateVariables = await win.returnAllStateVariables1(); expect(me.fromAst(stateVariables['/a'].stateValues.value).evaluate_to_constant()).is.eq(-1.5); expect(me.fromAst(stateVariables['/b'].stateValues.value).evaluate_to_constant()).is.eq(2); @@ -340,10 +340,10 @@ describe('MathInput Graph Tests', function () { cy.log(`move point to (5,6)`) cy.window().then(async (win) => { await win.callAction1({ - actionName: "movePoint", - componentName: "/_point1", - args: { x: 5, y: 6 } - }); + actionName: "movePoint", + componentName: "/_point1", + args: { x: 5, y: 6 } + }); let stateVariables = await win.returnAllStateVariables1(); expect(me.fromAst(stateVariables['/a'].stateValues.value).evaluate_to_constant()).is.eq(2.5); expect(me.fromAst(stateVariables['/b'].stateValues.value).evaluate_to_constant()).is.eq(2); diff --git a/cypress/e2e/DoenetML/tagSpecific/mathlist.cy.js b/cypress/e2e/DoenetML/tagSpecific/mathlist.cy.js index 69aeef9f8a..7d1d8408fb 100644 --- a/cypress/e2e/DoenetML/tagSpecific/mathlist.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/mathlist.cy.js @@ -12,7 +12,7 @@ describe('MathList Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('mathlist from string', () => { @@ -1295,10 +1295,10 @@ describe('MathList Tag Tests', function () { }) cy.log("change values") - cy.get("#\\/mi1 textarea").type("{end}{backspace}h{enter}", {force:true}); - cy.get("#\\/mi2 textarea").type("{end}{backspace}i{enter}", {force:true}); - cy.get("#\\/mi3 textarea").type("{end}{backspace}j{enter}", {force:true}); - cy.get("#\\/mi4 textarea").type("{end}{backspace}k{enter}", {force:true}); + cy.get("#\\/mi1 textarea").type("{end}{backspace}h{enter}", { force: true }); + cy.get("#\\/mi2 textarea").type("{end}{backspace}i{enter}", { force: true }); + cy.get("#\\/mi3 textarea").type("{end}{backspace}j{enter}", { force: true }); + cy.get("#\\/mi4 textarea").type("{end}{backspace}k{enter}", { force: true }); cy.log('Test value displayed in browser') @@ -1376,13 +1376,13 @@ describe('MathList Tag Tests', function () { cy.log("change values") - cy.get("#\\/mi1 textarea").type("{end}{backspace}l{enter}", {force:true}); - cy.get("#\\/mi2 textarea").type("{end}{backspace}m{enter}", {force:true}); - cy.get("#\\/mi3 textarea").type("{end}{backspace}n{enter}", {force:true}); - cy.get("#\\/mi4 textarea").type("{end}{backspace}o{enter}", {force:true}); - cy.get("#\\/mi5 textarea").type("{end}{backspace}p{enter}", {force:true}); - cy.get("#\\/mi6 textarea").type("{end}{backspace}q{enter}", {force:true}); - cy.get("#\\/mi7 textarea").type("{end}{backspace}r{enter}", {force:true}); + cy.get("#\\/mi1 textarea").type("{end}{backspace}l{enter}", { force: true }); + cy.get("#\\/mi2 textarea").type("{end}{backspace}m{enter}", { force: true }); + cy.get("#\\/mi3 textarea").type("{end}{backspace}n{enter}", { force: true }); + cy.get("#\\/mi4 textarea").type("{end}{backspace}o{enter}", { force: true }); + cy.get("#\\/mi5 textarea").type("{end}{backspace}p{enter}", { force: true }); + cy.get("#\\/mi6 textarea").type("{end}{backspace}q{enter}", { force: true }); + cy.get("#\\/mi7 textarea").type("{end}{backspace}r{enter}", { force: true }); cy.log('Test value displayed in browser') cy.get('#\\/_math4 .mjx-mrow').should('contain.text', 'r') @@ -1511,11 +1511,11 @@ describe('MathList Tag Tests', function () { cy.log("change values") - cy.get("#\\/mi1 textarea").type("{end}{backspace}f{enter}", {force:true}); - cy.get("#\\/mi2 textarea").type("{end}{backspace}g{enter}", {force:true}); - cy.get("#\\/mi3 textarea").type("{end}{backspace}h{enter}", {force:true}); - cy.get("#\\/mi4 textarea").type("{end}{backspace}i{enter}", {force:true}); - cy.get("#\\/mi5 textarea").type("{end}{backspace}j{enter}", {force:true}); + cy.get("#\\/mi1 textarea").type("{end}{backspace}f{enter}", { force: true }); + cy.get("#\\/mi2 textarea").type("{end}{backspace}g{enter}", { force: true }); + cy.get("#\\/mi3 textarea").type("{end}{backspace}h{enter}", { force: true }); + cy.get("#\\/mi4 textarea").type("{end}{backspace}i{enter}", { force: true }); + cy.get("#\\/mi5 textarea").type("{end}{backspace}j{enter}", { force: true }); cy.log('Test value displayed in browser') @@ -2287,7 +2287,7 @@ describe('MathList Tag Tests', function () { cy.get("#\\/ml1 .mjx-mrow").eq(0).should("have.text", "34.24502348") cy.get("#\\/ml1 .mjx-mrow").eq(1).should("have.text", "250") - + cy.get("#\\/ml1Dig4 .mjx-mrow").eq(0).should("have.text", "34.25") cy.get("#\\/ml1Dig4 .mjx-mrow").eq(1).should("have.text", "245.2") cy.get("#\\/ml1Dig4a .mjx-mrow").eq(0).should("have.text", "34.25") diff --git a/cypress/e2e/DoenetML/tagSpecific/mathoperators.cy.js b/cypress/e2e/DoenetML/tagSpecific/mathoperators.cy.js index 7009fedd2c..de2d14e9ac 100644 --- a/cypress/e2e/DoenetML/tagSpecific/mathoperators.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/mathoperators.cy.js @@ -15,7 +15,7 @@ describe('Math Operator Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('sum', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/matrix.cy.js b/cypress/e2e/DoenetML/tagSpecific/matrix.cy.js index c71f147278..63491b049d 100644 --- a/cypress/e2e/DoenetML/tagSpecific/matrix.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/matrix.cy.js @@ -12,7 +12,7 @@ describe('Matrix Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('no arguments, 0x0 matrix', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/matrixinput.cy.js b/cypress/e2e/DoenetML/tagSpecific/matrixinput.cy.js index 84a7cbd429..1c40b9ca90 100644 --- a/cypress/e2e/DoenetML/tagSpecific/matrixinput.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/matrixinput.cy.js @@ -12,7 +12,7 @@ describe('MatrixInput Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('no arguments, copy matrixinput', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/module.cy.js b/cypress/e2e/DoenetML/tagSpecific/module.cy.js index 7f0efcb6d1..f6224f4e28 100644 --- a/cypress/e2e/DoenetML/tagSpecific/module.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/module.cy.js @@ -12,7 +12,7 @@ describe('Module Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/number.cy.js b/cypress/e2e/DoenetML/tagSpecific/number.cy.js index 588653ef20..61cbee3b0e 100644 --- a/cypress/e2e/DoenetML/tagSpecific/number.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/number.cy.js @@ -13,7 +13,7 @@ describe('Number Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('1+1', () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/numberlist.cy.js b/cypress/e2e/DoenetML/tagSpecific/numberlist.cy.js index c42ab13ba2..2b9ebf9014 100644 --- a/cypress/e2e/DoenetML/tagSpecific/numberlist.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/numberlist.cy.js @@ -12,7 +12,7 @@ describe('Numberlist Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('numberlist from string', () => { @@ -1037,7 +1037,7 @@ describe('Numberlist Tag Tests', function () { cy.get('#\\/_text1').should('have.text', 'a'); // to wait until loaded cy.get("#\\/ml1").should("have.text", "34.24502348, 250") - + cy.get("#\\/ml1Dig4").should("have.text", "34.25, 245.2") cy.get("#\\/ml1Dig4a").should("have.text", "34.25, 245.2") @@ -1080,5 +1080,5 @@ describe('Numberlist Tag Tests', function () { }) }) - + }) diff --git a/cypress/e2e/DoenetML/tagSpecific/p.cy.js b/cypress/e2e/DoenetML/tagSpecific/p.cy.js index aee0e80656..cced55c2eb 100644 --- a/cypress/e2e/DoenetML/tagSpecific/p.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/p.cy.js @@ -3,7 +3,7 @@ describe('P Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/paginator.cy.js b/cypress/e2e/DoenetML/tagSpecific/paginator.cy.js index 4dee8f3338..2a8179e9b3 100644 --- a/cypress/e2e/DoenetML/tagSpecific/paginator.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/paginator.cy.js @@ -13,7 +13,7 @@ describe('Paginator Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/parabola.cy.js b/cypress/e2e/DoenetML/tagSpecific/parabola.cy.js index 88517ba9e8..133611f747 100644 --- a/cypress/e2e/DoenetML/tagSpecific/parabola.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/parabola.cy.js @@ -21,7 +21,7 @@ describe('Parabola Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/paragraphmarkup.cy.js b/cypress/e2e/DoenetML/tagSpecific/paragraphmarkup.cy.js index e92f9726f4..4061438b06 100644 --- a/cypress/e2e/DoenetML/tagSpecific/paragraphmarkup.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/paragraphmarkup.cy.js @@ -3,7 +3,7 @@ describe('Paragraph Markup Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/periodicset.cy.js b/cypress/e2e/DoenetML/tagSpecific/periodicset.cy.js index 393c7ab9a1..0979e5adec 100644 --- a/cypress/e2e/DoenetML/tagSpecific/periodicset.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/periodicset.cy.js @@ -2,7 +2,7 @@ describe('PeriodicSet Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -935,7 +935,7 @@ describe('PeriodicSet Tag Tests', function () { cy.get('#\\/offsets textarea').type('{end},8{enter}', { force: true }); cy.get('#\\/offsets2').should('contain.text', '3,1,8') - + cy.get("#\\/l1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { expect(text.trim()).equal('…,−6,−4,1,3,8,10,…') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/piecewisefunction.cy.js b/cypress/e2e/DoenetML/tagSpecific/piecewisefunction.cy.js index 66d3c32a32..ec28beb107 100644 --- a/cypress/e2e/DoenetML/tagSpecific/piecewisefunction.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/piecewisefunction.cy.js @@ -22,7 +22,7 @@ describe('Piecewise Function Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/pluralize.cy.js b/cypress/e2e/DoenetML/tagSpecific/pluralize.cy.js index 66a719d549..c69eeced61 100644 --- a/cypress/e2e/DoenetML/tagSpecific/pluralize.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/pluralize.cy.js @@ -3,7 +3,7 @@ describe('Pluralize Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/point.cy.js b/cypress/e2e/DoenetML/tagSpecific/point.cy.js index 5fa7e3b454..295afe94af 100644 --- a/cypress/e2e/DoenetML/tagSpecific/point.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/point.cy.js @@ -13,7 +13,7 @@ describe('Point Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -3583,7 +3583,7 @@ describe('Point Tag Tests', function () { }) - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') cy.window().then(async (win) => { win.postMessage({ @@ -8193,6184 +8193,4 @@ describe('Point Tag Tests', function () { }) - it('points depending on each other', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - - - - - - - `}, "*"); - }); - - - // use this to wait for page to load - cy.get('#\\/_text1').should('have.text', 'a'); - - cy.log("initial values") - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(9,7)`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - let x = 9; - let y = 7; - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - }); - - cy.log("move point 1") - cy.window().then(async (win) => { - let x = -3; - let y = 5; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point1', - args: { x, y } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - }); - }) - - cy.log("move point 2") - cy.window().then(async (win) => { - let x = 7; - let y = 9; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point2', - args: { x: y, y: x } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - }); - }) - - }) - - it('points depending on each other 2', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - (, 7) - (, 9) - - - - - `}, "*"); - }); - - - // use this to wait for page to load - cy.get('#\\/_text1').should('have.text', 'a'); - - cy.log("initial values") - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(9,7)`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - let x = 9; - let y = 7; - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - }); - - cy.log("move point 1") - cy.window().then(async (win) => { - let x = -3; - let y = 5; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point1', - args: { x, y } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - }) - }); - - cy.log("move point 2") - cy.window().then(async (win) => { - let x = 7; - let y = 9; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point2', - args: { x: y, y: x } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - }); - }) - - - }) - - it('points depending on each other through intermediaries', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - - - - - - - - - - `}, "*"); - }); - - // use this to wait for page to load - cy.get('#\\/_text1').should('have.text', 'a'); - - cy.log("initial values") - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(9,7)`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - let x = 9; - let y = 7; - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); - - }); - - cy.log("move point 1") - cy.window().then(async (win) => { - let x = -3; - let y = 5; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point1', - args: { x, y } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); - }) - }); - - cy.log("move point 2") - cy.window().then(async (win) => { - let x = 7; - let y = 9; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point2', - args: { x: y, y: x } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); - }) - }); - - - cy.log("move point 3") - cy.window().then(async (win) => { - let x = 6; - let y = -1; - - win.callAction1({ - actionName: "movePoint", - componentName: '/P1ap', - args: { x, y } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); - }) - }); - - - cy.log("move point 4") - cy.window().then(async (win) => { - let x = -3; - let y = 2; - - win.callAction1({ - actionName: "movePoint", - componentName: '/P2ap', - args: { x: y, y: x } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); - }) - }); - - - }) - - it('points depending on each other through intermediaries 2', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - (, 7) - (, 9) - - - - - - - - - - `}, "*"); - }); - - // use this to wait for page to load - cy.get('#\\/_text1').should('have.text', 'a'); - - cy.log("initial values") - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(9,7)`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - let x = 9; - let y = 7; - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); - - }); - - cy.log("move point 1") - cy.window().then(async (win) => { - let x = -3; - let y = 5; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point1', - args: { x, y } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); - }) - }); - - cy.log("move point 2") - cy.window().then(async (win) => { - let x = 7; - let y = 9; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point2', - args: { x: y, y: x } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); - }) - }); - - - cy.log("move point 3") - cy.window().then(async (win) => { - let x = 6; - let y = -1; - - win.callAction1({ - actionName: "movePoint", - componentName: '/P1ap', - args: { x, y } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); - }) - }); - - - cy.log("move point 4") - cy.window().then(async (win) => { - let x = -3; - let y = 2; - - win.callAction1({ - actionName: "movePoint", - componentName: '/P2ap', - args: { x: y, y: x } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); - - }); - }) - - - }) - - it('points depending on each other, one using coords', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - - - - - - - `}, "*"); - }); - - - // use this to wait for page to load - cy.get('#\\/_text1').should('have.text', 'a'); - - cy.log("initial values") - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(9,7)`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - let x = 9; - let y = 7; - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - - }); - - cy.log("move point 1") - cy.window().then(async (win) => { - let x = -3; - let y = 5; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point1', - args: { x, y } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - }) - }); - - cy.log("move point 2") - cy.window().then(async (win) => { - let x = 7; - let y = 9; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point2', - args: { x: y, y: x } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); - }) - }); - - - }) - - it('points depending on themselves', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - (3, 2+1) - (2+1, 3) - - - - - - `}, "*"); - }); - - - // use this to wait for page to load - cy.get('#\\/_text1').should('have.text', 'a'); - - cy.log("initial values") - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - let x1 = 3; - let y1 = 2 * x1 + 1; - - let y2 = 3; - let x2 = 2 * y2 + 1; - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(${x1},${y1})`) - - }); - - cy.log("move points") - cy.window().then(async (win) => { - let x1 = -3; - let y1try = 5; - - let x2 = 9; - let y2try = -7; - - let y1 = 2 * x1 + 1; - let y2 = (x2 - 1) / 2; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point1', - args: { x: x1, y: y1try } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/_point2', - args: { x: x2, y: y2try } - }) - - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x1)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y1)}`) - cy.get('#\\/coords2 .mjx-mrow').should('contain.text', `${Math.abs(x2)}`) - cy.get('#\\/coords2 .mjx-mrow').should('contain.text', `${Math.abs(y2)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); - - }) - }); - - - }) - - it('points depending original graph axis limit', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - - (,5) - - - - - - - `}, "*"); - }); - - - // use this to wait for page to load - cy.get('#\\/_text1').should('have.text', 'a'); - - cy.log("initial values") - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - let x1 = 3; - let y1 = 10; - let x2 = -10 - let y2 = 5; - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(${x1},${y1})`) - - }); - - cy.log("move points") - cy.window().then(async (win) => { - let x1 = 1; - let y1 = 5; - let x2 = 8 - let y2 = -3; - - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point1', - args: { x: x1, y: y1 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/_point2', - args: { x: x2, y: y2 } - }) - - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x1)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `10`) - cy.get('#\\/coords2 .mjx-mrow').should('contain.text', `−10`) - cy.get('#\\/coords2 .mjx-mrow').should('contain.text', `${Math.abs(y2)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(10); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(-10); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); - - }) - }); - - - }) - - it('label points by combining coordinates with other point', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - - (1,2) - - - (3,4) - - - - -

Label 1:

-

Label 2:

- `}, "*"); - }); - - // use this to wait for page to load - cy.get('#\\/_text1').should('have.text', 'a'); - - cy.log("initial values") - - cy.get('#\\/_p1').should('have.text', 'Label 1: 1, 3') - cy.get('#\\/_p2').should('have.text', 'Label 2: 2, 4') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - let x1 = 1; - let y1 = 2; - let x2 = 3; - let y2 = 4; - - let label1 = `${x1}, ${x2}`; - let label2 = `${y1}, ${y2}`; - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); - - expect(stateVariables['/_point1'].stateValues.label).eq(label1); - expect(stateVariables['/_point2'].stateValues.label).eq(label2); - - }); - - cy.log("move points") - cy.window().then(async (win) => { - let x1 = 1; - let y1 = 5; - let x2 = 8 - let y2 = -3; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point1', - args: { x: x1, y: y1 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/_point2', - args: { x: x2, y: y2 } - }) - - let label1 = `${x1}, ${x2}`; - let label2 = `${y1}, ${y2}`; - - cy.get('#\\/_p1').should('have.text', `Label 1: ${label1}`) - cy.get('#\\/_p2').should('have.text', `Label 2: ${label2}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); - - expect(stateVariables['/_point1'].stateValues.label).eq(label1); - expect(stateVariables['/_point2'].stateValues.label).eq(label2); - - cy.get('#\\/_p1').should('have.text', `Label 1: ${label1}`) - cy.get('#\\/_p2').should('have.text', `Label 2: ${label2}`) - - }); - }) - - - cy.log("move points to fractional coordinates") - cy.window().then(async (win) => { - let x1 = 3.12552502; - let y1 = -3.4815436398; - let x2 = 0.36193540738 - let y2 = 7.813395519475; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point1', - args: { x: x1, y: y1 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/_point2', - args: { x: x2, y: y2 } - }) - - - let x1round = me.fromAst(x1).round_numbers_to_precision(3); - let y1round = me.fromAst(y1).round_numbers_to_precision(3); - let x2round = me.fromAst(x2).round_numbers_to_precision(3); - let y2round = me.fromAst(y2).round_numbers_to_precision(3); - - let label1 = `${x1round}, ${x2round}`; - let label2 = `${y1round}, ${y2round}`; - - - cy.get('#\\/_p1').should('have.text', `Label 1: ${label1}`) - cy.get('#\\/_p2').should('have.text', `Label 2: ${label2}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); - - expect(stateVariables['/_point1'].stateValues.label).eq(label1); - expect(stateVariables['/_point2'].stateValues.label).eq(label2); - }) - }); - - }) - - it('label points by combining coordinates with other point 2', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - - (1,2) - - - (3,4) - - - - -

Label 1:

-

Label 2:

- `}, "*"); - }); - - // use this to wait for page to load - cy.get('#\\/_text1').should('have.text', 'a'); - - cy.log("initial values") - - cy.get('#\\/_p1').should('contain.text', 'Label 1: ') - cy.get('#\\/_p2').should('contain.text', 'Label 2: ') - cy.get('#\\/_p1').find('.mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq('1'); - }) - cy.get('#\\/_p1').find('.mjx-mrow').eq(1).invoke('text').then(text => { - expect(text).eq('3'); - }) - cy.get('#\\/_p2').find('.mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq('2'); - }) - cy.get('#\\/_p2').find('.mjx-mrow').eq(1).invoke('text').then(text => { - expect(text).eq('4'); - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - let x1 = 1; - let y1 = 2; - let x2 = 3; - let y2 = 4; - - let label1 = `\\(${x1}\\), \\(${x2}\\)`; - let label2 = `\\(${y1}\\), \\(${y2}\\)`; - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); - - expect(stateVariables['/_point1'].stateValues.label).eq(label1); - expect(stateVariables['/_point2'].stateValues.label).eq(label2); - - }); - - cy.log("move points") - cy.window().then(async (win) => { - let x1 = 1; - let y1 = 5; - let x2 = 8 - let y2 = -3; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point1', - args: { x: x1, y: y1 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/_point2', - args: { x: x2, y: y2 } - }) - - let label1 = `\\(${x1}\\), \\(${x2}\\)`; - let label2 = `\\(${y1}\\), \\(${y2}\\)`; - - cy.get('#\\/_p1').should('contain.text', `${x2}`) - - cy.get('#\\/_p1').find('.mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq(`${x1}`); - }) - cy.get('#\\/_p1').find('.mjx-mrow').eq(1).invoke('text').then(text => { - expect(text).eq(`${x2}`); - }) - cy.get('#\\/_p2').find('.mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq(`${y1}`); - }) - cy.get('#\\/_p2').find('.mjx-mrow').eq(1).invoke('text').then(text => { - expect(text).eq(`−3`); - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); - - expect(stateVariables['/_point1'].stateValues.label).eq(label1); - expect(stateVariables['/_point2'].stateValues.label).eq(label2); - - }); - }) - - - cy.log("move points to fractional coordinates") - cy.window().then(async (win) => { - let x1 = 3.12552502; - let y1 = -3.4815436398; - let x2 = 0.36193540738 - let y2 = 7.813395519475; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point1', - args: { x: x1, y: y1 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/_point2', - args: { x: x2, y: y2 } - }) - - - let x1round = me.fromAst(x1).round_numbers_to_precision(3); - let y1round = me.fromAst(y1).round_numbers_to_precision(3); - let x2round = me.fromAst(x2).round_numbers_to_precision(3); - let y2round = me.fromAst(y2).round_numbers_to_precision(3); - - let label1 = `\\(${x1round}\\), \\(${x2round}\\)`; - let label2 = `\\(${y1round}\\), \\(${y2round}\\)`; - - cy.get('#\\/_p1').should('contain.text', `${x2round}`) - - cy.get('#\\/_p1').find('.mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq(`${x1round}`); - }) - cy.get('#\\/_p1').find('.mjx-mrow').eq(1).invoke('text').then(text => { - expect(text).eq(`${x2round}`); - }) - cy.get('#\\/_p2').find('.mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq(`−3.48`); - }) - cy.get('#\\/_p2').find('.mjx-mrow').eq(1).invoke('text').then(text => { - expect(text).eq(`${y2round}`); - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); - - expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); - expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); - - expect(stateVariables['/_point1'].stateValues.label).eq(label1); - expect(stateVariables['/_point2'].stateValues.label).eq(label2); - }) - }); - - }) - - it('update point with constraints', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - 0 - - - - (1,-7) - - - - - - - - - - `}, "*"); - }); - - cy.get("#\\/_text1").should('have.text', 'a'); // to wait for page to load - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(−4,1)`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - let x = -4; - let y = 1; - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - expect((stateVariables['/_point3'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point3'].stateValues.xs)[1]).eq(0); - expect((stateVariables['/_point4'].stateValues.xs)[0]).eq(0); - expect((stateVariables['/_point4'].stateValues.xs)[1]).eq(y); - - }); - - cy.log("move first point") - cy.window().then(async (win) => { - let x = 3; - let y = -2; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point1', - args: { x, y } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - expect((stateVariables['/_point3'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point3'].stateValues.xs)[1]).eq(0); - expect((stateVariables['/_point4'].stateValues.xs)[0]).eq(0); - expect((stateVariables['/_point4'].stateValues.xs)[1]).eq(y); - }) - }); - - cy.log("move x-axis point") - cy.window().then(async (win) => { - let x = 9; - let y = -2; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point3', - args: { x, y: -3 } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - expect((stateVariables['/_point3'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point3'].stateValues.xs)[1]).eq(0); - expect((stateVariables['/_point4'].stateValues.xs)[0]).eq(0); - expect((stateVariables['/_point4'].stateValues.xs)[1]).eq(y); - }) - }); - - cy.log("move y-axis point") - cy.window().then(async (win) => { - let x = 9; - let y = -7.1; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point4', - args: { x: -10, y: y } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - expect((stateVariables['/_point3'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point3'].stateValues.xs)[1]).eq(0); - expect((stateVariables['/_point4'].stateValues.xs)[0]).eq(0); - expect((stateVariables['/_point4'].stateValues.xs)[1]).eq(y); - }) - }); - - cy.log("move near attractor") - cy.window().then(async (win) => { - let x = 1; - let y = -7; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point3', - args: { x: 0.9, y: 6 } - }) - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(1,−7)`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - expect((stateVariables['/_point3'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point3'].stateValues.xs)[1]).eq(0); - expect((stateVariables['/_point4'].stateValues.xs)[0]).eq(0); - expect((stateVariables['/_point4'].stateValues.xs)[1]).eq(y); - }) - }); - - cy.log("move again near attractor to make sure doesn't change") - cy.window().then(async (win) => { - let x = 1; - let y = -7; - - win.callAction1({ - actionName: "movePoint", - componentName: '/_point3', - args: { x: 1.1, y: 6 } - }) - - // since nothing has changed in the DOM - // check boolean input and wait for it to change - // to make sure got message back from core - cy.get('#\\/bi').click(); - cy.get('#\\/b').should('have.text', 'true'); - - cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(1,−7)`) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); - expect((stateVariables['/_point3'].stateValues.xs)[0]).eq(x); - expect((stateVariables['/_point3'].stateValues.xs)[1]).eq(0); - expect((stateVariables['/_point4'].stateValues.xs)[0]).eq(0); - expect((stateVariables['/_point4'].stateValues.xs)[1]).eq(y); - }) - }); - }) - - it('change point dimensions', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a -

Specify point coordinates:

- -
The points -

The point:

-

The point copied:

-

The point copied again:

-
- -
From point 1 -

Number of dimensions:

-

x-coordinate:

-

y-coordinate:

-

z-coordinate:

-

All individual coordinates:

-

Coordinates:

-
- -
From point 2 -

Number of dimensions:

-

x-coordinate:

-

y-coordinate:

-

z-coordinate:

-

All individual coordinates:

-

Coordinates:

-
- -
From point 3 -

Number of dimensions:

-

x-coordinate:

-

y-coordinate:

-

z-coordinate:

-

All individual coordinates:

-

Coordinates:

-
- -
For point 1 -

Change coords:

-

Change x-coordinate:

-

Change y-coordinate:

-

Change z-coordinate:

-
- -
For point 2 -

Change coords:

-

Change x-coordinate:

-

Change y-coordinate:

-

Change z-coordinate:

-
- -
For point 3 -

Change coords:

-

Change x-coordinate:

-

Change y-coordinate:

-

Change z-coordinate:

-
- -
collecting -

x-coordinates:

-

y-coordinates:

-

z-coordinates:

-

All individual coordinates:

-

Coordinates:

-
- -
Extracting from point 3 -

x-coordinate:

-

y-coordinate:

-

z-coordinate:

-

All individual coordinates:

-

Coordinates:

-
- - `}, "*"); - }); - - cy.get("#\\/_text1").should('have.text', 'a'); // to wait for page to load - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/nDimensions1").should('have.text', '1'); - cy.get("#\\/nDimensions2").should('have.text', '1'); - cy.get("#\\/nDimensions3").should('have.text', '1'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/p1y").should('have.text', 'y-coordinate: ') - cy.get("#\\/p2y").should('have.text', 'y-coordinate: ') - cy.get("#\\/p3y").should('have.text', 'y-coordinate: ') - cy.get("#\\/p3ye").should('have.text', 'y-coordinate: ') - cy.get("#\\/pally").should('have.text', 'y-coordinates: ') - cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') - cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(1); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(1); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('_'); - expect(stateVariables['/_point1'].stateValues.x1).eq('_'); - expect(stateVariables['/_point1'].stateValues.x2).eq(undefined); - expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(1); - expect((stateVariables['/point2'].stateValues.xs).length).eq(1); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('_'); - expect(stateVariables['/point2'].stateValues.x1).eq('_'); - expect(stateVariables['/point2'].stateValues.x2).eq(undefined); - expect(stateVariables['/point2'].stateValues.x3).eq(undefined); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(1); - expect((stateVariables['/point3'].stateValues.xs).length).eq(1); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('_'); - expect(stateVariables['/point3'].stateValues.x1).eq('_'); - expect(stateVariables['/point3'].stateValues.x2).eq(undefined); - expect(stateVariables['/point3'].stateValues.x3).eq(undefined); - - }); - - cy.log('Create 2D point') - cy.get('#\\/originalCoords textarea').type('{end}{backspace}(a,b){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(a,b)') - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/nDimensions1").should('have.text', '2'); - cy.get("#\\/nDimensions2").should('have.text', '2'); - cy.get("#\\/nDimensions3").should('have.text', '2'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') - cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).should('not.exist') - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('a'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('b'); - expect(stateVariables['/_point1'].stateValues.x1).eq('a'); - expect(stateVariables['/_point1'].stateValues.x2).eq('b'); - expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point2'].stateValues.xs).length).eq(2); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('a'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('b'); - expect(stateVariables['/point2'].stateValues.x1).eq('a'); - expect(stateVariables['/point2'].stateValues.x2).eq('b'); - expect(stateVariables['/point2'].stateValues.x3).eq(undefined); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point3'].stateValues.xs).length).eq(2); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('a'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('b'); - expect(stateVariables['/point3'].stateValues.x1).eq('a'); - expect(stateVariables['/point3'].stateValues.x2).eq('b'); - expect(stateVariables['/point3'].stateValues.x3).eq(undefined); - - }); - - - - cy.log('Back to 1D point') - cy.get('#\\/originalCoords textarea').type('{ctrl+home}{shift+end}{backspace}q{enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', 'q') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/nDimensions1").should('have.text', '1'); - cy.get("#\\/nDimensions2").should('have.text', '1'); - cy.get("#\\/nDimensions3").should('have.text', '1'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - - cy.get("#\\/p1y").should('have.text', 'y-coordinate: ') - cy.get("#\\/p2y").should('have.text', 'y-coordinate: ') - cy.get("#\\/p3y").should('have.text', 'y-coordinate: ') - cy.get("#\\/p3ye").should('have.text', 'y-coordinate: ') - cy.get("#\\/pally").should('have.text', 'y-coordinates: ') - - cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') - cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).should('not.exist') - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).should('not.exist') - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).should('not.exist') - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).should('not.exist') - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).should('not.exist') - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(1); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(1); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('q'); - expect(stateVariables['/_point1'].stateValues.x1).eq('q'); - expect(stateVariables['/_point1'].stateValues.x2).eq(undefined); - expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(1); - expect((stateVariables['/point2'].stateValues.xs).length).eq(1); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('q'); - expect(stateVariables['/point2'].stateValues.x1).eq('q'); - expect(stateVariables['/point2'].stateValues.x2).eq(undefined); - expect(stateVariables['/point2'].stateValues.x3).eq(undefined); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(1); - expect((stateVariables['/point3'].stateValues.xs).length).eq(1); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('q'); - expect(stateVariables['/point3'].stateValues.x1).eq('q'); - expect(stateVariables['/point3'].stateValues.x2).eq(undefined); - expect(stateVariables['/point3'].stateValues.x3).eq(undefined); - - }); - - - - cy.log('Create 3D point') - cy.get('#\\/originalCoords textarea').type('{end}{backspace}\\langle 2x,u/v{rightarrow},w^2{rightarrow}\\rangle {enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(2x,uv,w2)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - cy.get("#\\/nDimensions1").should('have.text', '3'); - cy.get("#\\/nDimensions2").should('have.text', '3'); - cy.get("#\\/nDimensions3").should('have.text', '3'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - cy.get("#\\/p3alle .mjx-mrow").should('contain.text', "2x") - cy.get("#\\/p3alle .mjx-mrow").should('contain.text', "uv") - cy.get("#\\/p3alle .mjx-mrow").should('contain.text', "w2") - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { - expect(text.trim()).equal('2x') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(9).invoke('text').then((text) => { - expect(text.trim()).equal('uv') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(10).invoke('text').then((text) => { - expect(text.trim()).equal('w2') - }) - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eqls(["*", 2, "x"]); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eqls(["/", "u", "v"]); - expect((stateVariables['/_point1'].stateValues.xs)[2]).eqls(["^", "w", 2]); - expect(stateVariables['/_point1'].stateValues.x1).eqls(["*", 2, "x"]);; - expect(stateVariables['/_point1'].stateValues.x2).eqls(["/", "u", "v"]); - expect(stateVariables['/_point1'].stateValues.x3).eqls(["^", "w", 2]); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point2'].stateValues.xs).length).eq(3); - expect((stateVariables['/point2'].stateValues.xs)[0]).eqls(["*", 2, "x"]); - expect((stateVariables['/point2'].stateValues.xs)[1]).eqls(["/", "u", "v"]); - expect((stateVariables['/point2'].stateValues.xs)[2]).eqls(["^", "w", 2]); - expect(stateVariables['/point2'].stateValues.x1).eqls(["*", 2, "x"]); - expect(stateVariables['/point2'].stateValues.x2).eqls(["/", "u", "v"]); - expect(stateVariables['/point2'].stateValues.x3).eqls(["^", "w", 2]); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point3'].stateValues.xs).length).eq(3); - expect((stateVariables['/point3'].stateValues.xs)[0]).eqls(["*", 2, "x"]); - expect((stateVariables['/point3'].stateValues.xs)[1]).eqls(["/", "u", "v"]); - expect((stateVariables['/point3'].stateValues.xs)[2]).eqls(["^", "w", 2]); - expect(stateVariables['/point3'].stateValues.x1).eqls(["*", 2, "x"]); - expect(stateVariables['/point3'].stateValues.x2).eqls(["/", "u", "v"]); - expect(stateVariables['/point3'].stateValues.x3).eqls(["^", "w", 2]); - - }); - - - cy.log('change the coordinates from point 1 coords') - cy.get("#\\/coords1b textarea").type('{ctrl+home}{shift+end}{backspace}(7,8,9){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(7,8,9)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(7,8,9)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(7,8,9)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(7,8,9)') - }) - cy.get("#\\/nDimensions1").should('have.text', '3'); - cy.get("#\\/nDimensions2").should('have.text', '3'); - cy.get("#\\/nDimensions3").should('have.text', '3'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { - expect(text.trim()).equal('7') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { - expect(text.trim()).equal('8') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { - expect(text.trim()).equal('9') - }) - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(7,8,9)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(7,8,9)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(7,8,9)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(7,8,9)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(7,8,9)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(7,8,9)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(7,8,9)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(7); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(8); - expect((stateVariables['/_point1'].stateValues.xs)[2]).eq(9); - expect(stateVariables['/_point1'].stateValues.x1).eq(7);; - expect(stateVariables['/_point1'].stateValues.x2).eq(8); - expect(stateVariables['/_point1'].stateValues.x3).eq(9); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point2'].stateValues.xs).length).eq(3); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq(7); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq(8); - expect((stateVariables['/point2'].stateValues.xs)[2]).eq(9); - expect(stateVariables['/point2'].stateValues.x1).eq(7); - expect(stateVariables['/point2'].stateValues.x2).eq(8); - expect(stateVariables['/point2'].stateValues.x3).eq(9); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point3'].stateValues.xs).length).eq(3); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq(7); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq(8); - expect((stateVariables['/point3'].stateValues.xs)[2]).eq(9); - expect(stateVariables['/point3'].stateValues.x1).eq(7); - expect(stateVariables['/point3'].stateValues.x2).eq(8); - expect(stateVariables['/point3'].stateValues.x3).eq(9); - - }); - - - cy.log('change the coordinates from point 2 coords') - cy.get("#\\/coords2b textarea").type('{ctrl+home}{shift+end}{backspace}\\langle i,j,k\\rangle {enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(i,j,k)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(i,j,k)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(i,j,k)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(i,j,k)') - }) - cy.get("#\\/nDimensions1").should('have.text', '3'); - cy.get("#\\/nDimensions2").should('have.text', '3'); - cy.get("#\\/nDimensions3").should('have.text', '3'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { - expect(text.trim()).equal('i') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { - expect(text.trim()).equal('j') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { - expect(text.trim()).equal('k') - }) - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(i,j,k)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(i,j,k)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(i,j,k)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(i,j,k)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(i,j,k)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(i,j,k)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(i,j,k)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('i'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('j'); - expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('k'); - expect(stateVariables['/_point1'].stateValues.x1).eq('i');; - expect(stateVariables['/_point1'].stateValues.x2).eq('j'); - expect(stateVariables['/_point1'].stateValues.x3).eq('k'); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point2'].stateValues.xs).length).eq(3); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('i'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('j'); - expect((stateVariables['/point2'].stateValues.xs)[2]).eq('k'); - expect(stateVariables['/point2'].stateValues.x1).eq('i'); - expect(stateVariables['/point2'].stateValues.x2).eq('j'); - expect(stateVariables['/point2'].stateValues.x3).eq('k'); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point3'].stateValues.xs).length).eq(3); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('i'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('j'); - expect((stateVariables['/point3'].stateValues.xs)[2]).eq('k'); - expect(stateVariables['/point3'].stateValues.x1).eq('i'); - expect(stateVariables['/point3'].stateValues.x2).eq('j'); - expect(stateVariables['/point3'].stateValues.x3).eq('k'); - - }); - - - - cy.log('change the coordinates from point 3 coords') - cy.get("#\\/coords3b textarea").type('{ctrl+home}{shift+end}{backspace}(l,m,n){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(l,m,n)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(l,m,n)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(l,m,n)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(l,m,n)') - }) - cy.get("#\\/nDimensions1").should('have.text', '3'); - cy.get("#\\/nDimensions2").should('have.text', '3'); - cy.get("#\\/nDimensions3").should('have.text', '3'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { - expect(text.trim()).equal('l') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { - expect(text.trim()).equal('m') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { - expect(text.trim()).equal('n') - }) - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(l,m,n)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(l,m,n)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(l,m,n)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(l,m,n)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(l,m,n)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(l,m,n)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(l,m,n)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('l'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('m'); - expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('n'); - expect(stateVariables['/_point1'].stateValues.x1).eq('l');; - expect(stateVariables['/_point1'].stateValues.x2).eq('m'); - expect(stateVariables['/_point1'].stateValues.x3).eq('n'); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point2'].stateValues.xs).length).eq(3); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('l'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('m'); - expect((stateVariables['/point2'].stateValues.xs)[2]).eq('n'); - expect(stateVariables['/point2'].stateValues.x1).eq('l'); - expect(stateVariables['/point2'].stateValues.x2).eq('m'); - expect(stateVariables['/point2'].stateValues.x3).eq('n'); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point3'].stateValues.xs).length).eq(3); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('l'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('m'); - expect((stateVariables['/point3'].stateValues.xs)[2]).eq('n'); - expect(stateVariables['/point3'].stateValues.x1).eq('l'); - expect(stateVariables['/point3'].stateValues.x2).eq('m'); - expect(stateVariables['/point3'].stateValues.x3).eq('n'); - - }); - - - - cy.log('change the coordinates from point 1 individual components') - cy.get("#\\/point1x1b textarea").type('{end}{backspace}r{enter}', { force: true }); - cy.get("#\\/point1x2b textarea").type('{end}{backspace}s{enter}', { force: true }); - cy.get("#\\/point1x3b textarea").type('{end}{backspace}t{enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(r,s,t)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(r,s,t)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(r,s,t)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(r,s,t)') - }) - cy.get("#\\/nDimensions1").should('have.text', '3'); - cy.get("#\\/nDimensions2").should('have.text', '3'); - cy.get("#\\/nDimensions3").should('have.text', '3'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(r,s,t)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(r,s,t)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(r,s,t)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(r,s,t)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(r,s,t)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(r,s,t)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(r,s,t)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('r'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('s'); - expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('t'); - expect(stateVariables['/_point1'].stateValues.x1).eq('r');; - expect(stateVariables['/_point1'].stateValues.x2).eq('s'); - expect(stateVariables['/_point1'].stateValues.x3).eq('t'); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point2'].stateValues.xs).length).eq(3); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('r'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('s'); - expect((stateVariables['/point2'].stateValues.xs)[2]).eq('t'); - expect(stateVariables['/point2'].stateValues.x1).eq('r'); - expect(stateVariables['/point2'].stateValues.x2).eq('s'); - expect(stateVariables['/point2'].stateValues.x3).eq('t'); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point3'].stateValues.xs).length).eq(3); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('r'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('s'); - expect((stateVariables['/point3'].stateValues.xs)[2]).eq('t'); - expect(stateVariables['/point3'].stateValues.x1).eq('r'); - expect(stateVariables['/point3'].stateValues.x2).eq('s'); - expect(stateVariables['/point3'].stateValues.x3).eq('t'); - - }); - - - - cy.log('change the coordinates from point 2 individual components') - cy.get("#\\/point2x1b textarea").type('{end}{backspace}f{enter}', { force: true }); - cy.get("#\\/point2x2b textarea").type('{end}{backspace}g{enter}', { force: true }); - cy.get("#\\/point2x3b textarea").type('{end}{backspace}h{enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(f,g,h)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(f,g,h)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(f,g,h)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(f,g,h)') - }) - cy.get("#\\/nDimensions1").should('have.text', '3'); - cy.get("#\\/nDimensions2").should('have.text', '3'); - cy.get("#\\/nDimensions3").should('have.text', '3'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - - // TODO: makes no sense why this is failing. - // It seems to be in the DOM just like the others - // cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - // expect(text.trim()).equal('h') - // }) - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { - expect(text.trim()).equal('f') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(f,g,h)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(f,g,h)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(f,g,h)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(f,g,h)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(f,g,h)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(f,g,h)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(f,g,h)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('f'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('g'); - expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('h'); - expect(stateVariables['/_point1'].stateValues.x1).eq('f');; - expect(stateVariables['/_point1'].stateValues.x2).eq('g'); - expect(stateVariables['/_point1'].stateValues.x3).eq('h'); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point2'].stateValues.xs).length).eq(3); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('f'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('g'); - expect((stateVariables['/point2'].stateValues.xs)[2]).eq('h'); - expect(stateVariables['/point2'].stateValues.x1).eq('f'); - expect(stateVariables['/point2'].stateValues.x2).eq('g'); - expect(stateVariables['/point2'].stateValues.x3).eq('h'); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point3'].stateValues.xs).length).eq(3); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('f'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('g'); - expect((stateVariables['/point3'].stateValues.xs)[2]).eq('h'); - expect(stateVariables['/point3'].stateValues.x1).eq('f'); - expect(stateVariables['/point3'].stateValues.x2).eq('g'); - expect(stateVariables['/point3'].stateValues.x3).eq('h'); - - }); - - - - cy.log('change the coordinates from point 3 individual components') - cy.get("#\\/point3x1b textarea").type('{end}{backspace}x{enter}', { force: true }); - cy.get("#\\/point3x2b textarea").type('{end}{backspace}y{enter}', { force: true }); - cy.get("#\\/point3x3b textarea").type('{end}{backspace}z{enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(x,y,z)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(x,y,z)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(x,y,z)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(x,y,z)') - }) - cy.get("#\\/nDimensions1").should('have.text', '3'); - cy.get("#\\/nDimensions2").should('have.text', '3'); - cy.get("#\\/nDimensions3").should('have.text', '3'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { - expect(text.trim()).equal('x') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { - expect(text.trim()).equal('y') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(x,y,z)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(x,y,z)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(x,y,z)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(x,y,z)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(x,y,z)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(x,y,z)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(x,y,z)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('x'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('y'); - expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('z'); - expect(stateVariables['/_point1'].stateValues.x1).eq('x');; - expect(stateVariables['/_point1'].stateValues.x2).eq('y'); - expect(stateVariables['/_point1'].stateValues.x3).eq('z'); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point2'].stateValues.xs).length).eq(3); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('x'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('y'); - expect((stateVariables['/point2'].stateValues.xs)[2]).eq('z'); - expect(stateVariables['/point2'].stateValues.x1).eq('x'); - expect(stateVariables['/point2'].stateValues.x2).eq('y'); - expect(stateVariables['/point2'].stateValues.x3).eq('z'); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point3'].stateValues.xs).length).eq(3); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('x'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('y'); - expect((stateVariables['/point3'].stateValues.xs)[2]).eq('z'); - expect(stateVariables['/point3'].stateValues.x1).eq('x'); - expect(stateVariables['/point3'].stateValues.x2).eq('y'); - expect(stateVariables['/point3'].stateValues.x3).eq('z'); - - }); - - - - cy.log(`can't decrease dimension from inverse direction 1`) - cy.get("#\\/coords1b textarea").type('{ctrl+home}{shift+end}{backspace}(u,v){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(u,v,z)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(u,v,z)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(u,v,z)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(u,v,z)') - }) - cy.get("#\\/nDimensions1").should('have.text', '3'); - cy.get("#\\/nDimensions2").should('have.text', '3'); - cy.get("#\\/nDimensions3").should('have.text', '3'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { - expect(text.trim()).equal('u') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { - expect(text.trim()).equal('v') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(u,v,z)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(u,v,z)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(u,v,z)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(u,v,z)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(u,v,z)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(u,v,z)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(u,v,z)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('u'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('v'); - expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('z'); - expect(stateVariables['/_point1'].stateValues.x1).eq('u');; - expect(stateVariables['/_point1'].stateValues.x2).eq('v'); - expect(stateVariables['/_point1'].stateValues.x3).eq('z'); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point2'].stateValues.xs).length).eq(3); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('u'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('v'); - expect((stateVariables['/point2'].stateValues.xs)[2]).eq('z'); - expect(stateVariables['/point2'].stateValues.x1).eq('u'); - expect(stateVariables['/point2'].stateValues.x2).eq('v'); - expect(stateVariables['/point2'].stateValues.x3).eq('z'); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point3'].stateValues.xs).length).eq(3); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('u'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('v'); - expect((stateVariables['/point3'].stateValues.xs)[2]).eq('z'); - expect(stateVariables['/point3'].stateValues.x1).eq('u'); - expect(stateVariables['/point3'].stateValues.x2).eq('v'); - expect(stateVariables['/point3'].stateValues.x3).eq('z'); - - }); - - - - cy.log(`can't decrease dimension from inverse direction 2`) - cy.get("#\\/coords2b textarea").type('{ctrl+home}{shift+end}{backspace}(s,t){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(s,t,z)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(s,t,z)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(s,t,z)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(s,t,z)') - }) - cy.get("#\\/nDimensions1").should('have.text', '3'); - cy.get("#\\/nDimensions2").should('have.text', '3'); - cy.get("#\\/nDimensions3").should('have.text', '3'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { - expect(text.trim()).equal('s') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { - expect(text.trim()).equal('t') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(s,t,z)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(s,t,z)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(s,t,z)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(s,t,z)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(s,t,z)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(s,t,z)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(s,t,z)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('s'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('t'); - expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('z'); - expect(stateVariables['/_point1'].stateValues.x1).eq('s');; - expect(stateVariables['/_point1'].stateValues.x2).eq('t'); - expect(stateVariables['/_point1'].stateValues.x3).eq('z'); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point2'].stateValues.xs).length).eq(3); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('s'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('t'); - expect((stateVariables['/point2'].stateValues.xs)[2]).eq('z'); - expect(stateVariables['/point2'].stateValues.x1).eq('s'); - expect(stateVariables['/point2'].stateValues.x2).eq('t'); - expect(stateVariables['/point2'].stateValues.x3).eq('z'); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point3'].stateValues.xs).length).eq(3); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('s'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('t'); - expect((stateVariables['/point3'].stateValues.xs)[2]).eq('z'); - expect(stateVariables['/point3'].stateValues.x1).eq('s'); - expect(stateVariables['/point3'].stateValues.x2).eq('t'); - expect(stateVariables['/point3'].stateValues.x3).eq('z'); - - }); - - - cy.log(`can't decrease dimension from inverse direction 3`) - cy.get("#\\/coords3b textarea").type('{ctrl+home}{shift+end}{backspace}(q,r){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(q,r,z)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(q,r,z)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(q,r,z)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(q,r,z)') - }) - cy.get("#\\/nDimensions1").should('have.text', '3'); - cy.get("#\\/nDimensions2").should('have.text', '3'); - cy.get("#\\/nDimensions3").should('have.text', '3'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { - expect(text.trim()).equal('r') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { - expect(text.trim()).equal('z') - }) - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(q,r,z)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(q,r,z)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(q,r,z)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(q,r,z)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(q,r,z)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(q,r,z)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(q,r,z)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('q'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('r'); - expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('z'); - expect(stateVariables['/_point1'].stateValues.x1).eq('q');; - expect(stateVariables['/_point1'].stateValues.x2).eq('r'); - expect(stateVariables['/_point1'].stateValues.x3).eq('z'); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point2'].stateValues.xs).length).eq(3); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('q'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('r'); - expect((stateVariables['/point2'].stateValues.xs)[2]).eq('z'); - expect(stateVariables['/point2'].stateValues.x1).eq('q'); - expect(stateVariables['/point2'].stateValues.x2).eq('r'); - expect(stateVariables['/point2'].stateValues.x3).eq('z'); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point3'].stateValues.xs).length).eq(3); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('q'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('r'); - expect((stateVariables['/point3'].stateValues.xs)[2]).eq('z'); - expect(stateVariables['/point3'].stateValues.x1).eq('q'); - expect(stateVariables['/point3'].stateValues.x2).eq('r'); - expect(stateVariables['/point3'].stateValues.x3).eq('z'); - - }); - - - - - - - cy.log('Back to 2D point') - cy.get('#\\/originalCoords textarea').type('{ctrl+home}{shift+end}{backspace}(p,q){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(p,q)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - cy.get("#\\/nDimensions1").should('have.text', '2'); - cy.get("#\\/nDimensions2").should('have.text', '2'); - cy.get("#\\/nDimensions3").should('have.text', '2'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') - cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('p') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).should('not.exist') - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('p'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('q'); - expect(stateVariables['/_point1'].stateValues.x1).eq('p'); - expect(stateVariables['/_point1'].stateValues.x2).eq('q'); - expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point2'].stateValues.xs).length).eq(2); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('p'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('q'); - expect(stateVariables['/point2'].stateValues.x1).eq('p'); - expect(stateVariables['/point2'].stateValues.x2).eq('q'); - expect(stateVariables['/point2'].stateValues.x3).eq(undefined); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point3'].stateValues.xs).length).eq(2); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('p'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('q'); - expect(stateVariables['/point3'].stateValues.x1).eq('p'); - expect(stateVariables['/point3'].stateValues.x2).eq('q'); - expect(stateVariables['/point3'].stateValues.x3).eq(undefined); - - }); - - - cy.log(`can't increase dimension from inverse direction 1`) - cy.get("#\\/coords1b textarea").type('{ctrl+home}{shift+end}{backspace}(a,b,c){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(a,b)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/nDimensions1").should('have.text', '2'); - cy.get("#\\/nDimensions2").should('have.text', '2'); - cy.get("#\\/nDimensions3").should('have.text', '2'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') - cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('a') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('b') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).should('not.exist') - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('a'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('b'); - expect(stateVariables['/_point1'].stateValues.x1).eq('a'); - expect(stateVariables['/_point1'].stateValues.x2).eq('b'); - expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point2'].stateValues.xs).length).eq(2); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('a'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('b'); - expect(stateVariables['/point2'].stateValues.x1).eq('a'); - expect(stateVariables['/point2'].stateValues.x2).eq('b'); - expect(stateVariables['/point2'].stateValues.x3).eq(undefined); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point3'].stateValues.xs).length).eq(2); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('a'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('b'); - expect(stateVariables['/point3'].stateValues.x1).eq('a'); - expect(stateVariables['/point3'].stateValues.x2).eq('b'); - expect(stateVariables['/point3'].stateValues.x3).eq(undefined); - - }); - - - - cy.log(`can't increase dimension from inverse direction 2`) - cy.get("#\\/coords2b textarea").type('{ctrl+home}{shift+end}{backspace}(d,e,f){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(d,e)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(d,e)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(d,e)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(d,e)') - }) - cy.get("#\\/nDimensions1").should('have.text', '2'); - cy.get("#\\/nDimensions2").should('have.text', '2'); - cy.get("#\\/nDimensions3").should('have.text', '2'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') - cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('d') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('e') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).should('not.exist') - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(d,e)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(d,e)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(d,e)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(d,e)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(d,e)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(d,e)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(d,e)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('d'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('e'); - expect(stateVariables['/_point1'].stateValues.x1).eq('d'); - expect(stateVariables['/_point1'].stateValues.x2).eq('e'); - expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point2'].stateValues.xs).length).eq(2); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('d'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('e'); - expect(stateVariables['/point2'].stateValues.x1).eq('d'); - expect(stateVariables['/point2'].stateValues.x2).eq('e'); - expect(stateVariables['/point2'].stateValues.x3).eq(undefined); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point3'].stateValues.xs).length).eq(2); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('d'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('e'); - expect(stateVariables['/point3'].stateValues.x1).eq('d'); - expect(stateVariables['/point3'].stateValues.x2).eq('e'); - expect(stateVariables['/point3'].stateValues.x3).eq(undefined); - - }); - - - cy.log(`can't increase dimension from inverse direction 3`) - cy.get("#\\/coords3b textarea").type('{ctrl+home}{shift+end}{backspace}(g,h,i){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(g,h)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(g,h)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(g,h)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(g,h)') - }) - cy.get("#\\/nDimensions1").should('have.text', '2'); - cy.get("#\\/nDimensions2").should('have.text', '2'); - cy.get("#\\/nDimensions3").should('have.text', '2'); - cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') - cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') - cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') - - cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/p1all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/p2all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/p3all").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).should('not.exist') - - cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { - expect(text.trim()).equal('g') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { - expect(text.trim()).equal('h') - }) - cy.get("#\\/pallall").find('.mjx-mrow').eq(6).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(7).should('not.exist') - cy.get("#\\/pallall").find('.mjx-mrow').eq(8).should('not.exist') - - cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(g,h)') - }) - cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(g,h)') - }) - cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(g,h)') - }) - cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(g,h)') - }) - cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(g,h)') - }) - cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(g,h)') - }) - cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(g,h)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('g'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('h'); - expect(stateVariables['/_point1'].stateValues.x1).eq('g'); - expect(stateVariables['/_point1'].stateValues.x2).eq('h'); - expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point2'].stateValues.xs).length).eq(2); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('g'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('h'); - expect(stateVariables['/point2'].stateValues.x1).eq('g'); - expect(stateVariables['/point2'].stateValues.x2).eq('h'); - expect(stateVariables['/point2'].stateValues.x3).eq(undefined); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point3'].stateValues.xs).length).eq(2); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('g'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('h'); - expect(stateVariables['/point3'].stateValues.x1).eq('g'); - expect(stateVariables['/point3'].stateValues.x2).eq('h'); - expect(stateVariables['/point3'].stateValues.x3).eq(undefined); - - }); - - - - - - - - }) - - // have this abbreviated test, at it was triggering an error - // that wasn't caught with full test - it('change point dimensions, abbreviated', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a -

Specify point coordinates:

- -
The points -

The point:

-

The point copied:

-

The point copied again:

-
- - `}, "*"); - }); - - cy.get("#\\/_text1").should('have.text', 'a'); // to wait for page to load - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('_') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(1); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(1); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('_'); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(1); - expect((stateVariables['/point2'].stateValues.xs).length).eq(1); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('_'); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(1); - expect((stateVariables['/point3'].stateValues.xs).length).eq(1); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('_'); - - }); - - cy.log('Create 2D point 2') - cy.get('#\\/originalCoords textarea').type('(a,b){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(a,b)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(a,b)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('a'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('b'); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point2'].stateValues.xs).length).eq(2); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('a'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('b'); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point3'].stateValues.xs).length).eq(2); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('a'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('b'); - - }); - - - - cy.log('Back to 1D point') - cy.get('#\\/originalCoords textarea').type('{ctrl+home}{shift+end}{backspace}q{enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', 'q') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('q') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(1); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(1); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('q'); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(1); - expect((stateVariables['/point2'].stateValues.xs).length).eq(1); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('q'); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(1); - expect((stateVariables['/point3'].stateValues.xs).length).eq(1); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('q'); - - }); - - - - cy.log('Create 3D point') - cy.get('#\\/originalCoords textarea').type('{end}{backspace}(2x,u/v{rightarrow},w^2{rightarrow}){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(2x,uv,w2)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(2x,uv,w2)') - }) - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eqls(["*", 2, "x"]); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eqls(["/", "u", "v"]); - expect((stateVariables['/_point1'].stateValues.xs)[2]).eqls(["^", "w", 2]); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point2'].stateValues.xs).length).eq(3); - expect((stateVariables['/point2'].stateValues.xs)[0]).eqls(["*", 2, "x"]); - expect((stateVariables['/point2'].stateValues.xs)[1]).eqls(["/", "u", "v"]); - expect((stateVariables['/point2'].stateValues.xs)[2]).eqls(["^", "w", 2]); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); - expect((stateVariables['/point3'].stateValues.xs).length).eq(3); - expect((stateVariables['/point3'].stateValues.xs)[0]).eqls(["*", 2, "x"]); - expect((stateVariables['/point3'].stateValues.xs)[1]).eqls(["/", "u", "v"]); - expect((stateVariables['/point3'].stateValues.xs)[2]).eqls(["^", "w", 2]); - - }); - - - - - - cy.log('Back to 2D point 2') - cy.get('#\\/originalCoords textarea').type('{ctrl+home}{shift+end}{backspace}(p,q){enter}', { force: true }); - - cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(p,q)') - - cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('(p,q)') - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); - expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); - expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('p'); - expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('q'); - expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point2'].stateValues.xs).length).eq(2); - expect((stateVariables['/point2'].stateValues.xs)[0]).eq('p'); - expect((stateVariables['/point2'].stateValues.xs)[1]).eq('q'); - expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); - expect((stateVariables['/point3'].stateValues.xs).length).eq(2); - expect((stateVariables['/point3'].stateValues.xs)[0]).eq('p'); - expect((stateVariables['/point3'].stateValues.xs)[1]).eq('q'); - - }); - - - }) - - it('label positioning', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - - - (1,2) - - - -

label:

-

position: - - upperRight - upperLeft - lowerRight - lowerLeft - -

- - `}, "*"); - }); - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - // not sure what to test as don't know how to check renderer... - - cy.get('#\\/label_input').clear().type("B{enter}") - - cy.get('#\\/labelPos').select("upperLeft") - cy.get('#\\/labelPos').select("lowerRight") - cy.get('#\\/labelPos').select("lowerLeft") - - }); - - - it('copy and overwrite coordinates, initial individual components', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - - - - - - - - - - - - - - - - - - 1 - - `}, "*"); - }); - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - cy.log('initial values') - - cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(1,2,4)') - cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(3,0,1)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/A'].stateValues.xs)).eqls([1, 2]) - expect((stateVariables['/B'].stateValues.xs)).eqls([3, 4]) - expect((stateVariables['/C'].stateValues.xs)).eqls([3, 1]) - expect((stateVariables['/A1'].stateValues.xs)).eqls([-1, 2]) - expect((stateVariables['/B1'].stateValues.xs)).eqls([3, -2]) - expect((stateVariables['/C1'].stateValues.xs)).eqls([1, 1]) - expect((stateVariables['/C2/C'].stateValues.xs)).eqls([3, 0]) - expect((stateVariables['/A2'].stateValues.xs)).eqls([1, 2, 4]) - expect((stateVariables['/C3'].stateValues.xs)).eqls([3, 0, 1]) - expect(stateVariables['/A'].stateValues.label).eq('A'); - expect(stateVariables['/A1'].stateValues.label).eq('A'); - expect(stateVariables['/B'].stateValues.label).eq('B'); - expect(stateVariables['/B1'].stateValues.label).eq('B'); - expect(stateVariables['/C'].stateValues.label).eq('C'); - expect(stateVariables['/C1'].stateValues.label).eq('C'); - expect(stateVariables['/C2/C'].stateValues.label).eq('C'); - - }) - - cy.log('move original points') - - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/A', - args: { x: -2, y: -7 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/B', - args: { x: 5.1, y: 8.9 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/C', - args: { x: -3, y: -8 } - }) - }) - - cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(−2,−7,4)') - cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(−3,−6,1)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/A'].stateValues.xs)).eqls([-2, -7]) - expect((stateVariables['/B'].stateValues.xs)).eqls([5, 9]) - expect((stateVariables['/C'].stateValues.xs)).eqls([-3, -8]) - expect((stateVariables['/A1'].stateValues.xs)).eqls([-1, -7]) - expect((stateVariables['/B1'].stateValues.xs)).eqls([5, -2]) - expect((stateVariables['/C1'].stateValues.xs)).eqls([-5, -8]) - expect((stateVariables['/C2/C'].stateValues.xs)).eqls([-3, -6]) - expect((stateVariables['/A2'].stateValues.xs)).eqls([-2, -7, 4]) - expect((stateVariables['/C3'].stateValues.xs)).eqls([-3, -6, 1]) - - }) - - - cy.log('move copied points') - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/A1', - args: { x: 8, y: -5 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/B1', - args: { x: -5.6, y: 6.3 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/C1', - args: { x: -7, y: 4 } - }) - }) - - cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(−2,−5,4)') - cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(−5,−8,1)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/A'].stateValues.xs)).eqls([-2, -5]) - expect((stateVariables['/B'].stateValues.xs)).eqls([-6, 9]) - expect((stateVariables['/C'].stateValues.xs)).eqls([-5, 4]) - expect((stateVariables['/A1'].stateValues.xs)).eqls([8, -5]) - expect((stateVariables['/B1'].stateValues.xs)).eqls([-6, 6]) - expect((stateVariables['/C1'].stateValues.xs)).eqls([-7, 4]) - expect((stateVariables['/C2/C'].stateValues.xs)).eqls([-5, -8]) - expect((stateVariables['/A2'].stateValues.xs)).eqls([-2, -5, 4]) - expect((stateVariables['/C3'].stateValues.xs)).eqls([-5, -8, 1]) - - }) - - - - }); - - - it('copy and overwrite coordinates, initial xs', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - - - - - - - - - - - - - - - - - - 1 - - `}, "*"); - }); - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - cy.log('initial values') - - cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(1,2,4)') - cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(3,0,1)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/A'].stateValues.xs)).eqls([1, 2]) - expect((stateVariables['/B'].stateValues.xs)).eqls([3, 4]) - expect((stateVariables['/C'].stateValues.xs)).eqls([3, 1]) - expect((stateVariables['/A1'].stateValues.xs)).eqls([-1, 2]) - expect((stateVariables['/B1'].stateValues.xs)).eqls([3, -2]) - expect((stateVariables['/C1'].stateValues.xs)).eqls([1, 1]) - expect((stateVariables['/C2/C'].stateValues.xs)).eqls([3, 0]) - expect((stateVariables['/A2'].stateValues.xs)).eqls([1, 2, 4]) - expect((stateVariables['/C3'].stateValues.xs)).eqls([3, 0, 1]) - expect(stateVariables['/A'].stateValues.label).eq('A'); - expect(stateVariables['/A1'].stateValues.label).eq('A'); - expect(stateVariables['/B'].stateValues.label).eq('B'); - expect(stateVariables['/B1'].stateValues.label).eq('B'); - expect(stateVariables['/C'].stateValues.label).eq('C'); - expect(stateVariables['/C1'].stateValues.label).eq('C'); - expect(stateVariables['/C2/C'].stateValues.label).eq('C'); - - }) - - cy.log('move original points') - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/A', - args: { x: -2, y: -7 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/B', - args: { x: 5.1, y: 8.9 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/C', - args: { x: -3, y: -8 } - }) - }) - - cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(−2,−7,4)') - cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(−3,−6,1)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/A'].stateValues.xs)).eqls([-2, -7]) - expect((stateVariables['/B'].stateValues.xs)).eqls([5, 9]) - expect((stateVariables['/C'].stateValues.xs)).eqls([-3, -8]) - expect((stateVariables['/A1'].stateValues.xs)).eqls([-1, -7]) - expect((stateVariables['/B1'].stateValues.xs)).eqls([5, -2]) - expect((stateVariables['/C1'].stateValues.xs)).eqls([-5, -8]) - expect((stateVariables['/C2/C'].stateValues.xs)).eqls([-3, -6]) - expect((stateVariables['/A2'].stateValues.xs)).eqls([-2, -7, 4]) - expect((stateVariables['/C3'].stateValues.xs)).eqls([-3, -6, 1]) - - }) - - - cy.log('move copied points') - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/A1', - args: { x: 8, y: -5 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/B1', - args: { x: -5.6, y: 6.3 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/C1', - args: { x: -7, y: 4 } - }) - }) - - cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(−2,−5,4)') - cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(−5,−8,1)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/A'].stateValues.xs)).eqls([-2, -5]) - expect((stateVariables['/B'].stateValues.xs)).eqls([-6, 9]) - expect((stateVariables['/C'].stateValues.xs)).eqls([-5, 4]) - expect((stateVariables['/A1'].stateValues.xs)).eqls([8, -5]) - expect((stateVariables['/B1'].stateValues.xs)).eqls([-6, 6]) - expect((stateVariables['/C1'].stateValues.xs)).eqls([-7, 4]) - expect((stateVariables['/C2/C'].stateValues.xs)).eqls([-5, -8]) - expect((stateVariables['/A2'].stateValues.xs)).eqls([-2, -5, 4]) - expect((stateVariables['/C3'].stateValues.xs)).eqls([-5, -8, 1]) - - }) - - - - }); - - - it('copy and overwrite coordinates, initial coords', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - - - - - - - - - - - - - - - - - - 1 - - `}, "*"); - }); - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - cy.log('initial values') - - cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(1,2,4)') - cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(3,0,1)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/A'].stateValues.xs)).eqls([1, 2]) - expect((stateVariables['/B'].stateValues.xs)).eqls([3, 4]) - expect((stateVariables['/C'].stateValues.xs)).eqls([3, 1]) - expect((stateVariables['/A1'].stateValues.xs)).eqls([-1, 2]) - expect((stateVariables['/B1'].stateValues.xs)).eqls([3, -2]) - expect((stateVariables['/C1'].stateValues.xs)).eqls([1, 1]) - expect((stateVariables['/C2/C'].stateValues.xs)).eqls([3, 0]) - expect((stateVariables['/A2'].stateValues.xs)).eqls([1, 2, 4]) - expect((stateVariables['/C3'].stateValues.xs)).eqls([3, 0, 1]) - expect(stateVariables['/A'].stateValues.label).eq('A'); - expect(stateVariables['/A1'].stateValues.label).eq('A'); - expect(stateVariables['/B'].stateValues.label).eq('B'); - expect(stateVariables['/B1'].stateValues.label).eq('B'); - expect(stateVariables['/C'].stateValues.label).eq('C'); - expect(stateVariables['/C1'].stateValues.label).eq('C'); - expect(stateVariables['/C2/C'].stateValues.label).eq('C'); - - }) - - cy.log('move original points') - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/A', - args: { x: -2, y: -7 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/B', - args: { x: 5.1, y: 8.9 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/C', - args: { x: -3, y: -8 } - }) - }) - - cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(−2,−7,4)') - cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(−3,−6,1)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/A'].stateValues.xs)).eqls([-2, -7]) - expect((stateVariables['/B'].stateValues.xs)).eqls([5, 9]) - expect((stateVariables['/C'].stateValues.xs)).eqls([-3, -8]) - expect((stateVariables['/A1'].stateValues.xs)).eqls([-1, -7]) - expect((stateVariables['/B1'].stateValues.xs)).eqls([5, -2]) - expect((stateVariables['/C1'].stateValues.xs)).eqls([-5, -8]) - expect((stateVariables['/C2/C'].stateValues.xs)).eqls([-3, -6]) - expect((stateVariables['/A2'].stateValues.xs)).eqls([-2, -7, 4]) - expect((stateVariables['/C3'].stateValues.xs)).eqls([-3, -6, 1]) - - }) - - - cy.log('move copied points') - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/A1', - args: { x: 8, y: -5 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/B1', - args: { x: -5.6, y: 6.3 } - }) - win.callAction1({ - actionName: "movePoint", - componentName: '/C1', - args: { x: -7, y: 4 } - }) - }) - - cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(−2,−5,4)') - cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(−5,−8,1)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/A'].stateValues.xs)).eqls([-2, -5]) - expect((stateVariables['/B'].stateValues.xs)).eqls([-6, 9]) - expect((stateVariables['/C'].stateValues.xs)).eqls([-5, 4]) - expect((stateVariables['/A1'].stateValues.xs)).eqls([8, -5]) - expect((stateVariables['/B1'].stateValues.xs)).eqls([-6, 6]) - expect((stateVariables['/C1'].stateValues.xs)).eqls([-7, 4]) - expect((stateVariables['/C2/C'].stateValues.xs)).eqls([-5, -8]) - expect((stateVariables['/A2'].stateValues.xs)).eqls([-2, -5, 4]) - expect((stateVariables['/C3'].stateValues.xs)).eqls([-5, -8, 1]) - - }) - - - - }); - - - it('copy and overwrite each coordinate in sequence, initial sugar', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - (3,2) - - - - - - - - - - - - - - - - - - `}, "*"); - }); - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - cy.log('initial values') - - cy.get('#\\/P1 .mjx-mrow').should('contain.text', '(3,2)') - cy.get('#\\/P2 .mjx-mrow').should('contain.text', '(−1,2)') - cy.get('#\\/P3 .mjx-mrow').should('contain.text', '(−1,2)') - cy.get('#\\/P4 .mjx-mrow').should('contain.text', '(−1,−5)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/g1/P'].stateValues.xs)).eqls([3, 2]) - expect((stateVariables['/g2/P'].stateValues.xs)).eqls([-1, 2]) - expect((stateVariables['/g3/P'].stateValues.xs)).eqls([-1, 2]) - expect((stateVariables['/g4/P'].stateValues.xs)).eqls([-1, -5]) - }) - - cy.log('move first point') - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/g1/P', - args: { x: -2, y: -7 } - }) - }) - - cy.get('#\\/P1 .mjx-mrow').should('contain.text', '(−2,−7)') - cy.get('#\\/P2 .mjx-mrow').should('contain.text', '(−1,−7)') - cy.get('#\\/P3 .mjx-mrow').should('contain.text', '(−1,−7)') - cy.get('#\\/P4 .mjx-mrow').should('contain.text', '(−1,−5)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/g1/P'].stateValues.xs)).eqls([-2, -7]) - expect((stateVariables['/g2/P'].stateValues.xs)).eqls([-1, -7]) - expect((stateVariables['/g3/P'].stateValues.xs)).eqls([-1, -7]) - expect((stateVariables['/g4/P'].stateValues.xs)).eqls([-1, -5]) - }) - - - cy.log('move second point') - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/g2/P', - args: { x: 8, y: -6 } - }) - }) - - cy.get('#\\/P1 .mjx-mrow').should('contain.text', '(−2,−6)') - cy.get('#\\/P2 .mjx-mrow').should('contain.text', '(8,−6)') - cy.get('#\\/P3 .mjx-mrow').should('contain.text', '(8,−6)') - cy.get('#\\/P4 .mjx-mrow').should('contain.text', '(8,−5)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/g1/P'].stateValues.xs)).eqls([-2, -6]) - expect((stateVariables['/g2/P'].stateValues.xs)).eqls([8, -6]) - expect((stateVariables['/g3/P'].stateValues.xs)).eqls([8, -6]) - expect((stateVariables['/g4/P'].stateValues.xs)).eqls([8, -5]) - }) - - - cy.log('move third point') - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/g3/P', - args: { x: 1, y: 0 } - }) - }) - - cy.get('#\\/P1 .mjx-mrow').should('contain.text', '(−2,0)') - cy.get('#\\/P2 .mjx-mrow').should('contain.text', '(1,0)') - cy.get('#\\/P3 .mjx-mrow').should('contain.text', '(1,0)') - cy.get('#\\/P4 .mjx-mrow').should('contain.text', '(1,−5)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/g1/P'].stateValues.xs)).eqls([-2, 0]) - expect((stateVariables['/g2/P'].stateValues.xs)).eqls([1, 0]) - expect((stateVariables['/g3/P'].stateValues.xs)).eqls([1, 0]) - expect((stateVariables['/g4/P'].stateValues.xs)).eqls([1, -5]) - }) - - cy.log('move fourth point') - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/g4/P', - args: { x: 3, y: 4 } - }) - }) - - cy.get('#\\/P1 .mjx-mrow').should('contain.text', '(−2,0)') - cy.get('#\\/P2 .mjx-mrow').should('contain.text', '(3,0)') - cy.get('#\\/P3 .mjx-mrow').should('contain.text', '(3,0)') - cy.get('#\\/P4 .mjx-mrow').should('contain.text', '(3,4)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/g1/P'].stateValues.xs)).eqls([-2, 0]) - expect((stateVariables['/g2/P'].stateValues.xs)).eqls([3, 0]) - expect((stateVariables['/g3/P'].stateValues.xs)).eqls([3, 0]) - expect((stateVariables['/g4/P'].stateValues.xs)).eqls([3, 4]) - }) - - }); - - it('1D point with 2D constraint does not crash', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - - - x^2 - - - - - - x^2x^3 - - - - - - - - - - - y=2x - - - - - - - - - - - - - - - - - - - - - - - - - - - - `}, "*"); - }); - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - cy.get('#\\/xa .mjx-mrow').should('have.text', '1') - cy.get('#\\/xb .mjx-mrow').should('have.text', '2') - cy.get('#\\/xc .mjx-mrow').should('have.text', '3') - cy.get('#\\/xd .mjx-mrow').should('have.text', '4') - cy.get('#\\/xe .mjx-mrow').should('have.text', '5') - cy.get('#\\/xf .mjx-mrow').should('have.text', '6') - cy.get('#\\/xg .mjx-mrow').should('have.text', '7') - - - }); - - it('display digits propagates', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - (32.252609, 0.0672854, 5) - - - - - - - - - - - - - - - - - - - - - $P - $Q - $R - - $P - $Q - $R - - $(P.x) - - - $(P.x) - - - - `}, "*"); - }); - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - cy.get('#\\/P .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32,0.067,5)") - }) - cy.get('#\\/Q .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32.25,0.07,5)") - }) - cy.get('#\\/R .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32.25260900,0.06728540000,5.000000000)") - }) - cy.get('#\\/Pcoords .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32,0.067,5)") - }) - cy.get('#\\/Qcoords .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32.25,0.07,5)") - }) - cy.get('#\\/Rcoords .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32.25260900,0.06728540000,5.000000000)") - }) - cy.get('#\\/PcoordsDec4 .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32.2526,0.0673,5)") - }) - cy.get('#\\/QcoordsDig4 .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32.25,0.06729,5)") - }) - cy.get('#\\/RcoordsDig2 .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32,0.067,5.0)") - }) - cy.get('#\\/PcoordsPad .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32,0.067,5.0)") - }) - cy.get('#\\/QcoordsPad .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32.25,0.07,5.00)") - }) - cy.get('#\\/RcoordsNoPad .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32.252609,0.0672854,5)") - }) - cy.get('#\\/Px1 .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("32") - }) - cy.get('#\\/Px2 .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("0.067") - }) - cy.get('#\\/Px3 .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("5") - }) - cy.get('#\\/Qx1 .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("32.25") - }) - cy.get('#\\/Qx2 .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("0.07") - }) - cy.get('#\\/Rx3 .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("5.000000000") - }) - cy.get('#\\/Pmath .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32,0.067,5)") - }) - cy.get('#\\/Qmath .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32.25,0.07,5)") - }) - cy.get('#\\/Rmath .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32.25260900,0.06728540000,5.000000000)") - }) - cy.get('#\\/PmathDec4 .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32.2526,0.0673,5)") - }) - cy.get('#\\/QmathDig4 .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32.25,0.06729,5)") - }) - cy.get('#\\/RmathDig2 .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(32,0.067,5.0)") - }) - cy.get('#\\/Px1number').should('have.text', "32") - cy.get('#\\/Px2number').should('have.text', "0.067") - cy.get('#\\/Px1numberDec4').should('have.text', "32.2526") - cy.get('#\\/Px2numberDig4').should('have.text', "0.06729") - - - }); - - it('rounding, copy and override', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - -

(34.245023482352345, 245.23823402358234234)

-

-

-

-

- ` }, "*"); - }); - - cy.get('#\\/_text1').should('have.text', 'a'); // to wait until loaded - - cy.get("#\\/p1 .mjx-mrow").eq(0).should("have.text", "(34.24502348,245.238234)") - - cy.get("#\\/p1Dig4 .mjx-mrow").eq(0).should("have.text", "(34.25,245.2)") - cy.get("#\\/p1Dig4a .mjx-mrow").eq(0).should("have.text", "(34.25,245.2)") - - cy.get("#\\/p1Dec6 .mjx-mrow").eq(0).should("have.text", "(34.24502,245.23823)") - cy.get("#\\/p1Dec6a .mjx-mrow").eq(0).should("have.text", "(34.24502,245.23823)") - - }) - - it('label point with child, part math', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - (1,2) - - - - - (3,4) - - - - (5,6) - - - - (7,8) - - - -

Label for P:

-

Label for Q:

-

Label for R:

-

Label for S:

- `}, "*"); - }); - - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - cy.get('#\\/labelPPar').should('contain.text', 'Label for P: We have ') - cy.get('#\\/labelPPar .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("x1.0+y2.0") - }) - cy.get('#\\/labelQPar').should('have.text', 'Label for Q: No latex: x^3.00 + y^4.00') - cy.get('#\\/labelRPar').should('contain.text', 'Label for R: We have ') - cy.get('#\\/labelRPar').should('contain.text', ' and ') - cy.get('#\\/labelSPar').should('contain.text', 'Label for S: No latex: x^3.00 + y^4.00 and ') - cy.get('#\\/labelSPar .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(7,8)") - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/P"].stateValues.label).eq('We have \\(x^{1.0} + y^{2.0}\\)') - expect(stateVariables["/P"].stateValues.labelHasLatex).eq(true) - - expect(stateVariables["/Q"].stateValues.label).eq('No latex: x^3.00 + y^4.00') - expect(stateVariables["/Q"].stateValues.labelHasLatex).eq(false) - - expect(stateVariables["/R"].stateValues.label).eq('We have \\(x^{1.0} + y^{2.0}\\) and \\(\\left( 5, 6 \\right)\\)') - expect(stateVariables["/R"].stateValues.labelHasLatex).eq(true) - - expect(stateVariables["/S"].stateValues.label).eq('No latex: x^3.00 + y^4.00 and \\(\\left( 7, 8 \\right)\\)') - expect(stateVariables["/S"].stateValues.labelHasLatex).eq(true) - - }) - - - cy.log('move points') - cy.window().then(async (win) => { - await win.callAction1({ - actionName: "movePoint", - componentName: "/P", - args: { x: Math.PI, y: Math.E } - }) - await win.callAction1({ - actionName: "movePoint", - componentName: "/Q", - args: { x: Math.sqrt(2), y: 1 / 3 } - }) - await win.callAction1({ - actionName: "movePoint", - componentName: "/R", - args: { x: 1 / 6, y: 2 / 3 } - }) - await win.callAction1({ - actionName: "movePoint", - componentName: "/S", - args: { x: 1 / 8, y: 9 / 8 } - }) - }) - - - cy.get('#\\/labelQPar').should('have.text', 'Label for Q: No latex: x^1.41 + y^0.333') - - cy.get('#\\/labelPPar').should('contain.text', 'Label for P: We have ') - cy.get('#\\/labelPPar .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("x3.1+y2.7") - }) - cy.get('#\\/labelSPar').should('contain.text', 'Label for S: No latex: x^1.41 + y^0.333 and ') - cy.get('#\\/labelSPar .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("(0.13,1.1)") - }) - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/P"].stateValues.label).eq('We have \\(x^{3.1} + y^{2.7}\\)') - expect(stateVariables["/P"].stateValues.labelHasLatex).eq(true) - - expect(stateVariables["/Q"].stateValues.label).eq('No latex: x^1.41 + y^0.333') - expect(stateVariables["/Q"].stateValues.labelHasLatex).eq(false) - - expect(stateVariables["/R"].stateValues.label).eq('We have \\(x^{3.1} + y^{2.7}\\) and \\(\\left( 0.17, 0.67 \\right)\\)') - expect(stateVariables["/R"].stateValues.labelHasLatex).eq(true) - - expect(stateVariables["/S"].stateValues.label).eq('No latex: x^1.41 + y^0.333 and \\(\\left( 0.13, 1.1 \\right)\\)') - expect(stateVariables["/S"].stateValues.labelHasLatex).eq(true) - - }) - - - }); - - it('copy point and override label', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - (1,2) - - - - - - - - - -

Label for P:

-

Label for Q:

- `}, "*"); - }); - - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - cy.get('#\\/labelPPar').should('contain.text', 'Label for P: We have ') - cy.get('#\\/labelPPar .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("x1.0+y2.0") - }) - cy.get('#\\/labelQPar').should('have.text', 'Label for Q: No latex: x^1.00 + y^2.00') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/P"].stateValues.label).eq('We have \\(x^{1.0} + y^{2.0}\\)') - expect(stateVariables["/P"].stateValues.labelHasLatex).eq(true) - - expect(stateVariables["/Q"].stateValues.label).eq('No latex: x^1.00 + y^2.00') - expect(stateVariables["/Q"].stateValues.labelHasLatex).eq(false) - - }) - - - cy.log('move point') - cy.window().then(async (win) => { - await win.callAction1({ - actionName: "movePoint", - componentName: "/P", - args: { x: Math.PI, y: Math.E } - }) - }) - - - cy.get('#\\/labelQPar').should('have.text', 'Label for Q: No latex: x^3.14 + y^2.72') - - cy.get('#\\/labelPPar').should('contain.text', 'Label for P: We have ') - cy.get('#\\/labelPPar .mjx-mrow').eq(0).invoke('text').then(text => { - expect(text).eq("x3.1+y2.7") - }) - - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/P"].stateValues.label).eq('We have \\(x^{3.1} + y^{2.7}\\)') - expect(stateVariables["/P"].stateValues.labelHasLatex).eq(true) - - expect(stateVariables["/Q"].stateValues.label).eq('No latex: x^3.14 + y^2.72') - expect(stateVariables["/Q"].stateValues.labelHasLatex).eq(false) - - }) - - }); - - it('update labels', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - (1,2) - - - - (3,4) - - - - (5,6) - - - - (7,8) - - - - -

Change label 1:

-

- -

-

The label 1:

- -

Change label 2:

-

- -

-

The label 2:

- -

Change label 3:

-

- -

-

The label 3:

- - -

Change label 4:

-

- -

-

The label 4:

- - `}, "*"); - }); - - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - cy.get('#\\/theLabel1').should('have.text', 'P1') - cy.get("#\\/ti1_input").should('have.value', 'P1') - cy.get('#\\/theLabel2').should('have.text', 'P2') - cy.get("#\\/ti2_input").should('have.value', 'P2') - cy.get('#\\/theLabel3 .mjx-mrow').eq(0).should('have.text', 'P3') - cy.get("#\\/ti3_input").should('have.value', '\\frac{P}{3}') - cy.get('#\\/theLabel4 .mjx-mrow').eq(0).should('have.text', 'P4') - cy.get("#\\/ti4_input").should('have.value', '\\frac{P}{4}') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/P1"].stateValues.label).eq('P1') - expect(stateVariables["/P1"].stateValues.labelHasLatex).eq(false) - expect(stateVariables["/theLabel1"].stateValues.value).eq('P1') - expect(stateVariables["/theLabel1"].stateValues.text).eq('P1') - expect(stateVariables["/theLabel1"].stateValues.latex).eq('P1') - expect(stateVariables["/theLabel1"].stateValues.hasLatex).eq(false) - - expect(stateVariables["/P2"].stateValues.label).eq('P2') - expect(stateVariables["/P2"].stateValues.labelHasLatex).eq(false) - expect(stateVariables["/theLabel2"].stateValues.value).eq('P2') - expect(stateVariables["/theLabel2"].stateValues.text).eq('P2') - expect(stateVariables["/theLabel2"].stateValues.latex).eq('P2') - expect(stateVariables["/theLabel2"].stateValues.hasLatex).eq(false) - - expect(stateVariables["/P3"].stateValues.label).eq('\\(\\frac{P}{3}\\)') - expect(stateVariables["/P3"].stateValues.labelHasLatex).eq(true) - expect(stateVariables["/theLabel3"].stateValues.value).eq('\\(\\frac{P}{3}\\)') - expect(stateVariables["/theLabel3"].stateValues.text).eq('\\frac{P}{3}') - expect(stateVariables["/theLabel3"].stateValues.latex).eq('\\frac{P}{3}') - expect(stateVariables["/theLabel3"].stateValues.hasLatex).eq(true) - - expect(stateVariables["/P4"].stateValues.label).eq('\\(\\frac{P}{4}\\)') - expect(stateVariables["/P4"].stateValues.labelHasLatex).eq(true) - expect(stateVariables["/theLabel4"].stateValues.value).eq('\\(\\frac{P}{4}\\)') - expect(stateVariables["/theLabel4"].stateValues.text).eq('\\frac{P}{4}') - expect(stateVariables["/theLabel4"].stateValues.latex).eq('\\frac{P}{4}') - expect(stateVariables["/theLabel4"].stateValues.hasLatex).eq(true) - }) - - - cy.log("Change label via textinput") - cy.get("#\\/ti1_input").clear().type("Q1{enter}"); - cy.get("#\\/ti2_input").clear().type("Q2{enter}"); - cy.get("#\\/ti3_input").clear().type("\\frac{{}Q}{{}3}{enter}"); - cy.get("#\\/ti4_input").clear().type("\\frac{{}Q}{{}4}{enter}"); - cy.get('#\\/theLabel4 .mjx-mrow').should('contain.text', 'Q4') - - - cy.get('#\\/theLabel1').should('have.text', 'Q1') - cy.get("#\\/ti1_input").should('have.value', 'Q1') - cy.get('#\\/theLabel2').should('have.text', 'Q2') - cy.get("#\\/ti2_input").should('have.value', 'Q2') - cy.get('#\\/theLabel3 .mjx-mrow').eq(0).should('have.text', 'Q3') - cy.get("#\\/ti3_input").should('have.value', '\\frac{Q}{3}') - cy.get('#\\/theLabel4 .mjx-mrow').eq(0).should('have.text', 'Q4') - cy.get("#\\/ti4_input").should('have.value', '\\frac{Q}{4}') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/P1"].stateValues.label).eq('Q1') - expect(stateVariables["/P1"].stateValues.labelHasLatex).eq(false) - expect(stateVariables["/theLabel1"].stateValues.value).eq('Q1') - expect(stateVariables["/theLabel1"].stateValues.text).eq('Q1') - expect(stateVariables["/theLabel1"].stateValues.latex).eq('Q1') - expect(stateVariables["/theLabel1"].stateValues.hasLatex).eq(false) - - expect(stateVariables["/P2"].stateValues.label).eq('Q2') - expect(stateVariables["/P2"].stateValues.labelHasLatex).eq(false) - expect(stateVariables["/theLabel2"].stateValues.value).eq('Q2') - expect(stateVariables["/theLabel2"].stateValues.text).eq('Q2') - expect(stateVariables["/theLabel2"].stateValues.latex).eq('Q2') - expect(stateVariables["/theLabel2"].stateValues.hasLatex).eq(false) - - expect(stateVariables["/P3"].stateValues.label).eq('\\(\\frac{Q}{3}\\)') - expect(stateVariables["/P3"].stateValues.labelHasLatex).eq(true) - expect(stateVariables["/theLabel3"].stateValues.value).eq('\\(\\frac{Q}{3}\\)') - expect(stateVariables["/theLabel3"].stateValues.text).eq('\\frac{Q}{3}') - expect(stateVariables["/theLabel3"].stateValues.latex).eq('\\frac{Q}{3}') - expect(stateVariables["/theLabel3"].stateValues.hasLatex).eq(true) - - expect(stateVariables["/P4"].stateValues.label).eq('\\(\\frac{Q}{4}\\)') - expect(stateVariables["/P4"].stateValues.labelHasLatex).eq(true) - expect(stateVariables["/theLabel4"].stateValues.value).eq('\\(\\frac{Q}{4}\\)') - expect(stateVariables["/theLabel4"].stateValues.text).eq('\\frac{Q}{4}') - expect(stateVariables["/theLabel4"].stateValues.latex).eq('\\frac{Q}{4}') - expect(stateVariables["/theLabel4"].stateValues.hasLatex).eq(true) - }) - - cy.log('Revert label') - cy.get('#\\/revert1_button').click(); - cy.get('#\\/revert2_button').click(); - cy.get('#\\/revert3_button').click(); - cy.get('#\\/revert4_button').click(); - cy.get('#\\/theLabel4 .mjx-mrow').should('contain.text', 'P4') - - cy.get('#\\/theLabel1').should('have.text', 'P1') - cy.get("#\\/ti1_input").should('have.value', 'P1') - cy.get('#\\/theLabel2').should('have.text', 'P2') - cy.get("#\\/ti2_input").should('have.value', 'P2') - cy.get('#\\/theLabel3 .mjx-mrow').eq(0).should('have.text', 'P3') - cy.get("#\\/ti3_input").should('have.value', '\\frac{P}{3}') - cy.get('#\\/theLabel4 .mjx-mrow').eq(0).should('have.text', 'P4') - cy.get("#\\/ti4_input").should('have.value', '\\frac{P}{4}') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/P1"].stateValues.label).eq('P1') - expect(stateVariables["/P1"].stateValues.labelHasLatex).eq(false) - expect(stateVariables["/theLabel1"].stateValues.value).eq('P1') - expect(stateVariables["/theLabel1"].stateValues.text).eq('P1') - expect(stateVariables["/theLabel1"].stateValues.latex).eq('P1') - expect(stateVariables["/theLabel1"].stateValues.hasLatex).eq(false) - - expect(stateVariables["/P2"].stateValues.label).eq('P2') - expect(stateVariables["/P2"].stateValues.labelHasLatex).eq(false) - expect(stateVariables["/theLabel2"].stateValues.value).eq('P2') - expect(stateVariables["/theLabel2"].stateValues.text).eq('P2') - expect(stateVariables["/theLabel2"].stateValues.latex).eq('P2') - expect(stateVariables["/theLabel2"].stateValues.hasLatex).eq(false) - - expect(stateVariables["/P3"].stateValues.label).eq('\\(\\frac{P}{3}\\)') - expect(stateVariables["/P3"].stateValues.labelHasLatex).eq(true) - expect(stateVariables["/theLabel3"].stateValues.value).eq('\\(\\frac{P}{3}\\)') - expect(stateVariables["/theLabel3"].stateValues.text).eq('\\frac{P}{3}') - expect(stateVariables["/theLabel3"].stateValues.latex).eq('\\frac{P}{3}') - expect(stateVariables["/theLabel3"].stateValues.hasLatex).eq(true) - - expect(stateVariables["/P4"].stateValues.label).eq('\\(\\frac{P}{4}\\)') - expect(stateVariables["/P4"].stateValues.labelHasLatex).eq(true) - expect(stateVariables["/theLabel4"].stateValues.value).eq('\\(\\frac{P}{4}\\)') - expect(stateVariables["/theLabel4"].stateValues.text).eq('\\frac{P}{4}') - expect(stateVariables["/theLabel4"].stateValues.latex).eq('\\frac{P}{4}') - expect(stateVariables["/theLabel4"].stateValues.hasLatex).eq(true) - }) - - cy.log("Cannot switch to latex, unneeded delimiters ignored") - cy.get("#\\/ti1_input").clear().type("\\(\\frac{{}Q}{{}1}\\){enter}"); - cy.get("#\\/ti2_input").clear().type("\\(\\frac{{}Q}{{}2}\\){enter}"); - cy.get("#\\/ti3_input").clear().type("\\(\\frac{{}Q}{{}3}\\){enter}"); - cy.get("#\\/ti4_input").clear().type("\\(\\frac{{}Q}{{}4}\\){enter}"); - cy.get('#\\/theLabel4 .mjx-mrow').should('contain.text', 'Q4') - - cy.get('#\\/theLabel1').should('have.text', '\\(\\frac{Q}{1}\\)') - cy.get("#\\/ti1_input").should('have.value', '\\(\\frac{Q}{1}\\)') - cy.get('#\\/theLabel2').should('have.text', '\\(\\frac{Q}{2}\\)') - cy.get("#\\/ti2_input").should('have.value', '\\(\\frac{Q}{2}\\)') - cy.get('#\\/theLabel3 .mjx-mrow').eq(0).should('have.text', 'Q3') - cy.get("#\\/ti3_input").should('have.value', '\\frac{Q}{3}') - cy.get('#\\/theLabel4 .mjx-mrow').eq(0).should('have.text', 'Q4') - cy.get("#\\/ti4_input").should('have.value', '\\frac{Q}{4}') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/P1"].stateValues.label).eq('\\(\\frac{Q}{1}\\)') - expect(stateVariables["/P1"].stateValues.labelHasLatex).eq(false) - expect(stateVariables["/theLabel1"].stateValues.value).eq('\\(\\frac{Q}{1}\\)') - expect(stateVariables["/theLabel1"].stateValues.text).eq('\\(\\frac{Q}{1}\\)') - expect(stateVariables["/theLabel1"].stateValues.latex).eq('\\(\\frac{Q}{1}\\)') - expect(stateVariables["/theLabel1"].stateValues.hasLatex).eq(false) - - expect(stateVariables["/P2"].stateValues.label).eq('\\(\\frac{Q}{2}\\)') - expect(stateVariables["/P2"].stateValues.labelHasLatex).eq(false) - expect(stateVariables["/theLabel2"].stateValues.value).eq('\\(\\frac{Q}{2}\\)') - expect(stateVariables["/theLabel2"].stateValues.text).eq('\\(\\frac{Q}{2}\\)') - expect(stateVariables["/theLabel2"].stateValues.latex).eq('\\(\\frac{Q}{2}\\)') - expect(stateVariables["/theLabel2"].stateValues.hasLatex).eq(false) - - expect(stateVariables["/P3"].stateValues.label).eq('\\(\\frac{Q}{3}\\)') - expect(stateVariables["/P3"].stateValues.labelHasLatex).eq(true) - expect(stateVariables["/theLabel3"].stateValues.value).eq('\\(\\frac{Q}{3}\\)') - expect(stateVariables["/theLabel3"].stateValues.text).eq('\\frac{Q}{3}') - expect(stateVariables["/theLabel3"].stateValues.latex).eq('\\frac{Q}{3}') - expect(stateVariables["/theLabel3"].stateValues.hasLatex).eq(true) - - expect(stateVariables["/P4"].stateValues.label).eq('\\(\\frac{Q}{4}\\)') - expect(stateVariables["/P4"].stateValues.labelHasLatex).eq(true) - expect(stateVariables["/theLabel4"].stateValues.value).eq('\\(\\frac{Q}{4}\\)') - expect(stateVariables["/theLabel4"].stateValues.text).eq('\\frac{Q}{4}') - expect(stateVariables["/theLabel4"].stateValues.latex).eq('\\frac{Q}{4}') - expect(stateVariables["/theLabel4"].stateValues.hasLatex).eq(true) - }) - - - }); - - it('copy point with no arguments, specify individual coordinates', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - - - - - - - - - - - - - - - - - - `}, "*"); - }); - - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(0,0)"); - cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(1,0)"); - cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(0,1)"); - cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(1,2)"); - - cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(0,0)"); - cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(1,0)"); - cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(0,1)"); - cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(1,2)"); - - - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/A', - args: { x: 3, y: 4 } - }) - }) - - cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(3,4)"); - cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(1,4)"); - cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(3,1)"); - cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(1,2)"); - - cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(3,4)"); - cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(1,4)"); - cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(3,1)"); - cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(1,2)"); - - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/B', - args: { x: 5, y: 6 } - }) - }) - - cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(5,6)"); - - cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(3,6)"); - cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(3,1)"); - cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(5,2)"); - - cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(3,6)"); - cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(5,6)"); - cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(3,1)"); - cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(5,2)"); - - - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/C', - args: { x: 7, y: 8 } - }) - }) - - cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(7,8)"); - - cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(7,6)"); - cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(5,6)"); - cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(5,2)"); - - cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(7,6)"); - cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(5,6)"); - cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(7,8)"); - cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(5,2)"); - - - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/D', - args: { x: 9, y: 10 } - }) - }) - - cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(9,10)"); - - cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(7,6)"); - cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(9,6)"); - cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(7,8)"); - - cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(7,6)"); - cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(9,6)"); - cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(7,8)"); - cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(9,10)"); - - - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/g2/D', - args: { x: -1, y: -2 } - }) - }) - - cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(−1,−2)"); - - cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(7,6)"); - cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(−1,6)"); - cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(7,8)"); - - cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(7,6)"); - cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(−1,6)"); - cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(7,8)"); - cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(−1,−2)"); - - - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/g2/C', - args: { x: -3, y: -4 } - }) - }) - - cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(−3,−4)"); - - cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(−3,6)"); - cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(−1,6)"); - cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(−1,−2)"); - - cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(−3,6)"); - cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(−1,6)"); - cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(−3,−4)"); - cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(−1,−2)"); - - - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/g2/B', - args: { x: -5, y: -6 } - }) - }) - - cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(−5,−6)"); - - cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(−3,−6)"); - cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(−3,−4)"); - cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(−5,−2)"); - - cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(−3,−6)"); - cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(−5,−6)"); - cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(−3,−4)"); - cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(−5,−2)"); - - - cy.window().then(async (win) => { - win.callAction1({ - actionName: "movePoint", - componentName: '/g2/A', - args: { x: -7, y: -8 } - }) - }) - - cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(−7,−8)"); - - cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(−5,−8)"); - cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(−7,−4)"); - cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(−5,−2)"); - - cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(−7,−8)"); - cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(−5,−8)"); - cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(−7,−4)"); - cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(−5,−2)"); - - - - - }); - - it('1D point from string, xs, coords, not x', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - 1 - - - - - `}, "*"); - }); - - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - cy.get('#\\/oneDa .mjx-mrow').eq(0).should('have.text', "1"); - cy.get('#\\/oneDb .mjx-mrow').eq(0).should('have.text', "1"); - cy.get('#\\/oneDc .mjx-mrow').eq(0).should('have.text', "1"); - cy.get('#\\/twoD .mjx-mrow').eq(0).should('have.text', "(1,0)"); - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - - expect(stateVariables["/oneDa"].stateValues.nDimensions).eq(1); - expect(stateVariables["/oneDb"].stateValues.nDimensions).eq(1); - expect(stateVariables["/oneDc"].stateValues.nDimensions).eq(1); - expect(stateVariables["/twoD"].stateValues.nDimensions).eq(2); - - - expect(stateVariables["/oneDa"].stateValues.xs).eqls([1]); - expect(stateVariables["/oneDb"].stateValues.xs).eqls([1]); - expect(stateVariables["/oneDc"].stateValues.xs).eqls([1]); - expect(stateVariables["/twoD"].stateValues.xs).eqls([1, 0]); - - }) - - }); - - it('handle invalid layer', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - a - - (3,4) - - - - `}, "*"); - }); - - - cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - - cy.get("#\\/l2").should('have.text', '0') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/P"].stateValues.layer).eq(0); - - }) - - - cy.get("#\\/l textarea").type("1{enter}", { force: true }); - cy.get("#\\/l2").should('have.text', '1') - - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/P"].stateValues.layer).eq(1); - - }) - - }); - }) diff --git a/cypress/e2e/DoenetML/tagSpecific/point2.cy.js b/cypress/e2e/DoenetML/tagSpecific/point2.cy.js new file mode 100644 index 0000000000..49d46864b8 --- /dev/null +++ b/cypress/e2e/DoenetML/tagSpecific/point2.cy.js @@ -0,0 +1,6239 @@ +import me from 'math-expressions'; +import cssesc from 'cssesc'; + +function cesc(s) { + s = cssesc(s, { isIdentifier: true }); + if (s.slice(0, 2) === '\\#') { + s = s.slice(1); + } + return s; +} + +describe('Point Tag Tests', function () { + + beforeEach(() => { + cy.clearIndexedDB(); + cy.visit('/src/Tools/cypressTest/') + }) + + it('points depending on each other', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + + + + + + `}, "*"); + }); + + + // use this to wait for page to load + cy.get('#\\/_text1').should('have.text', 'a'); + + cy.log("initial values") + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(9,7)`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + let x = 9; + let y = 7; + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + }); + + cy.log("move point 1") + cy.window().then(async (win) => { + let x = -3; + let y = 5; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point1', + args: { x, y } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + }); + }) + + cy.log("move point 2") + cy.window().then(async (win) => { + let x = 7; + let y = 9; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point2', + args: { x: y, y: x } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + }); + }) + + }) + + it('points depending on each other 2', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + (, 7) + (, 9) + + + + + `}, "*"); + }); + + + // use this to wait for page to load + cy.get('#\\/_text1').should('have.text', 'a'); + + cy.log("initial values") + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(9,7)`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + let x = 9; + let y = 7; + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + }); + + cy.log("move point 1") + cy.window().then(async (win) => { + let x = -3; + let y = 5; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point1', + args: { x, y } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + }) + }); + + cy.log("move point 2") + cy.window().then(async (win) => { + let x = 7; + let y = 9; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point2', + args: { x: y, y: x } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + }); + }) + + + }) + + it('points depending on each other through intermediaries', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + + + + + + + + + `}, "*"); + }); + + // use this to wait for page to load + cy.get('#\\/_text1').should('have.text', 'a'); + + cy.log("initial values") + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(9,7)`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + let x = 9; + let y = 7; + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); + + }); + + cy.log("move point 1") + cy.window().then(async (win) => { + let x = -3; + let y = 5; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point1', + args: { x, y } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); + }) + }); + + cy.log("move point 2") + cy.window().then(async (win) => { + let x = 7; + let y = 9; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point2', + args: { x: y, y: x } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); + }) + }); + + + cy.log("move point 3") + cy.window().then(async (win) => { + let x = 6; + let y = -1; + + win.callAction1({ + actionName: "movePoint", + componentName: '/P1ap', + args: { x, y } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); + }) + }); + + + cy.log("move point 4") + cy.window().then(async (win) => { + let x = -3; + let y = 2; + + win.callAction1({ + actionName: "movePoint", + componentName: '/P2ap', + args: { x: y, y: x } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); + }) + }); + + + }) + + it('points depending on each other through intermediaries 2', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + (, 7) + (, 9) + + + + + + + + + + `}, "*"); + }); + + // use this to wait for page to load + cy.get('#\\/_text1').should('have.text', 'a'); + + cy.log("initial values") + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(9,7)`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + let x = 9; + let y = 7; + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); + + }); + + cy.log("move point 1") + cy.window().then(async (win) => { + let x = -3; + let y = 5; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point1', + args: { x, y } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); + }) + }); + + cy.log("move point 2") + cy.window().then(async (win) => { + let x = 7; + let y = 9; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point2', + args: { x: y, y: x } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); + }) + }); + + + cy.log("move point 3") + cy.window().then(async (win) => { + let x = 6; + let y = -1; + + win.callAction1({ + actionName: "movePoint", + componentName: '/P1ap', + args: { x, y } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); + }) + }); + + + cy.log("move point 4") + cy.window().then(async (win) => { + let x = -3; + let y = 2; + + win.callAction1({ + actionName: "movePoint", + componentName: '/P2ap', + args: { x: y, y: x } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + expect((stateVariables['/P1ap'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/P1ap'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/P2ap'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/P2ap'].stateValues.xs)[1]).eq(x); + + }); + }) + + + }) + + it('points depending on each other, one using coords', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + + + + + + `}, "*"); + }); + + + // use this to wait for page to load + cy.get('#\\/_text1').should('have.text', 'a'); + + cy.log("initial values") + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(9,7)`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + let x = 9; + let y = 7; + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + + }); + + cy.log("move point 1") + cy.window().then(async (win) => { + let x = -3; + let y = 5; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point1', + args: { x, y } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + }) + }); + + cy.log("move point 2") + cy.window().then(async (win) => { + let x = 7; + let y = 9; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point2', + args: { x: y, y: x } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(y); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(x); + }) + }); + + + }) + + it('points depending on themselves', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + (3, 2+1) + (2+1, 3) + + + + + + `}, "*"); + }); + + + // use this to wait for page to load + cy.get('#\\/_text1').should('have.text', 'a'); + + cy.log("initial values") + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + let x1 = 3; + let y1 = 2 * x1 + 1; + + let y2 = 3; + let x2 = 2 * y2 + 1; + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(${x1},${y1})`) + + }); + + cy.log("move points") + cy.window().then(async (win) => { + let x1 = -3; + let y1try = 5; + + let x2 = 9; + let y2try = -7; + + let y1 = 2 * x1 + 1; + let y2 = (x2 - 1) / 2; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point1', + args: { x: x1, y: y1try } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/_point2', + args: { x: x2, y: y2try } + }) + + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x1)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y1)}`) + cy.get('#\\/coords2 .mjx-mrow').should('contain.text', `${Math.abs(x2)}`) + cy.get('#\\/coords2 .mjx-mrow').should('contain.text', `${Math.abs(y2)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); + + }) + }); + + + }) + + it('points depending original graph axis limit', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + (,5) + + + + + + + `}, "*"); + }); + + + // use this to wait for page to load + cy.get('#\\/_text1').should('have.text', 'a'); + + cy.log("initial values") + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + let x1 = 3; + let y1 = 10; + let x2 = -10 + let y2 = 5; + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(${x1},${y1})`) + + }); + + cy.log("move points") + cy.window().then(async (win) => { + let x1 = 1; + let y1 = 5; + let x2 = 8 + let y2 = -3; + + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point1', + args: { x: x1, y: y1 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/_point2', + args: { x: x2, y: y2 } + }) + + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x1)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `10`) + cy.get('#\\/coords2 .mjx-mrow').should('contain.text', `−10`) + cy.get('#\\/coords2 .mjx-mrow').should('contain.text', `${Math.abs(y2)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(10); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(-10); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); + + }) + }); + + + }) + + it('label points by combining coordinates with other point', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + (1,2) + + + (3,4) + + + + +

Label 1:

+

Label 2:

+ `}, "*"); + }); + + // use this to wait for page to load + cy.get('#\\/_text1').should('have.text', 'a'); + + cy.log("initial values") + + cy.get('#\\/_p1').should('have.text', 'Label 1: 1, 3') + cy.get('#\\/_p2').should('have.text', 'Label 2: 2, 4') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + let x1 = 1; + let y1 = 2; + let x2 = 3; + let y2 = 4; + + let label1 = `${x1}, ${x2}`; + let label2 = `${y1}, ${y2}`; + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); + + expect(stateVariables['/_point1'].stateValues.label).eq(label1); + expect(stateVariables['/_point2'].stateValues.label).eq(label2); + + }); + + cy.log("move points") + cy.window().then(async (win) => { + let x1 = 1; + let y1 = 5; + let x2 = 8 + let y2 = -3; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point1', + args: { x: x1, y: y1 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/_point2', + args: { x: x2, y: y2 } + }) + + let label1 = `${x1}, ${x2}`; + let label2 = `${y1}, ${y2}`; + + cy.get('#\\/_p1').should('have.text', `Label 1: ${label1}`) + cy.get('#\\/_p2').should('have.text', `Label 2: ${label2}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); + + expect(stateVariables['/_point1'].stateValues.label).eq(label1); + expect(stateVariables['/_point2'].stateValues.label).eq(label2); + + cy.get('#\\/_p1').should('have.text', `Label 1: ${label1}`) + cy.get('#\\/_p2').should('have.text', `Label 2: ${label2}`) + + }); + }) + + + cy.log("move points to fractional coordinates") + cy.window().then(async (win) => { + let x1 = 3.12552502; + let y1 = -3.4815436398; + let x2 = 0.36193540738 + let y2 = 7.813395519475; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point1', + args: { x: x1, y: y1 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/_point2', + args: { x: x2, y: y2 } + }) + + + let x1round = me.fromAst(x1).round_numbers_to_precision(3); + let y1round = me.fromAst(y1).round_numbers_to_precision(3); + let x2round = me.fromAst(x2).round_numbers_to_precision(3); + let y2round = me.fromAst(y2).round_numbers_to_precision(3); + + let label1 = `${x1round}, ${x2round}`; + let label2 = `${y1round}, ${y2round}`; + + + cy.get('#\\/_p1').should('have.text', `Label 1: ${label1}`) + cy.get('#\\/_p2').should('have.text', `Label 2: ${label2}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); + + expect(stateVariables['/_point1'].stateValues.label).eq(label1); + expect(stateVariables['/_point2'].stateValues.label).eq(label2); + }) + }); + + }) + + it('label points by combining coordinates with other point 2', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + (1,2) + + + (3,4) + + + + +

Label 1:

+

Label 2:

+ `}, "*"); + }); + + // use this to wait for page to load + cy.get('#\\/_text1').should('have.text', 'a'); + + cy.log("initial values") + + cy.get('#\\/_p1').should('contain.text', 'Label 1: ') + cy.get('#\\/_p2').should('contain.text', 'Label 2: ') + cy.get('#\\/_p1').find('.mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq('1'); + }) + cy.get('#\\/_p1').find('.mjx-mrow').eq(1).invoke('text').then(text => { + expect(text).eq('3'); + }) + cy.get('#\\/_p2').find('.mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq('2'); + }) + cy.get('#\\/_p2').find('.mjx-mrow').eq(1).invoke('text').then(text => { + expect(text).eq('4'); + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + let x1 = 1; + let y1 = 2; + let x2 = 3; + let y2 = 4; + + let label1 = `\\(${x1}\\), \\(${x2}\\)`; + let label2 = `\\(${y1}\\), \\(${y2}\\)`; + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); + + expect(stateVariables['/_point1'].stateValues.label).eq(label1); + expect(stateVariables['/_point2'].stateValues.label).eq(label2); + + }); + + cy.log("move points") + cy.window().then(async (win) => { + let x1 = 1; + let y1 = 5; + let x2 = 8 + let y2 = -3; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point1', + args: { x: x1, y: y1 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/_point2', + args: { x: x2, y: y2 } + }) + + let label1 = `\\(${x1}\\), \\(${x2}\\)`; + let label2 = `\\(${y1}\\), \\(${y2}\\)`; + + cy.get('#\\/_p1').should('contain.text', `${x2}`) + + cy.get('#\\/_p1').find('.mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq(`${x1}`); + }) + cy.get('#\\/_p1').find('.mjx-mrow').eq(1).invoke('text').then(text => { + expect(text).eq(`${x2}`); + }) + cy.get('#\\/_p2').find('.mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq(`${y1}`); + }) + cy.get('#\\/_p2').find('.mjx-mrow').eq(1).invoke('text').then(text => { + expect(text).eq(`−3`); + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); + + expect(stateVariables['/_point1'].stateValues.label).eq(label1); + expect(stateVariables['/_point2'].stateValues.label).eq(label2); + + }); + }) + + + cy.log("move points to fractional coordinates") + cy.window().then(async (win) => { + let x1 = 3.12552502; + let y1 = -3.4815436398; + let x2 = 0.36193540738 + let y2 = 7.813395519475; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point1', + args: { x: x1, y: y1 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/_point2', + args: { x: x2, y: y2 } + }) + + + let x1round = me.fromAst(x1).round_numbers_to_precision(3); + let y1round = me.fromAst(y1).round_numbers_to_precision(3); + let x2round = me.fromAst(x2).round_numbers_to_precision(3); + let y2round = me.fromAst(y2).round_numbers_to_precision(3); + + let label1 = `\\(${x1round}\\), \\(${x2round}\\)`; + let label2 = `\\(${y1round}\\), \\(${y2round}\\)`; + + cy.get('#\\/_p1').should('contain.text', `${x2round}`) + + cy.get('#\\/_p1').find('.mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq(`${x1round}`); + }) + cy.get('#\\/_p1').find('.mjx-mrow').eq(1).invoke('text').then(text => { + expect(text).eq(`${x2round}`); + }) + cy.get('#\\/_p2').find('.mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq(`−3.48`); + }) + cy.get('#\\/_p2').find('.mjx-mrow').eq(1).invoke('text').then(text => { + expect(text).eq(`${y2round}`); + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x1); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y1); + + expect((stateVariables['/_point2'].stateValues.xs)[0]).eq(x2); + expect((stateVariables['/_point2'].stateValues.xs)[1]).eq(y2); + + expect(stateVariables['/_point1'].stateValues.label).eq(label1); + expect(stateVariables['/_point2'].stateValues.label).eq(label2); + }) + }); + + }) + + it('update point with constraints', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + 0 + + + + (1,-7) + + + + + + + + + + `}, "*"); + }); + + cy.get("#\\/_text1").should('have.text', 'a'); // to wait for page to load + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(−4,1)`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + let x = -4; + let y = 1; + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + expect((stateVariables['/_point3'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point3'].stateValues.xs)[1]).eq(0); + expect((stateVariables['/_point4'].stateValues.xs)[0]).eq(0); + expect((stateVariables['/_point4'].stateValues.xs)[1]).eq(y); + + }); + + cy.log("move first point") + cy.window().then(async (win) => { + let x = 3; + let y = -2; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point1', + args: { x, y } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + expect((stateVariables['/_point3'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point3'].stateValues.xs)[1]).eq(0); + expect((stateVariables['/_point4'].stateValues.xs)[0]).eq(0); + expect((stateVariables['/_point4'].stateValues.xs)[1]).eq(y); + }) + }); + + cy.log("move x-axis point") + cy.window().then(async (win) => { + let x = 9; + let y = -2; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point3', + args: { x, y: -3 } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + expect((stateVariables['/_point3'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point3'].stateValues.xs)[1]).eq(0); + expect((stateVariables['/_point4'].stateValues.xs)[0]).eq(0); + expect((stateVariables['/_point4'].stateValues.xs)[1]).eq(y); + }) + }); + + cy.log("move y-axis point") + cy.window().then(async (win) => { + let x = 9; + let y = -7.1; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point4', + args: { x: -10, y: y } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(x)}`) + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `${Math.abs(y)}`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + expect((stateVariables['/_point3'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point3'].stateValues.xs)[1]).eq(0); + expect((stateVariables['/_point4'].stateValues.xs)[0]).eq(0); + expect((stateVariables['/_point4'].stateValues.xs)[1]).eq(y); + }) + }); + + cy.log("move near attractor") + cy.window().then(async (win) => { + let x = 1; + let y = -7; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point3', + args: { x: 0.9, y: 6 } + }) + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(1,−7)`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + expect((stateVariables['/_point3'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point3'].stateValues.xs)[1]).eq(0); + expect((stateVariables['/_point4'].stateValues.xs)[0]).eq(0); + expect((stateVariables['/_point4'].stateValues.xs)[1]).eq(y); + }) + }); + + cy.log("move again near attractor to make sure doesn't change") + cy.window().then(async (win) => { + let x = 1; + let y = -7; + + win.callAction1({ + actionName: "movePoint", + componentName: '/_point3', + args: { x: 1.1, y: 6 } + }) + + // since nothing has changed in the DOM + // check boolean input and wait for it to change + // to make sure got message back from core + cy.get('#\\/bi').click(); + cy.get('#\\/b').should('have.text', 'true'); + + cy.get('#\\/coords1 .mjx-mrow').should('contain.text', `(1,−7)`) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(y); + expect((stateVariables['/_point3'].stateValues.xs)[0]).eq(x); + expect((stateVariables['/_point3'].stateValues.xs)[1]).eq(0); + expect((stateVariables['/_point4'].stateValues.xs)[0]).eq(0); + expect((stateVariables['/_point4'].stateValues.xs)[1]).eq(y); + }) + }); + }) + + it('change point dimensions', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a +

Specify point coordinates:

+ +
The points +

The point:

+

The point copied:

+

The point copied again:

+
+ +
From point 1 +

Number of dimensions:

+

x-coordinate:

+

y-coordinate:

+

z-coordinate:

+

All individual coordinates:

+

Coordinates:

+
+ +
From point 2 +

Number of dimensions:

+

x-coordinate:

+

y-coordinate:

+

z-coordinate:

+

All individual coordinates:

+

Coordinates:

+
+ +
From point 3 +

Number of dimensions:

+

x-coordinate:

+

y-coordinate:

+

z-coordinate:

+

All individual coordinates:

+

Coordinates:

+
+ +
For point 1 +

Change coords:

+

Change x-coordinate:

+

Change y-coordinate:

+

Change z-coordinate:

+
+ +
For point 2 +

Change coords:

+

Change x-coordinate:

+

Change y-coordinate:

+

Change z-coordinate:

+
+ +
For point 3 +

Change coords:

+

Change x-coordinate:

+

Change y-coordinate:

+

Change z-coordinate:

+
+ +
collecting +

x-coordinates:

+

y-coordinates:

+

z-coordinates:

+

All individual coordinates:

+

Coordinates:

+
+ +
Extracting from point 3 +

x-coordinate:

+

y-coordinate:

+

z-coordinate:

+

All individual coordinates:

+

Coordinates:

+
+ + `}, "*"); + }); + + cy.get("#\\/_text1").should('have.text', 'a'); // to wait for page to load + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/nDimensions1").should('have.text', '1'); + cy.get("#\\/nDimensions2").should('have.text', '1'); + cy.get("#\\/nDimensions3").should('have.text', '1'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/p1y").should('have.text', 'y-coordinate: ') + cy.get("#\\/p2y").should('have.text', 'y-coordinate: ') + cy.get("#\\/p3y").should('have.text', 'y-coordinate: ') + cy.get("#\\/p3ye").should('have.text', 'y-coordinate: ') + cy.get("#\\/pally").should('have.text', 'y-coordinates: ') + cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') + cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(1); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(1); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('_'); + expect(stateVariables['/_point1'].stateValues.x1).eq('_'); + expect(stateVariables['/_point1'].stateValues.x2).eq(undefined); + expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(1); + expect((stateVariables['/point2'].stateValues.xs).length).eq(1); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('_'); + expect(stateVariables['/point2'].stateValues.x1).eq('_'); + expect(stateVariables['/point2'].stateValues.x2).eq(undefined); + expect(stateVariables['/point2'].stateValues.x3).eq(undefined); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(1); + expect((stateVariables['/point3'].stateValues.xs).length).eq(1); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('_'); + expect(stateVariables['/point3'].stateValues.x1).eq('_'); + expect(stateVariables['/point3'].stateValues.x2).eq(undefined); + expect(stateVariables['/point3'].stateValues.x3).eq(undefined); + + }); + + cy.log('Create 2D point') + cy.get('#\\/originalCoords textarea').type('{end}{backspace}(a,b){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(a,b)') + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/nDimensions1").should('have.text', '2'); + cy.get("#\\/nDimensions2").should('have.text', '2'); + cy.get("#\\/nDimensions3").should('have.text', '2'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') + cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).should('not.exist') + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('a'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('b'); + expect(stateVariables['/_point1'].stateValues.x1).eq('a'); + expect(stateVariables['/_point1'].stateValues.x2).eq('b'); + expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point2'].stateValues.xs).length).eq(2); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('a'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('b'); + expect(stateVariables['/point2'].stateValues.x1).eq('a'); + expect(stateVariables['/point2'].stateValues.x2).eq('b'); + expect(stateVariables['/point2'].stateValues.x3).eq(undefined); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point3'].stateValues.xs).length).eq(2); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('a'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('b'); + expect(stateVariables['/point3'].stateValues.x1).eq('a'); + expect(stateVariables['/point3'].stateValues.x2).eq('b'); + expect(stateVariables['/point3'].stateValues.x3).eq(undefined); + + }); + + + + cy.log('Back to 1D point') + cy.get('#\\/originalCoords textarea').type('{ctrl+home}{shift+end}{backspace}q{enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', 'q') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/nDimensions1").should('have.text', '1'); + cy.get("#\\/nDimensions2").should('have.text', '1'); + cy.get("#\\/nDimensions3").should('have.text', '1'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + + cy.get("#\\/p1y").should('have.text', 'y-coordinate: ') + cy.get("#\\/p2y").should('have.text', 'y-coordinate: ') + cy.get("#\\/p3y").should('have.text', 'y-coordinate: ') + cy.get("#\\/p3ye").should('have.text', 'y-coordinate: ') + cy.get("#\\/pally").should('have.text', 'y-coordinates: ') + + cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') + cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).should('not.exist') + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).should('not.exist') + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).should('not.exist') + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).should('not.exist') + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).should('not.exist') + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(1); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(1); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('q'); + expect(stateVariables['/_point1'].stateValues.x1).eq('q'); + expect(stateVariables['/_point1'].stateValues.x2).eq(undefined); + expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(1); + expect((stateVariables['/point2'].stateValues.xs).length).eq(1); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('q'); + expect(stateVariables['/point2'].stateValues.x1).eq('q'); + expect(stateVariables['/point2'].stateValues.x2).eq(undefined); + expect(stateVariables['/point2'].stateValues.x3).eq(undefined); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(1); + expect((stateVariables['/point3'].stateValues.xs).length).eq(1); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('q'); + expect(stateVariables['/point3'].stateValues.x1).eq('q'); + expect(stateVariables['/point3'].stateValues.x2).eq(undefined); + expect(stateVariables['/point3'].stateValues.x3).eq(undefined); + + }); + + + + cy.log('Create 3D point') + cy.get('#\\/originalCoords textarea').type('{end}{backspace}\\langle 2x,u/v{rightarrow},w^2{rightarrow}\\rangle {enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(2x,uv,w2)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + cy.get("#\\/nDimensions1").should('have.text', '3'); + cy.get("#\\/nDimensions2").should('have.text', '3'); + cy.get("#\\/nDimensions3").should('have.text', '3'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + cy.get("#\\/p3alle .mjx-mrow").should('contain.text', "2x") + cy.get("#\\/p3alle .mjx-mrow").should('contain.text', "uv") + cy.get("#\\/p3alle .mjx-mrow").should('contain.text', "w2") + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { + expect(text.trim()).equal('2x') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(9).invoke('text').then((text) => { + expect(text.trim()).equal('uv') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(10).invoke('text').then((text) => { + expect(text.trim()).equal('w2') + }) + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eqls(["*", 2, "x"]); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eqls(["/", "u", "v"]); + expect((stateVariables['/_point1'].stateValues.xs)[2]).eqls(["^", "w", 2]); + expect(stateVariables['/_point1'].stateValues.x1).eqls(["*", 2, "x"]);; + expect(stateVariables['/_point1'].stateValues.x2).eqls(["/", "u", "v"]); + expect(stateVariables['/_point1'].stateValues.x3).eqls(["^", "w", 2]); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point2'].stateValues.xs).length).eq(3); + expect((stateVariables['/point2'].stateValues.xs)[0]).eqls(["*", 2, "x"]); + expect((stateVariables['/point2'].stateValues.xs)[1]).eqls(["/", "u", "v"]); + expect((stateVariables['/point2'].stateValues.xs)[2]).eqls(["^", "w", 2]); + expect(stateVariables['/point2'].stateValues.x1).eqls(["*", 2, "x"]); + expect(stateVariables['/point2'].stateValues.x2).eqls(["/", "u", "v"]); + expect(stateVariables['/point2'].stateValues.x3).eqls(["^", "w", 2]); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point3'].stateValues.xs).length).eq(3); + expect((stateVariables['/point3'].stateValues.xs)[0]).eqls(["*", 2, "x"]); + expect((stateVariables['/point3'].stateValues.xs)[1]).eqls(["/", "u", "v"]); + expect((stateVariables['/point3'].stateValues.xs)[2]).eqls(["^", "w", 2]); + expect(stateVariables['/point3'].stateValues.x1).eqls(["*", 2, "x"]); + expect(stateVariables['/point3'].stateValues.x2).eqls(["/", "u", "v"]); + expect(stateVariables['/point3'].stateValues.x3).eqls(["^", "w", 2]); + + }); + + + cy.log('change the coordinates from point 1 coords') + cy.get("#\\/coords1b textarea").type('{ctrl+home}{shift+end}{backspace}(7,8,9){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(7,8,9)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(7,8,9)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(7,8,9)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(7,8,9)') + }) + cy.get("#\\/nDimensions1").should('have.text', '3'); + cy.get("#\\/nDimensions2").should('have.text', '3'); + cy.get("#\\/nDimensions3").should('have.text', '3'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { + expect(text.trim()).equal('7') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { + expect(text.trim()).equal('8') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { + expect(text.trim()).equal('9') + }) + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(7,8,9)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(7,8,9)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(7,8,9)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(7,8,9)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(7,8,9)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(7,8,9)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(7,8,9)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq(7); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq(8); + expect((stateVariables['/_point1'].stateValues.xs)[2]).eq(9); + expect(stateVariables['/_point1'].stateValues.x1).eq(7);; + expect(stateVariables['/_point1'].stateValues.x2).eq(8); + expect(stateVariables['/_point1'].stateValues.x3).eq(9); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point2'].stateValues.xs).length).eq(3); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq(7); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq(8); + expect((stateVariables['/point2'].stateValues.xs)[2]).eq(9); + expect(stateVariables['/point2'].stateValues.x1).eq(7); + expect(stateVariables['/point2'].stateValues.x2).eq(8); + expect(stateVariables['/point2'].stateValues.x3).eq(9); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point3'].stateValues.xs).length).eq(3); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq(7); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq(8); + expect((stateVariables['/point3'].stateValues.xs)[2]).eq(9); + expect(stateVariables['/point3'].stateValues.x1).eq(7); + expect(stateVariables['/point3'].stateValues.x2).eq(8); + expect(stateVariables['/point3'].stateValues.x3).eq(9); + + }); + + + cy.log('change the coordinates from point 2 coords') + cy.get("#\\/coords2b textarea").type('{ctrl+home}{shift+end}{backspace}\\langle i,j,k\\rangle {enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(i,j,k)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(i,j,k)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(i,j,k)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(i,j,k)') + }) + cy.get("#\\/nDimensions1").should('have.text', '3'); + cy.get("#\\/nDimensions2").should('have.text', '3'); + cy.get("#\\/nDimensions3").should('have.text', '3'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { + expect(text.trim()).equal('i') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { + expect(text.trim()).equal('j') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { + expect(text.trim()).equal('k') + }) + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(i,j,k)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(i,j,k)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(i,j,k)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(i,j,k)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(i,j,k)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(i,j,k)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(i,j,k)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('i'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('j'); + expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('k'); + expect(stateVariables['/_point1'].stateValues.x1).eq('i');; + expect(stateVariables['/_point1'].stateValues.x2).eq('j'); + expect(stateVariables['/_point1'].stateValues.x3).eq('k'); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point2'].stateValues.xs).length).eq(3); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('i'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('j'); + expect((stateVariables['/point2'].stateValues.xs)[2]).eq('k'); + expect(stateVariables['/point2'].stateValues.x1).eq('i'); + expect(stateVariables['/point2'].stateValues.x2).eq('j'); + expect(stateVariables['/point2'].stateValues.x3).eq('k'); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point3'].stateValues.xs).length).eq(3); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('i'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('j'); + expect((stateVariables['/point3'].stateValues.xs)[2]).eq('k'); + expect(stateVariables['/point3'].stateValues.x1).eq('i'); + expect(stateVariables['/point3'].stateValues.x2).eq('j'); + expect(stateVariables['/point3'].stateValues.x3).eq('k'); + + }); + + + + cy.log('change the coordinates from point 3 coords') + cy.get("#\\/coords3b textarea").type('{ctrl+home}{shift+end}{backspace}(l,m,n){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(l,m,n)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(l,m,n)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(l,m,n)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(l,m,n)') + }) + cy.get("#\\/nDimensions1").should('have.text', '3'); + cy.get("#\\/nDimensions2").should('have.text', '3'); + cy.get("#\\/nDimensions3").should('have.text', '3'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { + expect(text.trim()).equal('l') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { + expect(text.trim()).equal('m') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { + expect(text.trim()).equal('n') + }) + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(l,m,n)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(l,m,n)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(l,m,n)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(l,m,n)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(l,m,n)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(l,m,n)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(l,m,n)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('l'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('m'); + expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('n'); + expect(stateVariables['/_point1'].stateValues.x1).eq('l');; + expect(stateVariables['/_point1'].stateValues.x2).eq('m'); + expect(stateVariables['/_point1'].stateValues.x3).eq('n'); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point2'].stateValues.xs).length).eq(3); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('l'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('m'); + expect((stateVariables['/point2'].stateValues.xs)[2]).eq('n'); + expect(stateVariables['/point2'].stateValues.x1).eq('l'); + expect(stateVariables['/point2'].stateValues.x2).eq('m'); + expect(stateVariables['/point2'].stateValues.x3).eq('n'); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point3'].stateValues.xs).length).eq(3); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('l'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('m'); + expect((stateVariables['/point3'].stateValues.xs)[2]).eq('n'); + expect(stateVariables['/point3'].stateValues.x1).eq('l'); + expect(stateVariables['/point3'].stateValues.x2).eq('m'); + expect(stateVariables['/point3'].stateValues.x3).eq('n'); + + }); + + + + cy.log('change the coordinates from point 1 individual components') + cy.get("#\\/point1x1b textarea").type('{end}{backspace}r{enter}', { force: true }); + cy.get("#\\/point1x2b textarea").type('{end}{backspace}s{enter}', { force: true }); + cy.get("#\\/point1x3b textarea").type('{end}{backspace}t{enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(r,s,t)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(r,s,t)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(r,s,t)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(r,s,t)') + }) + cy.get("#\\/nDimensions1").should('have.text', '3'); + cy.get("#\\/nDimensions2").should('have.text', '3'); + cy.get("#\\/nDimensions3").should('have.text', '3'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(r,s,t)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(r,s,t)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(r,s,t)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(r,s,t)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(r,s,t)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(r,s,t)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(r,s,t)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('r'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('s'); + expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('t'); + expect(stateVariables['/_point1'].stateValues.x1).eq('r');; + expect(stateVariables['/_point1'].stateValues.x2).eq('s'); + expect(stateVariables['/_point1'].stateValues.x3).eq('t'); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point2'].stateValues.xs).length).eq(3); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('r'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('s'); + expect((stateVariables['/point2'].stateValues.xs)[2]).eq('t'); + expect(stateVariables['/point2'].stateValues.x1).eq('r'); + expect(stateVariables['/point2'].stateValues.x2).eq('s'); + expect(stateVariables['/point2'].stateValues.x3).eq('t'); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point3'].stateValues.xs).length).eq(3); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('r'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('s'); + expect((stateVariables['/point3'].stateValues.xs)[2]).eq('t'); + expect(stateVariables['/point3'].stateValues.x1).eq('r'); + expect(stateVariables['/point3'].stateValues.x2).eq('s'); + expect(stateVariables['/point3'].stateValues.x3).eq('t'); + + }); + + + + cy.log('change the coordinates from point 2 individual components') + cy.get("#\\/point2x1b textarea").type('{end}{backspace}f{enter}', { force: true }); + cy.get("#\\/point2x2b textarea").type('{end}{backspace}g{enter}', { force: true }); + cy.get("#\\/point2x3b textarea").type('{end}{backspace}h{enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(f,g,h)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(f,g,h)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(f,g,h)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(f,g,h)') + }) + cy.get("#\\/nDimensions1").should('have.text', '3'); + cy.get("#\\/nDimensions2").should('have.text', '3'); + cy.get("#\\/nDimensions3").should('have.text', '3'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + + // TODO: makes no sense why this is failing. + // It seems to be in the DOM just like the others + // cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + // expect(text.trim()).equal('h') + // }) + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { + expect(text.trim()).equal('f') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(f,g,h)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(f,g,h)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(f,g,h)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(f,g,h)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(f,g,h)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(f,g,h)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(f,g,h)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('f'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('g'); + expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('h'); + expect(stateVariables['/_point1'].stateValues.x1).eq('f');; + expect(stateVariables['/_point1'].stateValues.x2).eq('g'); + expect(stateVariables['/_point1'].stateValues.x3).eq('h'); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point2'].stateValues.xs).length).eq(3); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('f'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('g'); + expect((stateVariables['/point2'].stateValues.xs)[2]).eq('h'); + expect(stateVariables['/point2'].stateValues.x1).eq('f'); + expect(stateVariables['/point2'].stateValues.x2).eq('g'); + expect(stateVariables['/point2'].stateValues.x3).eq('h'); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point3'].stateValues.xs).length).eq(3); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('f'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('g'); + expect((stateVariables['/point3'].stateValues.xs)[2]).eq('h'); + expect(stateVariables['/point3'].stateValues.x1).eq('f'); + expect(stateVariables['/point3'].stateValues.x2).eq('g'); + expect(stateVariables['/point3'].stateValues.x3).eq('h'); + + }); + + + + cy.log('change the coordinates from point 3 individual components') + cy.get("#\\/point3x1b textarea").type('{end}{backspace}x{enter}', { force: true }); + cy.get("#\\/point3x2b textarea").type('{end}{backspace}y{enter}', { force: true }); + cy.get("#\\/point3x3b textarea").type('{end}{backspace}z{enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(x,y,z)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(x,y,z)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(x,y,z)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(x,y,z)') + }) + cy.get("#\\/nDimensions1").should('have.text', '3'); + cy.get("#\\/nDimensions2").should('have.text', '3'); + cy.get("#\\/nDimensions3").should('have.text', '3'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { + expect(text.trim()).equal('x') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { + expect(text.trim()).equal('y') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(x,y,z)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(x,y,z)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(x,y,z)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(x,y,z)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(x,y,z)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(x,y,z)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(x,y,z)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('x'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('y'); + expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('z'); + expect(stateVariables['/_point1'].stateValues.x1).eq('x');; + expect(stateVariables['/_point1'].stateValues.x2).eq('y'); + expect(stateVariables['/_point1'].stateValues.x3).eq('z'); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point2'].stateValues.xs).length).eq(3); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('x'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('y'); + expect((stateVariables['/point2'].stateValues.xs)[2]).eq('z'); + expect(stateVariables['/point2'].stateValues.x1).eq('x'); + expect(stateVariables['/point2'].stateValues.x2).eq('y'); + expect(stateVariables['/point2'].stateValues.x3).eq('z'); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point3'].stateValues.xs).length).eq(3); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('x'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('y'); + expect((stateVariables['/point3'].stateValues.xs)[2]).eq('z'); + expect(stateVariables['/point3'].stateValues.x1).eq('x'); + expect(stateVariables['/point3'].stateValues.x2).eq('y'); + expect(stateVariables['/point3'].stateValues.x3).eq('z'); + + }); + + + + cy.log(`can't decrease dimension from inverse direction 1`) + cy.get("#\\/coords1b textarea").type('{ctrl+home}{shift+end}{backspace}(u,v){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(u,v,z)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(u,v,z)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(u,v,z)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(u,v,z)') + }) + cy.get("#\\/nDimensions1").should('have.text', '3'); + cy.get("#\\/nDimensions2").should('have.text', '3'); + cy.get("#\\/nDimensions3").should('have.text', '3'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { + expect(text.trim()).equal('u') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { + expect(text.trim()).equal('v') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(u,v,z)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(u,v,z)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(u,v,z)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(u,v,z)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(u,v,z)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(u,v,z)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(u,v,z)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('u'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('v'); + expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('z'); + expect(stateVariables['/_point1'].stateValues.x1).eq('u');; + expect(stateVariables['/_point1'].stateValues.x2).eq('v'); + expect(stateVariables['/_point1'].stateValues.x3).eq('z'); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point2'].stateValues.xs).length).eq(3); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('u'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('v'); + expect((stateVariables['/point2'].stateValues.xs)[2]).eq('z'); + expect(stateVariables['/point2'].stateValues.x1).eq('u'); + expect(stateVariables['/point2'].stateValues.x2).eq('v'); + expect(stateVariables['/point2'].stateValues.x3).eq('z'); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point3'].stateValues.xs).length).eq(3); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('u'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('v'); + expect((stateVariables['/point3'].stateValues.xs)[2]).eq('z'); + expect(stateVariables['/point3'].stateValues.x1).eq('u'); + expect(stateVariables['/point3'].stateValues.x2).eq('v'); + expect(stateVariables['/point3'].stateValues.x3).eq('z'); + + }); + + + + cy.log(`can't decrease dimension from inverse direction 2`) + cy.get("#\\/coords2b textarea").type('{ctrl+home}{shift+end}{backspace}(s,t){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(s,t,z)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(s,t,z)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(s,t,z)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(s,t,z)') + }) + cy.get("#\\/nDimensions1").should('have.text', '3'); + cy.get("#\\/nDimensions2").should('have.text', '3'); + cy.get("#\\/nDimensions3").should('have.text', '3'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { + expect(text.trim()).equal('s') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { + expect(text.trim()).equal('t') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(s,t,z)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(s,t,z)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(s,t,z)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(s,t,z)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(s,t,z)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(s,t,z)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(s,t,z)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('s'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('t'); + expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('z'); + expect(stateVariables['/_point1'].stateValues.x1).eq('s');; + expect(stateVariables['/_point1'].stateValues.x2).eq('t'); + expect(stateVariables['/_point1'].stateValues.x3).eq('z'); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point2'].stateValues.xs).length).eq(3); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('s'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('t'); + expect((stateVariables['/point2'].stateValues.xs)[2]).eq('z'); + expect(stateVariables['/point2'].stateValues.x1).eq('s'); + expect(stateVariables['/point2'].stateValues.x2).eq('t'); + expect(stateVariables['/point2'].stateValues.x3).eq('z'); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point3'].stateValues.xs).length).eq(3); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('s'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('t'); + expect((stateVariables['/point3'].stateValues.xs)[2]).eq('z'); + expect(stateVariables['/point3'].stateValues.x1).eq('s'); + expect(stateVariables['/point3'].stateValues.x2).eq('t'); + expect(stateVariables['/point3'].stateValues.x3).eq('z'); + + }); + + + cy.log(`can't decrease dimension from inverse direction 3`) + cy.get("#\\/coords3b textarea").type('{ctrl+home}{shift+end}{backspace}(q,r){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(q,r,z)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(q,r,z)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(q,r,z)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(q,r,z)') + }) + cy.get("#\\/nDimensions1").should('have.text', '3'); + cy.get("#\\/nDimensions2").should('have.text', '3'); + cy.get("#\\/nDimensions3").should('have.text', '3'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/point1x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/point2x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/point3x3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/point3x3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pointallx3A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pointallx3B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pointallx3C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).invoke('text').then((text) => { + expect(text.trim()).equal('r') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).invoke('text').then((text) => { + expect(text.trim()).equal('z') + }) + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(q,r,z)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(q,r,z)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(q,r,z)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(q,r,z)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(q,r,z)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(q,r,z)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(q,r,z)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('q'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('r'); + expect((stateVariables['/_point1'].stateValues.xs)[2]).eq('z'); + expect(stateVariables['/_point1'].stateValues.x1).eq('q');; + expect(stateVariables['/_point1'].stateValues.x2).eq('r'); + expect(stateVariables['/_point1'].stateValues.x3).eq('z'); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point2'].stateValues.xs).length).eq(3); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('q'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('r'); + expect((stateVariables['/point2'].stateValues.xs)[2]).eq('z'); + expect(stateVariables['/point2'].stateValues.x1).eq('q'); + expect(stateVariables['/point2'].stateValues.x2).eq('r'); + expect(stateVariables['/point2'].stateValues.x3).eq('z'); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point3'].stateValues.xs).length).eq(3); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('q'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('r'); + expect((stateVariables['/point3'].stateValues.xs)[2]).eq('z'); + expect(stateVariables['/point3'].stateValues.x1).eq('q'); + expect(stateVariables['/point3'].stateValues.x2).eq('r'); + expect(stateVariables['/point3'].stateValues.x3).eq('z'); + + }); + + + + + + + cy.log('Back to 2D point') + cy.get('#\\/originalCoords textarea').type('{ctrl+home}{shift+end}{backspace}(p,q){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(p,q)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + cy.get("#\\/nDimensions1").should('have.text', '2'); + cy.get("#\\/nDimensions2").should('have.text', '2'); + cy.get("#\\/nDimensions3").should('have.text', '2'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') + cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('p') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).should('not.exist') + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('p'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('q'); + expect(stateVariables['/_point1'].stateValues.x1).eq('p'); + expect(stateVariables['/_point1'].stateValues.x2).eq('q'); + expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point2'].stateValues.xs).length).eq(2); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('p'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('q'); + expect(stateVariables['/point2'].stateValues.x1).eq('p'); + expect(stateVariables['/point2'].stateValues.x2).eq('q'); + expect(stateVariables['/point2'].stateValues.x3).eq(undefined); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point3'].stateValues.xs).length).eq(2); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('p'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('q'); + expect(stateVariables['/point3'].stateValues.x1).eq('p'); + expect(stateVariables['/point3'].stateValues.x2).eq('q'); + expect(stateVariables['/point3'].stateValues.x3).eq(undefined); + + }); + + + cy.log(`can't increase dimension from inverse direction 1`) + cy.get("#\\/coords1b textarea").type('{ctrl+home}{shift+end}{backspace}(a,b,c){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(a,b)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/nDimensions1").should('have.text', '2'); + cy.get("#\\/nDimensions2").should('have.text', '2'); + cy.get("#\\/nDimensions3").should('have.text', '2'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') + cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('a') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('b') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).should('not.exist') + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('a'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('b'); + expect(stateVariables['/_point1'].stateValues.x1).eq('a'); + expect(stateVariables['/_point1'].stateValues.x2).eq('b'); + expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point2'].stateValues.xs).length).eq(2); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('a'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('b'); + expect(stateVariables['/point2'].stateValues.x1).eq('a'); + expect(stateVariables['/point2'].stateValues.x2).eq('b'); + expect(stateVariables['/point2'].stateValues.x3).eq(undefined); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point3'].stateValues.xs).length).eq(2); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('a'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('b'); + expect(stateVariables['/point3'].stateValues.x1).eq('a'); + expect(stateVariables['/point3'].stateValues.x2).eq('b'); + expect(stateVariables['/point3'].stateValues.x3).eq(undefined); + + }); + + + + cy.log(`can't increase dimension from inverse direction 2`) + cy.get("#\\/coords2b textarea").type('{ctrl+home}{shift+end}{backspace}(d,e,f){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(d,e)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(d,e)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(d,e)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(d,e)') + }) + cy.get("#\\/nDimensions1").should('have.text', '2'); + cy.get("#\\/nDimensions2").should('have.text', '2'); + cy.get("#\\/nDimensions3").should('have.text', '2'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') + cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('d') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('e') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).should('not.exist') + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(d,e)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(d,e)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(d,e)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(d,e)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(d,e)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(d,e)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(d,e)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('d'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('e'); + expect(stateVariables['/_point1'].stateValues.x1).eq('d'); + expect(stateVariables['/_point1'].stateValues.x2).eq('e'); + expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point2'].stateValues.xs).length).eq(2); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('d'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('e'); + expect(stateVariables['/point2'].stateValues.x1).eq('d'); + expect(stateVariables['/point2'].stateValues.x2).eq('e'); + expect(stateVariables['/point2'].stateValues.x3).eq(undefined); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point3'].stateValues.xs).length).eq(2); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('d'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('e'); + expect(stateVariables['/point3'].stateValues.x1).eq('d'); + expect(stateVariables['/point3'].stateValues.x2).eq('e'); + expect(stateVariables['/point3'].stateValues.x3).eq(undefined); + + }); + + + cy.log(`can't increase dimension from inverse direction 3`) + cy.get("#\\/coords3b textarea").type('{ctrl+home}{shift+end}{backspace}(g,h,i){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(g,h)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(g,h)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(g,h)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(g,h)') + }) + cy.get("#\\/nDimensions1").should('have.text', '2'); + cy.get("#\\/nDimensions2").should('have.text', '2'); + cy.get("#\\/nDimensions3").should('have.text', '2'); + cy.get("#\\/point1x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/point2x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/point3x1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/point3x1e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/pointallx1A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/pointallx1B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/pointallx1C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/point1x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/point2x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/point3x2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/point3x2e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/pointallx2A").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/pointallx2B").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/pointallx2C").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/p1z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p2z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3z").should('have.text', 'z-coordinate: ') + cy.get("#\\/p3ze").should('have.text', 'z-coordinate: ') + cy.get("#\\/pallz").should('have.text', 'z-coordinates: ') + + cy.get("#\\/p1all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/p1all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p2all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/p2all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p3all").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/p3all").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/p3alle").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/p3alle").find('.mjx-mrow').eq(2).should('not.exist') + + cy.get("#\\/pallall").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(1).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(2).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(3).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(4).invoke('text').then((text) => { + expect(text.trim()).equal('g') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(5).invoke('text').then((text) => { + expect(text.trim()).equal('h') + }) + cy.get("#\\/pallall").find('.mjx-mrow').eq(6).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(7).should('not.exist') + cy.get("#\\/pallall").find('.mjx-mrow').eq(8).should('not.exist') + + cy.get("#\\/coords1").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(g,h)') + }) + cy.get("#\\/coords2").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(g,h)') + }) + cy.get("#\\/coords3").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(g,h)') + }) + cy.get("#\\/coords3e").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(g,h)') + }) + cy.get("#\\/coordsallA").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(g,h)') + }) + cy.get("#\\/coordsallB").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(g,h)') + }) + cy.get("#\\/coordsallC").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(g,h)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('g'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('h'); + expect(stateVariables['/_point1'].stateValues.x1).eq('g'); + expect(stateVariables['/_point1'].stateValues.x2).eq('h'); + expect(stateVariables['/_point1'].stateValues.x3).eq(undefined); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point2'].stateValues.xs).length).eq(2); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('g'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('h'); + expect(stateVariables['/point2'].stateValues.x1).eq('g'); + expect(stateVariables['/point2'].stateValues.x2).eq('h'); + expect(stateVariables['/point2'].stateValues.x3).eq(undefined); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point3'].stateValues.xs).length).eq(2); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('g'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('h'); + expect(stateVariables['/point3'].stateValues.x1).eq('g'); + expect(stateVariables['/point3'].stateValues.x2).eq('h'); + expect(stateVariables['/point3'].stateValues.x3).eq(undefined); + + }); + + + + + + + + }) + + // have this abbreviated test, at it was triggering an error + // that wasn't caught with full test + it('change point dimensions, abbreviated', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a +

Specify point coordinates:

+ +
The points +

The point:

+

The point copied:

+

The point copied again:

+
+ + `}, "*"); + }); + + cy.get("#\\/_text1").should('have.text', 'a'); // to wait for page to load + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('_') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(1); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(1); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('_'); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(1); + expect((stateVariables['/point2'].stateValues.xs).length).eq(1); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('_'); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(1); + expect((stateVariables['/point3'].stateValues.xs).length).eq(1); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('_'); + + }); + + cy.log('Create 2D point 2') + cy.get('#\\/originalCoords textarea').type('(a,b){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(a,b)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(a,b)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('a'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('b'); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point2'].stateValues.xs).length).eq(2); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('a'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('b'); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point3'].stateValues.xs).length).eq(2); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('a'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('b'); + + }); + + + + cy.log('Back to 1D point') + cy.get('#\\/originalCoords textarea').type('{ctrl+home}{shift+end}{backspace}q{enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', 'q') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('q') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(1); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(1); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('q'); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(1); + expect((stateVariables['/point2'].stateValues.xs).length).eq(1); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('q'); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(1); + expect((stateVariables['/point3'].stateValues.xs).length).eq(1); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('q'); + + }); + + + + cy.log('Create 3D point') + cy.get('#\\/originalCoords textarea').type('{end}{backspace}(2x,u/v{rightarrow},w^2{rightarrow}){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(2x,uv,w2)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(2x,uv,w2)') + }) + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(3); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(3); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eqls(["*", 2, "x"]); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eqls(["/", "u", "v"]); + expect((stateVariables['/_point1'].stateValues.xs)[2]).eqls(["^", "w", 2]); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point2'].stateValues.xs).length).eq(3); + expect((stateVariables['/point2'].stateValues.xs)[0]).eqls(["*", 2, "x"]); + expect((stateVariables['/point2'].stateValues.xs)[1]).eqls(["/", "u", "v"]); + expect((stateVariables['/point2'].stateValues.xs)[2]).eqls(["^", "w", 2]); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(3); + expect((stateVariables['/point3'].stateValues.xs).length).eq(3); + expect((stateVariables['/point3'].stateValues.xs)[0]).eqls(["*", 2, "x"]); + expect((stateVariables['/point3'].stateValues.xs)[1]).eqls(["/", "u", "v"]); + expect((stateVariables['/point3'].stateValues.xs)[2]).eqls(["^", "w", 2]); + + }); + + + + + + cy.log('Back to 2D point 2') + cy.get('#\\/originalCoords textarea').type('{ctrl+home}{shift+end}{backspace}(p,q){enter}', { force: true }); + + cy.get("#\\/point1p .mjx-mrow").should('contain.text', '(p,q)') + + cy.get("#\\/point1p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + cy.get("#\\/point2p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + cy.get("#\\/point3p").find('.mjx-mrow').eq(0).invoke('text').then((text) => { + expect(text.trim()).equal('(p,q)') + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables['/_point1'].stateValues.nDimensions).eq(2); + expect((stateVariables['/_point1'].stateValues.xs).length).eq(2); + expect((stateVariables['/_point1'].stateValues.xs)[0]).eq('p'); + expect((stateVariables['/_point1'].stateValues.xs)[1]).eq('q'); + expect(stateVariables['/point2'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point2'].stateValues.xs).length).eq(2); + expect((stateVariables['/point2'].stateValues.xs)[0]).eq('p'); + expect((stateVariables['/point2'].stateValues.xs)[1]).eq('q'); + expect(stateVariables['/point3'].stateValues.nDimensions).eq(2); + expect((stateVariables['/point3'].stateValues.xs).length).eq(2); + expect((stateVariables['/point3'].stateValues.xs)[0]).eq('p'); + expect((stateVariables['/point3'].stateValues.xs)[1]).eq('q'); + + }); + + + }) + + it('label positioning', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + + (1,2) + + + +

label:

+

position: + + upperRight + upperLeft + lowerRight + lowerLeft + +

+ + `}, "*"); + }); + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + // not sure what to test as don't know how to check renderer... + + cy.get('#\\/label_input').clear().type("B{enter}") + + cy.get('#\\/labelPos').select("upperLeft") + cy.get('#\\/labelPos').select("lowerRight") + cy.get('#\\/labelPos').select("lowerLeft") + + }); + + + it('copy and overwrite coordinates, initial individual components', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + + + + + + + + + + + + + + + + + 1 + + `}, "*"); + }); + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + cy.log('initial values') + + cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(1,2,4)') + cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(3,0,1)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/A'].stateValues.xs)).eqls([1, 2]) + expect((stateVariables['/B'].stateValues.xs)).eqls([3, 4]) + expect((stateVariables['/C'].stateValues.xs)).eqls([3, 1]) + expect((stateVariables['/A1'].stateValues.xs)).eqls([-1, 2]) + expect((stateVariables['/B1'].stateValues.xs)).eqls([3, -2]) + expect((stateVariables['/C1'].stateValues.xs)).eqls([1, 1]) + expect((stateVariables['/C2/C'].stateValues.xs)).eqls([3, 0]) + expect((stateVariables['/A2'].stateValues.xs)).eqls([1, 2, 4]) + expect((stateVariables['/C3'].stateValues.xs)).eqls([3, 0, 1]) + expect(stateVariables['/A'].stateValues.label).eq('A'); + expect(stateVariables['/A1'].stateValues.label).eq('A'); + expect(stateVariables['/B'].stateValues.label).eq('B'); + expect(stateVariables['/B1'].stateValues.label).eq('B'); + expect(stateVariables['/C'].stateValues.label).eq('C'); + expect(stateVariables['/C1'].stateValues.label).eq('C'); + expect(stateVariables['/C2/C'].stateValues.label).eq('C'); + + }) + + cy.log('move original points') + + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/A', + args: { x: -2, y: -7 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/B', + args: { x: 5.1, y: 8.9 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/C', + args: { x: -3, y: -8 } + }) + }) + + cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(−2,−7,4)') + cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(−3,−6,1)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/A'].stateValues.xs)).eqls([-2, -7]) + expect((stateVariables['/B'].stateValues.xs)).eqls([5, 9]) + expect((stateVariables['/C'].stateValues.xs)).eqls([-3, -8]) + expect((stateVariables['/A1'].stateValues.xs)).eqls([-1, -7]) + expect((stateVariables['/B1'].stateValues.xs)).eqls([5, -2]) + expect((stateVariables['/C1'].stateValues.xs)).eqls([-5, -8]) + expect((stateVariables['/C2/C'].stateValues.xs)).eqls([-3, -6]) + expect((stateVariables['/A2'].stateValues.xs)).eqls([-2, -7, 4]) + expect((stateVariables['/C3'].stateValues.xs)).eqls([-3, -6, 1]) + + }) + + + cy.log('move copied points') + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/A1', + args: { x: 8, y: -5 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/B1', + args: { x: -5.6, y: 6.3 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/C1', + args: { x: -7, y: 4 } + }) + }) + + cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(−2,−5,4)') + cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(−5,−8,1)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/A'].stateValues.xs)).eqls([-2, -5]) + expect((stateVariables['/B'].stateValues.xs)).eqls([-6, 9]) + expect((stateVariables['/C'].stateValues.xs)).eqls([-5, 4]) + expect((stateVariables['/A1'].stateValues.xs)).eqls([8, -5]) + expect((stateVariables['/B1'].stateValues.xs)).eqls([-6, 6]) + expect((stateVariables['/C1'].stateValues.xs)).eqls([-7, 4]) + expect((stateVariables['/C2/C'].stateValues.xs)).eqls([-5, -8]) + expect((stateVariables['/A2'].stateValues.xs)).eqls([-2, -5, 4]) + expect((stateVariables['/C3'].stateValues.xs)).eqls([-5, -8, 1]) + + }) + + + + }); + + + it('copy and overwrite coordinates, initial xs', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + + + + + + + + + + + + + + + + + 1 + + `}, "*"); + }); + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + cy.log('initial values') + + cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(1,2,4)') + cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(3,0,1)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/A'].stateValues.xs)).eqls([1, 2]) + expect((stateVariables['/B'].stateValues.xs)).eqls([3, 4]) + expect((stateVariables['/C'].stateValues.xs)).eqls([3, 1]) + expect((stateVariables['/A1'].stateValues.xs)).eqls([-1, 2]) + expect((stateVariables['/B1'].stateValues.xs)).eqls([3, -2]) + expect((stateVariables['/C1'].stateValues.xs)).eqls([1, 1]) + expect((stateVariables['/C2/C'].stateValues.xs)).eqls([3, 0]) + expect((stateVariables['/A2'].stateValues.xs)).eqls([1, 2, 4]) + expect((stateVariables['/C3'].stateValues.xs)).eqls([3, 0, 1]) + expect(stateVariables['/A'].stateValues.label).eq('A'); + expect(stateVariables['/A1'].stateValues.label).eq('A'); + expect(stateVariables['/B'].stateValues.label).eq('B'); + expect(stateVariables['/B1'].stateValues.label).eq('B'); + expect(stateVariables['/C'].stateValues.label).eq('C'); + expect(stateVariables['/C1'].stateValues.label).eq('C'); + expect(stateVariables['/C2/C'].stateValues.label).eq('C'); + + }) + + cy.log('move original points') + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/A', + args: { x: -2, y: -7 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/B', + args: { x: 5.1, y: 8.9 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/C', + args: { x: -3, y: -8 } + }) + }) + + cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(−2,−7,4)') + cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(−3,−6,1)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/A'].stateValues.xs)).eqls([-2, -7]) + expect((stateVariables['/B'].stateValues.xs)).eqls([5, 9]) + expect((stateVariables['/C'].stateValues.xs)).eqls([-3, -8]) + expect((stateVariables['/A1'].stateValues.xs)).eqls([-1, -7]) + expect((stateVariables['/B1'].stateValues.xs)).eqls([5, -2]) + expect((stateVariables['/C1'].stateValues.xs)).eqls([-5, -8]) + expect((stateVariables['/C2/C'].stateValues.xs)).eqls([-3, -6]) + expect((stateVariables['/A2'].stateValues.xs)).eqls([-2, -7, 4]) + expect((stateVariables['/C3'].stateValues.xs)).eqls([-3, -6, 1]) + + }) + + + cy.log('move copied points') + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/A1', + args: { x: 8, y: -5 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/B1', + args: { x: -5.6, y: 6.3 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/C1', + args: { x: -7, y: 4 } + }) + }) + + cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(−2,−5,4)') + cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(−5,−8,1)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/A'].stateValues.xs)).eqls([-2, -5]) + expect((stateVariables['/B'].stateValues.xs)).eqls([-6, 9]) + expect((stateVariables['/C'].stateValues.xs)).eqls([-5, 4]) + expect((stateVariables['/A1'].stateValues.xs)).eqls([8, -5]) + expect((stateVariables['/B1'].stateValues.xs)).eqls([-6, 6]) + expect((stateVariables['/C1'].stateValues.xs)).eqls([-7, 4]) + expect((stateVariables['/C2/C'].stateValues.xs)).eqls([-5, -8]) + expect((stateVariables['/A2'].stateValues.xs)).eqls([-2, -5, 4]) + expect((stateVariables['/C3'].stateValues.xs)).eqls([-5, -8, 1]) + + }) + + + + }); + + + it('copy and overwrite coordinates, initial coords', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + + + + + + + + + + + + + + + + + 1 + + `}, "*"); + }); + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + cy.log('initial values') + + cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(1,2,4)') + cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(3,0,1)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/A'].stateValues.xs)).eqls([1, 2]) + expect((stateVariables['/B'].stateValues.xs)).eqls([3, 4]) + expect((stateVariables['/C'].stateValues.xs)).eqls([3, 1]) + expect((stateVariables['/A1'].stateValues.xs)).eqls([-1, 2]) + expect((stateVariables['/B1'].stateValues.xs)).eqls([3, -2]) + expect((stateVariables['/C1'].stateValues.xs)).eqls([1, 1]) + expect((stateVariables['/C2/C'].stateValues.xs)).eqls([3, 0]) + expect((stateVariables['/A2'].stateValues.xs)).eqls([1, 2, 4]) + expect((stateVariables['/C3'].stateValues.xs)).eqls([3, 0, 1]) + expect(stateVariables['/A'].stateValues.label).eq('A'); + expect(stateVariables['/A1'].stateValues.label).eq('A'); + expect(stateVariables['/B'].stateValues.label).eq('B'); + expect(stateVariables['/B1'].stateValues.label).eq('B'); + expect(stateVariables['/C'].stateValues.label).eq('C'); + expect(stateVariables['/C1'].stateValues.label).eq('C'); + expect(stateVariables['/C2/C'].stateValues.label).eq('C'); + + }) + + cy.log('move original points') + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/A', + args: { x: -2, y: -7 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/B', + args: { x: 5.1, y: 8.9 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/C', + args: { x: -3, y: -8 } + }) + }) + + cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(−2,−7,4)') + cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(−3,−6,1)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/A'].stateValues.xs)).eqls([-2, -7]) + expect((stateVariables['/B'].stateValues.xs)).eqls([5, 9]) + expect((stateVariables['/C'].stateValues.xs)).eqls([-3, -8]) + expect((stateVariables['/A1'].stateValues.xs)).eqls([-1, -7]) + expect((stateVariables['/B1'].stateValues.xs)).eqls([5, -2]) + expect((stateVariables['/C1'].stateValues.xs)).eqls([-5, -8]) + expect((stateVariables['/C2/C'].stateValues.xs)).eqls([-3, -6]) + expect((stateVariables['/A2'].stateValues.xs)).eqls([-2, -7, 4]) + expect((stateVariables['/C3'].stateValues.xs)).eqls([-3, -6, 1]) + + }) + + + cy.log('move copied points') + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/A1', + args: { x: 8, y: -5 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/B1', + args: { x: -5.6, y: 6.3 } + }) + win.callAction1({ + actionName: "movePoint", + componentName: '/C1', + args: { x: -7, y: 4 } + }) + }) + + cy.get('#\\/A2 .mjx-mrow').should('contain.text', '(−2,−5,4)') + cy.get('#\\/C3 .mjx-mrow').should('contain.text', '(−5,−8,1)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/A'].stateValues.xs)).eqls([-2, -5]) + expect((stateVariables['/B'].stateValues.xs)).eqls([-6, 9]) + expect((stateVariables['/C'].stateValues.xs)).eqls([-5, 4]) + expect((stateVariables['/A1'].stateValues.xs)).eqls([8, -5]) + expect((stateVariables['/B1'].stateValues.xs)).eqls([-6, 6]) + expect((stateVariables['/C1'].stateValues.xs)).eqls([-7, 4]) + expect((stateVariables['/C2/C'].stateValues.xs)).eqls([-5, -8]) + expect((stateVariables['/A2'].stateValues.xs)).eqls([-2, -5, 4]) + expect((stateVariables['/C3'].stateValues.xs)).eqls([-5, -8, 1]) + + }) + + + + }); + + + it('copy and overwrite each coordinate in sequence, initial sugar', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + (3,2) + + + + + + + + + + + + + + + + + + `}, "*"); + }); + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + cy.log('initial values') + + cy.get('#\\/P1 .mjx-mrow').should('contain.text', '(3,2)') + cy.get('#\\/P2 .mjx-mrow').should('contain.text', '(−1,2)') + cy.get('#\\/P3 .mjx-mrow').should('contain.text', '(−1,2)') + cy.get('#\\/P4 .mjx-mrow').should('contain.text', '(−1,−5)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/g1/P'].stateValues.xs)).eqls([3, 2]) + expect((stateVariables['/g2/P'].stateValues.xs)).eqls([-1, 2]) + expect((stateVariables['/g3/P'].stateValues.xs)).eqls([-1, 2]) + expect((stateVariables['/g4/P'].stateValues.xs)).eqls([-1, -5]) + }) + + cy.log('move first point') + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/g1/P', + args: { x: -2, y: -7 } + }) + }) + + cy.get('#\\/P1 .mjx-mrow').should('contain.text', '(−2,−7)') + cy.get('#\\/P2 .mjx-mrow').should('contain.text', '(−1,−7)') + cy.get('#\\/P3 .mjx-mrow').should('contain.text', '(−1,−7)') + cy.get('#\\/P4 .mjx-mrow').should('contain.text', '(−1,−5)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/g1/P'].stateValues.xs)).eqls([-2, -7]) + expect((stateVariables['/g2/P'].stateValues.xs)).eqls([-1, -7]) + expect((stateVariables['/g3/P'].stateValues.xs)).eqls([-1, -7]) + expect((stateVariables['/g4/P'].stateValues.xs)).eqls([-1, -5]) + }) + + + cy.log('move second point') + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/g2/P', + args: { x: 8, y: -6 } + }) + }) + + cy.get('#\\/P1 .mjx-mrow').should('contain.text', '(−2,−6)') + cy.get('#\\/P2 .mjx-mrow').should('contain.text', '(8,−6)') + cy.get('#\\/P3 .mjx-mrow').should('contain.text', '(8,−6)') + cy.get('#\\/P4 .mjx-mrow').should('contain.text', '(8,−5)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/g1/P'].stateValues.xs)).eqls([-2, -6]) + expect((stateVariables['/g2/P'].stateValues.xs)).eqls([8, -6]) + expect((stateVariables['/g3/P'].stateValues.xs)).eqls([8, -6]) + expect((stateVariables['/g4/P'].stateValues.xs)).eqls([8, -5]) + }) + + + cy.log('move third point') + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/g3/P', + args: { x: 1, y: 0 } + }) + }) + + cy.get('#\\/P1 .mjx-mrow').should('contain.text', '(−2,0)') + cy.get('#\\/P2 .mjx-mrow').should('contain.text', '(1,0)') + cy.get('#\\/P3 .mjx-mrow').should('contain.text', '(1,0)') + cy.get('#\\/P4 .mjx-mrow').should('contain.text', '(1,−5)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/g1/P'].stateValues.xs)).eqls([-2, 0]) + expect((stateVariables['/g2/P'].stateValues.xs)).eqls([1, 0]) + expect((stateVariables['/g3/P'].stateValues.xs)).eqls([1, 0]) + expect((stateVariables['/g4/P'].stateValues.xs)).eqls([1, -5]) + }) + + cy.log('move fourth point') + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/g4/P', + args: { x: 3, y: 4 } + }) + }) + + cy.get('#\\/P1 .mjx-mrow').should('contain.text', '(−2,0)') + cy.get('#\\/P2 .mjx-mrow').should('contain.text', '(3,0)') + cy.get('#\\/P3 .mjx-mrow').should('contain.text', '(3,0)') + cy.get('#\\/P4 .mjx-mrow').should('contain.text', '(3,4)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/g1/P'].stateValues.xs)).eqls([-2, 0]) + expect((stateVariables['/g2/P'].stateValues.xs)).eqls([3, 0]) + expect((stateVariables['/g3/P'].stateValues.xs)).eqls([3, 0]) + expect((stateVariables['/g4/P'].stateValues.xs)).eqls([3, 4]) + }) + + }); + + it('1D point with 2D constraint does not crash', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + + x^2 + + + + + + x^2x^3 + + + + + + + + + + + y=2x + + + + + + + + + + + + + + + + + + + + + + + + + + + + `}, "*"); + }); + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + cy.get('#\\/xa .mjx-mrow').should('have.text', '1') + cy.get('#\\/xb .mjx-mrow').should('have.text', '2') + cy.get('#\\/xc .mjx-mrow').should('have.text', '3') + cy.get('#\\/xd .mjx-mrow').should('have.text', '4') + cy.get('#\\/xe .mjx-mrow').should('have.text', '5') + cy.get('#\\/xf .mjx-mrow').should('have.text', '6') + cy.get('#\\/xg .mjx-mrow').should('have.text', '7') + + + }); + + it('display digits propagates', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + (32.252609, 0.0672854, 5) + + + + + + + + + + + + + + + + + + + + + $P + $Q + $R + + $P + $Q + $R + + $(P.x) + + + $(P.x) + + + + `}, "*"); + }); + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + cy.get('#\\/P .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32,0.067,5)") + }) + cy.get('#\\/Q .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32.25,0.07,5)") + }) + cy.get('#\\/R .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32.25260900,0.06728540000,5.000000000)") + }) + cy.get('#\\/Pcoords .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32,0.067,5)") + }) + cy.get('#\\/Qcoords .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32.25,0.07,5)") + }) + cy.get('#\\/Rcoords .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32.25260900,0.06728540000,5.000000000)") + }) + cy.get('#\\/PcoordsDec4 .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32.2526,0.0673,5)") + }) + cy.get('#\\/QcoordsDig4 .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32.25,0.06729,5)") + }) + cy.get('#\\/RcoordsDig2 .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32,0.067,5.0)") + }) + cy.get('#\\/PcoordsPad .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32,0.067,5.0)") + }) + cy.get('#\\/QcoordsPad .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32.25,0.07,5.00)") + }) + cy.get('#\\/RcoordsNoPad .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32.252609,0.0672854,5)") + }) + cy.get('#\\/Px1 .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("32") + }) + cy.get('#\\/Px2 .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("0.067") + }) + cy.get('#\\/Px3 .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("5") + }) + cy.get('#\\/Qx1 .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("32.25") + }) + cy.get('#\\/Qx2 .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("0.07") + }) + cy.get('#\\/Rx3 .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("5.000000000") + }) + cy.get('#\\/Pmath .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32,0.067,5)") + }) + cy.get('#\\/Qmath .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32.25,0.07,5)") + }) + cy.get('#\\/Rmath .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32.25260900,0.06728540000,5.000000000)") + }) + cy.get('#\\/PmathDec4 .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32.2526,0.0673,5)") + }) + cy.get('#\\/QmathDig4 .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32.25,0.06729,5)") + }) + cy.get('#\\/RmathDig2 .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(32,0.067,5.0)") + }) + cy.get('#\\/Px1number').should('have.text', "32") + cy.get('#\\/Px2number').should('have.text', "0.067") + cy.get('#\\/Px1numberDec4').should('have.text', "32.2526") + cy.get('#\\/Px2numberDig4').should('have.text', "0.06729") + + + }); + + it('rounding, copy and override', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + +

(34.245023482352345, 245.23823402358234234)

+

+

+

+

+ ` }, "*"); + }); + + cy.get('#\\/_text1').should('have.text', 'a'); // to wait until loaded + + cy.get("#\\/p1 .mjx-mrow").eq(0).should("have.text", "(34.24502348,245.238234)") + + cy.get("#\\/p1Dig4 .mjx-mrow").eq(0).should("have.text", "(34.25,245.2)") + cy.get("#\\/p1Dig4a .mjx-mrow").eq(0).should("have.text", "(34.25,245.2)") + + cy.get("#\\/p1Dec6 .mjx-mrow").eq(0).should("have.text", "(34.24502,245.23823)") + cy.get("#\\/p1Dec6a .mjx-mrow").eq(0).should("have.text", "(34.24502,245.23823)") + + }) + + it('label point with child, part math', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + (1,2) + + + + + (3,4) + + + + (5,6) + + + + (7,8) + + + +

Label for P:

+

Label for Q:

+

Label for R:

+

Label for S:

+ `}, "*"); + }); + + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + cy.get('#\\/labelPPar').should('contain.text', 'Label for P: We have ') + cy.get('#\\/labelPPar .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("x1.0+y2.0") + }) + cy.get('#\\/labelQPar').should('have.text', 'Label for Q: No latex: x^3.00 + y^4.00') + cy.get('#\\/labelRPar').should('contain.text', 'Label for R: We have ') + cy.get('#\\/labelRPar').should('contain.text', ' and ') + cy.get('#\\/labelSPar').should('contain.text', 'Label for S: No latex: x^3.00 + y^4.00 and ') + cy.get('#\\/labelSPar .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(7,8)") + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables["/P"].stateValues.label).eq('We have \\(x^{1.0} + y^{2.0}\\)') + expect(stateVariables["/P"].stateValues.labelHasLatex).eq(true) + + expect(stateVariables["/Q"].stateValues.label).eq('No latex: x^3.00 + y^4.00') + expect(stateVariables["/Q"].stateValues.labelHasLatex).eq(false) + + expect(stateVariables["/R"].stateValues.label).eq('We have \\(x^{1.0} + y^{2.0}\\) and \\(\\left( 5, 6 \\right)\\)') + expect(stateVariables["/R"].stateValues.labelHasLatex).eq(true) + + expect(stateVariables["/S"].stateValues.label).eq('No latex: x^3.00 + y^4.00 and \\(\\left( 7, 8 \\right)\\)') + expect(stateVariables["/S"].stateValues.labelHasLatex).eq(true) + + }) + + + cy.log('move points') + cy.window().then(async (win) => { + await win.callAction1({ + actionName: "movePoint", + componentName: "/P", + args: { x: Math.PI, y: Math.E } + }) + await win.callAction1({ + actionName: "movePoint", + componentName: "/Q", + args: { x: Math.sqrt(2), y: 1 / 3 } + }) + await win.callAction1({ + actionName: "movePoint", + componentName: "/R", + args: { x: 1 / 6, y: 2 / 3 } + }) + await win.callAction1({ + actionName: "movePoint", + componentName: "/S", + args: { x: 1 / 8, y: 9 / 8 } + }) + }) + + + cy.get('#\\/labelQPar').should('have.text', 'Label for Q: No latex: x^1.41 + y^0.333') + + cy.get('#\\/labelPPar').should('contain.text', 'Label for P: We have ') + cy.get('#\\/labelPPar .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("x3.1+y2.7") + }) + cy.get('#\\/labelSPar').should('contain.text', 'Label for S: No latex: x^1.41 + y^0.333 and ') + cy.get('#\\/labelSPar .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("(0.13,1.1)") + }) + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables["/P"].stateValues.label).eq('We have \\(x^{3.1} + y^{2.7}\\)') + expect(stateVariables["/P"].stateValues.labelHasLatex).eq(true) + + expect(stateVariables["/Q"].stateValues.label).eq('No latex: x^1.41 + y^0.333') + expect(stateVariables["/Q"].stateValues.labelHasLatex).eq(false) + + expect(stateVariables["/R"].stateValues.label).eq('We have \\(x^{3.1} + y^{2.7}\\) and \\(\\left( 0.17, 0.67 \\right)\\)') + expect(stateVariables["/R"].stateValues.labelHasLatex).eq(true) + + expect(stateVariables["/S"].stateValues.label).eq('No latex: x^1.41 + y^0.333 and \\(\\left( 0.13, 1.1 \\right)\\)') + expect(stateVariables["/S"].stateValues.labelHasLatex).eq(true) + + }) + + + }); + + it('copy point and override label', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + (1,2) + + + + + + + + + +

Label for P:

+

Label for Q:

+ `}, "*"); + }); + + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + cy.get('#\\/labelPPar').should('contain.text', 'Label for P: We have ') + cy.get('#\\/labelPPar .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("x1.0+y2.0") + }) + cy.get('#\\/labelQPar').should('have.text', 'Label for Q: No latex: x^1.00 + y^2.00') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables["/P"].stateValues.label).eq('We have \\(x^{1.0} + y^{2.0}\\)') + expect(stateVariables["/P"].stateValues.labelHasLatex).eq(true) + + expect(stateVariables["/Q"].stateValues.label).eq('No latex: x^1.00 + y^2.00') + expect(stateVariables["/Q"].stateValues.labelHasLatex).eq(false) + + }) + + + cy.log('move point') + cy.window().then(async (win) => { + await win.callAction1({ + actionName: "movePoint", + componentName: "/P", + args: { x: Math.PI, y: Math.E } + }) + }) + + + cy.get('#\\/labelQPar').should('have.text', 'Label for Q: No latex: x^3.14 + y^2.72') + + cy.get('#\\/labelPPar').should('contain.text', 'Label for P: We have ') + cy.get('#\\/labelPPar .mjx-mrow').eq(0).invoke('text').then(text => { + expect(text).eq("x3.1+y2.7") + }) + + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables["/P"].stateValues.label).eq('We have \\(x^{3.1} + y^{2.7}\\)') + expect(stateVariables["/P"].stateValues.labelHasLatex).eq(true) + + expect(stateVariables["/Q"].stateValues.label).eq('No latex: x^3.14 + y^2.72') + expect(stateVariables["/Q"].stateValues.labelHasLatex).eq(false) + + }) + + }); + + it('update labels', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + (1,2) + + + + (3,4) + + + + (5,6) + + + + (7,8) + + + + +

Change label 1:

+

+ +

+

The label 1:

+ +

Change label 2:

+

+ +

+

The label 2:

+ +

Change label 3:

+

+ +

+

The label 3:

+ + +

Change label 4:

+

+ +

+

The label 4:

+ + `}, "*"); + }); + + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + cy.get('#\\/theLabel1').should('have.text', 'P1') + cy.get("#\\/ti1_input").should('have.value', 'P1') + cy.get('#\\/theLabel2').should('have.text', 'P2') + cy.get("#\\/ti2_input").should('have.value', 'P2') + cy.get('#\\/theLabel3 .mjx-mrow').eq(0).should('have.text', 'P3') + cy.get("#\\/ti3_input").should('have.value', '\\frac{P}{3}') + cy.get('#\\/theLabel4 .mjx-mrow').eq(0).should('have.text', 'P4') + cy.get("#\\/ti4_input").should('have.value', '\\frac{P}{4}') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables["/P1"].stateValues.label).eq('P1') + expect(stateVariables["/P1"].stateValues.labelHasLatex).eq(false) + expect(stateVariables["/theLabel1"].stateValues.value).eq('P1') + expect(stateVariables["/theLabel1"].stateValues.text).eq('P1') + expect(stateVariables["/theLabel1"].stateValues.latex).eq('P1') + expect(stateVariables["/theLabel1"].stateValues.hasLatex).eq(false) + + expect(stateVariables["/P2"].stateValues.label).eq('P2') + expect(stateVariables["/P2"].stateValues.labelHasLatex).eq(false) + expect(stateVariables["/theLabel2"].stateValues.value).eq('P2') + expect(stateVariables["/theLabel2"].stateValues.text).eq('P2') + expect(stateVariables["/theLabel2"].stateValues.latex).eq('P2') + expect(stateVariables["/theLabel2"].stateValues.hasLatex).eq(false) + + expect(stateVariables["/P3"].stateValues.label).eq('\\(\\frac{P}{3}\\)') + expect(stateVariables["/P3"].stateValues.labelHasLatex).eq(true) + expect(stateVariables["/theLabel3"].stateValues.value).eq('\\(\\frac{P}{3}\\)') + expect(stateVariables["/theLabel3"].stateValues.text).eq('\\frac{P}{3}') + expect(stateVariables["/theLabel3"].stateValues.latex).eq('\\frac{P}{3}') + expect(stateVariables["/theLabel3"].stateValues.hasLatex).eq(true) + + expect(stateVariables["/P4"].stateValues.label).eq('\\(\\frac{P}{4}\\)') + expect(stateVariables["/P4"].stateValues.labelHasLatex).eq(true) + expect(stateVariables["/theLabel4"].stateValues.value).eq('\\(\\frac{P}{4}\\)') + expect(stateVariables["/theLabel4"].stateValues.text).eq('\\frac{P}{4}') + expect(stateVariables["/theLabel4"].stateValues.latex).eq('\\frac{P}{4}') + expect(stateVariables["/theLabel4"].stateValues.hasLatex).eq(true) + }) + + + cy.log("Change label via textinput") + cy.get("#\\/ti1_input").clear().type("Q1{enter}"); + cy.get("#\\/ti2_input").clear().type("Q2{enter}"); + cy.get("#\\/ti3_input").clear().type("\\frac{{}Q}{{}3}{enter}"); + cy.get("#\\/ti4_input").clear().type("\\frac{{}Q}{{}4}{enter}"); + cy.get('#\\/theLabel4 .mjx-mrow').should('contain.text', 'Q4') + + + cy.get('#\\/theLabel1').should('have.text', 'Q1') + cy.get("#\\/ti1_input").should('have.value', 'Q1') + cy.get('#\\/theLabel2').should('have.text', 'Q2') + cy.get("#\\/ti2_input").should('have.value', 'Q2') + cy.get('#\\/theLabel3 .mjx-mrow').eq(0).should('have.text', 'Q3') + cy.get("#\\/ti3_input").should('have.value', '\\frac{Q}{3}') + cy.get('#\\/theLabel4 .mjx-mrow').eq(0).should('have.text', 'Q4') + cy.get("#\\/ti4_input").should('have.value', '\\frac{Q}{4}') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables["/P1"].stateValues.label).eq('Q1') + expect(stateVariables["/P1"].stateValues.labelHasLatex).eq(false) + expect(stateVariables["/theLabel1"].stateValues.value).eq('Q1') + expect(stateVariables["/theLabel1"].stateValues.text).eq('Q1') + expect(stateVariables["/theLabel1"].stateValues.latex).eq('Q1') + expect(stateVariables["/theLabel1"].stateValues.hasLatex).eq(false) + + expect(stateVariables["/P2"].stateValues.label).eq('Q2') + expect(stateVariables["/P2"].stateValues.labelHasLatex).eq(false) + expect(stateVariables["/theLabel2"].stateValues.value).eq('Q2') + expect(stateVariables["/theLabel2"].stateValues.text).eq('Q2') + expect(stateVariables["/theLabel2"].stateValues.latex).eq('Q2') + expect(stateVariables["/theLabel2"].stateValues.hasLatex).eq(false) + + expect(stateVariables["/P3"].stateValues.label).eq('\\(\\frac{Q}{3}\\)') + expect(stateVariables["/P3"].stateValues.labelHasLatex).eq(true) + expect(stateVariables["/theLabel3"].stateValues.value).eq('\\(\\frac{Q}{3}\\)') + expect(stateVariables["/theLabel3"].stateValues.text).eq('\\frac{Q}{3}') + expect(stateVariables["/theLabel3"].stateValues.latex).eq('\\frac{Q}{3}') + expect(stateVariables["/theLabel3"].stateValues.hasLatex).eq(true) + + expect(stateVariables["/P4"].stateValues.label).eq('\\(\\frac{Q}{4}\\)') + expect(stateVariables["/P4"].stateValues.labelHasLatex).eq(true) + expect(stateVariables["/theLabel4"].stateValues.value).eq('\\(\\frac{Q}{4}\\)') + expect(stateVariables["/theLabel4"].stateValues.text).eq('\\frac{Q}{4}') + expect(stateVariables["/theLabel4"].stateValues.latex).eq('\\frac{Q}{4}') + expect(stateVariables["/theLabel4"].stateValues.hasLatex).eq(true) + }) + + cy.log('Revert label') + cy.get('#\\/revert1_button').click(); + cy.get('#\\/revert2_button').click(); + cy.get('#\\/revert3_button').click(); + cy.get('#\\/revert4_button').click(); + cy.get('#\\/theLabel4 .mjx-mrow').should('contain.text', 'P4') + + cy.get('#\\/theLabel1').should('have.text', 'P1') + cy.get("#\\/ti1_input").should('have.value', 'P1') + cy.get('#\\/theLabel2').should('have.text', 'P2') + cy.get("#\\/ti2_input").should('have.value', 'P2') + cy.get('#\\/theLabel3 .mjx-mrow').eq(0).should('have.text', 'P3') + cy.get("#\\/ti3_input").should('have.value', '\\frac{P}{3}') + cy.get('#\\/theLabel4 .mjx-mrow').eq(0).should('have.text', 'P4') + cy.get("#\\/ti4_input").should('have.value', '\\frac{P}{4}') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables["/P1"].stateValues.label).eq('P1') + expect(stateVariables["/P1"].stateValues.labelHasLatex).eq(false) + expect(stateVariables["/theLabel1"].stateValues.value).eq('P1') + expect(stateVariables["/theLabel1"].stateValues.text).eq('P1') + expect(stateVariables["/theLabel1"].stateValues.latex).eq('P1') + expect(stateVariables["/theLabel1"].stateValues.hasLatex).eq(false) + + expect(stateVariables["/P2"].stateValues.label).eq('P2') + expect(stateVariables["/P2"].stateValues.labelHasLatex).eq(false) + expect(stateVariables["/theLabel2"].stateValues.value).eq('P2') + expect(stateVariables["/theLabel2"].stateValues.text).eq('P2') + expect(stateVariables["/theLabel2"].stateValues.latex).eq('P2') + expect(stateVariables["/theLabel2"].stateValues.hasLatex).eq(false) + + expect(stateVariables["/P3"].stateValues.label).eq('\\(\\frac{P}{3}\\)') + expect(stateVariables["/P3"].stateValues.labelHasLatex).eq(true) + expect(stateVariables["/theLabel3"].stateValues.value).eq('\\(\\frac{P}{3}\\)') + expect(stateVariables["/theLabel3"].stateValues.text).eq('\\frac{P}{3}') + expect(stateVariables["/theLabel3"].stateValues.latex).eq('\\frac{P}{3}') + expect(stateVariables["/theLabel3"].stateValues.hasLatex).eq(true) + + expect(stateVariables["/P4"].stateValues.label).eq('\\(\\frac{P}{4}\\)') + expect(stateVariables["/P4"].stateValues.labelHasLatex).eq(true) + expect(stateVariables["/theLabel4"].stateValues.value).eq('\\(\\frac{P}{4}\\)') + expect(stateVariables["/theLabel4"].stateValues.text).eq('\\frac{P}{4}') + expect(stateVariables["/theLabel4"].stateValues.latex).eq('\\frac{P}{4}') + expect(stateVariables["/theLabel4"].stateValues.hasLatex).eq(true) + }) + + cy.log("Cannot switch to latex, unneeded delimiters ignored") + cy.get("#\\/ti1_input").clear().type("\\(\\frac{{}Q}{{}1}\\){enter}"); + cy.get("#\\/ti2_input").clear().type("\\(\\frac{{}Q}{{}2}\\){enter}"); + cy.get("#\\/ti3_input").clear().type("\\(\\frac{{}Q}{{}3}\\){enter}"); + cy.get("#\\/ti4_input").clear().type("\\(\\frac{{}Q}{{}4}\\){enter}"); + cy.get('#\\/theLabel4 .mjx-mrow').should('contain.text', 'Q4') + + cy.get('#\\/theLabel1').should('have.text', '\\(\\frac{Q}{1}\\)') + cy.get("#\\/ti1_input").should('have.value', '\\(\\frac{Q}{1}\\)') + cy.get('#\\/theLabel2').should('have.text', '\\(\\frac{Q}{2}\\)') + cy.get("#\\/ti2_input").should('have.value', '\\(\\frac{Q}{2}\\)') + cy.get('#\\/theLabel3 .mjx-mrow').eq(0).should('have.text', 'Q3') + cy.get("#\\/ti3_input").should('have.value', '\\frac{Q}{3}') + cy.get('#\\/theLabel4 .mjx-mrow').eq(0).should('have.text', 'Q4') + cy.get("#\\/ti4_input").should('have.value', '\\frac{Q}{4}') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables["/P1"].stateValues.label).eq('\\(\\frac{Q}{1}\\)') + expect(stateVariables["/P1"].stateValues.labelHasLatex).eq(false) + expect(stateVariables["/theLabel1"].stateValues.value).eq('\\(\\frac{Q}{1}\\)') + expect(stateVariables["/theLabel1"].stateValues.text).eq('\\(\\frac{Q}{1}\\)') + expect(stateVariables["/theLabel1"].stateValues.latex).eq('\\(\\frac{Q}{1}\\)') + expect(stateVariables["/theLabel1"].stateValues.hasLatex).eq(false) + + expect(stateVariables["/P2"].stateValues.label).eq('\\(\\frac{Q}{2}\\)') + expect(stateVariables["/P2"].stateValues.labelHasLatex).eq(false) + expect(stateVariables["/theLabel2"].stateValues.value).eq('\\(\\frac{Q}{2}\\)') + expect(stateVariables["/theLabel2"].stateValues.text).eq('\\(\\frac{Q}{2}\\)') + expect(stateVariables["/theLabel2"].stateValues.latex).eq('\\(\\frac{Q}{2}\\)') + expect(stateVariables["/theLabel2"].stateValues.hasLatex).eq(false) + + expect(stateVariables["/P3"].stateValues.label).eq('\\(\\frac{Q}{3}\\)') + expect(stateVariables["/P3"].stateValues.labelHasLatex).eq(true) + expect(stateVariables["/theLabel3"].stateValues.value).eq('\\(\\frac{Q}{3}\\)') + expect(stateVariables["/theLabel3"].stateValues.text).eq('\\frac{Q}{3}') + expect(stateVariables["/theLabel3"].stateValues.latex).eq('\\frac{Q}{3}') + expect(stateVariables["/theLabel3"].stateValues.hasLatex).eq(true) + + expect(stateVariables["/P4"].stateValues.label).eq('\\(\\frac{Q}{4}\\)') + expect(stateVariables["/P4"].stateValues.labelHasLatex).eq(true) + expect(stateVariables["/theLabel4"].stateValues.value).eq('\\(\\frac{Q}{4}\\)') + expect(stateVariables["/theLabel4"].stateValues.text).eq('\\frac{Q}{4}') + expect(stateVariables["/theLabel4"].stateValues.latex).eq('\\frac{Q}{4}') + expect(stateVariables["/theLabel4"].stateValues.hasLatex).eq(true) + }) + + + }); + + it('copy point with no arguments, specify individual coordinates', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + + + + + + + + + + + + + + + + `}, "*"); + }); + + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(0,0)"); + cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(1,0)"); + cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(0,1)"); + cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(1,2)"); + + cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(0,0)"); + cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(1,0)"); + cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(0,1)"); + cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(1,2)"); + + + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/A', + args: { x: 3, y: 4 } + }) + }) + + cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(3,4)"); + cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(1,4)"); + cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(3,1)"); + cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(1,2)"); + + cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(3,4)"); + cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(1,4)"); + cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(3,1)"); + cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(1,2)"); + + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/B', + args: { x: 5, y: 6 } + }) + }) + + cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(5,6)"); + + cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(3,6)"); + cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(3,1)"); + cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(5,2)"); + + cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(3,6)"); + cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(5,6)"); + cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(3,1)"); + cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(5,2)"); + + + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/C', + args: { x: 7, y: 8 } + }) + }) + + cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(7,8)"); + + cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(7,6)"); + cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(5,6)"); + cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(5,2)"); + + cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(7,6)"); + cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(5,6)"); + cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(7,8)"); + cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(5,2)"); + + + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/D', + args: { x: 9, y: 10 } + }) + }) + + cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(9,10)"); + + cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(7,6)"); + cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(9,6)"); + cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(7,8)"); + + cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(7,6)"); + cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(9,6)"); + cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(7,8)"); + cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(9,10)"); + + + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/g2/D', + args: { x: -1, y: -2 } + }) + }) + + cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(−1,−2)"); + + cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(7,6)"); + cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(−1,6)"); + cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(7,8)"); + + cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(7,6)"); + cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(−1,6)"); + cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(7,8)"); + cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(−1,−2)"); + + + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/g2/C', + args: { x: -3, y: -4 } + }) + }) + + cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(−3,−4)"); + + cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(−3,6)"); + cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(−1,6)"); + cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(−1,−2)"); + + cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(−3,6)"); + cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(−1,6)"); + cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(−3,−4)"); + cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(−1,−2)"); + + + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/g2/B', + args: { x: -5, y: -6 } + }) + }) + + cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(−5,−6)"); + + cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(−3,−6)"); + cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(−3,−4)"); + cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(−5,−2)"); + + cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(−3,−6)"); + cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(−5,−6)"); + cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(−3,−4)"); + cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(−5,−2)"); + + + cy.window().then(async (win) => { + win.callAction1({ + actionName: "movePoint", + componentName: '/g2/A', + args: { x: -7, y: -8 } + }) + }) + + cy.get('#\\/Ac .mjx-mrow').should('contain.text', "(−7,−8)"); + + cy.get('#\\/Bc .mjx-mrow').should('contain.text', "(−5,−8)"); + cy.get('#\\/Cc .mjx-mrow').should('contain.text', "(−7,−4)"); + cy.get('#\\/Dc .mjx-mrow').should('contain.text', "(−5,−2)"); + + cy.get('#\\/Ac2 .mjx-mrow').should('contain.text', "(−7,−8)"); + cy.get('#\\/Bc2 .mjx-mrow').should('contain.text', "(−5,−8)"); + cy.get('#\\/Cc2 .mjx-mrow').should('contain.text', "(−7,−4)"); + cy.get('#\\/Dc2 .mjx-mrow').should('contain.text', "(−5,−2)"); + + + + + }); + + it('1D point from string, xs, coords, not x', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + 1 + + + + + `}, "*"); + }); + + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + cy.get('#\\/oneDa .mjx-mrow').eq(0).should('have.text', "1"); + cy.get('#\\/oneDb .mjx-mrow').eq(0).should('have.text', "1"); + cy.get('#\\/oneDc .mjx-mrow').eq(0).should('have.text', "1"); + cy.get('#\\/twoD .mjx-mrow').eq(0).should('have.text', "(1,0)"); + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + expect(stateVariables["/oneDa"].stateValues.nDimensions).eq(1); + expect(stateVariables["/oneDb"].stateValues.nDimensions).eq(1); + expect(stateVariables["/oneDc"].stateValues.nDimensions).eq(1); + expect(stateVariables["/twoD"].stateValues.nDimensions).eq(2); + + + expect(stateVariables["/oneDa"].stateValues.xs).eqls([1]); + expect(stateVariables["/oneDb"].stateValues.xs).eqls([1]); + expect(stateVariables["/oneDc"].stateValues.xs).eqls([1]); + expect(stateVariables["/twoD"].stateValues.xs).eqls([1, 0]); + + }) + + }); + + it('handle invalid layer', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + (3,4) + + + + `}, "*"); + }); + + + cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load + + cy.get("#\\/l2").should('have.text', '0') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables["/P"].stateValues.layer).eq(0); + + }) + + + cy.get("#\\/l textarea").type("1{enter}", { force: true }); + cy.get("#\\/l2").should('have.text', '1') + + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables["/P"].stateValues.layer).eq(1); + + }) + + }); + + it('style description changes with theme', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + + + + + + + + (1,2) + (3,4) + (5,6) + +

Point A is $A.styleDescription.

+

B is a $B.styleDescriptionWithNoun.

+

C is a $C.styleDescriptionWithNoun.

+ `}, "*"); + }); + + + cy.get('#\\/Adescrip').should('have.text', 'Point A is brown.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a dark red square.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a black point.'); + + cy.log('set dark mode') + cy.get('#testRunner_toggleControls').click(); + cy.get('#testRunner_darkmode').click() + cy.wait(100) + cy.get('#testRunner_toggleControls').click(); + + + cy.get('#\\/Adescrip').should('have.text', 'Point A is yellow.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a light red square.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a white point.'); + + + }); + +}) diff --git a/cypress/e2e/DoenetML/tagSpecific/polygon.cy.js b/cypress/e2e/DoenetML/tagSpecific/polygon.cy.js index 067d88aaf5..0f152a2634 100644 --- a/cypress/e2e/DoenetML/tagSpecific/polygon.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/polygon.cy.js @@ -71,7 +71,7 @@ describe('Polygon Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -3740,4 +3740,62 @@ describe('Polygon Tag Tests', function () { }) + it('style description changes with theme', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + + + + + + + + + + + +

Polygon A is $A.styleDescription.

+

B is a $B.styleDescriptionWithNoun.

+

C is a $C.styleDescriptionWithNoun.

+

A has a $A.borderStyleDescription border.

+

B has a $B.borderStyleDescription border.

+

C has a $C.borderStyleDescription border.

+

A has a $A.fillStyleDescription fill.

+

B has a $B.fillStyleDescription fill.

+

C has a $C.fillStyleDescription fill.

+ `}, "*"); + }); + + + cy.get('#\\/Adescrip').should('have.text', 'Polygon A is filled brown with thick border.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a filled dark red polygon.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a filled black polygon with a thin border.'); + cy.get('#\\/Aborderdescrip').should('have.text', 'A has a thick brown border.'); + cy.get('#\\/Bborderdescrip').should('have.text', 'B has a dark red border.'); + cy.get('#\\/Cborderdescrip').should('have.text', 'C has a thin black border.'); + cy.get('#\\/Afilldescrip').should('have.text', 'A has a brown fill.'); + cy.get('#\\/Bfilldescrip').should('have.text', 'B has a dark red fill.'); + cy.get('#\\/Cfilldescrip').should('have.text', 'C has a black fill.'); + + cy.log('set dark mode') + cy.get('#testRunner_toggleControls').click(); + cy.get('#testRunner_darkmode').click() + cy.wait(100) + cy.get('#testRunner_toggleControls').click(); + + + cy.get('#\\/Adescrip').should('have.text', 'Polygon A is filled yellow with thick border.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a filled light red polygon.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a filled white polygon with a thin border.'); + cy.get('#\\/Aborderdescrip').should('have.text', 'A has a thick yellow border.'); + cy.get('#\\/Bborderdescrip').should('have.text', 'B has a light red border.'); + cy.get('#\\/Cborderdescrip').should('have.text', 'C has a thin white border.'); + cy.get('#\\/Afilldescrip').should('have.text', 'A has a yellow fill.'); + cy.get('#\\/Bfilldescrip').should('have.text', 'B has a light red fill.'); + cy.get('#\\/Cfilldescrip').should('have.text', 'C has a white fill.'); + + + }); + }); \ No newline at end of file diff --git a/cypress/e2e/DoenetML/tagSpecific/polyline.cy.js b/cypress/e2e/DoenetML/tagSpecific/polyline.cy.js index d8178c7d79..a6f5b9fd23 100644 --- a/cypress/e2e/DoenetML/tagSpecific/polyline.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/polyline.cy.js @@ -71,7 +71,7 @@ describe('Polyline Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -3639,5 +3639,45 @@ describe('Polyline Tag Tests', function () { }) + it('style description changes with theme', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + + + + + + + + + + + +

Polyline A is $A.styleDescription.

+

B is a $B.styleDescriptionWithNoun.

+

C is a $C.styleDescriptionWithNoun.

+ `}, "*"); + }); + + + cy.get('#\\/Adescrip').should('have.text', 'Polyline A is thick brown.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a dark red polyline.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin black polyline.'); + + cy.log('set dark mode') + cy.get('#testRunner_toggleControls').click(); + cy.get('#testRunner_darkmode').click() + cy.wait(100) + cy.get('#testRunner_toggleControls').click(); + + + cy.get('#\\/Adescrip').should('have.text', 'Polyline A is thick yellow.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a light red polyline.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin white polyline.'); + + + }); + }); \ No newline at end of file diff --git a/cypress/e2e/DoenetML/tagSpecific/problem.cy.js b/cypress/e2e/DoenetML/tagSpecific/problem.cy.js index cbde852fef..ce25667fc6 100644 --- a/cypress/e2e/DoenetML/tagSpecific/problem.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/problem.cy.js @@ -12,7 +12,7 @@ describe('Problem Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/ray.cy.js b/cypress/e2e/DoenetML/tagSpecific/ray.cy.js index 6808a7dd11..f3400ce986 100644 --- a/cypress/e2e/DoenetML/tagSpecific/ray.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/ray.cy.js @@ -21,7 +21,7 @@ describe('Ray Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -5854,5 +5854,45 @@ describe('Ray Tag Tests', function () { }) + it('style description changes with theme', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + + + + + + + + + + + +

Ray A is $A.styleDescription.

+

B is a $B.styleDescriptionWithNoun.

+

C is a $C.styleDescriptionWithNoun.

+ `}, "*"); + }); + + + cy.get('#\\/Adescrip').should('have.text', 'Ray A is thick brown.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a dark red ray.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin black ray.'); + + cy.log('set dark mode') + cy.get('#testRunner_toggleControls').click(); + cy.get('#testRunner_darkmode').click() + cy.wait(100) + cy.get('#testRunner_toggleControls').click(); + + + cy.get('#\\/Adescrip').should('have.text', 'Ray A is thick yellow.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a light red ray.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin white ray.'); + + + }); + }); \ No newline at end of file diff --git a/cypress/e2e/DoenetML/tagSpecific/rectangle.cy.js b/cypress/e2e/DoenetML/tagSpecific/rectangle.cy.js index 672cd8f407..82aa5c0571 100644 --- a/cypress/e2e/DoenetML/tagSpecific/rectangle.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/rectangle.cy.js @@ -12,7 +12,7 @@ describe('Rectangle Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/ref.cy.js b/cypress/e2e/DoenetML/tagSpecific/ref.cy.js index 5813f86276..c42eac7739 100644 --- a/cypress/e2e/DoenetML/tagSpecific/ref.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/ref.cy.js @@ -12,7 +12,7 @@ describe('ref Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/regularPolygon.cy.js b/cypress/e2e/DoenetML/tagSpecific/regularPolygon.cy.js index 50d5d37e55..b0c8f39af9 100644 --- a/cypress/e2e/DoenetML/tagSpecific/regularPolygon.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/regularPolygon.cy.js @@ -3,7 +3,7 @@ describe('Regular Polygon Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -136,673 +136,6 @@ describe('Regular Polygon Tag Tests', function () { }); - it('specify radius for square', () => { - - setupScene({ - attributes: { - nVertices: "4", - radius: "7", - center: "(-6,-2)" - }, - }); - - runTests({ - nVertices: 4, - vertex1: [-6 + 7, -2], - center: [-6, -2], - conservedWhenChangeNvertices: "circumradius", - abbreviated: true, - }); - - }); - - it('specify center for pentagon', () => { - - setupScene({ - attributes: { - nVertices: "5", - center: "(-5,-3)" - }, - }); - - runTests({ - nVertices: 5, - vertex1: [-5 + 1, -3], - center: [-5, -3], - conservedWhenChangeNvertices: "circumradius" - }); - - }); - - it('specify one vertex for square', () => { - - setupScene({ - attributes: { - nVertices: 4, - vertices: "(2,-5)" - }, - }); - - runTests({ - nVertices: 4, - vertex1: [2, -5], - center: [1, -5], - conservedWhenChangeNvertices: "circumradius" - }); - - }); - - it('specify two vertices for pentagon', () => { - - setupScene({ - attributes: { - nVertices: "5", - vertices: "(2,-5) (5,1)" - }, - }); - - let nVertices = 5; - - let vertex1 = [2, -5]; - let vertex2 = [5, 1]; - - let sideVector = [vertex2[0] - vertex1[0], vertex2[1] - vertex1[1]]; - let midpoint = [(vertex1[0] + vertex2[0]) / 2, (vertex1[1] + vertex2[1]) / 2]; - let sideLength = Math.sqrt(sideVector[0] ** 2 + sideVector[1] ** 2); - let inradius = sideLength / (2 * Math.tan(Math.PI / nVertices)); - - let inradiusDirection = [-sideVector[1] / sideLength, sideVector[0] / sideLength]; - - let center = [midpoint[0] + inradiusDirection[0] * inradius, midpoint[1] + inradiusDirection[1] * inradius]; - - - runTests({ - nVertices, - vertex1, - center, - conservedWhenChangeNvertices: "twoVertices" - }); - - }); - - it('specify center and one vertex for triangle', () => { - - setupScene({ - attributes: { - nVertices: "3", - vertices: "(2,-5)", - center: "(-1,-3)" - }, - }); - - runTests({ - nVertices: 3, - vertex1: [2, -5], - center: [-1, -3], - conservedWhenChangeNvertices: "circumradius" - }); - - }); - - it('specify center and two vertices for triangle, ignore second vertex', () => { - - setupScene({ - attributes: { - nVertices: "3", - vertices: "(2,-5) (10,12)", - center: "(-1,-3)" - }, - }); - - runTests({ - nVertices: 3, - vertex1: [2, -5], - center: [-1, -3], - conservedWhenChangeNvertices: "circumradius", - abbreviated: true, - }); - - }); - - it('specify center and vertex for triangle, ignore all size attributes', () => { - - setupScene({ - attributes: { - nVertices: "3", - vertices: "(2,-5)", - center: "(-1,-3)", - circumradius: "11", - inradius: "3", - sideLength: "5", - perimeter: "10", - area: "99", - }, - }); - - runTests({ - nVertices: 3, - vertex1: [2, -5], - center: [-1, -3], - conservedWhenChangeNvertices: "circumradius", - abbreviated: true, - }); - - }) - - it('specify center and circumradius for triangle, ignore all other size attributes', () => { - - setupScene({ - attributes: { - nVertices: "3", - center: "(-1,-3)", - circumradius: "11", - inradius: "3", - sideLength: "5", - perimeter: "10", - area: "99", - }, - }); - - runTests({ - nVertices: 3, - vertex1: [10, -3], - center: [-1, -3], - conservedWhenChangeNvertices: "circumradius", - abbreviated: true, - }); - - - }); - - it('specify vertex and circumradius for triangle, ignore all other size attributes', () => { - - setupScene({ - attributes: { - nVertices: "3", - vertices: "(2,-5)", - circumradius: "11", - inradius: "3", - sideLength: "5", - perimeter: "10", - area: "99", - }, - }); - - runTests({ - nVertices: 3, - vertex1: [2, -5], - center: [-9, -5], - conservedWhenChangeNvertices: "circumradius", - abbreviated: true, - }); - - - }); - - it('specify two vertices for triangle, ingnore all size attributes', () => { - - setupScene({ - attributes: { - nVertices: "3", - vertices: "(2,-5) (5,1)", - circumradius: "11", - inradius: "3", - sideLength: "5", - perimeter: "10", - area: "99", - }, - }); - - let nVertices = 3; - - let vertex1 = [2, -5]; - let vertex2 = [5, 1]; - - let sideVector = [vertex2[0] - vertex1[0], vertex2[1] - vertex1[1]]; - let midpoint = [(vertex1[0] + vertex2[0]) / 2, (vertex1[1] + vertex2[1]) / 2]; - let sideLength = Math.sqrt(sideVector[0] ** 2 + sideVector[1] ** 2); - let inradius = sideLength / (2 * Math.tan(Math.PI / nVertices)); - - let inradiusDirection = [-sideVector[1] / sideLength, sideVector[0] / sideLength]; - - let center = [midpoint[0] + inradiusDirection[0] * inradius, midpoint[1] + inradiusDirection[1] * inradius]; - - - runTests({ - nVertices, - vertex1, - center, - conservedWhenChangeNvertices: "twoVertices", - abbreviated: true, - }); - - }); - - it('specify circumradius for triangle, ignore all other size attributes', () => { - - setupScene({ - attributes: { - nVertices: "3", - circumradius: "11", - inradius: "3", - sideLength: "5", - perimeter: "10", - area: "99", - }, - }); - - runTests({ - nVertices: 3, - vertex1: [11, 0], - center: [0, 0], - conservedWhenChangeNvertices: "circumradius", - abbreviated: true, - }); - - - }); - - it('specify radius for triangle, ignore all other size attributes', () => { - - setupScene({ - attributes: { - nVertices: "3", - radius: "11", - inradius: "3", - sideLength: "5", - perimeter: "10", - area: "99", - }, - }); - - runTests({ - nVertices: 3, - vertex1: [11, 0], - center: [0, 0], - conservedWhenChangeNvertices: "circumradius", - abbreviated: true, - }); - - - }); - - it('specify inradius for triangle, ignore all other size attributes', () => { - - setupScene({ - attributes: { - nVertices: "3", - inradius: "3", - sideLength: "5", - perimeter: "10", - area: "99", - }, - }); - - runTests({ - nVertices: 3, - vertex1: [3 / (Math.cos(Math.PI / 3)), 0], - center: [0, 0], - conservedWhenChangeNvertices: "inradius", - abbreviated: true, - }); - - - }); - - it('specify center and apothem for triangle, ignore all other size attributes', () => { - - setupScene({ - attributes: { - nVertices: "3", - center: "(-1,-3)", - apothem: "3", - sideLength: "5", - perimeter: "10", - area: "99", - }, - }); - - runTests({ - nVertices: 3, - vertex1: [-1 + 3 / (Math.cos(Math.PI / 3)), -3], - center: [-1, -3], - conservedWhenChangeNvertices: "inradius", - abbreviated: true, - }); - - - }); - - it('specify sideLength for triangle, ignore all other size attributes', () => { - - setupScene({ - attributes: { - nVertices: "3", - sideLength: "5", - perimeter: "10", - area: "99", - }, - }); - - runTests({ - nVertices: 3, - vertex1: [5 / (2 * Math.sin(Math.PI / 3)), 0], - center: [0, 0], - conservedWhenChangeNvertices: "sideLength", - abbreviated: true, - }); - - - }); - - it('specify center and perimeter for triangle, ignore area', () => { - - setupScene({ - attributes: { - nVertices: "3", - center: "(-1,-3)", - perimeter: "10", - area: "99", - }, - }); - - runTests({ - nVertices: 3, - vertex1: [-1 + 10 / (3 * 2 * Math.sin(Math.PI / 3)), -3], - center: [-1, -3], - conservedWhenChangeNvertices: "perimeter", - abbreviated: true, - }); - - - }); - - it('draggable, vertices draggable', () => { - cy.window().then(async (win) => { - win.postMessage({ - doenetML: ` - - - -

To wait:

-

draggable:

-

vertices draggable:

-

two vertices: $p.vertex1 $p.vertex2

- `}, "*"); - }); - - cy.get("#\\/d2").should('have.text', 'false') - cy.get("#\\/vd2").should('have.text', 'false') - cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(1,3)') - cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(5,7)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables['/p'].stateValues.draggable).eq(false); - expect(stateVariables['/p'].stateValues.verticesDraggable).eq(false); - }) - - cy.log('cannot move single vertex') - cy.window().then(async (win) => { - - await win.callAction1({ - actionName: "movePolygon", - componentName: "/p", - args: { - pointCoords: { 0: [4, 7] } - } - }) - }) - - - // wait for core to process click - cy.get('#\\/bi').click() - cy.get('#\\/bi2').should('have.text', 'true') - - cy.get("#\\/d2").should('have.text', 'false') - cy.get("#\\/vd2").should('have.text', 'false') - - cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(1,3)') - cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(5,7)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables['/p'].stateValues.draggable).eq(false); - expect(stateVariables['/p'].stateValues.verticesDraggable).eq(false); - }) - - - - cy.log('cannot move all vertices') - cy.window().then(async (win) => { - - await win.callAction1({ - actionName: "movePolygon", - componentName: "/p", - args: { - pointCoords: [[4, 7], [8, 10], [1, 9]] - } - }) - }) - - - // wait for core to process click - cy.get('#\\/bi').click() - cy.get('#\\/bi2').should('have.text', 'false') - - cy.get("#\\/d2").should('have.text', 'false') - cy.get("#\\/vd2").should('have.text', 'false') - - cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(1,3)') - cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(5,7)') - - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables['/p'].stateValues.draggable).eq(false); - expect(stateVariables['/p'].stateValues.verticesDraggable).eq(false); - }) - - - cy.log('only vertices draggable') - - cy.get('#\\/verticesDraggable').click() - cy.get('#\\/vd2').should('have.text', 'true') - - - cy.log('can move single vertex') - cy.window().then(async (win) => { - - await win.callAction1({ - actionName: "movePolygon", - componentName: "/p", - args: { - pointCoords: { 0: [4, 7] } - } - }) - }) - - - cy.get("#\\/pvert .mjx-mrow").should('contain.text', '(4,7)') - - cy.get("#\\/d2").should('have.text', 'false') - cy.get("#\\/vd2").should('have.text', 'true') - - cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(4,7)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables['/p'].stateValues.draggable).eq(false); - expect(stateVariables['/p'].stateValues.verticesDraggable).eq(true); - }) - - - - cy.log('cannot move all vertices') - cy.window().then(async (win) => { - - await win.callAction1({ - actionName: "movePolygon", - componentName: "/p", - args: { - pointCoords: [[3, 8], [8, 10], [1, 9]] - } - }) - }) - - - // wait for core to process click - cy.get('#\\/bi').click() - cy.get('#\\/bi2').should('have.text', 'true') - - cy.get("#\\/d2").should('have.text', 'false') - cy.get("#\\/vd2").should('have.text', 'true') - - - cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(4,7)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect((stateVariables['/p'].stateValues.vertices)[0]).eqls([4, 7]); - expect(stateVariables['/p'].stateValues.draggable).eq(false); - expect(stateVariables['/p'].stateValues.verticesDraggable).eq(true); - }) - - - - cy.log('vertices and polygon draggable') - - cy.get('#\\/draggable').click() - cy.get('#\\/d2').should('have.text', 'true') - - - cy.log('can move single vertex') - cy.window().then(async (win) => { - - await win.callAction1({ - actionName: "movePolygon", - componentName: "/p", - args: { - pointCoords: { 1: [-3, 2] } - } - }) - }) - - - cy.get("#\\/pvert .mjx-mrow").should('contain.text', '(−3,2)') - - cy.get("#\\/d2").should('have.text', 'true') - cy.get("#\\/vd2").should('have.text', 'true') - - cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(−3,2)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables['/p'].stateValues.draggable).eq(true); - expect(stateVariables['/p'].stateValues.verticesDraggable).eq(true); - }) - - - - cy.log('can move all vertices') - cy.window().then(async (win) => { - - await win.callAction1({ - actionName: "movePolygon", - componentName: "/p", - args: { - pointCoords: [[3, 8], [5, 8], [4, 8 + Math.sqrt(3)]] - } - }) - }) - - - cy.get("#\\/pvert .mjx-mrow").should('contain.text', '(3,8)') - - - cy.get("#\\/d2").should('have.text', 'true') - cy.get("#\\/vd2").should('have.text', 'true') - - - cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(3,8)') - cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(5,8)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables['/p'].stateValues.draggable).eq(true); - expect(stateVariables['/p'].stateValues.verticesDraggable).eq(true); - }) - - - cy.log('polygon but not vertices draggable') - - cy.get('#\\/verticesDraggable').click() - cy.get('#\\/vd2').should('have.text', 'false') - - - cy.log('cannot move single vertex') - cy.window().then(async (win) => { - - await win.callAction1({ - actionName: "movePolygon", - componentName: "/p", - args: { - pointCoords: { 0: [9, 3] } - } - }) - }) - - // wait for core to process click - cy.get('#\\/bi').click() - cy.get('#\\/bi2').should('have.text', 'false') - - - cy.get("#\\/d2").should('have.text', 'true') - cy.get("#\\/vd2").should('have.text', 'false') - - cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(3,8)') - cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(5,8)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables['/p'].stateValues.draggable).eq(true); - expect(stateVariables['/p'].stateValues.verticesDraggable).eq(false); - }) - - - - cy.log('can move all vertices') - cy.window().then(async (win) => { - - await win.callAction1({ - actionName: "movePolygon", - componentName: "/p", - args: { - pointCoords: [[-4, 1], [-4, 5], [-4 - 2 * Math.sqrt(3), 3]] - } - }) - }) - - - cy.get("#\\/pvert .mjx-mrow").should('contain.text', '(−4,1)') - - - cy.get("#\\/d2").should('have.text', 'true') - cy.get("#\\/vd2").should('have.text', 'false') - - - cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(−4,1)') - cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(−4,5)') - - cy.window().then(async (win) => { - let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables['/p'].stateValues.draggable).eq(true); - expect(stateVariables['/p'].stateValues.verticesDraggable).eq(false); - }) - - - - }) }); diff --git a/cypress/e2e/DoenetML/tagSpecific/regularPolygon2.cy.js b/cypress/e2e/DoenetML/tagSpecific/regularPolygon2.cy.js new file mode 100644 index 0000000000..6ced9eee3a --- /dev/null +++ b/cypress/e2e/DoenetML/tagSpecific/regularPolygon2.cy.js @@ -0,0 +1,1493 @@ + +describe('Regular Polygon Tag Tests', function () { + + beforeEach(() => { + cy.clearIndexedDB(); + cy.visit('/src/Tools/cypressTest/') + + }) + + it('specify radius for square', () => { + + setupScene({ + attributes: { + nVertices: "4", + radius: "7", + center: "(-6,-2)" + }, + }); + + runTests({ + nVertices: 4, + vertex1: [-6 + 7, -2], + center: [-6, -2], + conservedWhenChangeNvertices: "circumradius", + abbreviated: true, + }); + + }); + + it('specify center for pentagon', () => { + + setupScene({ + attributes: { + nVertices: "5", + center: "(-5,-3)" + }, + }); + + runTests({ + nVertices: 5, + vertex1: [-5 + 1, -3], + center: [-5, -3], + conservedWhenChangeNvertices: "circumradius" + }); + + }); + + it('specify one vertex for square', () => { + + setupScene({ + attributes: { + nVertices: 4, + vertices: "(2,-5)" + }, + }); + + runTests({ + nVertices: 4, + vertex1: [2, -5], + center: [1, -5], + conservedWhenChangeNvertices: "circumradius" + }); + + }); + + it('specify two vertices for pentagon', () => { + + setupScene({ + attributes: { + nVertices: "5", + vertices: "(2,-5) (5,1)" + }, + }); + + let nVertices = 5; + + let vertex1 = [2, -5]; + let vertex2 = [5, 1]; + + let sideVector = [vertex2[0] - vertex1[0], vertex2[1] - vertex1[1]]; + let midpoint = [(vertex1[0] + vertex2[0]) / 2, (vertex1[1] + vertex2[1]) / 2]; + let sideLength = Math.sqrt(sideVector[0] ** 2 + sideVector[1] ** 2); + let inradius = sideLength / (2 * Math.tan(Math.PI / nVertices)); + + let inradiusDirection = [-sideVector[1] / sideLength, sideVector[0] / sideLength]; + + let center = [midpoint[0] + inradiusDirection[0] * inradius, midpoint[1] + inradiusDirection[1] * inradius]; + + + runTests({ + nVertices, + vertex1, + center, + conservedWhenChangeNvertices: "twoVertices" + }); + + }); + + it('specify center and one vertex for triangle', () => { + + setupScene({ + attributes: { + nVertices: "3", + vertices: "(2,-5)", + center: "(-1,-3)" + }, + }); + + runTests({ + nVertices: 3, + vertex1: [2, -5], + center: [-1, -3], + conservedWhenChangeNvertices: "circumradius" + }); + + }); + + it('specify center and two vertices for triangle, ignore second vertex', () => { + + setupScene({ + attributes: { + nVertices: "3", + vertices: "(2,-5) (10,12)", + center: "(-1,-3)" + }, + }); + + runTests({ + nVertices: 3, + vertex1: [2, -5], + center: [-1, -3], + conservedWhenChangeNvertices: "circumradius", + abbreviated: true, + }); + + }); + + it('specify center and vertex for triangle, ignore all size attributes', () => { + + setupScene({ + attributes: { + nVertices: "3", + vertices: "(2,-5)", + center: "(-1,-3)", + circumradius: "11", + inradius: "3", + sideLength: "5", + perimeter: "10", + area: "99", + }, + }); + + runTests({ + nVertices: 3, + vertex1: [2, -5], + center: [-1, -3], + conservedWhenChangeNvertices: "circumradius", + abbreviated: true, + }); + + }) + + it('specify center and circumradius for triangle, ignore all other size attributes', () => { + + setupScene({ + attributes: { + nVertices: "3", + center: "(-1,-3)", + circumradius: "11", + inradius: "3", + sideLength: "5", + perimeter: "10", + area: "99", + }, + }); + + runTests({ + nVertices: 3, + vertex1: [10, -3], + center: [-1, -3], + conservedWhenChangeNvertices: "circumradius", + abbreviated: true, + }); + + + }); + + it('specify vertex and circumradius for triangle, ignore all other size attributes', () => { + + setupScene({ + attributes: { + nVertices: "3", + vertices: "(2,-5)", + circumradius: "11", + inradius: "3", + sideLength: "5", + perimeter: "10", + area: "99", + }, + }); + + runTests({ + nVertices: 3, + vertex1: [2, -5], + center: [-9, -5], + conservedWhenChangeNvertices: "circumradius", + abbreviated: true, + }); + + + }); + + it('specify two vertices for triangle, ingnore all size attributes', () => { + + setupScene({ + attributes: { + nVertices: "3", + vertices: "(2,-5) (5,1)", + circumradius: "11", + inradius: "3", + sideLength: "5", + perimeter: "10", + area: "99", + }, + }); + + let nVertices = 3; + + let vertex1 = [2, -5]; + let vertex2 = [5, 1]; + + let sideVector = [vertex2[0] - vertex1[0], vertex2[1] - vertex1[1]]; + let midpoint = [(vertex1[0] + vertex2[0]) / 2, (vertex1[1] + vertex2[1]) / 2]; + let sideLength = Math.sqrt(sideVector[0] ** 2 + sideVector[1] ** 2); + let inradius = sideLength / (2 * Math.tan(Math.PI / nVertices)); + + let inradiusDirection = [-sideVector[1] / sideLength, sideVector[0] / sideLength]; + + let center = [midpoint[0] + inradiusDirection[0] * inradius, midpoint[1] + inradiusDirection[1] * inradius]; + + + runTests({ + nVertices, + vertex1, + center, + conservedWhenChangeNvertices: "twoVertices", + abbreviated: true, + }); + + }); + + it('specify circumradius for triangle, ignore all other size attributes', () => { + + setupScene({ + attributes: { + nVertices: "3", + circumradius: "11", + inradius: "3", + sideLength: "5", + perimeter: "10", + area: "99", + }, + }); + + runTests({ + nVertices: 3, + vertex1: [11, 0], + center: [0, 0], + conservedWhenChangeNvertices: "circumradius", + abbreviated: true, + }); + + + }); + + it('specify radius for triangle, ignore all other size attributes', () => { + + setupScene({ + attributes: { + nVertices: "3", + radius: "11", + inradius: "3", + sideLength: "5", + perimeter: "10", + area: "99", + }, + }); + + runTests({ + nVertices: 3, + vertex1: [11, 0], + center: [0, 0], + conservedWhenChangeNvertices: "circumradius", + abbreviated: true, + }); + + + }); + + it('specify inradius for triangle, ignore all other size attributes', () => { + + setupScene({ + attributes: { + nVertices: "3", + inradius: "3", + sideLength: "5", + perimeter: "10", + area: "99", + }, + }); + + runTests({ + nVertices: 3, + vertex1: [3 / (Math.cos(Math.PI / 3)), 0], + center: [0, 0], + conservedWhenChangeNvertices: "inradius", + abbreviated: true, + }); + + + }); + + it('specify center and apothem for triangle, ignore all other size attributes', () => { + + setupScene({ + attributes: { + nVertices: "3", + center: "(-1,-3)", + apothem: "3", + sideLength: "5", + perimeter: "10", + area: "99", + }, + }); + + runTests({ + nVertices: 3, + vertex1: [-1 + 3 / (Math.cos(Math.PI / 3)), -3], + center: [-1, -3], + conservedWhenChangeNvertices: "inradius", + abbreviated: true, + }); + + + }); + + it('specify sideLength for triangle, ignore all other size attributes', () => { + + setupScene({ + attributes: { + nVertices: "3", + sideLength: "5", + perimeter: "10", + area: "99", + }, + }); + + runTests({ + nVertices: 3, + vertex1: [5 / (2 * Math.sin(Math.PI / 3)), 0], + center: [0, 0], + conservedWhenChangeNvertices: "sideLength", + abbreviated: true, + }); + + + }); + + it('specify center and perimeter for triangle, ignore area', () => { + + setupScene({ + attributes: { + nVertices: "3", + center: "(-1,-3)", + perimeter: "10", + area: "99", + }, + }); + + runTests({ + nVertices: 3, + vertex1: [-1 + 10 / (3 * 2 * Math.sin(Math.PI / 3)), -3], + center: [-1, -3], + conservedWhenChangeNvertices: "perimeter", + abbreviated: true, + }); + + + }); + + it('draggable, vertices draggable', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + + + +

To wait:

+

draggable:

+

vertices draggable:

+

two vertices: $p.vertex1 $p.vertex2

+ `}, "*"); + }); + + cy.get("#\\/d2").should('have.text', 'false') + cy.get("#\\/vd2").should('have.text', 'false') + cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(1,3)') + cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(5,7)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables['/p'].stateValues.draggable).eq(false); + expect(stateVariables['/p'].stateValues.verticesDraggable).eq(false); + }) + + cy.log('cannot move single vertex') + cy.window().then(async (win) => { + + await win.callAction1({ + actionName: "movePolygon", + componentName: "/p", + args: { + pointCoords: { 0: [4, 7] } + } + }) + }) + + + // wait for core to process click + cy.get('#\\/bi').click() + cy.get('#\\/bi2').should('have.text', 'true') + + cy.get("#\\/d2").should('have.text', 'false') + cy.get("#\\/vd2").should('have.text', 'false') + + cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(1,3)') + cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(5,7)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables['/p'].stateValues.draggable).eq(false); + expect(stateVariables['/p'].stateValues.verticesDraggable).eq(false); + }) + + + + cy.log('cannot move all vertices') + cy.window().then(async (win) => { + + await win.callAction1({ + actionName: "movePolygon", + componentName: "/p", + args: { + pointCoords: [[4, 7], [8, 10], [1, 9]] + } + }) + }) + + + // wait for core to process click + cy.get('#\\/bi').click() + cy.get('#\\/bi2').should('have.text', 'false') + + cy.get("#\\/d2").should('have.text', 'false') + cy.get("#\\/vd2").should('have.text', 'false') + + cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(1,3)') + cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(5,7)') + + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables['/p'].stateValues.draggable).eq(false); + expect(stateVariables['/p'].stateValues.verticesDraggable).eq(false); + }) + + + cy.log('only vertices draggable') + + cy.get('#\\/verticesDraggable').click() + cy.get('#\\/vd2').should('have.text', 'true') + + + cy.log('can move single vertex') + cy.window().then(async (win) => { + + await win.callAction1({ + actionName: "movePolygon", + componentName: "/p", + args: { + pointCoords: { 0: [4, 7] } + } + }) + }) + + + cy.get("#\\/pvert .mjx-mrow").should('contain.text', '(4,7)') + + cy.get("#\\/d2").should('have.text', 'false') + cy.get("#\\/vd2").should('have.text', 'true') + + cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(4,7)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables['/p'].stateValues.draggable).eq(false); + expect(stateVariables['/p'].stateValues.verticesDraggable).eq(true); + }) + + + + cy.log('cannot move all vertices') + cy.window().then(async (win) => { + + await win.callAction1({ + actionName: "movePolygon", + componentName: "/p", + args: { + pointCoords: [[3, 8], [8, 10], [1, 9]] + } + }) + }) + + + // wait for core to process click + cy.get('#\\/bi').click() + cy.get('#\\/bi2').should('have.text', 'true') + + cy.get("#\\/d2").should('have.text', 'false') + cy.get("#\\/vd2").should('have.text', 'true') + + + cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(4,7)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect((stateVariables['/p'].stateValues.vertices)[0]).eqls([4, 7]); + expect(stateVariables['/p'].stateValues.draggable).eq(false); + expect(stateVariables['/p'].stateValues.verticesDraggable).eq(true); + }) + + + + cy.log('vertices and polygon draggable') + + cy.get('#\\/draggable').click() + cy.get('#\\/d2').should('have.text', 'true') + + + cy.log('can move single vertex') + cy.window().then(async (win) => { + + await win.callAction1({ + actionName: "movePolygon", + componentName: "/p", + args: { + pointCoords: { 1: [-3, 2] } + } + }) + }) + + + cy.get("#\\/pvert .mjx-mrow").should('contain.text', '(−3,2)') + + cy.get("#\\/d2").should('have.text', 'true') + cy.get("#\\/vd2").should('have.text', 'true') + + cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(−3,2)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables['/p'].stateValues.draggable).eq(true); + expect(stateVariables['/p'].stateValues.verticesDraggable).eq(true); + }) + + + + cy.log('can move all vertices') + cy.window().then(async (win) => { + + await win.callAction1({ + actionName: "movePolygon", + componentName: "/p", + args: { + pointCoords: [[3, 8], [5, 8], [4, 8 + Math.sqrt(3)]] + } + }) + }) + + + cy.get("#\\/pvert .mjx-mrow").should('contain.text', '(3,8)') + + + cy.get("#\\/d2").should('have.text', 'true') + cy.get("#\\/vd2").should('have.text', 'true') + + + cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(3,8)') + cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(5,8)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables['/p'].stateValues.draggable).eq(true); + expect(stateVariables['/p'].stateValues.verticesDraggable).eq(true); + }) + + + cy.log('polygon but not vertices draggable') + + cy.get('#\\/verticesDraggable').click() + cy.get('#\\/vd2').should('have.text', 'false') + + + cy.log('cannot move single vertex') + cy.window().then(async (win) => { + + await win.callAction1({ + actionName: "movePolygon", + componentName: "/p", + args: { + pointCoords: { 0: [9, 3] } + } + }) + }) + + // wait for core to process click + cy.get('#\\/bi').click() + cy.get('#\\/bi2').should('have.text', 'false') + + + cy.get("#\\/d2").should('have.text', 'true') + cy.get("#\\/vd2").should('have.text', 'false') + + cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(3,8)') + cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(5,8)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables['/p'].stateValues.draggable).eq(true); + expect(stateVariables['/p'].stateValues.verticesDraggable).eq(false); + }) + + + + cy.log('can move all vertices') + cy.window().then(async (win) => { + + await win.callAction1({ + actionName: "movePolygon", + componentName: "/p", + args: { + pointCoords: [[-4, 1], [-4, 5], [-4 - 2 * Math.sqrt(3), 3]] + } + }) + }) + + + cy.get("#\\/pvert .mjx-mrow").should('contain.text', '(−4,1)') + + + cy.get("#\\/d2").should('have.text', 'true') + cy.get("#\\/vd2").should('have.text', 'false') + + + cy.get("#\\/pvert .mjx-mrow").eq(0).should('have.text', '(−4,1)') + cy.get("#\\/pvert .mjx-mrow").eq(2).should('have.text', '(−4,5)') + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + expect(stateVariables['/p'].stateValues.draggable).eq(true); + expect(stateVariables['/p'].stateValues.verticesDraggable).eq(false); + }) + + + + }) + + +}); + +function setupScene({ attributes }) { + + let attributesString = Object.keys(attributes).map(attr => `${attr} = "${attributes[attr]}"`).join(" "); + + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + a + + + + + + + + + + + +

circumradius:

+

radius:

+ +

inradius:

+

apothem:

+ +

side length:

+

perimeter:

+ + +

area:

+ +

n vertices:

+ + + + + + + + `}, "*"); + }); +} + +function runTests({ center, vertex1, nVertices, conservedWhenChangeNvertices = "radius", abbreviated = false }) { + cy.get('#\\/_text1').should('have.text', 'a'); // to wait for page to load + + cy.window().then(async (win) => { + let stateVariables = await win.returnAllStateVariables1(); + + let polygonName = "/rp"; + let centerPointName = "/centerPoint"; + let allVertexNames = ["/v1", "/v2", "/v3", "/v4", "/v5", "/v6", "/v7", "/v8", "/v9", "/v10"]; + let polygonCopyName = "/rp2"; + let polygonCopy2Name = "/g4/rp2"; + + let inputs = { + polygonNames: [polygonName, polygonCopyName, polygonCopy2Name], + vertexNames: allVertexNames.slice(0, nVertices), + centerPointName + } + + cy.window().then(async (win) => { + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + + + cy.log("move vertices individually"); + + for (let i = 0; i < 3; i++) { + let index = (i * Math.round(nVertices / 3)) % nVertices; + + cy.window().then(async (win) => { + + let vertex = [index, index + 1]; + + await win.callAction1({ + actionName: "movePolygon", + componentName: polygonName, + args: { + pointCoords: { [index]: vertex } + } + }) + + stateVariables = await win.returnAllStateVariables1(); + + let angle = -index * 2 * Math.PI / nVertices; + let c = Math.cos(angle); + let s = Math.sin(angle); + + + let directionWithRadius = [vertex[0] - center[0], vertex[1] - center[1]]; + + vertex1 = [directionWithRadius[0] * c - directionWithRadius[1] * s + center[0], directionWithRadius[0] * s + directionWithRadius[1] * c + center[1]] + + + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + + } + + + if (!abbreviated) { + cy.log("move polygon points together"); + cy.window().then(async (win) => { + + stateVariables = await win.returnAllStateVariables1(); + + let dx = 3, dy = -2; + + let currentVertices = stateVariables[polygonName].stateValues.vertices; + let pointCoords = {}; + + for (let i = 0; i < nVertices; i++) { + pointCoords[i] = [currentVertices[i][0] + dx, currentVertices[i][1] + dy] + } + + vertex1 = pointCoords[0]; + center = [center[0] + dx, center[1] + dy] + + + await win.callAction1({ + actionName: "movePolygon", + componentName: polygonName, + args: { + pointCoords + } + }) + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + + cy.log("move center point"); + cy.window().then(async (win) => { + + vertex1 = [vertex1[0] - center[0], vertex1[1] - center[1]] + center = [0, 0]; + + await win.callAction1({ + actionName: "movePoint", + componentName: centerPointName, + args: { x: center[0], y: center[1] } + }); + + + + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + + + cy.log("move copied vertices"); + for (let i = 0; i < 3; i++) { + let index = (i * Math.round(nVertices / 3) + 1) % nVertices; + cy.window().then(async (win) => { + + let vertex = [index / 2 + 3, -1.5 * index]; + + await win.callAction1({ + actionName: "movePoint", + componentName: allVertexNames[index], + args: { x: vertex[0], y: vertex[1] } + }); + + + stateVariables = await win.returnAllStateVariables1(); + + let angle = -index * 2 * Math.PI / nVertices; + let c = Math.cos(angle); + let s = Math.sin(angle); + + + let directionWithRadius = [vertex[0] - center[0], vertex[1] - center[1]]; + + vertex1 = [directionWithRadius[0] * c - directionWithRadius[1] * s + center[0], directionWithRadius[0] * s + directionWithRadius[1] * c + center[1]] + + + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + + } + + + cy.log("move polygonCopy vertices individually"); + for (let i = 0; i < 3; i++) { + let index = (i * Math.round(nVertices / 3) + 2) % nVertices; + + cy.window().then(async (win) => { + + let vertex = [-index - 1, 2 * index]; + + await win.callAction1({ + actionName: "movePolygon", + componentName: polygonCopyName, + args: { + pointCoords: { [index]: vertex } + } + }) + + stateVariables = await win.returnAllStateVariables1(); + + let angle = -index * 2 * Math.PI / nVertices; + let c = Math.cos(angle); + let s = Math.sin(angle); + + + let directionWithRadius = [vertex[0] - center[0], vertex[1] - center[1]]; + + vertex1 = [directionWithRadius[0] * c - directionWithRadius[1] * s + center[0], directionWithRadius[0] * s + directionWithRadius[1] * c + center[1]] + + + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + + } + } + + cy.log("polygonCopy vertices together"); + cy.window().then(async (win) => { + + stateVariables = await win.returnAllStateVariables1(); + + let dx = -2, dy = -4; + + let currentVertices = stateVariables[polygonCopyName].stateValues.vertices; + let pointCoords = {}; + + for (let i = 0; i < nVertices; i++) { + pointCoords[i] = [currentVertices[i][0] + dx, currentVertices[i][1] + dy] + } + + vertex1 = pointCoords[0]; + center = [center[0] + dx, center[1] + dy] + + + + await win.callAction1({ + actionName: "movePolygon", + componentName: polygonCopyName, + args: { + pointCoords + } + }) + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + + + if (!abbreviated) { + + cy.log("move polygonCopy2 vertices individually"); + for (let i = 0; i < 3; i++) { + let index = (i * Math.round(nVertices / 3) + 3) % nVertices; + cy.window().then(async (win) => { + + let vertex = [-2 * index - 1, index + 4]; + + await win.callAction1({ + actionName: "movePolygon", + componentName: polygonCopy2Name, + args: { + pointCoords: { [index]: vertex } + } + }) + + stateVariables = await win.returnAllStateVariables1(); + + let angle = -index * 2 * Math.PI / nVertices; + let c = Math.cos(angle); + let s = Math.sin(angle); + + + let directionWithRadius = [vertex[0] - center[0], vertex[1] - center[1]]; + + vertex1 = [directionWithRadius[0] * c - directionWithRadius[1] * s + center[0], directionWithRadius[0] * s + directionWithRadius[1] * c + center[1]] + + + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + + } + + + cy.log("polygonCopy2 vertices together"); + cy.window().then(async (win) => { + + stateVariables = await win.returnAllStateVariables1(); + + let dx = 1, dy = -3; + + let currentVertices = stateVariables[polygonCopyName].stateValues.vertices; + let pointCoords = {}; + + for (let i = 0; i < nVertices; i++) { + pointCoords[i] = [currentVertices[i][0] + dx, currentVertices[i][1] + dy] + } + + vertex1 = pointCoords[0]; + center = [center[0] + dx, center[1] + dy] + + + + await win.callAction1({ + actionName: "movePolygon", + componentName: polygonCopy2Name, + args: { + pointCoords + } + }) + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + } + + + cy.log("Change circumradius") + cy.window().then(async (win) => { + + stateVariables = await win.returnAllStateVariables1(); + + let oldCr = stateVariables[polygonName].stateValues.circumradius; + + let circumradius = 1; + + cy.get("#\\/micr textarea").type(`{home}{shift+end}{backspace}${circumradius}{enter}`, { force: true }) + cy.get("#\\/cr").should('have.text', `${circumradius}`) + + vertex1 = [ + (vertex1[0] - center[0]) * circumradius / oldCr + center[0], + (vertex1[1] - center[1]) * circumradius / oldCr + center[1] + ] + + cy.window().then(async (win) => { + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + }) + + + if (!abbreviated) { + + cy.log("Change radius") + cy.window().then(async (win) => { + + stateVariables = await win.returnAllStateVariables1(); + + let oldR = stateVariables[polygonName].stateValues.circumradius; + + let radius = 3; + + cy.get("#\\/mir textarea").type(`{home}{shift+end}{backspace}${radius}{enter}`, { force: true }) + cy.get("#\\/r").should('have.text', `${radius}`) + + vertex1 = [ + (vertex1[0] - center[0]) * radius / oldR + center[0], + (vertex1[1] - center[1]) * radius / oldR + center[1] + ] + + cy.window().then(async (win) => { + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + }) + + + cy.log("Change inradius") + cy.window().then(async (win) => { + + stateVariables = await win.returnAllStateVariables1(); + + let oldIr = stateVariables[polygonName].stateValues.inradius; + + let inradius = 5; + + cy.get("#\\/miir textarea").type(`{home}{shift+end}{backspace}${inradius}{enter}`, { force: true }) + cy.get("#\\/ir").should('have.text', `${inradius}`) + + vertex1 = [ + (vertex1[0] - center[0]) * inradius / oldIr + center[0], + (vertex1[1] - center[1]) * inradius / oldIr + center[1] + ] + + cy.window().then(async (win) => { + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + }) + + + cy.log("Change apothem") + cy.window().then(async (win) => { + + stateVariables = await win.returnAllStateVariables1(); + + let oldAp = stateVariables[polygonName].stateValues.inradius; + + let apothem = 4; + + cy.get("#\\/miap textarea").type(`{home}{shift+end}{backspace}${apothem}{enter}`, { force: true }) + cy.get("#\\/ap").should('have.text', `${apothem}`) + + vertex1 = [ + (vertex1[0] - center[0]) * apothem / oldAp + center[0], + (vertex1[1] - center[1]) * apothem / oldAp + center[1] + ] + + cy.window().then(async (win) => { + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + }) + + + cy.log("Change sideLength") + cy.window().then(async (win) => { + + stateVariables = await win.returnAllStateVariables1(); + + let oldSl = stateVariables[polygonName].stateValues.sideLength; + + let sideLength = 2; + + cy.get("#\\/misl textarea").type(`{home}{shift+end}{backspace}${sideLength}{enter}`, { force: true }) + cy.get("#\\/sl").should('have.text', `${sideLength}`) + + vertex1 = [ + (vertex1[0] - center[0]) * sideLength / oldSl + center[0], + (vertex1[1] - center[1]) * sideLength / oldSl + center[1] + ] + + cy.window().then(async (win) => { + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + }) + + + cy.log("Change perimeter") + cy.window().then(async (win) => { + + stateVariables = await win.returnAllStateVariables1(); + + let oldSl = stateVariables[polygonName].stateValues.perimeter; + + let perimeter = 9; + + cy.get("#\\/mip textarea").type(`{home}{shift+end}{backspace}${perimeter}{enter}`, { force: true }) + cy.get("#\\/p").should('have.text', `${perimeter}`) + + vertex1 = [ + (vertex1[0] - center[0]) * perimeter / oldSl + center[0], + (vertex1[1] - center[1]) * perimeter / oldSl + center[1] + ] + + cy.window().then(async (win) => { + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + }) + + + cy.log("Change area") + cy.window().then(async (win) => { + + stateVariables = await win.returnAllStateVariables1(); + + let oldAr = stateVariables[polygonName].stateValues.area; + + let area = 13; + + cy.get("#\\/miar textarea").type(`{home}{shift+end}{backspace}${area}{enter}`, { force: true }) + cy.get("#\\/ar").should('have.text', `${area}`) + + vertex1 = [ + (vertex1[0] - center[0]) * Math.sqrt(area / oldAr) + center[0], + (vertex1[1] - center[1]) * Math.sqrt(area / oldAr) + center[1] + ] + + cy.window().then(async (win) => { + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + }) + + + } + + + + cy.log("Add two vertices") + cy.window().then(async (win) => { + + + let result = adjustVertex1CenterWhenChangeNVertices(vertex1, center, nVertices, nVertices + 2, conservedWhenChangeNvertices); + + vertex1 = result.vertex1; + center = result.center; + + nVertices += 2; + + cy.get("#\\/minv textarea").type(`{end}+2{enter}`, { force: true }) + cy.get("#\\/nv").should('have.text', `${nVertices}`) + + + inputs.vertexNames = allVertexNames.slice(0, nVertices); + + + cy.window().then(async (win) => { + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + }) + + + + if (!abbreviated) { + + cy.log("Remove a vertex") + cy.window().then(async (win) => { + + let result = adjustVertex1CenterWhenChangeNVertices(vertex1, center, nVertices, nVertices - 1, conservedWhenChangeNvertices); + + vertex1 = result.vertex1; + center = result.center; + + + nVertices -= 1; + + cy.get("#\\/minv textarea").type(`{end}-1{enter}`, { force: true }) + cy.get("#\\/nv").should('have.text', `${nVertices}`) + + + inputs.vertexNames = allVertexNames.slice(0, nVertices); + + + cy.window().then(async (win) => { + stateVariables = await win.returnAllStateVariables1(); + checkPolygonValues( + inputs, + { + nVertices, + vertex1, + center, + }, + stateVariables + ); + }) + }) + } + + + + }) +} + +function adjustVertex1CenterWhenChangeNVertices(vertex1, center, nVerticesOld, nVerticesNew, conservedWhenChangeNvertices) { + + let radiusRatio = 1; + + if (conservedWhenChangeNvertices === "inradius") { + + radiusRatio = Math.cos(Math.PI / nVerticesOld) / Math.cos(Math.PI / nVerticesNew) + + } else if (conservedWhenChangeNvertices === "sideLength") { + + radiusRatio = (2 * Math.sin(Math.PI / nVerticesOld)) / (2 * Math.sin(Math.PI / nVerticesNew)) + + } else if (conservedWhenChangeNvertices === "perimeter") { + + radiusRatio = (2 * nVerticesOld * Math.sin(Math.PI / nVerticesOld)) / (2 * nVerticesNew * Math.sin(Math.PI / nVerticesNew)) + + } else if (conservedWhenChangeNvertices === "area") { + radiusRatio = Math.sqrt((nVerticesOld / 2 * Math.sin(2 * Math.PI / nVerticesOld)) + / (nVerticesNew / 2 * Math.sin(2 * Math.PI / nVerticesNew))) + + } else if (conservedWhenChangeNvertices === "twoVertices") { + + + // calculate vertex2 + let directionWithRadius = [vertex1[0] - center[0], vertex1[1] - center[1]]; + + let angleOld = 2 * Math.PI / nVerticesOld; + let c = Math.cos(angleOld); + let s = Math.sin(angleOld); + + let vertex2 = [directionWithRadius[0] * c - directionWithRadius[1] * s + center[0], directionWithRadius[0] * s + directionWithRadius[1] * c + center[1]]; + + // calculate center based on this vertex 2 and new nVertices + let sideVector = [vertex2[0] - vertex1[0], vertex2[1] - vertex1[1]]; + let midpoint = [(vertex1[0] + vertex2[0]) / 2, (vertex1[1] + vertex2[1]) / 2]; + let sideLength = Math.sqrt(sideVector[0] ** 2 + sideVector[1] ** 2); + let inradius = sideLength / (2 * Math.tan(Math.PI / nVerticesNew)); + + let inradiusDirection = [-sideVector[1] / sideLength, sideVector[0] / sideLength]; + + center = [midpoint[0] + inradiusDirection[0] * inradius, midpoint[1] + inradiusDirection[1] * inradius]; + + } + + + vertex1 = [ + (vertex1[0] - center[0]) * radiusRatio + center[0], + (vertex1[1] - center[1]) * radiusRatio + center[1] + ] + + return { vertex1, center }; + +} + + +function checkPolygonValues({ + polygonNames, + vertexNames, + centerPointName +}, { + nVertices, + center, + vertex1, +}, + stateVariables +) { + + + let vertexCoords = [vertex1]; + + let directionWithRadius = [vertex1[0] - center[0], vertex1[1] - center[1]]; + + let circumradius = Math.sqrt(directionWithRadius[0] ** 2 + directionWithRadius[1] ** 2); + let inradius = circumradius * Math.cos(Math.PI / nVertices); + let sideLength = circumradius * (2 * Math.sin(Math.PI / nVertices)); + let perimeter = circumradius * (2 * nVertices * Math.sin(Math.PI / nVertices)); + let area = circumradius ** 2 * (nVertices / 2 * Math.sin(2 * Math.PI / nVertices)) + + + + for (let i = 1; i < nVertices; i++) { + let angle = i * 2 * Math.PI / nVertices; + let c = Math.cos(angle); + let s = Math.sin(angle); + + vertexCoords.push([directionWithRadius[0] * c - directionWithRadius[1] * s + center[0], directionWithRadius[0] * s + directionWithRadius[1] * c + center[1]]) + + } + + for (let polygonName of polygonNames) { + let polygon = stateVariables[polygonName]; + for (let i = 0; i < nVertices; i++) { + expect(polygon.stateValues.vertices[i][0]).closeTo(vertexCoords[i][0], 1E-14 * Math.abs(vertexCoords[i][0]) + 1E-14) + expect(polygon.stateValues.vertices[i][1]).closeTo(vertexCoords[i][1], 1E-14 * Math.abs(vertexCoords[i][1]) + 1E-14) + } + expect(polygon.stateValues.center[0]).closeTo(center[0], 1E-14 * Math.abs(center[0]) + 1E-14); + expect(polygon.stateValues.center[1]).closeTo(center[1], 1E-14 * Math.abs(center[1]) + 1E-14); + + expect((polygon.stateValues.nVertices)).eq(nVertices); + + expect((polygon.stateValues.circumradius)).closeTo(circumradius, 1E-14 * circumradius); + expect((polygon.stateValues.inradius)).closeTo(inradius, 1E-14 * inradius); + expect((polygon.stateValues.sideLength)).closeTo(sideLength, 1E-14 * sideLength); + expect((polygon.stateValues.perimeter)).closeTo(perimeter, 1E-14 * perimeter); + expect((polygon.stateValues.area)).closeTo(area, 1E-14 * area); + + } + + if (vertexNames) { + for (let [i, vertexName] of vertexNames.entries()) { + let vertex = stateVariables[vertexName]; + expect(vertex.stateValues.xs[0]).closeTo(vertexCoords[i][0], 1E-14 * Math.abs(vertexCoords[i][0]) + 1E-14) + expect(vertex.stateValues.xs[1]).closeTo(vertexCoords[i][1], 1E-14 * Math.abs(vertexCoords[i][1]) + 1E-14) + } + } + + if (centerPointName) { + let centerPoint = stateVariables[centerPointName]; + expect(centerPoint.stateValues.xs[0]).closeTo(center[0], 1E-14 * Math.abs(center[0]) + 1E-14); + expect(centerPoint.stateValues.xs[1]).closeTo(center[1], 1E-14 * Math.abs(center[1]) + 1E-14); + + } +} \ No newline at end of file diff --git a/cypress/e2e/DoenetML/tagSpecific/samplerandomnumbers.cy.js b/cypress/e2e/DoenetML/tagSpecific/samplerandomnumbers.cy.js index 3f32a856d9..be679631be 100644 --- a/cypress/e2e/DoenetML/tagSpecific/samplerandomnumbers.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/samplerandomnumbers.cy.js @@ -4,7 +4,7 @@ describe('SampleRandomNumbers Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/sectioning.cy.js b/cypress/e2e/DoenetML/tagSpecific/sectioning.cy.js index db80307fe4..e6b0b2bc34 100644 --- a/cypress/e2e/DoenetML/tagSpecific/sectioning.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/sectioning.cy.js @@ -12,7 +12,7 @@ describe('Sectioning Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/select.cy.js b/cypress/e2e/DoenetML/tagSpecific/select.cy.js index 352c5403d7..435113bd9a 100644 --- a/cypress/e2e/DoenetML/tagSpecific/select.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/select.cy.js @@ -13,7 +13,7 @@ describe('Select Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it("no parameters, select doesn't do anything", () => { diff --git a/cypress/e2e/DoenetML/tagSpecific/selectfromsequence.cy.js b/cypress/e2e/DoenetML/tagSpecific/selectfromsequence.cy.js index 33b55ddef9..f2c2e196bb 100644 --- a/cypress/e2e/DoenetML/tagSpecific/selectfromsequence.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/selectfromsequence.cy.js @@ -4,7 +4,7 @@ describe('SelectFromSequence Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/selectrandomnumbers.cy.js b/cypress/e2e/DoenetML/tagSpecific/selectrandomnumbers.cy.js index c746d34fab..076b7a38c5 100644 --- a/cypress/e2e/DoenetML/tagSpecific/selectrandomnumbers.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/selectrandomnumbers.cy.js @@ -4,7 +4,7 @@ describe('SelectRandomNumbers Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/sequence.cy.js b/cypress/e2e/DoenetML/tagSpecific/sequence.cy.js index 06d899ab96..4e8da4345d 100644 --- a/cypress/e2e/DoenetML/tagSpecific/sequence.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/sequence.cy.js @@ -13,7 +13,7 @@ describe('Sequence Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('number sequence, no parameters', () => { @@ -1554,9 +1554,9 @@ describe('Sequence Tag Tests', function () { cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - let na=10.12345; - let nb=na+0.03257; - let nc=nb+0.03257; + let na = 10.12345; + let nb = na + 0.03257; + let nc = nb + 0.03257; cy.get('#\\/n1a').should('have.text', String(Math.round(na * 10 ** 8) / 10 ** 8)) cy.get('#\\/n1b').should('have.text', String(Math.round(nb * 10 ** 8) / 10 ** 8)) diff --git a/cypress/e2e/DoenetML/tagSpecific/shuffle.cy.js b/cypress/e2e/DoenetML/tagSpecific/shuffle.cy.js index 7f62ca1a2f..3887ad8059 100644 --- a/cypress/e2e/DoenetML/tagSpecific/shuffle.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/shuffle.cy.js @@ -3,7 +3,7 @@ describe('Shuffle Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/sidebyside.cy.js b/cypress/e2e/DoenetML/tagSpecific/sidebyside.cy.js index 337291326e..38834d7f14 100644 --- a/cypress/e2e/DoenetML/tagSpecific/sidebyside.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/sidebyside.cy.js @@ -12,7 +12,7 @@ describe('SideBySide Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/slider.cy.js b/cypress/e2e/DoenetML/tagSpecific/slider.cy.js index 37a33ac3c4..6b25cbad97 100644 --- a/cypress/e2e/DoenetML/tagSpecific/slider.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/slider.cy.js @@ -3,7 +3,7 @@ describe('Slider Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -22,7 +22,7 @@ describe('Slider Tag Tests', function () { }); cy.get('#\\/_text1').should('have.text', 'a') // to wait for page to load - + cy.get('#\\/sv').should('have.text', '1') cy.window().then(async (win) => { @@ -95,6 +95,7 @@ describe('Slider Tag Tests', function () { cy.get('#\\/sv').should('have.text', '0') + cy.get("#\\/mi .mq-editable-field").should('contain.text', '0') cy.get("#\\/mi .mq-editable-field").invoke('text').then((text) => { expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('0') }) @@ -115,6 +116,7 @@ describe('Slider Tag Tests', function () { .trigger('mouseup') cy.get('#\\/sv').should('have.text', '1') + cy.get("#\\/mi .mq-editable-field").should('contain.text', '1') cy.get("#\\/mi .mq-editable-field").invoke('text').then((text) => { expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('1') }) @@ -134,6 +136,7 @@ describe('Slider Tag Tests', function () { .trigger('mouseup') cy.get('#\\/sv').should('have.text', '9') + cy.get("#\\/mi .mq-editable-field").should('contain.text', '9') cy.get("#\\/mi .mq-editable-field").invoke('text').then((text) => { expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('9') }) @@ -151,6 +154,7 @@ describe('Slider Tag Tests', function () { cy.get("#\\/mi textarea").type("{end}{backspace}2.5{enter}", { force: true }) cy.get('#\\/sv').should('have.text', '3') + cy.get("#\\/mi .mq-editable-field").should('contain.text', '3') cy.get("#\\/mi .mq-editable-field").invoke('text').then((text) => { expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('3') }) @@ -171,6 +175,7 @@ describe('Slider Tag Tests', function () { cy.get('#\\/b').should('have.text', 'true'); cy.get('#\\/sv').should('have.text', '3') + cy.get("#\\/mi .mq-editable-field").should('contain.text', '3') cy.get("#\\/mi .mq-editable-field").invoke('text').then((text) => { expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('3') }) @@ -185,10 +190,11 @@ describe('Slider Tag Tests', function () { cy.log('drag handle past below document and past end sets to maximum 10'); cy.get('#\\/_document1') .trigger('mousedown', numberToPx2(3), 50) - .trigger('mousemove', numberToPx2(25), 400, {force: true}) + .trigger('mousemove', numberToPx2(25), 400, { force: true }) .trigger('mouseup') cy.get('#\\/sv').should('have.text', '10') + cy.get("#\\/mi .mq-editable-field").should('contain.text', '10') cy.get("#\\/mi .mq-editable-field").invoke('text').then((text) => { expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('10') }) @@ -205,6 +211,7 @@ describe('Slider Tag Tests', function () { .trigger('mousedown', numberToPx2(6), 50) cy.get('#\\/sv').should('have.text', '6') + cy.get("#\\/mi .mq-editable-field").should('contain.text', '6') cy.get("#\\/mi .mq-editable-field").invoke('text').then((text) => { expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('6') }) @@ -221,6 +228,7 @@ describe('Slider Tag Tests', function () { .trigger('mousemove', numberToPx2(2), 0) cy.get('#\\/sv').should('have.text', '2') + cy.get("#\\/mi .mq-editable-field").should('contain.text', '2') cy.get("#\\/mi .mq-editable-field").invoke('text').then((text) => { expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('2') }) @@ -235,9 +243,10 @@ describe('Slider Tag Tests', function () { cy.log('drag past left edge and below slider'); cy.get('#\\/_document1') - .trigger('mousemove', numberToPx2(-1), 200, {force: true}) + .trigger('mousemove', numberToPx2(-1), 200, { force: true }) cy.get('#\\/sv').should('have.text', '0') + cy.get("#\\/mi .mq-editable-field").should('contain.text', '0') cy.get("#\\/mi .mq-editable-field").invoke('text').then((text) => { expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('0') }) @@ -252,9 +261,10 @@ describe('Slider Tag Tests', function () { cy.log('drag to 7, but below slider'); cy.get('#\\/_document1') - .trigger('mousemove', numberToPx2(7), 300, {force: true}) + .trigger('mousemove', numberToPx2(7), 300, { force: true }) cy.get('#\\/sv').should('have.text', '7') + cy.get("#\\/mi .mq-editable-field").should('contain.text', '7') cy.get("#\\/mi .mq-editable-field").invoke('text').then((text) => { expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('7') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/solution.cy.js b/cypress/e2e/DoenetML/tagSpecific/solution.cy.js index f5d851c276..e7482d5908 100644 --- a/cypress/e2e/DoenetML/tagSpecific/solution.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/solution.cy.js @@ -3,7 +3,7 @@ describe('Solution Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -36,7 +36,7 @@ describe('Solution Tag Tests', function () { let stateVariables = await win.returnAllStateVariables1(); expect(stateVariables['/solutionText'].stateValues.text).eq('This is the text of the solution.'); }) - + }) it('Can open solution in read only mode', () => { @@ -95,7 +95,7 @@ describe('Solution Tag Tests', function () { cy.get("#\\/sol_button").click(); cy.get('#\\/solOpen').should('have.text', 'false'); - + }) }) diff --git a/cypress/e2e/DoenetML/tagSpecific/solveequations.cy.js b/cypress/e2e/DoenetML/tagSpecific/solveequations.cy.js index 75afe45c54..e7812cc2b7 100644 --- a/cypress/e2e/DoenetML/tagSpecific/solveequations.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/solveequations.cy.js @@ -3,7 +3,7 @@ describe('SolveEquations Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -368,7 +368,7 @@ describe('SolveEquations Tag Tests', function () { cy.get('#\\/maxvar textarea').type("{ctrl+home}{shift+end}{backspace}10{enter}", { force: true, delay: 5 }) cy.get('#\\/equation textarea').type("{ctrl+home}{shift+end}{backspace}sin(10b) = b^3{enter}", { force: true, delay: 5 }) - cy.get('#\\/equation2').should('contain.text','sin(10b)') + cy.get('#\\/equation2').should('contain.text', 'sin(10b)') cy.get("#\\/num").should('have.text', 4); @@ -439,7 +439,7 @@ describe('SolveEquations Tag Tests', function () { cy.get('#\\/equation textarea').type("{ctrl+home}{shift+end}{backspace}sin(pi b) = 0{enter}", { force: true, delay: 5 }) cy.get('#\\/minvar textarea').type("{end}.1{enter}", { force: true, delay: 5 }) cy.get('#\\/maxvar textarea').type("{end}.1{enter}", { force: true, delay: 5 }) - cy.get('#\\/maxvar2').should('contain.text','.1') + cy.get('#\\/maxvar2').should('contain.text', '.1') cy.get("#\\/num").should('have.text', 21); @@ -453,7 +453,7 @@ describe('SolveEquations Tag Tests', function () { cy.get('#\\/equation textarea').type("{ctrl+home}{shift+end}{backspace}b^2{rightArrow}-0.001b = 0{enter}", { force: true, delay: 5 }) - cy.get('#\\/equation2').should('contain.text','0.001b=0') + cy.get('#\\/equation2').should('contain.text', '0.001b=0') cy.get("#\\/num").should('have.text', 2); cy.window().then(async (win) => { @@ -464,7 +464,7 @@ describe('SolveEquations Tag Tests', function () { }) cy.get('#\\/equation textarea').type("{ctrl+home}{shift+end}{backspace}(b+0.03)(b+0.0301) = 0{enter}", { force: true, delay: 5 }) - cy.get('#\\/equation2').should('contain.text','(b+0.03)(b+0.0301)=0') + cy.get('#\\/equation2').should('contain.text', '(b+0.03)(b+0.0301)=0') cy.get("#\\/num").should('have.text', 2); cy.window().then(async (win) => { @@ -475,7 +475,7 @@ describe('SolveEquations Tag Tests', function () { }) cy.get('#\\/equation textarea').type("{end}{backspace}-0.1{enter}", { force: true, delay: 5 }) - cy.get('#\\/equation2').should('contain.text','=−0.1') + cy.get('#\\/equation2').should('contain.text', '=−0.1') cy.get("#\\/num").should('have.text', 0); cy.window().then(async (win) => { @@ -484,8 +484,8 @@ describe('SolveEquations Tag Tests', function () { }) cy.get('#\\/equation textarea').type("{ctrl+home}{shift+end}{backspace}43.241(b+4.52352)(b+4.52365)(b-8.58230)(b-8.58263) = 0{enter}", { force: true, delay: 5 }) - cy.get('#\\/equation2').should('contain.text','43.241(b+4.52352)(b+4.52365)') - + cy.get('#\\/equation2').should('contain.text', '43.241(b+4.52352)(b+4.52365)') + cy.get("#\\/num").should('have.text', 4); cy.window().then(async (win) => { let stateVariables = await win.returnAllStateVariables1(); @@ -498,7 +498,7 @@ describe('SolveEquations Tag Tests', function () { cy.get('#\\/equation textarea').type("{home}exp({end}{backspace}{backspace}{backspace})=1{enter}", { force: true, delay: 5 }) - cy.get('#\\/equation2').should('contain.text','=1') + cy.get('#\\/equation2').should('contain.text', '=1') cy.get("#\\/num").should('have.text', 4); cy.window().then(async (win) => { @@ -522,7 +522,7 @@ describe('SolveEquations Tag Tests', function () { }) cy.get('#\\/equation textarea').type("{ctrl+home}{shift+end}{backspace}cos(pib) = 1{enter}", { force: true, delay: 5 }) - + cy.get("#\\/num").should('have.text', 11); cy.window().then(async (win) => { let stateVariables = await win.returnAllStateVariables1(); @@ -533,7 +533,7 @@ describe('SolveEquations Tag Tests', function () { }) cy.get('#\\/minvar textarea').type("{end}{backspace}{backspace}{enter}", { force: true, delay: 5 }) - cy.get('#\\/minvar2').should('not.contain.text','.1') + cy.get('#\\/minvar2').should('not.contain.text', '.1') cy.get("#\\/num").should('have.text', 11); cy.window().then(async (win) => { @@ -545,7 +545,7 @@ describe('SolveEquations Tag Tests', function () { }) cy.get('#\\/maxvar textarea').type("{end}{backspace}{backspace}{enter}", { force: true, delay: 5 }) - cy.get('#\\/maxvar2').should('not.contain.text','.1') + cy.get('#\\/maxvar2').should('not.contain.text', '.1') cy.get("#\\/num").should('have.text', 11); cy.window().then(async (win) => { @@ -557,7 +557,7 @@ describe('SolveEquations Tag Tests', function () { }) cy.get('#\\/minvar textarea').type("{end}.0001{enter}", { force: true, delay: 5 }) - cy.get('#\\/minvar2').should('contain.text','.0001') + cy.get('#\\/minvar2').should('contain.text', '.0001') cy.get("#\\/num").should('have.text', 11); cy.window().then(async (win) => { @@ -588,7 +588,7 @@ describe('SolveEquations Tag Tests', function () { }) cy.get('#\\/equation textarea').type("{ctrl+home}{shift+end}{backspace}sqrtpi^2{rightArrow}-b^2{rightArrow}{rightArrow}=0{enter}", { force: true, delay: 5 }) - cy.get('#\\/equation2').should('contain.text','√π2−b2=0') + cy.get('#\\/equation2').should('contain.text', '√π2−b2=0') cy.get("#\\/num").should('have.text', 2); cy.window().then(async (win) => { @@ -600,7 +600,7 @@ describe('SolveEquations Tag Tests', function () { cy.get('#\\/equation textarea').type("{ctrl+home}{shift+end}{backspace}10000000000sqrtpi^2{rightArrow}-b^2{rightArrow}{rightArrow}=0{enter}", { force: true, delay: 5 }) - cy.get('#\\/equation2').should('contain.text','10000000000√π2−b2=0') + cy.get('#\\/equation2').should('contain.text', '10000000000√π2−b2=0') cy.get("#\\/num").should('have.text', 2); cy.window().then(async (win) => { @@ -612,7 +612,7 @@ describe('SolveEquations Tag Tests', function () { cy.get('#\\/equation textarea').type("{ctrl+home}{shift+end}{backspace}0.00000000000000000001sqrtpi^2{rightArrow}-b^2{rightArrow}{rightArrow}=0{enter}", { force: true, delay: 5 }) - cy.get('#\\/equation2').should('contain.text','1⋅10−20√π2−b2=0') + cy.get('#\\/equation2').should('contain.text', '1⋅10−20√π2−b2=0') cy.get("#\\/num").should('have.text', 2); cy.window().then(async (win) => { @@ -623,7 +623,7 @@ describe('SolveEquations Tag Tests', function () { }) - + }) diff --git a/cypress/e2e/DoenetML/tagSpecific/sort.cy.js b/cypress/e2e/DoenetML/tagSpecific/sort.cy.js index bb435bbf47..a9353e0f5c 100644 --- a/cypress/e2e/DoenetML/tagSpecific/sort.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/sort.cy.js @@ -3,7 +3,7 @@ describe('Sort Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -879,7 +879,7 @@ describe('Sort Tag Tests', function () { }) - cy.get('#\\/cs textarea').type("(a,b,c,d){enter}", {force:true}); + cy.get('#\\/cs textarea').type("(a,b,c,d){enter}", { force: true }); cy.get('#\\/P5 .mjx-mrow').should('contain.text', '(a,b,c,d)'); @@ -900,7 +900,7 @@ describe('Sort Tag Tests', function () { }) - cy.get('#\\/cs textarea').type("{ctrl+home}{shift+ctrl+end}{backspace}(3,4,5){enter}", {force:true}); + cy.get('#\\/cs textarea').type("{ctrl+home}{shift+ctrl+end}{backspace}(3,4,5){enter}", { force: true }); cy.get('#\\/P4 .mjx-mrow').should('contain.text', '(3,4,5)'); @@ -922,7 +922,7 @@ describe('Sort Tag Tests', function () { }) - + it('sort texts', () => { cy.window().then(async (win) => { win.postMessage({ @@ -980,7 +980,7 @@ describe('Sort Tag Tests', function () { }) - + it('sort text, numbers, maths', () => { cy.window().then(async (win) => { win.postMessage({ diff --git a/cypress/e2e/DoenetML/tagSpecific/spreadsheet.cy.js b/cypress/e2e/DoenetML/tagSpecific/spreadsheet.cy.js index bda990c794..b9c1fcd79a 100644 --- a/cypress/e2e/DoenetML/tagSpecific/spreadsheet.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/spreadsheet.cy.js @@ -3,7 +3,7 @@ describe('Spreadsheet Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) var enterSpreadsheetText = function ({ id = "\\/_spreadsheet1", row, column, text = "", clear = false, verify = true }) { @@ -3547,7 +3547,7 @@ describe('Spreadsheet Tag Tests', function () { }); - + it('copy multidimensional propIndex of evaluated cells, dot and array notation', () => { cy.window().then(async (win) => { win.postMessage({ @@ -3628,7 +3628,7 @@ describe('Spreadsheet Tag Tests', function () { }); - + it('copy multidimensional propIndex of evaluated rows and columns, dot and array notation', () => { cy.window().then(async (win) => { win.postMessage({ @@ -3709,7 +3709,7 @@ describe('Spreadsheet Tag Tests', function () { }); - + it('copy single propIndex of evaluated rows and columns, dot and array notation', () => { cy.window().then(async (win) => { win.postMessage({ @@ -3790,7 +3790,7 @@ describe('Spreadsheet Tag Tests', function () { }); - + it('copy propIndex of points in cells', () => { cy.window().then(async (win) => { win.postMessage({ @@ -3861,7 +3861,7 @@ describe('Spreadsheet Tag Tests', function () { }); - + it('copy propIndex of points in cells, dot and array notation', () => { cy.window().then(async (win) => { win.postMessage({ @@ -3932,7 +3932,7 @@ describe('Spreadsheet Tag Tests', function () { }); - + it('copy multidimensional propIndex of points in cells, dot and array notation', () => { cy.window().then(async (win) => { win.postMessage({ diff --git a/cypress/e2e/DoenetML/tagSpecific/subsetofreals.cy.js b/cypress/e2e/DoenetML/tagSpecific/subsetofreals.cy.js index a201bf4d81..8ed32f9142 100644 --- a/cypress/e2e/DoenetML/tagSpecific/subsetofreals.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/subsetofreals.cy.js @@ -3,7 +3,7 @@ describe('SubsetOfReals Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/substitute.cy.js b/cypress/e2e/DoenetML/tagSpecific/substitute.cy.js index 668432a9fe..2c4129062f 100644 --- a/cypress/e2e/DoenetML/tagSpecific/substitute.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/substitute.cy.js @@ -4,7 +4,7 @@ describe('Substitute Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/text.cy.js b/cypress/e2e/DoenetML/tagSpecific/text.cy.js index 709a7fc0e4..a5d1cafa44 100644 --- a/cypress/e2e/DoenetML/tagSpecific/text.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/text.cy.js @@ -3,7 +3,7 @@ describe('Text Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/textinput.cy.js b/cypress/e2e/DoenetML/tagSpecific/textinput.cy.js index 1a9fd603eb..7056db7194 100644 --- a/cypress/e2e/DoenetML/tagSpecific/textinput.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/textinput.cy.js @@ -12,7 +12,7 @@ describe('TextInput Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/textlist.cy.js b/cypress/e2e/DoenetML/tagSpecific/textlist.cy.js index 4fe1ef4d57..f8e27ab580 100644 --- a/cypress/e2e/DoenetML/tagSpecific/textlist.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/textlist.cy.js @@ -12,7 +12,7 @@ describe('TextList Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/triangle.cy.js b/cypress/e2e/DoenetML/tagSpecific/triangle.cy.js index 0493b34517..e1f8e595c2 100644 --- a/cypress/e2e/DoenetML/tagSpecific/triangle.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/triangle.cy.js @@ -4,7 +4,7 @@ describe('Triangle Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/triggerset.cy.js b/cypress/e2e/DoenetML/tagSpecific/triggerset.cy.js index 80e3967af4..df2e9647d7 100644 --- a/cypress/e2e/DoenetML/tagSpecific/triggerset.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/triggerset.cy.js @@ -2,7 +2,7 @@ describe('TriggerSet Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/updatevalue.cy.js b/cypress/e2e/DoenetML/tagSpecific/updatevalue.cy.js index 1dbaed16fc..6df9150d3b 100644 --- a/cypress/e2e/DoenetML/tagSpecific/updatevalue.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/updatevalue.cy.js @@ -4,7 +4,7 @@ describe('UpdateValue Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/vector.cy.js b/cypress/e2e/DoenetML/tagSpecific/vector.cy.js index 9bb9bea7f2..8a83717717 100644 --- a/cypress/e2e/DoenetML/tagSpecific/vector.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/vector.cy.js @@ -21,7 +21,7 @@ describe('Vector Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) @@ -13643,5 +13643,45 @@ describe('Vector Tag Tests', function () { }) + it('style description changes with theme', () => { + cy.window().then(async (win) => { + win.postMessage({ + doenetML: ` + + + + + + + + + + + +

Vector A is $A.styleDescription.

+

B is a $B.styleDescriptionWithNoun.

+

C is a $C.styleDescriptionWithNoun.

+ `}, "*"); + }); + + + cy.get('#\\/Adescrip').should('have.text', 'Vector A is thick brown.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a dark red vector.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin black vector.'); + + cy.log('set dark mode') + cy.get('#testRunner_toggleControls').click(); + cy.get('#testRunner_darkmode').click() + cy.wait(100) + cy.get('#testRunner_toggleControls').click(); + + + cy.get('#\\/Adescrip').should('have.text', 'Vector A is thick yellow.'); + cy.get('#\\/Bdescrip').should('have.text', 'B is a light red vector.'); + cy.get('#\\/Cdescrip').should('have.text', 'C is a thin white vector.'); + + + }); + }); \ No newline at end of file diff --git a/cypress/e2e/DoenetML/tagSpecific/video.cy.js b/cypress/e2e/DoenetML/tagSpecific/video.cy.js index dc9f4836b9..0e456717c1 100644 --- a/cypress/e2e/DoenetML/tagSpecific/video.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/video.cy.js @@ -13,7 +13,7 @@ describe('Video Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/tagSpecific/when.cy.js b/cypress/e2e/DoenetML/tagSpecific/when.cy.js index cac684f7a4..406c77bd5b 100644 --- a/cypress/e2e/DoenetML/tagSpecific/when.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/when.cy.js @@ -3,7 +3,7 @@ describe('When Tag Tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) diff --git a/cypress/e2e/DoenetML/variants/specifysinglevariant.cy.js b/cypress/e2e/DoenetML/variants/specifysinglevariant.cy.js index 00e2070be9..0f1a7baed2 100644 --- a/cypress/e2e/DoenetML/variants/specifysinglevariant.cy.js +++ b/cypress/e2e/DoenetML/variants/specifysinglevariant.cy.js @@ -14,7 +14,7 @@ describe('Specifying single variant document tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('document with no variant control', () => { @@ -4636,7 +4636,7 @@ describe('Specifying single variant document tests', function () { a = stateVariables["/a"].stateValues.value; }); - + let doenetML2 = `2` + randomPiece1 + nonRandom1 + randomPiece2 + nonRandom2 + nonRandom3 + nonRandom4; cy.window().then(async (win) => { @@ -4681,7 +4681,7 @@ describe('Specifying single variant document tests', function () { w2 = stateVariables["/w2"].stateValues.value; w3 = stateVariables["/w3"].stateValues.value; m = stateVariables["/m"].stateValues.value; - + }); diff --git a/cypress/e2e/DoenetML/variants/uniquevariants.cy.js b/cypress/e2e/DoenetML/variants/uniquevariants.cy.js index 430b47a823..0e119fc54c 100644 --- a/cypress/e2e/DoenetML/variants/uniquevariants.cy.js +++ b/cypress/e2e/DoenetML/variants/uniquevariants.cy.js @@ -13,7 +13,7 @@ describe('Specifying unique variant tests', function () { beforeEach(() => { cy.clearIndexedDB(); - cy.visit('/cypressTest') + cy.visit('/src/Tools/cypressTest/') }) it('single select', () => { diff --git a/cypress/e2e/Editor/Editor.cy.js b/cypress/e2e/Editor/Editor.cy.js index b5edd50a38..9d581d1633 100644 --- a/cypress/e2e/Editor/Editor.cy.js +++ b/cypress/e2e/Editor/Editor.cy.js @@ -23,8 +23,8 @@ describe('doenetEditor test', function () { cy.clearIndexedDB(); cy.clearAllOfAUsersActivities({ userId }) cy.clearAllOfAUsersActivities({ userId: studentUserId }) - cy.createActivity({courseId,doenetId,parentDoenetId:courseId,pageDoenetId}); - cy.visit(`http://localhost/course?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`) + cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId }); + cy.visit(`/course?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`) }) @@ -32,255 +32,255 @@ describe('doenetEditor test', function () { // returning false here prevents Cypress from // failing the test return false -}) - -it('basic test of update button',()=>{ - const doenetMLString = 'abcdefg' - cy.get('.cm-content').type(doenetMLString) - cy.get('#\\/_document1').should('not.contain', 'a'); - cy.get('[data-test="Viewer Update Button"]').click(); - cy.get('#\\/_document1').contains(doenetMLString) -}) - -it('ctrl+s updates viewer',()=>{ - const doenetMLString = 'abcdefg' - cy.get('.cm-content').type(doenetMLString) - cy.get('#\\/_document1').should('not.contain', 'a'); - cy.get('.cm-content').type('{control}{s}') - cy.get('#\\/_document1').contains(doenetMLString) -}) - -it('command+s updates viewer',()=>{ - const doenetMLString = 'abcdefg' - cy.get('.cm-content').type(doenetMLString) - cy.get('#\\/_document1').should('not.contain', 'a'); - cy.get('.cm-content').type('{command}{s}') - cy.get('#\\/_document1').contains(doenetMLString) -}) - -it('Page Variant Menu Test',()=>{ - const componentName = 'sequenceContainer' - const doenetMLString = `

` - // const doenetMLString = `` - cy.get('.cm-content').type(doenetMLString) - cy.get('[data-test="Viewer Update Button"]').click(); - cy.get('[data-test="PageVariant Menu"]').click(); - - cy.get('[data-test="Variant Index Input"]').invoke('val','3').type(' {enter}') - cy.get(`#\\/${componentName}`).contains('3') - - cy.get('[data-test="Variant Name Input"]').invoke('val','4').trigger('change'); - cy.get(`#\\/${componentName}`).contains('4') - - -}) - -it('Assign activity and navigate directly to URL',()=>{ - const doenetMLString = '42' - - cy.get('.cm-content').type(doenetMLString) - // cy.get('[data-test="Viewer Update Button"]').click(); - - cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should('be.visible'); - - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}`) - cy.get('#\\/problem1_title').contains('Problem 1') - -}) - -it('Assign activity and navigate using Breadcrumbs',()=>{ - const doenetMLString = '42' - - cy.get('.cm-content').type(doenetMLString) - // cy.get('[data-test="Viewer Update Button"]').click(); //Shouldn't need to click the update button - cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should('be.visible'); - cy.get('[data-test="Crumb Menu"]').click({force:true}); - cy.get('[data-test="Crumb Menu Item 2"]').click(); - 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="View Assigned Activity"]').click(); - cy.get('#\\/problem1_title').contains('Problem 1') -}) - -it('Assign two-page activity',()=>{ - const doenetMLString1 = ` + }) + + it('basic test of update button', () => { + const doenetMLString = 'abcdefg' + cy.get('.cm-content').type(doenetMLString) + cy.get('#\\/_document1').should('not.contain', 'a'); + cy.get('[data-test="Viewer Update Button"]').click(); + cy.get('#\\/_document1').contains(doenetMLString) + }) + + it('ctrl+s updates viewer', () => { + const doenetMLString = 'abcdefg' + cy.get('.cm-content').type(doenetMLString) + cy.get('#\\/_document1').should('not.contain', 'a'); + cy.get('.cm-content').type('{control}{s}') + cy.get('#\\/_document1').contains(doenetMLString) + }) + + it('command+s updates viewer', () => { + const doenetMLString = 'abcdefg' + cy.get('.cm-content').type(doenetMLString) + cy.get('#\\/_document1').should('not.contain', 'a'); + cy.get('.cm-content').type('{command}{s}') + cy.get('#\\/_document1').contains(doenetMLString) + }) + + it('Page Variant Menu Test', () => { + const componentName = 'sequenceContainer' + const doenetMLString = `

` + // const doenetMLString = `` + cy.get('.cm-content').type(doenetMLString) + cy.get('[data-test="Viewer Update Button"]').click(); + cy.get('[data-test="PageVariant Menu"]').click(); + + cy.get('[data-test="Variant Index Input"]').invoke('val', '3').type(' {enter}') + cy.get(`#\\/${componentName}`).contains('3') + + cy.get('[data-test="Variant Name Input"]').invoke('val', '4').trigger('change'); + cy.get(`#\\/${componentName}`).contains('4') + + + }) + + it('Assign activity and navigate directly to URL', () => { + const doenetMLString = '42' + + cy.get('.cm-content').type(doenetMLString) + // cy.get('[data-test="Viewer Update Button"]').click(); + + cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); + cy.get('[data-test="Assign Activity"]').click(); + cy.get('[data-test="Unassign Activity"]').should('be.visible'); + + cy.visit(`/course?tool=assignment&doenetId=${doenetId}`) + cy.get('#\\/problem1_title').contains('Problem 1') + + }) + + it('Assign activity and navigate using Breadcrumbs', () => { + const doenetMLString = '42' + + cy.get('.cm-content').type(doenetMLString) + // cy.get('[data-test="Viewer Update Button"]').click(); //Shouldn't need to click the update button + cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); + cy.get('[data-test="Assign Activity"]').click(); + cy.get('[data-test="Unassign Activity"]').should('be.visible'); + cy.get('[data-test="Crumb Menu"]').click({ force: true }); + cy.get('[data-test="Crumb Menu Item 2"]').click(); + 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="View Assigned Activity"]').click(); + cy.get('#\\/problem1_title').contains('Problem 1') + }) + + it('Assign two-page activity', () => { + const doenetMLString1 = `

1+1 = 2

Your answer: $a

` - const doenetMLString2 = ` + const doenetMLString2 = `

1 \\times 1 = 1

Your answer: $a

` - cy.get('.cm-content').type(doenetMLString1) - // cy.get('[data-test="Viewer Update Button"]').click(); + cy.get('.cm-content').type(doenetMLString1) + // cy.get('[data-test="Viewer Update Button"]').click(); + + cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); + cy.get('[data-test="Assign Activity"]').click(); + cy.get('[data-test="Unassign Activity"]').should('be.visible'); + + cy.get('[data-test="Crumb Menu"]').click({ force: true }); + cy.get('[data-test="Crumb Menu Item 2"]').click(); + + 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="Add Page"]').click(); + cy.get('.navigationRow').eq(0).get('[data-test="folderToggleOpenIcon"]').click(); - cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should('be.visible'); + // cy.get('.navigationRow').should('have.length',3); - cy.get('[data-test="Crumb Menu"]').click({force:true}); - cy.get('[data-test="Crumb Menu Item 2"]').click(); + cy.get('.navigationRow').eq(2).find('.navigationColumn1').click(); + cy.get('[data-test="Edit Page"]').click(); - 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="Add Page"]').click(); - cy.get('.navigationRow').eq(0).get('[data-test="folderToggleOpenIcon"]').click(); + cy.get('.cm-content').type(doenetMLString2) - // cy.get('.navigationRow').should('have.length',3); + cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); + cy.get('[data-test="Assign Activity"]').click(); - cy.get('.navigationRow').eq(2).find('.navigationColumn1').click(); - cy.get('[data-test="Edit Page"]').click(); + cy.get('[data-test="Unassign Activity"]').should('be.visible'); - cy.get('.cm-content').type(doenetMLString2) + cy.get('[data-test="Crumb Menu"]').click({ force: true }); + cy.get('[data-test="Crumb Menu Item 2"]').click(); + cy.get('.navigationRow').eq(0).find('.navigationColumn1').click(); - cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should('be.visible'); + cy.signin({ userId: studentUserId }) - cy.get('[data-test="Crumb Menu"]').click({force:true}); - cy.get('[data-test="Crumb Menu Item 2"]').click(); - cy.get('.navigationRow').eq(0).find('.navigationColumn1').click(); + cy.visit(`/course?tool=navigation&courseId=${courseId}`) - - cy.signin({userId: studentUserId}) + 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.visit(`http://localhost/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('#page1\\/_section1_title').should('have.text', 'Section 1') - cy.get('[data-test="View Activity"]').click(); + cy.get('[data-test="Possible Points"]').should('have.text', '10') + cy.get('[data-test="Final Score"]').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('#page1\\/_section1_title').should('have.text', 'Section 1') + cy.get('#page1\\/a textarea').type("{enter}", { force: true }) + cy.get('#page1\\/_p2 .mjx-mrow').should('contain.text', '\uff3f') - cy.get('[data-test="Possible Points"]').should('have.text', '10') - cy.get('[data-test="Final Score"]').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="Item 1 Credit"]').should('have.text', '0%') + cy.get('[data-test="Item 2 Credit"]').should('have.text', '0%') + cy.get('[data-test="Final Score"]').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="Possible Points"]').should('have.text', '10') - cy.get('#page1\\/a textarea').type("{enter}", {force: true}) - cy.get('#page1\\/_p2 .mjx-mrow').should('contain.text', '\uff3f') + // TODO: why does this frequently fail if don't wait here? + cy.wait(500) + cy.get('#page1\\/a textarea').type("2{enter}", { force: true }) + cy.get('#page1\\/_p2 .mjx-mrow').should('contain.text', '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="Final Score"]').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="Possible Points"]').should('have.text', '10') + cy.get('[data-test="Final Score"]').should('have.text', '5') + cy.get('[data-test="Attempt Percent"]').should('have.text', '50%') + 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', '50%') + cy.get('[data-test="Possible Points"]').should('have.text', '10') - // TODO: why does this frequently fail if don't wait here? - cy.wait(500) - cy.get('#page1\\/a textarea').type("2{enter}", {force: true}) - cy.get('#page1\\/_p2 .mjx-mrow').should('contain.text', '2') - - cy.get('[data-test="Final Score"]').should('have.text', '5') - cy.get('[data-test="Attempt Percent"]').should('have.text', '50%') - 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', '50%') - cy.get('[data-test="Possible Points"]').should('have.text', '10') + cy.get('[data-test=next]').click(); - cy.get('[data-test=next]').click(); + cy.wait(2000); // make sure debounce occurred while waiting - cy.wait(2000); // make sure debounce occurred while waiting + cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') - cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') + cy.get('[data-test="Final Score"]').should('have.text', '5') + cy.get('[data-test="Attempt Percent"]').should('have.text', '50%') + 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', '50%') + cy.get('[data-test="Possible Points"]').should('have.text', '10') - cy.get('[data-test="Final Score"]').should('have.text', '5') - cy.get('[data-test="Attempt Percent"]').should('have.text', '50%') - 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', '50%') - cy.get('[data-test="Possible Points"]').should('have.text', '10') + cy.get('#page2\\/a textarea').type("1{enter}", { force: true }) + cy.get('#page2\\/_p2 .mjx-mrow').should('contain.text', '1') - cy.get('#page2\\/a textarea').type("1{enter}", {force: true}) - cy.get('#page2\\/_p2 .mjx-mrow').should('contain.text', '1') + // cy.get('[data-test="Final Score"]').should('have.text', '10') + // cy.get('[data-test="Attempt Percent"]').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="Assignment Percent"]').should('have.text', '100%') + // cy.get('[data-test="Possible Points"]').should('have.text', '10') - cy.get('[data-test="Final Score"]').should('have.text', '10') - cy.get('[data-test="Attempt Percent"]').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="Assignment Percent"]').should('have.text', '100%') - cy.get('[data-test="Possible Points"]').should('have.text', '10') + cy.log('Reloading immediately does not save state but saves credit achieved') + cy.reload(); - cy.log('Reloading immediately does not save state but saves credit achieved') - cy.reload(); + cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') + cy.get('#page2\\/_p2').should('not.contain.text', '1') - cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') - cy.get('#page2\\/_p2').should('not.contain.text', '1') + cy.get('[data-test="Final Score"]').should('have.text', '10') + cy.get('[data-test="Attempt Percent"]').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="Assignment Percent"]').should('have.text', '100%') + cy.get('[data-test="Possible Points"]').should('have.text', '10') - cy.get('[data-test="Final Score"]').should('have.text', '10') - cy.get('[data-test="Attempt Percent"]').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="Assignment Percent"]').should('have.text', '100%') - cy.get('[data-test="Possible Points"]').should('have.text', '10') + cy.log('State on previous page was saved') + cy.get('[data-test=previous]').click(); + cy.get('#page1\\/_section1_title').should('have.text', 'Section 1') + cy.get('#page1\\/_p2 .mjx-mrow').should('contain.text', '2') - cy.log('State on previous page was saved') - cy.get('[data-test=previous]').click(); - cy.get('#page1\\/_section1_title').should('have.text', 'Section 1') - cy.get('#page1\\/_p2 .mjx-mrow').should('contain.text', '2') + cy.get('[data-test=next]').click(); + cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') - cy.get('[data-test=next]').click(); - cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') + cy.log('New attempt, goes back to page 1') + cy.get('[data-test="New Attempt"]').click(); - cy.log('New attempt, goes back to page 1') - cy.get('[data-test="New Attempt"]').click(); - - cy.get('#page1\\/_section1_title').should('have.text', 'Section 1') + cy.get('#page1\\/_section1_title').should('have.text', 'Section 1') - cy.get('[data-test="Attempt Percent"]').should('have.text', '0%') - cy.get('[data-test="Final Score"]').should('have.text', '10') - cy.get('[data-test="Assignment Percent"]').should('have.text', '100%') - cy.get('[data-test="Possible Points"]').should('have.text', '10') + cy.get('[data-test="Attempt Percent"]').should('have.text', '0%') + cy.get('[data-test="Final Score"]').should('have.text', '10') + cy.get('[data-test="Assignment Percent"]').should('have.text', '100%') + cy.get('[data-test="Possible Points"]').should('have.text', '10') - cy.get('[data-test=next]').click(); - cy.get('#page2\\/a textarea').type("1{enter}", {force: true}) + cy.get('[data-test=next]').click(); + cy.get('#page2\\/a textarea').type("1{enter}", { force: true }) - cy.get('#page2\\/_p2 .mjx-mrow').should('contain.text', '1') + cy.get('#page2\\/_p2 .mjx-mrow').should('contain.text', '1') - cy.get('[data-test="Attempt Percent"]').should('have.text', '50%') - 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="Final Score"]').should('have.text', '10') - cy.get('[data-test="Assignment Percent"]').should('have.text', '100%') - cy.get('[data-test="Possible Points"]').should('have.text', '10') + cy.get('[data-test="Attempt Percent"]').should('have.text', '50%') + 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="Final Score"]').should('have.text', '10') + cy.get('[data-test="Assignment Percent"]').should('have.text', '100%') + cy.get('[data-test="Possible Points"]').should('have.text', '10') - cy.wait(2000); // wait for debounce + cy.wait(2000); // wait for debounce - cy.log('Reloading after a wait does save state and credit achieved') - cy.reload(); + cy.log('Reloading after a wait does save state and credit achieved') + cy.reload(); - cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') - cy.get('#page2\\/_p2 .mjx-mrow').should('contain.text', '1') + cy.get('#page2\\/_section1_title').should('have.text', 'Section 2') + cy.get('#page2\\/_p2 .mjx-mrow').should('contain.text', '1') - cy.get('[data-test="Final Score"]').should('have.text', '10') - cy.get('[data-test="Attempt Percent"]').should('have.text', '50%') - 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="Assignment Percent"]').should('have.text', '100%') - cy.get('[data-test="Possible Points"]').should('have.text', '10') + cy.get('[data-test="Final Score"]').should('have.text', '10') + cy.get('[data-test="Attempt Percent"]').should('have.text', '50%') + 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="Assignment Percent"]').should('have.text', '100%') + cy.get('[data-test="Possible Points"]').should('have.text', '10') -}) + }) -it('animation stopped when click update button',()=>{ - const doenetMLString = ` + it('animation stopped when click update button', () => { + const doenetMLString = ` 1 @@ -289,56 +289,56 @@ it('animation stopped when click update button',()=>{

` - cy.get('.cm-content').type(doenetMLString) - cy.get('[data-test="Viewer Update Button"]').click(); - cy.get('#\\/n').should('have.text', '1') + cy.get('.cm-content').type(doenetMLString) + cy.get('[data-test="Viewer Update Button"]').click(); + cy.get('#\\/n').should('have.text', '1') + + cy.get('#\\/ca_button').click(); + cy.get('#\\/n').should('have.text', '2') + cy.get('#\\/n').should('have.text', '3') - cy.get('#\\/ca_button').click(); - cy.get('#\\/n').should('have.text', '2') - cy.get('#\\/n').should('have.text', '3') + cy.get('.cm-content').type("{ctrl+end}

More text

{enter}") - cy.get('.cm-content').type("{ctrl+end}

More text

{enter}") + cy.get('[data-test="Viewer Update Button"]').click(); - cy.get('[data-test="Viewer Update Button"]').click(); + cy.get("#\\/np").should('have.text', 'More text') - cy.get("#\\/np").should('have.text', 'More text') + cy.log('ensure animation has stopped') + cy.get('#\\/n').should('have.text', '1') + cy.wait(200) + cy.get('#\\/n').should('have.text', '1') - cy.log('ensure animation has stopped') - cy.get('#\\/n').should('have.text', '1') - cy.wait(200) - cy.get('#\\/n').should('have.text', '1') + cy.get('#\\/ca_button').click(); + cy.get('#\\/n').should('have.text', '2') + cy.get('#\\/n').should('have.text', '3') - cy.get('#\\/ca_button').click(); - cy.get('#\\/n').should('have.text', '2') - cy.get('#\\/n').should('have.text', '3') + cy.get('#\\/ca_button').click(); + cy.wait(200) + cy.get('#\\/n').contains(/3|4/) - cy.get('#\\/ca_button').click(); - cy.wait(200) - cy.get('#\\/n').contains(/3|4/) - - cy.get('.cm-content').type("{ctrl+end}

And more

{enter}") + cy.get('.cm-content').type("{ctrl+end}

And more

{enter}") - cy.get('[data-test="Viewer Update Button"]').click(); + cy.get('[data-test="Viewer Update Button"]').click(); - cy.get("#\\/np2").should('have.text', 'And more') + cy.get("#\\/np2").should('have.text', 'And more') - cy.log('ensure animation has stopped') - cy.get('#\\/n').should('have.text', '1') - cy.wait(200) - cy.get('#\\/n').should('have.text', '1') + cy.log('ensure animation has stopped') + cy.get('#\\/n').should('have.text', '1') + cy.wait(200) + cy.get('#\\/n').should('have.text', '1') - cy.get('#\\/ca_button').click(); - cy.get('#\\/n').should('have.text', '2') - cy.get('#\\/n').should('have.text', '3') + cy.get('#\\/ca_button').click(); + cy.get('#\\/n').should('have.text', '2') + cy.get('#\\/n').should('have.text', '3') - cy.get('#\\/ca_button').click(); - cy.wait(200) - cy.get('#\\/n').contains(/3|4/) - -}) + cy.get('#\\/ca_button').click(); + cy.wait(200) + cy.get('#\\/n').contains(/3|4/) -it('Repeatedly select same internal link', () => { - const doenetMLString = ` + }) + + it('Repeatedly select same internal link', () => { + const doenetMLString = `

Link to aside

@@ -353,62 +353,62 @@ it('Repeatedly select same internal link', () => {
` - cy.get('.cm-content').type(doenetMLString) - cy.get('[data-test="Viewer Update Button"]').click(); + cy.get('.cm-content').type(doenetMLString) + cy.get('[data-test="Viewer Update Button"]').click(); - cy.get('#\\/_section1_title').should('have.text', 'Section 1') - cy.url().should('match', /[^#]/) + cy.get('#\\/_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('[data-test="Main Panel"]').then(el => { + expect(el.scrollTop()).eq(0); + }) - cy.get('#\\/asideTitle').should('have.text', 'The aside'); - cy.get('#\\/insideAside').should('not.exist'); + cy.get('#\\/asideTitle').should('have.text', 'The aside'); + cy.get('#\\/insideAside').should('not.exist'); - cy.get('#\\/toAside').click(); - cy.url().should('match', /#\/aside$/) + cy.get('#\\/toAside').click(); + cy.url().should('match', /#\/aside$/) - cy.get('#\\/aside').then(el => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) - }) + cy.get('#\\/aside').then(el => { + let rect = el[0].getBoundingClientRect(); + expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) + }) - cy.get('#\\/insideAside').should('have.text', 'Content in aside'); + cy.get('#\\/insideAside').should('have.text', 'Content in aside'); - cy.get('#\\/asideTitle').click(); - cy.get('#\\/insideAside').should('not.exist'); + cy.get('#\\/asideTitle').click(); + cy.get('#\\/insideAside').should('not.exist'); - cy.get('#\\/toAside').scrollIntoView(); + cy.get('#\\/toAside').scrollIntoView(); - cy.get('#\\/toAside').then(el => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) - }) + cy.get('#\\/toAside').then(el => { + let rect = el[0].getBoundingClientRect(); + expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) + }) - cy.url().should('match', /#\/aside$/) + cy.url().should('match', /#\/aside$/) - cy.get('#\\/toAside').click(); - cy.get('#\\/insideAside').should('have.text', 'Content in aside'); + cy.get('#\\/toAside').click(); + cy.get('#\\/insideAside').should('have.text', 'Content in aside'); - cy.url().should('match', /#\/aside$/) + cy.url().should('match', /#\/aside$/) - cy.get('#\\/aside').then(el => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) - }) + cy.get('#\\/aside').then(el => { + let rect = el[0].getBoundingClientRect(); + expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) + }) -}) + }) -//This is broken -it.skip('Navigating back remembers position where clicked internal link', () => { - const doenetMLString = ` + //This is broken + it.skip('Navigating back remembers position where clicked internal link', () => { + const doenetMLString = `
@@ -429,56 +429,56 @@ it.skip('Navigating back remembers position where clicked internal link', () =>
` - cy.get('.cm-content').type(doenetMLString) - cy.get('[data-test="Viewer Update Button"]').click(); + cy.get('.cm-content').type(doenetMLString) + cy.get('[data-test="Viewer Update Button"]').click(); - cy.get('#\\/_section1_title').should('have.text', 'Section 1') - cy.url().should('match', /[^#]/) + cy.get('#\\/_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('[data-test="Main Panel"]').then(el => { + expect(el.scrollTop()).eq(0); + }) - cy.get('#\\/asideTitle').should('have.text', 'The aside'); - cy.get('#\\/insideAside').should('not.exist'); + cy.get('#\\/asideTitle').should('have.text', 'The aside'); + cy.get('#\\/insideAside').should('not.exist'); - cy.get('#\\/toAside').scrollIntoView(); + cy.get('#\\/toAside').scrollIntoView(); - cy.get('#\\/toAside').then(el => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) - }) + cy.get('#\\/toAside').then(el => { + let rect = el[0].getBoundingClientRect(); + expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) + }) - cy.get('#\\/toAside').click(); - cy.url().should('match', /#\/aside$/) + cy.get('#\\/toAside').click(); + cy.url().should('match', /#\/aside$/) - cy.get('#\\/aside').then(el => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) - }) + cy.get('#\\/aside').then(el => { + let rect = el[0].getBoundingClientRect(); + expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) + }) - cy.get('#\\/insideAside').should('have.text', 'Content in aside'); + cy.get('#\\/insideAside').should('have.text', 'Content in aside'); - cy.get('#\\/bottom').scrollIntoView(); + cy.get('#\\/bottom').scrollIntoView(); - cy.get('#\\/bottom').then(el => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) - }) + cy.get('#\\/bottom').then(el => { + let rect = el[0].getBoundingClientRect(); + expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) + }) - cy.go("back"); - cy.url().should('match', /[^#]/) + cy.go("back"); + cy.url().should('match', /[^#]/) - cy.get('#\\/toAside').then(el => { - let rect = el[0].getBoundingClientRect(); - expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) - }) + cy.get('#\\/toAside').then(el => { + let rect = el[0].getBoundingClientRect(); + expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) + }) -}) + }) }) \ No newline at end of file diff --git a/cypress/e2e/Events/Events.cy.js b/cypress/e2e/Events/Events.cy.js index 2afbc1b528..0fee333c66 100644 --- a/cypress/e2e/Events/Events.cy.js +++ b/cypress/e2e/Events/Events.cy.js @@ -21,8 +21,8 @@ describe('doenet events test', function () { cy.clearIndexedDB(); cy.clearAllOfAUsersActivities({ userId }) cy.clearAllOfAUsersActivities({ userId: studentUserId }) - cy.createActivity({courseId,doenetId,parentDoenetId:courseId,pageDoenetId}); - cy.clearEvents({doenetId}) + cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId }); + cy.clearEvents({ doenetId }) }) @@ -30,10 +30,10 @@ describe('doenet events test', function () { // returning false here prevents Cypress from // failing the test return false -}) + }) -it('make sure events are recorded in general',()=>{ - const doenetML = ` + it('make sure events are recorded in general', () => { + const doenetML = `

Enter values that sum to 3x: @@ -41,41 +41,41 @@ it('make sure events are recorded in general',()=>{ $_mathinput1+$_mathinput2 = 3

` - cy.saveDoenetML({doenetML,pageId:pageDoenetId,courseId}); - cy.visit(`http://localhost/course?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`) - cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); - cy.get('[data-test="Assign Activity"]').click(); - cy.get('[data-test="Unassign Activity"]').should('be.visible'); + cy.saveDoenetML({ doenetML, pageId: pageDoenetId, courseId }); + cy.visit(`/course?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`) + cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); + cy.get('[data-test="Assign Activity"]').click(); + cy.get('[data-test="Unassign Activity"]').should('be.visible'); - cy.wait(1000) + cy.wait(1000) - cy.signin({userId: studentUserId}) + cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}`) - //Interact with content - cy.log("Enter a correct answer in") - //TODO: clear out previous entry state + cy.visit(`/course?tool=assignment&doenetId=${doenetId}`) + //Interact with content + cy.log("Enter a correct answer in") + //TODO: clear out previous entry state cy.get('#\\/_mathinput1 textarea').type(`x+y`, { force: true }).blur(); cy.get('#\\/_mathinput2 textarea').type(`2x-y`, { force: true }).blur(); // cy.get('#\\/_mathinput1 textarea').invoke('val',`x+y`).blur(); // cy.get('#\\/_mathinput2 textarea').invoke('val',`2x-y`).blur(); - + cy.log("Submit answer") cy.get('#\\/_answer1_submit').click(); cy.wait(1000); //TODO: time travel instead of wait? - //Test if interactions were recorded - cy.request(`http://localhost/api/getEventData.php?doenetId[]=${doenetId}`) - .then((resp)=>{ - const events = resp.body.events; - expect(events.length).gt(0); - }); + //Test if interactions were recorded + cy.request(`/api/getEventData.php?doenetId[]=${doenetId}`) + .then((resp) => { + const events = resp.body.events; + expect(events.length).gt(0); + }); -}) + }) + - }) \ No newline at end of file diff --git a/cypress/e2e/Events/videoEvents.cy.js b/cypress/e2e/Events/videoEvents.cy.js index ebb438abb3..978096948a 100644 --- a/cypress/e2e/Events/videoEvents.cy.js +++ b/cypress/e2e/Events/videoEvents.cy.js @@ -48,15 +48,15 @@ describe('video events test', function () {

Skip to time 57:

` cy.saveDoenetML({ doenetML, pageId: pageDoenetId, courseId }); - cy.visit(`http://localhost/course?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`) + cy.visit(`/course?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`) cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); cy.get('[data-test="Assign Activity"]').click(); cy.get('[data-test="Unassign Activity"]').should('be.visible'); - cy.get('[data-test="Crumb Menu"]').click({force:true}); + cy.get('[data-test="Crumb Menu"]').click({ force: true }); cy.get('[data-test="Crumb Menu Item 2"]').click(); - cy.get('.navigationRow').should('have.length',1); //Need this to wait for the row to appear + cy.get('.navigationRow').should('have.length', 1); //Need this to wait for the row to appear cy.get('.navigationRow').eq(0).get('.navigationColumn1').click(); @@ -110,7 +110,7 @@ describe('video events test', function () { cy.wait(1000); //TODO: time travel instead of wait? //Test if interactions were recorded - cy.request(`http://localhost/api/getEventData.php?doenetId[]=${doenetId}`) + cy.request(`/api/getEventData.php?doenetId[]=${doenetId}`) .then((resp) => { const events = resp.body.events; diff --git a/cypress/e2e/Events/visibilityEvents.cy.js b/cypress/e2e/Events/visibilityEvents.cy.js index ba0ad55ac8..376450d281 100644 --- a/cypress/e2e/Events/visibilityEvents.cy.js +++ b/cypress/e2e/Events/visibilityEvents.cy.js @@ -83,16 +83,16 @@ describe('visibility events test', function () { ` - + cy.saveDoenetML({ doenetML, pageId: pageDoenetId, courseId }); - cy.visit(`http://localhost/course?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`) + cy.visit(`/course?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`) cy.get('[data-test="AssignmentSettingsMenu Menu"]').click(); cy.get('[data-test="Assign Activity"]').click(); cy.get('[data-test="toast"]').contains('Activity Assigned'); cy.clock(); - cy.visit(`http://localhost/course?tool=assignment&doenetId=${doenetId}`) + cy.visit(`/course?tool=assignment&doenetId=${doenetId}`) //Interact with content cy.get('[data-test="Crumb 3"]').contains('Cypress Activity'); cy.tick(1000); @@ -129,7 +129,7 @@ describe('visibility events test', function () { cy.log('wait 5 minutes') cy.wait(1000); - cy.tick(5*60*1000) + cy.tick(5 * 60 * 1000) cy.tick(1000) cy.tick(1000) cy.tick(1000) @@ -192,7 +192,7 @@ describe('visibility events test', function () { cy.wait(1000); //Test if interactions were recorded - cy.request(`http://localhost/api/getEventData.php?doenetId[]=${doenetId}`) + cy.request(`/api/getEventData.php?doenetId[]=${doenetId}`) .then((resp) => { const events = resp.body.events; diff --git a/cypress/e2e/Gradebook/Gradebook.cy.js b/cypress/e2e/Gradebook/Gradebook.cy.js index 3276d8eea5..c025b5ad54 100644 --- a/cypress/e2e/Gradebook/Gradebook.cy.js +++ b/cypress/e2e/Gradebook/Gradebook.cy.js @@ -57,7 +57,7 @@ describe('Gradebook tests', function () { cy.createMultipageActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId1, pageDoenetId2, pageDoenetId3, doenetML1, doenetML2, doenetML3, shufflePages: true, shuffleDoenetId }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -73,7 +73,7 @@ describe('Gradebook tests', function () { cy.signin({ userId: studentUserId }) - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -137,7 +137,7 @@ describe('Gradebook tests', function () { cy.get('[data-test="Crumb 2"]').click(); cy.get('.navigationRow').should('have.length', 1); - cy.visit(`http://localhost/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`).then(() => { + cy.visit(`/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`).then(() => { // put inside a "then" just so that pageOrder and ns have their new values cy.get('#page3\\/_title1').should('have.text', `Option ${pageOrder[2]}`) @@ -165,7 +165,7 @@ describe('Gradebook tests', function () { cy.signin({ userId }); - cy.visit(`http://localhost/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`).then(() => { + cy.visit(`/course?tool=gradebookStudentAssignment&courseId=${courseId}&userId=${studentUserId}&doenetId=${doenetId}`).then(() => { // put inside a "then" just so that pageOrder and ns have their new values cy.get('#page3\\/_title1').should('have.text', `Option ${pageOrder[2]}`) diff --git a/cypress/e2e/Navigation/Activity.cy.js b/cypress/e2e/Navigation/Activity.cy.js index a42de310aa..a827d80030 100644 --- a/cypress/e2e/Navigation/Activity.cy.js +++ b/cypress/e2e/Navigation/Activity.cy.js @@ -1,39 +1,39 @@ describe('Activity test', function () { - const userId = "cyuserId"; - // const userId = "devuserId"; - const courseId = "courseid1"; - // const doenetId1 = "activity1id"; - // const pageDoenetId1 = "_page1id"; - // const doenetId2 = "activity2id"; - // const pageDoenetId2 = "_page2id"; - - before(()=>{ - // cy.clearAllOfAUsersActivities({userId}) - cy.signin({userId}); - cy.clearAllOfAUsersCoursesAndItems({userId}); - cy.createCourse({userId,courseId}); - }) - beforeEach(() => { - cy.signin({userId}); - cy.clearIndexedDB(); - cy.clearAllOfAUsersActivities({userId}) - // cy.createActivity({courseId,doenetId:doenetId1,parentDoenetId:courseId,pageDoenetId:pageDoenetId1}); - // cy.createActivity({courseId,doenetId:doenetId2,parentDoenetId:courseId,pageDoenetId:pageDoenetId2}); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) - }) + const userId = "cyuserId"; + // const userId = "devuserId"; + const courseId = "courseid1"; + // const doenetId1 = "activity1id"; + // const pageDoenetId1 = "_page1id"; + // const doenetId2 = "activity2id"; + // const pageDoenetId2 = "_page2id"; - it('Renaming activity',()=>{ - const label1 = 'Hello'; - const label2 = 'First Activity'; - cy.get('[data-test="Add Activity Button"]').click(); - cy.get('.navigationRow').should('have.length',1); //Need this to wait for the row to appear - cy.get('.navigationRow').eq(0).get('.navigationColumn1').contains('Untitled Activity'); - cy.get('.navigationRow').eq(0).get('.navigationColumn1').click(); - cy.get('[data-test="Label Activity"]', {timeout:20000}).should('be.visible').clear({scrollBehavior:false}).type(label1,{scrollBehavior:false}) - cy.get('[data-test="infoPanelItemLabel"]').click(); - cy.get('[data-test="rowLabel"]').should('contain.text', label1); - cy.get('[data-test="Label Activity"]', {timeout:20000}).should('be.visible').clear({scrollBehavior:false}).type(label2,{scrollBehavior:false}).type('{enter}',{scrollBehavior:false}); - cy.get('[data-test="rowLabel"]').should('contain.text', label2); + before(() => { + // cy.clearAllOfAUsersActivities({userId}) + cy.signin({ userId }); + cy.clearAllOfAUsersCoursesAndItems({ userId }); + cy.createCourse({ userId, courseId }); + }) + beforeEach(() => { + cy.signin({ userId }); + cy.clearIndexedDB(); + cy.clearAllOfAUsersActivities({ userId }) + // cy.createActivity({courseId,doenetId:doenetId1,parentDoenetId:courseId,pageDoenetId:pageDoenetId1}); + // cy.createActivity({courseId,doenetId:doenetId2,parentDoenetId:courseId,pageDoenetId:pageDoenetId2}); + cy.visit(`/course?tool=navigation&courseId=${courseId}`) + }) - }) + it('Renaming activity', () => { + const label1 = 'Hello'; + const label2 = 'First Activity'; + cy.get('[data-test="Add Activity Button"]').click(); + cy.get('.navigationRow').should('have.length', 1); //Need this to wait for the row to appear + cy.get('.navigationRow').eq(0).get('.navigationColumn1').contains('Untitled Activity'); + cy.get('.navigationRow').eq(0).get('.navigationColumn1').click(); + cy.get('[data-test="Label Activity"]', { timeout: 20000 }).should('be.visible').clear({ scrollBehavior: false }).type(label1, { scrollBehavior: false }) + cy.get('[data-test="infoPanelItemLabel"]').click(); + cy.get('[data-test="rowLabel"]').should('contain.text', label1); + cy.get('[data-test="Label Activity"]', { timeout: 20000 }).should('be.visible').clear({ scrollBehavior: false }).type(label2, { scrollBehavior: false }).type('{enter}', { scrollBehavior: false }); + cy.get('[data-test="rowLabel"]').should('contain.text', label2); + + }) }) \ No newline at end of file diff --git a/cypress/e2e/Navigation/Navigation.cy.js b/cypress/e2e/Navigation/Navigation.cy.js index b3ed343add..c92c94240e 100644 --- a/cypress/e2e/Navigation/Navigation.cy.js +++ b/cypress/e2e/Navigation/Navigation.cy.js @@ -10,19 +10,19 @@ describe('Navigation test', function () { // const doenetId2 = "activity2id"; // const pageDoenetId2 = "_page2id"; - before(()=>{ + before(() => { // cy.clearAllOfAUsersActivities({userId}) - cy.signin({userId}); - cy.clearAllOfAUsersCoursesAndItems({userId}); - cy.createCourse({userId,courseId}); + cy.signin({ userId }); + cy.clearAllOfAUsersCoursesAndItems({ userId }); + cy.createCourse({ userId, courseId }); }) beforeEach(() => { - cy.signin({userId}); + cy.signin({ userId }); cy.clearIndexedDB(); - cy.clearAllOfAUsersActivities({userId}) + cy.clearAllOfAUsersActivities({ userId }) // cy.createActivity({courseId,doenetId:doenetId1,parentDoenetId:courseId,pageDoenetId:pageDoenetId1}); // cy.createActivity({courseId,doenetId:doenetId2,parentDoenetId:courseId,pageDoenetId:pageDoenetId2}); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + cy.visit(`/course?tool=navigation&courseId=${courseId}`) }) @@ -30,51 +30,51 @@ describe('Navigation test', function () { // returning false here prevents Cypress from // failing the test return false -}) + }) -it('Test Add Activity',()=>{ - cy.get('[data-test="Add Activity Button"]').click(); + it('Test Add Activity', () => { + cy.get('[data-test="Add Activity Button"]').click(); - cy.get('.navigationRow').should('have.length',1); //Need this to wait for the row to appear - cy.wait(500) - cy.get('.navigationRow').eq(0).get('.navigationColumn1').contains('Untitled Activity'); + cy.get('.navigationRow').should('have.length', 1); //Need this to wait for the row to appear + cy.wait(500) + cy.get('.navigationRow').eq(0).get('.navigationColumn1').contains('Untitled Activity'); -}) + }) -it('Test Add Collection',()=>{ - cy.get('[data-test="Add Collection Button"]').click(); - cy.get('.navigationRow').should('have.length',1); //Need this to wait for the row to appear - cy.get('.navigationRow').eq(0).get('.navigationColumn1').contains('Untitled Collection'); - -}) + it('Test Add Collection', () => { + cy.get('[data-test="Add Collection Button"]').click(); + cy.get('.navigationRow').should('have.length', 1); //Need this to wait for the row to appear + cy.get('.navigationRow').eq(0).get('.navigationColumn1').contains('Untitled Collection'); -it('Test Add Section',()=>{ - cy.get('[data-test="Add Section Button"]').click(); + }) - cy.get('.navigationRow').should('have.length',1); //Need this to wait for the row to appear - cy.get('.navigationRow').eq(0).get('.navigationColumn1').contains('Untitled Section'); -}) + it('Test Add Section', () => { + cy.get('[data-test="Add Section Button"]').click(); -it('Test Add a Activity, Collection and Section',()=>{ - cy.get('[data-test="Add Activity Button"]').click(); - cy.get('.navigationRow').should('have.length',1); //Need this to wait for the 1st one to appear - cy.wait(500); + cy.get('.navigationRow').should('have.length', 1); //Need this to wait for the row to appear + cy.get('.navigationRow').eq(0).get('.navigationColumn1').contains('Untitled Section'); + }) - cy.get('[data-test="Add Collection Button"]').click(); - cy.get('.navigationRow').should('have.length',1); //Need this to wait for the 2nd one to appear - cy.wait(500); + it('Test Add a Activity, Collection and Section', () => { + cy.get('[data-test="Add Activity Button"]').click(); + cy.get('.navigationRow').should('have.length', 1); //Need this to wait for the 1st one to appear + cy.wait(500); - cy.get('[data-test="Add Section Button"]').click(); - cy.get('.navigationRow').should('have.length',3); //Need this to wait for the 3rd one to appear - cy.wait(500); + cy.get('[data-test="Add Collection Button"]').click(); + cy.get('.navigationRow').should('have.length', 1); //Need this to wait for the 2nd one to appear + cy.wait(500); - cy.get('.navigationRow').eq(0).get('.navigationColumn1').contains('Untitled Activity'); - cy.get('.navigationRow').eq(1).get('.navigationColumn1').contains('Untitled Collection'); - cy.get('.navigationRow').eq(2).get('.navigationColumn1').contains('Untitled Section'); + cy.get('[data-test="Add Section Button"]').click(); + cy.get('.navigationRow').should('have.length', 3); //Need this to wait for the 3rd one to appear + cy.wait(500); + cy.get('.navigationRow').eq(0).get('.navigationColumn1').contains('Untitled Activity'); + cy.get('.navigationRow').eq(1).get('.navigationColumn1').contains('Untitled Collection'); + cy.get('.navigationRow').eq(2).get('.navigationColumn1').contains('Untitled Section'); + + + }) -}) - }) \ No newline at end of file diff --git a/cypress/e2e/Public/publicActivities.cy.js b/cypress/e2e/Public/publicActivities.cy.js index b776caadad..ee803837ee 100644 --- a/cypress/e2e/Public/publicActivities.cy.js +++ b/cypress/e2e/Public/publicActivities.cy.js @@ -38,25 +38,25 @@ describe('Multipage activity tests', function () {

This is public

` - cy.createActivity({courseId,doenetId,parentDoenetId:courseId,pageDoenetId, doenetML}); + cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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').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.log('Document is not public by default') - cy.visit(`http://localhost/public?doenetId=${doenetId}`) + cy.visit(`/public?doenetId=${doenetId}`) cy.get('[data-test="Main Panel"]').should('contain.text', 'not found'); cy.go("back"); - cy.visit(`http://localhost/public?tool=editor&doenetId=${doenetId}`) + cy.visit(`/public?tool=editor&doenetId=${doenetId}`) cy.get('[data-test="Main Panel"]').should('contain.text', 'not found'); cy.go("back"); @@ -66,7 +66,7 @@ describe('Multipage activity tests', function () { cy.get('[data-test="Make Publicly Visible"]').click() cy.wait(1000); - cy.visit(`http://localhost/public?doenetId=${doenetId}`) + cy.visit(`/public?doenetId=${doenetId}`) cy.get('#\\/_p1').should('have.text', 'This is public') @@ -74,7 +74,7 @@ describe('Multipage activity tests', function () { cy.go("back"); - cy.visit(`http://localhost/public?tool=editor&doenetId=${doenetId}`) + cy.visit(`/public?tool=editor&doenetId=${doenetId}`) cy.get('[data-test="Main Panel"]').should('contain.text', 'not found'); cy.go("back"); @@ -84,7 +84,7 @@ describe('Multipage activity tests', function () { cy.get('[data-test="Show DoenetML Source"]').click() cy.wait(1000); - cy.visit(`http://localhost/public?doenetId=${doenetId}`) + cy.visit(`/public?doenetId=${doenetId}`) cy.get('#\\/_p1').should('have.text', 'This is public') @@ -92,7 +92,7 @@ describe('Multipage activity tests', function () { cy.go("back"); - cy.visit(`http://localhost/public?tool=editor&doenetId=${doenetId}`) + cy.visit(`/public?tool=editor&doenetId=${doenetId}`) cy.get('#\\/_p1').should('have.text', 'This is public') cy.get('#\\/_p2').should('not.exist') @@ -125,7 +125,7 @@ describe('Multipage activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -140,7 +140,7 @@ describe('Multipage activity tests', function () { cy.get('[data-test="Show DoenetML Source"]').click() cy.wait(1000) - cy.visit(`http://localhost/public?doenetId=${doenetId}`) + cy.visit(`/public?doenetId=${doenetId}`) cy.get('#\\/_section1_title').should('have.text', 'Section 1') @@ -190,7 +190,7 @@ describe('Multipage activity tests', function () { }) - cy.visit(`http://localhost/public?tool=editor&doenetId=${doenetId}`) + cy.visit(`/public?tool=editor&doenetId=${doenetId}`) cy.get('#\\/_section1_title').should('have.text', 'Section 1') cy.url().should('match', /[^#]/) @@ -266,7 +266,7 @@ describe('Multipage activity tests', function () { cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId, doenetML }); - cy.visit(`http://localhost/course?tool=navigation&courseId=${courseId}`) + 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(); @@ -281,7 +281,7 @@ describe('Multipage activity tests', function () { cy.get('[data-test="Show DoenetML Source"]').click() cy.wait(1000) - cy.visit(`http://localhost/public?doenetId=${doenetId}`) + cy.visit(`/public?doenetId=${doenetId}`) cy.get('#\\/_section1_title').should('have.text', 'Section 1') @@ -329,7 +329,7 @@ describe('Multipage activity tests', function () { expect(rect.top).gt(headerPixels - 1).lt(headerPixels + 1) }) - cy.visit(`http://localhost/public?tool=editor&doenetId=${doenetId}`) + cy.visit(`/public?tool=editor&doenetId=${doenetId}`) cy.get('#\\/_section1_title').should('have.text', 'Section 1') diff --git a/cypress/e2e/UIComponents/ActionButton.cy.js b/cypress/e2e/UIComponents/ActionButton.cy.js index 6c1ec7bcc1..1482ee74dd 100644 --- a/cypress/e2e/UIComponents/ActionButton.cy.js +++ b/cypress/e2e/UIComponents/ActionButton.cy.js @@ -1,26 +1,26 @@ describe('ActionButton Tests', function () { -before(() => { - cy.visit("http://localhost/uiDocs"); - cy.get('[data-test="componentLinkactionbutton"] > a').click(); -}) - - - -// it('Button Width CSS Test',()=>{ -// cy.get('[data-test="ActionButton width example"]').contains('Action Button'); -// }) - -it('Button value has Edit',()=>{ - cy.get('[data-test="ActionButton Edit Value example"]').contains('Edit'); -}) - -it('Test onClick',()=>{ - cy.get('[data-test="ActionButton click example"]').click(); - cy.get('[data-test="action result"]').contains('ActionButton clicked'); - cy.get('[data-test="clear action result"]').click(); -}) + before(() => { + cy.visit("/uiDocs"); + cy.get('[data-test="componentLinkactionbutton"] > a').click(); + }) + + + + // it('Button Width CSS Test',()=>{ + // cy.get('[data-test="ActionButton width example"]').contains('Action Button'); + // }) + + it('Button value has Edit', () => { + cy.get('[data-test="ActionButton Edit Value example"]').contains('Edit'); + }) + + it('Test onClick', () => { + cy.get('[data-test="ActionButton click example"]').click(); + cy.get('[data-test="action result"]').contains('ActionButton clicked'); + cy.get('[data-test="clear action result"]').click(); + }) diff --git a/cypress/e2e/course/courseTiming.cy.js b/cypress/e2e/course/courseTiming.cy.js index df8a1f793a..a8de287c4e 100644 --- a/cypress/e2e/course/courseTiming.cy.js +++ b/cypress/e2e/course/courseTiming.cy.js @@ -1,47 +1,47 @@ describe('Course Timing Tests', function () { - const userId = "cyuserId"; - // const userId = "devuserId"; - const courseId = "courseid1"; - const doenetId = "activity1id"; - const pageDoenetId = "_page1id"; - - - before(()=>{ - cy.signin({userId}); - cy.clearAllOfAUsersCoursesAndItems({userId}); - cy.createCourse({userId,courseId}); + const userId = "cyuserId"; + // const userId = "devuserId"; + const courseId = "courseid1"; + const doenetId = "activity1id"; + const pageDoenetId = "_page1id"; + + + before(() => { + cy.signin({ userId }); + cy.clearAllOfAUsersCoursesAndItems({ userId }); + cy.createCourse({ userId, courseId }); }) - beforeEach(()=>{ - cy.signin({userId}); + beforeEach(() => { + cy.signin({ userId }); cy.clearIndexedDB(); - cy.clearAllOfAUsersActivities({userId}) - cy.createActivity({courseId,doenetId,parentDoenetId:courseId,pageDoenetId}); - cy.visit(`http://localhost/course?tool=dashboard&courseId=${courseId}`); + cy.clearAllOfAUsersActivities({ userId }) + cy.createActivity({ courseId, doenetId, parentDoenetId: courseId, pageDoenetId }); + cy.visit(`/course?tool=dashboard&courseId=${courseId}`); cy.get('[data-test="ClassTimes Menu"]').click(); cy.get('.svg-inline--fa.fa-plus').click(); }) - - - - it.skip('choosing class timing by clicking',()=>{ - const correctTime ='1:00 PM'; - cy.get('.rdt').eq(0).click(); - cy.get('.rdtCounter > .rdtBtn').eq(0).click(); - cy.get('.rdtCounter> .rdtBtn').eq(4).click(); - cy.get('[data-test="Main Panel"]').click(); - cy.get('.form-control').eq(0).should('have.value', correctTime); - - }) - - it.skip('choosing class timing by typing', ()=>{ - cy.get('.rdt').eq(0).click(); - cy.get(' .form-control').eq(0).type('1:00 PM'); - cy.get('[data-test="Main Panel"]').click(); - cy.get('.form-control').eq(0).should('have.value', '1:00 PM'); - - }) + + + + it.skip('choosing class timing by clicking', () => { + const correctTime = '1:00 PM'; + cy.get('.rdt').eq(0).click(); + cy.get('.rdtCounter > .rdtBtn').eq(0).click(); + cy.get('.rdtCounter> .rdtBtn').eq(4).click(); + cy.get('[data-test="Main Panel"]').click(); + cy.get('.form-control').eq(0).should('have.value', correctTime); + + }) + + it.skip('choosing class timing by typing', () => { + cy.get('.rdt').eq(0).click(); + cy.get(' .form-control').eq(0).type('1:00 PM'); + cy.get('[data-test="Main Panel"]').click(); + cy.get('.form-control').eq(0).should('have.value', '1:00 PM'); + + }) }) diff --git a/src/Core/Core.js b/src/Core/Core.js index cc93678668..e835327b4a 100644 --- a/src/Core/Core.js +++ b/src/Core/Core.js @@ -31,6 +31,7 @@ export default class Core { requestedVariant, requestedVariantIndex, previousComponentTypeCounts = {}, flags = {}, + theme, prerender = false, stateVariableChanges = {}, coreId, updateDataOnContentChange }) { @@ -52,6 +53,7 @@ export default class Core { this.numerics = new Numerics(); // this.flags = new Proxy(flags, readOnlyProxyHandler); //components shouldn't modify flags this.flags = flags; + this.theme = theme; this.finishCoreConstruction = this.finishCoreConstruction.bind(this); this.getStateVariableValue = this.getStateVariableValue.bind(this); @@ -190,6 +192,12 @@ export default class Core { }); this.documentName = serializedComponents[0].componentName; + + if (!serializedComponents[0].state) { + serializedComponents[0].state = {}; + } + serializedComponents[0].state.theme = this.theme; + serializedComponents[0].doenetAttributes.cid = this.cid; this._components = {}; @@ -8192,6 +8200,22 @@ export default class Core { async performAction({ componentName, actionName, args, event, caseInsensitiveMatch }) { + if (actionName === "setTheme" && !componentName) { + // For now, co-opting the action mechanism to let the viewer set the theme (dark mode) on document. + // Don't have an actual action on document as don't want the ability for others to call it. + // Theme doesn't affect the colors displayed, only the words in the styleDescriptions. + return await this.performUpdate({ + updateInstructions: [{ + updateType: "updateValue", + componentName: this.documentName, + stateVariable: "theme", + value: args.theme, + }], + actionId: args.actionId, + doNotSave: true, // this isn't an interaction, so don't save page state + }); + } + let component = this.components[componentName]; if (component && component.actions) { let action = component.actions[actionName]; diff --git a/src/Core/components/Circle.js b/src/Core/components/Circle.js index 47d4f0c07e..536d5dce87 100644 --- a/src/Core/components/Circle.js +++ b/src/Core/components/Circle.js @@ -70,9 +70,21 @@ export default class Circle extends Curve { dependencyType: "stateVariable", variableName: "filled", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + let borderDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { @@ -87,16 +99,24 @@ export default class Circle extends Curve { let styleDescription; if (!dependencyValues.filled) { - styleDescription = borderDescription + dependencyValues.selectedStyle.lineColorWord; + styleDescription = borderDescription + lineColorWord; } else { - if (dependencyValues.selectedStyle.fillColorWord === dependencyValues.selectedStyle.lineColorWord) { - styleDescription = "filled " + dependencyValues.selectedStyle.fillColorWord; + + let fillColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + fillColorWord = dependencyValues.selectedStyle.fillColorWordDarkMode; + } else { + fillColorWord = dependencyValues.selectedStyle.fillColorWord; + } + + if (fillColorWord === lineColorWord) { + styleDescription = "filled " + fillColorWord; if (borderDescription) { styleDescription += " with " + borderDescription + "border"; } } else { - styleDescription = "filled " + dependencyValues.selectedStyle.fillColorWord - + " with " + borderDescription + dependencyValues.selectedStyle.lineColorWord + styleDescription = "filled " + fillColorWord + + " with " + borderDescription + lineColorWord + " border"; } } @@ -119,9 +139,21 @@ export default class Circle extends Curve { dependencyType: "stateVariable", variableName: "filled", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + let borderDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { if (borderDescription) { @@ -135,18 +167,26 @@ export default class Circle extends Curve { let styleDescriptionWithNoun; if (!dependencyValues.filled) { - styleDescriptionWithNoun = borderDescription + dependencyValues.selectedStyle.lineColorWord + styleDescriptionWithNoun = borderDescription + lineColorWord + " circle"; } else { - if (dependencyValues.selectedStyle.fillColorWord === dependencyValues.selectedStyle.lineColorWord) { - styleDescriptionWithNoun = "filled " + dependencyValues.selectedStyle.fillColorWord + + let fillColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + fillColorWord = dependencyValues.selectedStyle.fillColorWordDarkMode; + } else { + fillColorWord = dependencyValues.selectedStyle.fillColorWord; + } + + if (fillColorWord === lineColorWord) { + styleDescriptionWithNoun = "filled " + fillColorWord + " circle"; if (borderDescription) { styleDescriptionWithNoun += " with a " + borderDescription + "border"; } } else { - styleDescriptionWithNoun = "filled " + dependencyValues.selectedStyle.fillColorWord - + " circle with a " + borderDescription + dependencyValues.selectedStyle.lineColorWord + styleDescriptionWithNoun = "filled " + fillColorWord + + " circle with a " + borderDescription + lineColorWord + " border"; } } @@ -166,9 +206,21 @@ export default class Circle extends Curve { dependencyType: "stateVariable", variableName: "selectedStyle", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + let borderStyleDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { if (borderStyleDescription) { @@ -181,7 +233,7 @@ export default class Circle extends Curve { borderStyleDescription += " "; } - borderStyleDescription += dependencyValues.selectedStyle.lineColorWord + borderStyleDescription += lineColorWord return { setValue: { borderStyleDescription } }; } @@ -201,15 +253,26 @@ export default class Circle extends Curve { dependencyType: "stateVariable", variableName: "filled", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let fillColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + fillColorWord = dependencyValues.selectedStyle.fillColorWordDarkMode; + } else { + fillColorWord = dependencyValues.selectedStyle.fillColorWord; + } let fillStyleDescription; if (!dependencyValues.filled) { fillStyleDescription = "unfilled"; } else { - fillStyleDescription = dependencyValues.selectedStyle.fillColorWord; + fillStyleDescription = fillColorWord; } return { setValue: { fillStyleDescription } }; diff --git a/src/Core/components/Curve.js b/src/Core/components/Curve.js index b709f7ebed..d126b2694d 100644 --- a/src/Core/components/Curve.js +++ b/src/Core/components/Curve.js @@ -245,9 +245,22 @@ export default class Curve extends GraphicalComponent { dependencyType: "stateVariable", variableName: "selectedStyle", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + + let styleDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { if (styleDescription) { @@ -260,7 +273,7 @@ export default class Curve extends GraphicalComponent { styleDescription += " "; } - styleDescription += dependencyValues.selectedStyle.lineColorWord + styleDescription += lineColorWord return { setValue: { styleDescription } }; } diff --git a/src/Core/components/DiscreteSimulationResultPolyline.js b/src/Core/components/DiscreteSimulationResultPolyline.js index 25b0b24fd9..952ae0cd50 100644 --- a/src/Core/components/DiscreteSimulationResultPolyline.js +++ b/src/Core/components/DiscreteSimulationResultPolyline.js @@ -56,9 +56,21 @@ export default class DiscreteSimulationResultPolyline extends GraphicalComponent dependencyType: "stateVariable", variableName: "selectedStyle", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + let curveDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { if (curveDescription) { @@ -71,7 +83,7 @@ export default class DiscreteSimulationResultPolyline extends GraphicalComponent curveDescription += " "; } - curveDescription += dependencyValues.selectedStyle.lineColorWord + curveDescription += lineColorWord return { setValue: { styleDescription: curveDescription } }; } diff --git a/src/Core/components/Document.js b/src/Core/components/Document.js index e219761851..ac105071fe 100644 --- a/src/Core/components/Document.js +++ b/src/Core/components/Document.js @@ -9,7 +9,7 @@ export default class Document extends BaseComponent { Object.assign(this.actions, { submitAllAnswers: this.submitAllAnswers.bind(this), - recordVisibilityChange: this.recordVisibilityChange.bind(this) + recordVisibilityChange: this.recordVisibilityChange.bind(this), }); } @@ -167,6 +167,48 @@ export default class Document extends BaseComponent { } } + // Theme is used to by styleDescriptions to use the dark mode words if theme is dark. + // It is set to be either "light" or "dark" via an action sent by the viewer. + stateVariableDefinitions.theme = { + hasEssential: true, + defaultValue: "light", + returnDependencies: () => ({ + documentAncestor: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + } + }), + definition({ dependencyValues }) { + if (dependencyValues.documentAncestor) { + // this document is inside another document so use the ancestor's value + return { setValue: { theme: dependencyValues.documentAncestor.stateValues.theme } } + } else { + return { useEssentialOrDefaultValue: { theme: true } } + } + }, + inverseDefinition({ desiredStateVariableValues, dependencyValues }) { + if (dependencyValues.documentAncestor) { + return { + success: true, + instructions: [{ + setDependency: "documentAncestor", + desiredValue: desiredStateVariableValues.theme, + }] + } + } else { + return { + success: true, + instructions: [{ + setEssentialValue: "theme", + value: desiredStateVariableValues.theme, + }] + } + } + + } + } + stateVariableDefinitions.level = { forRenderer: true, returnDependencies: () => ({}), diff --git a/src/Core/components/Function.js b/src/Core/components/Function.js index 0ecddd7d4f..634e2eb29a 100644 --- a/src/Core/components/Function.js +++ b/src/Core/components/Function.js @@ -235,9 +235,21 @@ export default class Function extends InlineComponent { dependencyType: "stateVariable", variableName: "selectedStyle", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + let styleDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { if (styleDescription) { @@ -250,7 +262,7 @@ export default class Function extends InlineComponent { styleDescription += " "; } - styleDescription += dependencyValues.selectedStyle.lineColorWord + styleDescription += lineColorWord return { setValue: { styleDescription } }; } diff --git a/src/Core/components/Line.js b/src/Core/components/Line.js index 88aa34a37c..f206fdb3d6 100644 --- a/src/Core/components/Line.js +++ b/src/Core/components/Line.js @@ -166,9 +166,22 @@ export default class Line extends GraphicalComponent { dependencyType: "stateVariable", variableName: "selectedStyle", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + + let styleDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { if (styleDescription) { @@ -181,7 +194,7 @@ export default class Line extends GraphicalComponent { styleDescription += " "; } - styleDescription += dependencyValues.selectedStyle.lineColorWord + styleDescription += lineColorWord return { setValue: { styleDescription } }; } diff --git a/src/Core/components/LineSegment.js b/src/Core/components/LineSegment.js index d651bd7349..8e34e4d550 100644 --- a/src/Core/components/LineSegment.js +++ b/src/Core/components/LineSegment.js @@ -70,9 +70,21 @@ export default class LineSegment extends GraphicalComponent { dependencyType: "stateVariable", variableName: "selectedStyle", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + let styleDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { if (styleDescription) { @@ -85,7 +97,7 @@ export default class LineSegment extends GraphicalComponent { styleDescription += " "; } - styleDescription += dependencyValues.selectedStyle.lineColorWord + styleDescription += lineColorWord return { setValue: { styleDescription } }; } diff --git a/src/Core/components/Point.js b/src/Core/components/Point.js index ae0d8d2a9a..55d2d0b27f 100644 --- a/src/Core/components/Point.js +++ b/src/Core/components/Point.js @@ -257,12 +257,23 @@ export default class Point extends GraphicalComponent { dependencyType: "stateVariable", variableName: "selectedStyle", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let markerColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + markerColorWord = dependencyValues.selectedStyle.markerColorWordDarkMode; + } else { + markerColorWord = dependencyValues.selectedStyle.markerColorWord; + } return { setValue: { - styleDescription: dependencyValues.selectedStyle.markerColorWord + styleDescription: markerColorWord } }; } @@ -278,10 +289,14 @@ export default class Point extends GraphicalComponent { dependencyType: "stateVariable", variableName: "selectedStyle", }, + styleDescription: { + dependencyType: "stateVariable", + variableName: "styleDescription", + }, }), definition: function ({ dependencyValues }) { - let pointDescription = dependencyValues.selectedStyle.markerColorWord + let pointDescription = dependencyValues.styleDescription + " " + dependencyValues.selectedStyle.markerStyleWord; return { setValue: { styleDescriptionWithNoun: pointDescription } }; } diff --git a/src/Core/components/Polygon.js b/src/Core/components/Polygon.js index 6b602c7000..47f4610b6a 100644 --- a/src/Core/components/Polygon.js +++ b/src/Core/components/Polygon.js @@ -58,9 +58,21 @@ export default class Polygon extends Polyline { dependencyType: "stateVariable", variableName: "filled", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + let borderDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { if (borderDescription) { @@ -74,16 +86,24 @@ export default class Polygon extends Polyline { let styleDescription; if (!dependencyValues.filled) { - styleDescription = borderDescription + dependencyValues.selectedStyle.lineColorWord; + styleDescription = borderDescription + lineColorWord; } else { - if (dependencyValues.selectedStyle.fillColorWord === dependencyValues.selectedStyle.lineColorWord) { - styleDescription = "filled " + dependencyValues.selectedStyle.fillColorWord; + + let fillColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + fillColorWord = dependencyValues.selectedStyle.fillColorWordDarkMode; + } else { + fillColorWord = dependencyValues.selectedStyle.fillColorWord; + } + + if (fillColorWord === lineColorWord) { + styleDescription = "filled " + fillColorWord; if (borderDescription) { styleDescription += " with " + borderDescription + "border"; } } else { - styleDescription = "filled " + dependencyValues.selectedStyle.fillColorWord - + " with " + borderDescription + dependencyValues.selectedStyle.lineColorWord + styleDescription = "filled " + fillColorWord + + " with " + borderDescription + lineColorWord + " border"; } } @@ -106,9 +126,22 @@ export default class Polygon extends Polyline { dependencyType: "stateVariable", variableName: "filled", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + + let borderDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { if (borderDescription) { @@ -122,18 +155,26 @@ export default class Polygon extends Polyline { let styleDescriptionWithNoun; if (!dependencyValues.filled) { - styleDescriptionWithNoun = borderDescription + dependencyValues.selectedStyle.lineColorWord + styleDescriptionWithNoun = borderDescription + lineColorWord + " polygon"; } else { - if (dependencyValues.selectedStyle.fillColorWord === dependencyValues.selectedStyle.lineColorWord) { - styleDescriptionWithNoun = "filled " + dependencyValues.selectedStyle.fillColorWord + + let fillColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + fillColorWord = dependencyValues.selectedStyle.fillColorWordDarkMode; + } else { + fillColorWord = dependencyValues.selectedStyle.fillColorWord; + } + + if (fillColorWord === lineColorWord) { + styleDescriptionWithNoun = "filled " + fillColorWord + " polygon"; if (borderDescription) { styleDescriptionWithNoun += " with a " + borderDescription + "border"; } } else { - styleDescriptionWithNoun = "filled " + dependencyValues.selectedStyle.fillColorWord - + " polygon with a " + borderDescription + dependencyValues.selectedStyle.lineColorWord + styleDescriptionWithNoun = "filled " + fillColorWord + + " polygon with a " + borderDescription + lineColorWord + " border"; } } @@ -153,9 +194,21 @@ export default class Polygon extends Polyline { dependencyType: "stateVariable", variableName: "selectedStyle", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + let borderStyleDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { @@ -169,7 +222,7 @@ export default class Polygon extends Polyline { borderStyleDescription += " "; } - borderStyleDescription += dependencyValues.selectedStyle.lineColorWord + borderStyleDescription += lineColorWord return { setValue: { borderStyleDescription } }; } @@ -189,15 +242,27 @@ export default class Polygon extends Polyline { dependencyType: "stateVariable", variableName: "filled", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let fillColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + fillColorWord = dependencyValues.selectedStyle.fillColorWordDarkMode; + } else { + fillColorWord = dependencyValues.selectedStyle.fillColorWord; + } + let fillStyleDescription; if (!dependencyValues.filled) { fillStyleDescription = "unfilled"; } else { - fillStyleDescription = dependencyValues.selectedStyle.fillColorWord; + fillStyleDescription = fillColorWord; } return { setValue: { fillStyleDescription } }; diff --git a/src/Core/components/Polyline.js b/src/Core/components/Polyline.js index 62c62ece39..fd300f03db 100644 --- a/src/Core/components/Polyline.js +++ b/src/Core/components/Polyline.js @@ -52,9 +52,21 @@ export default class Polyline extends GraphicalComponent { dependencyType: "stateVariable", variableName: "selectedStyle", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + let styleDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { if (styleDescription) { @@ -67,7 +79,7 @@ export default class Polyline extends GraphicalComponent { styleDescription += " "; } - styleDescription += dependencyValues.selectedStyle.lineColorWord + styleDescription += lineColorWord return { setValue: { styleDescription } }; } diff --git a/src/Core/components/Ray.js b/src/Core/components/Ray.js index 3a9b3f1a0f..fb80024e66 100644 --- a/src/Core/components/Ray.js +++ b/src/Core/components/Ray.js @@ -54,9 +54,21 @@ export default class Ray extends GraphicalComponent { dependencyType: "stateVariable", variableName: "selectedStyle", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + let styleDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { if (styleDescription) { @@ -69,7 +81,7 @@ export default class Ray extends GraphicalComponent { styleDescription += " "; } - styleDescription += dependencyValues.selectedStyle.lineColorWord + styleDescription += lineColorWord return { setValue: { styleDescription } }; } diff --git a/src/Core/components/RegionBetweenCurveXAxis.js b/src/Core/components/RegionBetweenCurveXAxis.js index 9a6f86787b..70425c2f2f 100644 --- a/src/Core/components/RegionBetweenCurveXAxis.js +++ b/src/Core/components/RegionBetweenCurveXAxis.js @@ -37,12 +37,22 @@ export default class RegionBetweenCurveXAxis extends GraphicalComponent { dependencyType: "stateVariable", variableName: "selectedStyle", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { - let styleDescription = dependencyValues.selectedStyle.fillColorWord; + let fillColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + fillColorWord = dependencyValues.selectedStyle.fillColorWordDarkMode; + } else { + fillColorWord = dependencyValues.selectedStyle.fillColorWord; + } - return { setValue: { styleDescription } }; + return { setValue: { styleDescription: fillColorWord } }; } } diff --git a/src/Core/components/StyleDefinitions.js b/src/Core/components/StyleDefinitions.js index 66c5d5c5d3..c0a93a8324 100644 --- a/src/Core/components/StyleDefinitions.js +++ b/src/Core/components/StyleDefinitions.js @@ -53,7 +53,7 @@ export class StyleDefinition extends BaseComponent { styleDefinition[styleAttr] = dependencyValues[styleAttr].stateValues.value; - if(typeof styleDefinition[styleAttr] === "string") { + if (typeof styleDefinition[styleAttr] === "string") { styleDefinition[styleAttr] = styleDefinition[styleAttr].toLowerCase(); } } diff --git a/src/Core/components/Vector.js b/src/Core/components/Vector.js index 53e963fe98..54c9a8568b 100644 --- a/src/Core/components/Vector.js +++ b/src/Core/components/Vector.js @@ -246,9 +246,21 @@ export default class Vector extends GraphicalComponent { dependencyType: "stateVariable", variableName: "selectedStyle", }, + document: { + dependencyType: "ancestor", + componentType: "document", + variableNames: ["theme"] + }, }), definition: function ({ dependencyValues }) { + let lineColorWord; + if (dependencyValues.document?.stateValues.theme === "dark") { + lineColorWord = dependencyValues.selectedStyle.lineColorWordDarkMode; + } else { + lineColorWord = dependencyValues.selectedStyle.lineColorWord; + } + let styleDescription = dependencyValues.selectedStyle.lineWidthWord; if (dependencyValues.selectedStyle.lineStyleWord) { if (styleDescription) { @@ -261,7 +273,7 @@ export default class Vector extends GraphicalComponent { styleDescription += " "; } - styleDescription += dependencyValues.selectedStyle.lineColorWord + styleDescription += lineColorWord return { setValue: { styleDescription } }; } diff --git a/src/Core/utils/style.js b/src/Core/utils/style.js index 9d9bc1cf7d..890e828e65 100644 --- a/src/Core/utils/style.js +++ b/src/Core/utils/style.js @@ -2,6 +2,8 @@ export let styleAttributes = { lineColor: { componentType: "text" }, lineColorWord: { componentType: "text" }, + lineColorDarkMode: { componentType: "text" }, + lineColorWordDarkMode: { componentType: "text" }, lineOpacity: { componentType: "number" }, lineWidth: { componentType: "number" }, lineWidthWord: { componentType: "text" }, @@ -9,6 +11,8 @@ export let styleAttributes = { lineStyleWord: { componentType: "text" }, markerColor: { componentType: "text" }, markerColorWord: { componentType: "text" }, + markerColorDarkMode: { componentType: "text" }, + markerColorWordDarkMode: { componentType: "text" }, // marker styles: cross, circle, square, plus, diamond, // triangle (alias for triangleUp), triangleUp, triangleDown, triangleLeft, triangleRight markerStyle: { componentType: "text" }, @@ -16,12 +20,16 @@ export let styleAttributes = { markerSize: { componentType: "number" }, fillColor: { componentType: "text" }, fillColorWord: { componentType: "text" }, + fillColorDarkMode: { componentType: "text" }, + fillColorWordDarkMode: { componentType: "text" }, fillOpacity: { componentType: "number" }, } let defaultStyle = { lineColor: "#648FFF", lineColorWord: "blue", + lineColorDarkMode: "#648FFF", + lineColorWordDarkMode: "blue", lineOpacity: 0.7, lineWidth: 4, lineWidthWord: "thick", @@ -29,11 +37,15 @@ let defaultStyle = { lineStyleWord: "", markerColor: "#648FFF", markerColorWord: "blue", + markerColorDarkMode: "#648FFF", + markerColorWordDarkMode: "blue", markerStyle: "circle", markerStyleWord: "point", markerSize: 5, fillColor: "#648FFF", fillColorWord: "blue", + fillColorDarkMode: "#648FFF", + fillColorWordDarkMode: "blue", fillOpacity: 0.3, } @@ -44,6 +56,8 @@ function returnDefaultStyleDefinitions() { 1: { lineColor: "#648FFF", lineColorWord: "blue", + lineColorDarkMode: "#648FFF", + lineColorWordDarkMode: "blue", lineOpacity: 0.7, lineWidth: 4, lineWidthWord: "thick", @@ -51,16 +65,22 @@ function returnDefaultStyleDefinitions() { lineStyleWord: "", markerColor: "#648FFF", markerColorWord: "blue", + markerColorDarkMode: "#648FFF", + markerColorWordDarkMode: "blue", markerStyle: "circle", markerStyleWord: "point", markerSize: 5, fillColor: "#648FFF", fillColorWord: "blue", + fillColorDarkMode: "#648FFF", + fillColorWordDarkMode: "blue", fillOpacity: 0.3, }, 2: { lineColor: "#D4042D", lineColorWord: "red", + lineColorDarkMode: "#D4042D", + lineColorWordDarkMode: "red", lineOpacity: 0.7, lineWidth: 2, lineWidthWord: "", @@ -68,16 +88,22 @@ function returnDefaultStyleDefinitions() { lineStyleWord: "", markerColor: "#D4042D", markerColorWord: "red", + markerColorDarkMode: "#D4042D", + markerColorWordDarkMode: "red", markerStyle: "square", markerStyleWord: "square", markerSize: 5, fillColor: "#D4042D", fillColorWord: "red", + fillColorDarkMode: "#D4042D", + fillColorWordDarkMode: "red", fillOpacity: 0.3, }, 3: { lineColor: "#F19143", lineColorWord: "orange", + lineColorDarkMode: "#F19143", + lineColorWordDarkMode: "orange", lineOpacity: 0.7, lineWidth: 3, lineWidthWord: "", @@ -85,16 +111,22 @@ function returnDefaultStyleDefinitions() { lineStyleWord: "", markerColor: "#F19143", markerColorWord: "orange", + markerColorDarkMode: "#F19143", + markerColorWordDarkMode: "orange", markerStyle: "triangle", markerStyleWord: "triangle", markerSize: 5, fillColor: "#F19143", fillColorWord: "orange", + fillColorDarkMode: "#F19143", + fillColorWordDarkMode: "orange", fillOpacity: 0.3, }, 4: { lineColor: "#644CD6", lineColorWord: "purple", + lineColorDarkMode: "#644CD6", + lineColorWordDarkMode: "purple", lineOpacity: 0.7, lineWidth: 2, lineWidthWord: "", @@ -102,16 +134,22 @@ function returnDefaultStyleDefinitions() { lineStyleWord: "", markerColor: "#644CD6", markerColorWord: "purple", + markerColorDarkMode: "#644CD6", + markerColorWordDarkMode: "purple", markerStyle: "diamond", markerStyleWord: "diamond", markerSize: 5, fillColor: "#644CD6", fillColorWord: "purple", + fillColorDarkMode: "#644CD6", + fillColorWordDarkMode: "purple", fillOpacity: 0.3, }, 5: { lineColor: "black", lineColorWord: "black", + lineColorDarkMode: "white", + lineColorWordDarkMode: "white", lineOpacity: 0.7, lineWidth: 1, lineWidthWord: "thin", @@ -119,16 +157,22 @@ function returnDefaultStyleDefinitions() { lineStyleWord: "", markerColor: "black", markerColorWord: "black", + markerColorDarkMode: "white", + markerColorWordDarkMode: "white", markerStyle: "circle", markerStyleWord: "point", markerSize: 5, fillColor: "black", fillColorWord: "black", + fillColorDarkMode: "white", + fillColorWordDarkMode: "white", fillOpacity: 0.3, }, 6: { lineColor: "gray", lineColorWord: "gray", + lineColorDarkMode: "gray", + lineColorWordDarkMode: "gray", lineOpacity: 0.7, lineWidth: 1, lineWidthWord: "thin", @@ -136,11 +180,15 @@ function returnDefaultStyleDefinitions() { lineStyleWord: "dotted", markerColor: "gray", markerColorWord: "gray", + markerColorDarkMode: "gray", + markerColorWordDarkMode: "gray", markerStyle: "circle", markerStyleWord: "point", markerSize: 5, fillColor: "gray", fillColorWord: "gray", + fillColorDarkMode: "gray", + fillColorWordDarkMode: "gray", fillOpacity: 0.3, } } @@ -228,6 +276,13 @@ export function returnStyleDefinitionStateVariables() { if ("markerColor" in theNewDef && !("markerColorWord" in theNewDef)) { theNewDef.markerColorWord = theNewDef.markerColor; } + if ("markerColorDarkMode" in theNewDef && !("markerColorWordDarkMode" in theNewDef)) { + theNewDef.markerColorWordDarkMode = theNewDef.markerColorDarkMode; + } + if ("markerColor" in theNewDef && !("markerColorDarkMode" in theNewDef)) { + theNewDef.markerColorDarkMode = theNewDef.markerColor; + theNewDef.markerColorWordDarkMode = theNewDef.markerWordColor; + } if ("markerStyle" in theNewDef && !("markerStyleWord" in theNewDef)) { theNewDef.markerStyleWord = theNewDef.markerStyle; if (theNewDef.markerStyleWord === "circle") { @@ -239,9 +294,23 @@ export function returnStyleDefinitionStateVariables() { if ("lineColor" in theNewDef && !("lineColorWord" in theNewDef)) { theNewDef.lineColorWord = theNewDef.lineColor; } + if ("lineColorDarkMode" in theNewDef && !("lineColorWordDarkMode" in theNewDef)) { + theNewDef.lineColorWordDarkMode = theNewDef.lineColorDarkMode; + } + if ("lineColor" in theNewDef && !("lineColorDarkMode" in theNewDef)) { + theNewDef.lineColorDarkMode = theNewDef.lineColor; + theNewDef.lineColorWordDarkMode = theNewDef.lineWordColor; + } if ("fillColor" in theNewDef && !("fillColorWord" in theNewDef)) { theNewDef.fillColorWord = theNewDef.fillColor; } + if ("fillColorDarkMode" in theNewDef && !("fillColorWordDarkMode" in theNewDef)) { + theNewDef.fillColorWordDarkMode = theNewDef.fillColorDarkMode; + } + if ("fillColor" in theNewDef && !("fillColorDarkMode" in theNewDef)) { + theNewDef.fillColorDarkMode = theNewDef.fillColor; + theNewDef.fillColorWordDarkMode = theNewDef.fillWordColor; + } if ("lineWidth" in theNewDef && !("lineWidthWord" in theNewDef)) { if (theNewDef.lineWidth >= 4) { theNewDef.lineWidthWord = "thick"; diff --git a/src/Tools/cypressTest/CypressTest.jsx b/src/Tools/cypressTest/CypressTest.jsx index dc18a631fc..267a7501ac 100644 --- a/src/Tools/cypressTest/CypressTest.jsx +++ b/src/Tools/cypressTest/CypressTest.jsx @@ -1,6 +1,8 @@ import React, { useState, useEffect, useRef } from 'react'; import PageViewer from '../../Viewer/PageViewer.jsx'; import ActivityViewer from '../../Viewer/ActivityViewer.jsx'; +import { useRecoilState } from 'recoil'; +import { darkModeAtom } from '../_framework/DarkmodeController.jsx'; // import {plainText as testCodeDoenetML } from './testCode.doenet'; function Test() { @@ -51,6 +53,8 @@ function Test() { const [showFeedback, setShowFeedback] = useState(testSettings.showFeedback); const [showHints, setShowHints] = useState(testSettings.showHints); + const [darkModeToggle, setDarkModeToggle] = useRecoilState(darkModeAtom); + const [bundledCore, setBundledCore] = useState(testSettings.bundledCore); const [allowLoadState, setAllowLoadState] = useState(testSettings.allowLoadState); const [allowSaveState, setAllowSaveState] = useState(testSettings.allowSaveState); @@ -255,6 +259,14 @@ function Test() { } />Paginate
+
+ +
+

+
+ +
+