From 9143cc39d9a43e71ede088546cdaf25371e29929 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 21 Apr 2025 10:53:22 +0530 Subject: [PATCH] test: find the course image label and attach course image to its sibling input --- cypress/e2e/course_creation.cy.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/course_creation.cy.js b/cypress/e2e/course_creation.cy.js index d65b1d0f..69c0f1ca 100644 --- a/cypress/e2e/course_creation.cy.js +++ b/cypress/e2e/course_creation.cy.js @@ -19,12 +19,23 @@ describe("Course Creation", () => { ); cy.fixture("profile.png", "base64").then((fileContent) => { - cy.get('input[type="file"]').should("be.hidden").attachFile({ + /* cy.get('input[type="file"]').should("be.hidden").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")