Skip to content

Commit 18ec4e5

Browse files
committed
Clearer test avoiding use of class variables
1 parent b7a8b89 commit 18ec4e5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

cypress/e2e/spec-wc-pyodide.cy.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ describe("Running the code with pyodide", () => {
181181
});
182182

183183

184-
it("does not cache class variables in local files", () => {
184+
it.only("reloads imported local files between code runs", () => {
185185
cy.get("@editor")
186186
.findByLabelText('editor text input')
187187
.invoke("text",
188-
`from helper import Widget\nWidget.widget_count += 1\nprint(Widget.widget_count)`
188+
`from helper import b\nb()`
189189
);
190190

191191
cy.get("@editor").findByRole('button', { name: 'Add file' }).click()
@@ -200,23 +200,27 @@ describe("Running the code with pyodide", () => {
200200

201201
cy.get("@editor")
202202
.findByLabelText('editor text input')
203-
.invoke("text", `class Widget:\n widget_count = 0`);
203+
.invoke("text", `def b():\n print('one')`);
204204

205205
cy.get("@editor")
206206
.findByRole('button', { name: 'Run' }).click();
207207

208208
cy.get("@editor")
209209
.find(".pyodiderunner")
210210
.findByLabelText('Text output')
211-
.should("contain", "1");
211+
.should("contain", "one");
212+
213+
cy.get("@editor")
214+
.findByLabelText('editor text input')
215+
.invoke("text", `def b():\n print('two')`);
212216

213217
cy.get("@editor")
214218
.findByRole('button', { name: 'Run' }).click();
215219

216220
cy.get("@editor")
217221
.find(".pyodiderunner")
218222
.findByLabelText('Text output')
219-
.should("contain", "1");
223+
.should("contain", "two");
220224
});
221225

222226

0 commit comments

Comments
 (0)