Skip to content

Commit b6d2ad1

Browse files
committed
test: fix the test of toolabar and the planet
1 parent b9494a5 commit b6d2ad1

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

cypress/e2e/main.cy.js

Lines changed: 21 additions & 11 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", () => {
@@ -139,14 +141,22 @@ describe("MusicBlocks Application", () => {
139141
});
140142

141143
describe("Planet Page Interaction", () => {
142-
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');
144+
it("should load the Planet page and return to the main page when clicking the close button", () => {
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)