From 89fdbf56606dbac8a68114f0bdf6785385ec3fb8 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 21 Apr 2025 17:10:33 +0530 Subject: [PATCH] test: find the course image label and attach course image to its sibling input --- cypress/e2e/course_creation.cy.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cypress/e2e/course_creation.cy.js b/cypress/e2e/course_creation.cy.js index 7d20fdcb..28b97041 100644 --- a/cypress/e2e/course_creation.cy.js +++ b/cypress/e2e/course_creation.cy.js @@ -19,12 +19,16 @@ describe("Course Creation", () => { ); cy.fixture("profile.png", "base64").then((fileContent) => { - cy.get('input[type="file"]').attachFile({ - fileContent, - fileName: "profile.png", - mimeType: "image/png", - encoding: "base64", - }); + cy.get("div") + .contains("Course Image") + .siblings("div") + .children('input[type="file"]') + .attachFile({ + fileContent, + fileName: "profile.png", + mimeType: "image/png", + encoding: "base64", + }); }); cy.get("label")