|
1 | 1 | const baseUrl = "http://localhost:3001" |
2 | 2 |
|
3 | 3 | beforeEach(() => { |
4 | | - cy.visit(baseUrl) |
| 4 | + cy.visit(`${baseUrl}?sense_hat_always_enabled=true`) |
| 5 | +}) |
| 6 | + |
| 7 | +it("defaults to the visual output tab", () => { |
| 8 | + const runnerContainer = cy.get("editor-wc").shadow().find('.proj-runner-container') |
| 9 | + runnerContainer.find('.react-tabs__tab--selected').should("contain", "Visual Output") |
| 10 | +}) |
| 11 | + |
| 12 | +it("renders the astro pi component on page load", () => { |
| 13 | + cy.get("editor-wc").shadow().find("#root").should("contain", "yaw") |
| 14 | +}) |
| 15 | + |
| 16 | +it("keeps astro pi component if code run without sense hat imported", () => { |
| 17 | + cy.get("editor-wc").shadow().find("div[class=cm-content]").invoke('text', '') |
| 18 | + cy.get("editor-wc").shadow().find(".btn--run").click() |
| 19 | + cy.get("editor-wc").shadow().find("#root").should("contain", "yaw") |
5 | 20 | }) |
6 | 21 |
|
7 | 22 | it("loads the sense hat library", () => { |
@@ -57,15 +72,17 @@ it("confirms LEDs used when single led set", () => { |
57 | 72 | it("confirms LEDs used when display set", () => { |
58 | 73 | cy.get("editor-wc").shadow().find("div[class=cm-content]").invoke('text', 'from sense_hat import SenseHat\nsense = SenseHat()\nsense.set_pixels([[100,0,0]] * 64)') |
59 | 74 | cy.get("editor-wc").shadow().find(".btn--run").click() |
| 75 | + cy.scrollTo('bottom') |
60 | 76 | cy.get("#results").should("contain", '"usedLEDs":true') |
61 | 77 | }) |
62 | 78 |
|
63 | | -// it("picks up calls to input()", () => { |
64 | | -// cy.get("editor-wc").shadow().find("div[class=cm-content]").invoke('text', 'input()') |
65 | | -// cy.get("editor-wc").shadow().find(".btn--run").click() |
66 | | -// cy.get("editor-wc").shadow().find("span[contenteditable=true]").type('{enter}') |
67 | | -// cy.get("#results").should("contain", '"noInputEvents":false') |
68 | | -// }) |
| 79 | +it("picks up calls to input()", () => { |
| 80 | + cy.get("editor-wc").shadow().find("div[class=cm-content]").invoke('text', 'input()') |
| 81 | + cy.get("editor-wc").shadow().find(".btn--run").click() |
| 82 | + cy.get("editor-wc").shadow().contains('Text Output').click() |
| 83 | + cy.get("editor-wc").shadow().find("span[contenteditable=true]").type('{enter}') |
| 84 | + cy.get("#results").should("contain", '"noInputEvents":false') |
| 85 | +}) |
69 | 86 |
|
70 | 87 | it("picks up calls to wait for motion", () => { |
71 | 88 | cy.get("editor-wc").shadow().find("div[class=cm-content]").invoke('text', 'from sense_hat import SenseHat\nsense = SenseHat()\nsense.motion.wait_for_motion()') |
|
0 commit comments