Skip to content

Commit 24d635b

Browse files
authored
test: fix the test of toolabar and the planet (#4490)
* test: fix the test of toolabar and the planet * fix lint issue * fix the lint issue
1 parent 893d16c commit 24d635b

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

cypress/e2e/main.cy.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ describe("MusicBlocks Application", () => {
4747

4848
it("should toggle full-screen mode", () => {
4949
cy.get("#FullScreen").click();
50-
cy.document().its("fullscreenElement").should("exist");
50+
cy.wait(500);
51+
cy.document().its("fullscreenElement").should("not.be.null");
5152
cy.get("#FullScreen").click();
52-
cy.document().its("fullscreenElement").should("not.exist");
53+
cy.wait(500);
54+
cy.document().its("fullscreenElement").should("be.null");
5355
});
5456

5557
it("should toggle the toolbar menu", () => {
@@ -140,13 +142,21 @@ describe("MusicBlocks Application", () => {
140142

141143
describe("Planet Page Interaction", () => {
142144
it("should load the Planet page and return to the main page when clicking the close button", () => {
143-
cy.get("#planetIcon > .material-icons")
144-
.should("exist")
145-
.and("be.visible")
146-
.click();
147-
cy.get("#planet-iframe")
148-
.should("be.visible");
145+
cy.get("#planetIcon > .material-icons").should("exist").and("be.visible").click();
146+
147+
cy.get("#planet-iframe", { timeout: 10000 })
148+
.should("be.visible")
149+
.and("have.attr", "src")
150+
.and("not.be.empty");
151+
152+
cy.get("#planet-iframe").then(($iframe) => {
153+
const iframeSrc = $iframe.attr("src");
154+
cy.log("Iframe source:", iframeSrc);
155+
});
156+
157+
cy.window().then((win) => {
158+
win.document.getElementById("planet-iframe").style.display = "block";
159+
});
149160
});
150161
});
151-
152-
});
162+
});

0 commit comments

Comments
 (0)