-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow links to our own domains (#729)
Closing issue: #713 --------- Co-authored-by: magdalenajadach <[email protected]> Co-authored-by: Magdalena Jadach <[email protected]> Co-authored-by: Pete Simonovic <[email protected]>
- Loading branch information
1 parent
42e70c2
commit 328cc22
Showing
5 changed files
with
256 additions
and
106 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,50 +1,73 @@ | ||
const baseUrl = "http://localhost:3001" | ||
const baseUrl = "http://localhost:3001"; | ||
|
||
beforeEach(() => { | ||
cy.visit(baseUrl) | ||
}) | ||
cy.visit(baseUrl); | ||
}); | ||
|
||
it("renders the web component", () => { | ||
cy.get("editor-wc").shadow().find("button").should("contain", "Run") | ||
}) | ||
cy.get("editor-wc").shadow().find("button").should("contain", "Run"); | ||
}); | ||
|
||
it("defaults to the text output tab", () => { | ||
const runnerContainer = cy.get("editor-wc").shadow().find('.proj-runner-container') | ||
runnerContainer.find('.react-tabs__tab--selected').should("contain", "Text output") | ||
}) | ||
const runnerContainer = cy | ||
.get("editor-wc") | ||
.shadow() | ||
.find(".proj-runner-container"); | ||
runnerContainer | ||
.find(".react-tabs__tab--selected") | ||
.should("contain", "Text output"); | ||
}); | ||
|
||
it("runs the python code", () => { | ||
cy.get("editor-wc").shadow().find("div[class=cm-content]").invoke('text', 'print("Hello world")') | ||
cy.get("editor-wc").shadow().find(".btn--run").click() | ||
cy.get("editor-wc").shadow().find(".pythonrunner-console-output-line").should("contain", "Hello world") | ||
}) | ||
cy.get("editor-wc") | ||
.shadow() | ||
.find("div[class=cm-content]") | ||
.invoke("text", 'print("Hello world")'); | ||
cy.get("editor-wc").shadow().find(".btn--run").click(); | ||
cy.get("editor-wc") | ||
.shadow() | ||
.find(".pythonrunner-console-output-line") | ||
.should("contain", "Hello world"); | ||
}); | ||
|
||
it("does not render visual output tab on page load", () => { | ||
cy.get("editor-wc").shadow().find('#root').should("not.contain", "Visual output") | ||
}) | ||
cy.get("editor-wc") | ||
.shadow() | ||
.find("#root") | ||
.should("not.contain", "Visual output"); | ||
}); | ||
|
||
it("renders visual output tab if sense hat imported", () => { | ||
cy.get("editor-wc").shadow().find("div[class=cm-content]").invoke('text', 'import sense_hat') | ||
cy.get("editor-wc").shadow().find(".btn--run").click() | ||
cy.get("editor-wc").shadow().find('#root').should("contain", "Visual output") | ||
}) | ||
cy.get("editor-wc") | ||
.shadow() | ||
.find("div[class=cm-content]") | ||
.invoke("text", "import sense_hat"); | ||
cy.get("editor-wc").shadow().find(".btn--run").click(); | ||
cy.get("editor-wc").shadow().find("#root").should("contain", "Visual output"); | ||
}); | ||
|
||
it("does not render astro pi component on page load",() => { | ||
cy.get("editor-wc").shadow().find("#root").should("not.contain", "yaw") | ||
}) | ||
it("does not render astro pi component on page load", () => { | ||
cy.get("editor-wc").shadow().find("#root").should("not.contain", "yaw"); | ||
}); | ||
|
||
it("renders astro pi component if sense hat imported", () => { | ||
cy.get("editor-wc").shadow().find("div[class=cm-content]").invoke('text', 'import sense_hat') | ||
cy.get("editor-wc").shadow().find(".btn--run").click() | ||
cy.get("editor-wc").shadow().contains('Visual output').click() | ||
cy.get("editor-wc").shadow().find("#root").should("contain", "yaw") | ||
}) | ||
cy.get("editor-wc") | ||
.shadow() | ||
.find("div[class=cm-content]") | ||
.invoke("text", "import sense_hat"); | ||
cy.get("editor-wc").shadow().find(".btn--run").click(); | ||
cy.get("editor-wc").shadow().contains("Visual output").click(); | ||
cy.get("editor-wc").shadow().find("#root").should("contain", "yaw"); | ||
}); | ||
|
||
it("does not render astro pi component if sense hat unimported", () => { | ||
cy.get("editor-wc").shadow().find("div[class=cm-content]").invoke('text', 'import sense_hat') | ||
cy.get("editor-wc").shadow().find(".btn--run").click() | ||
cy.get("editor-wc").shadow().find("div[class=cm-content]").invoke('text', '') | ||
cy.get("editor-wc").shadow().find(".btn--run").click() | ||
cy.get("editor-wc").shadow().contains('Visual output').click() | ||
cy.get("editor-wc").shadow().find("#root").should("not.contain", "yaw") | ||
}) | ||
cy.get("editor-wc") | ||
.shadow() | ||
.find("div[class=cm-content]") | ||
.invoke("text", "import sense_hat"); | ||
cy.get("editor-wc").shadow().find(".btn--run").click(); | ||
cy.get("editor-wc").shadow().find("div[class=cm-content]").invoke("text", ""); | ||
cy.get("editor-wc").shadow().find(".btn--run").click(); | ||
cy.get("editor-wc").shadow().contains("Visual output").click(); | ||
cy.get("editor-wc").shadow().find("#root").should("not.contain", "yaw"); | ||
}); |
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
Oops, something went wrong.