-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cypress test for reloading state of subsetOfRealsInput
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
packages/test-cypress/cypress/e2e/tagSpecific/subsetofrealsinput.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { cesc2 } from "@doenet/utils"; | ||
|
||
describe("SubsetOfRealsInput Tag Tests", function () { | ||
beforeEach(() => { | ||
cy.clearIndexedDB(); | ||
cy.visit("/"); | ||
}); | ||
|
||
it("subsetOfRealsInput state can be reloaded from local state", () => { | ||
const doenetML = ` | ||
<text>a</text> | ||
<p><subsetOfRealsInput name="sori" /></p> | ||
<p>Value: <subsetOfReals copySource="sori" name="sor" /></p> | ||
<p>Value: <mathInput copySource="sori.subsetValue" name="sormi" /></p> | ||
`; | ||
cy.get("#testRunner_toggleControls").click(); | ||
cy.get("#testRunner_allowLocalState").click(); | ||
cy.wait(100); | ||
cy.get("#testRunner_toggleControls").click(); | ||
|
||
cy.window().then(async (win) => { | ||
win.postMessage( | ||
{ | ||
doenetML, | ||
}, | ||
"*", | ||
); | ||
}); | ||
cy.get(cesc2("#/_text1")).should("have.text", "a"); // to wait for page to load | ||
|
||
cy.get(cesc2("#/sor")).should("contain.text", "∅"); | ||
|
||
cy.get(cesc2("#/sormi") + " textarea").type( | ||
"{end}{backspace}{{}3}{enter}", | ||
{ | ||
force: true, | ||
}, | ||
); | ||
|
||
cy.get(cesc2("#/sor")).should("contain.text", "{3}"); | ||
cy.wait(2000); // wait for 1 second debounce | ||
|
||
cy.reload(); | ||
cy.window().then(async (win) => { | ||
win.postMessage( | ||
{ | ||
doenetML, | ||
}, | ||
"*", | ||
); | ||
}); | ||
|
||
cy.get(cesc2("#/sor")).should("contain.text", "{3}"); | ||
}); | ||
}); |