From 8c54d77740180d1d49bece58dfc9c064895623fd Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Fri, 6 Mar 2026 17:22:12 +0530 Subject: [PATCH] test(ui): find course with the test title instead of checking the first course card --- cypress/e2e/course_creation.cy.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cypress/e2e/course_creation.cy.js b/cypress/e2e/course_creation.cy.js index 19167e05..7f073c62 100644 --- a/cypress/e2e/course_creation.cy.js +++ b/cypress/e2e/course_creation.cy.js @@ -104,15 +104,17 @@ describe("Course Creation", () => { cy.closeOnboardingModal(); cy.url().should("include", "/lms/courses"); - cy.get(".grid a:first").within(() => { - cy.get("div").contains("Test Course"); - cy.get("div").contains( - "Test Course Short Introduction to test the UI" - ); - cy.get(".bg-cover") - .invoke("css", "background-image") - .should("include", "/files/profile"); - }); + cy.get("div") + .contains("Test Course") + .closest("a") + .within(() => { + cy.get("div").contains( + "Test Course Short Introduction to test the UI" + ); + cy.get(".bg-cover") + .invoke("css", "background-image") + .should("include", "/files/profile"); + }); cy.get(".grid a:first").click(); cy.url().should("include", "/lms/courses/test-course"); cy.get("div").contains("Test Course");