test: fixed course creation test

This commit is contained in:
Jannat Patel
2023-05-10 19:35:45 +05:30
parent 752fe5b4ba
commit 0e444ab7d3
20 changed files with 372 additions and 675 deletions

View File

@@ -5,39 +5,50 @@ describe("Course Creation", () => {
// Create a course
cy.get("a.btn").contains("Create a Course").click();
cy.wait(1000);
cy.url().should("include", "/courses/new-course");
cy.button("Add Tag").click();
cy.get(".course-card-pills").type("Test");
cy.url().should("include", "/courses/new-course/edit");
cy.get("#title").type("Test Course");
cy.get("#intro").type("Test Course Short Introduction");
cy.get("#video-link").type("-LPmw2Znl2c");
cy.get("#published").check();
cy.get("#description").type("Test Course Description");
cy.get("#video-link").type("-LPmw2Znl2c");
cy.get("#tags-input").type("Test");
cy.get("#published").check();
cy.wait(1000);
cy.button("Save Course Details").click();
cy.button("Save").click();
// Add Chapter
cy.wait(3000);
cy.button("New Chapter").click();
cy.get(".new-chapter .chapter-title-main").type("Test Chapter");
cy.get(".new-chapter .chapter-description").type(
"Test Chapter Description"
);
cy.get(".new-chapter .btn-save-chapter").click();
cy.wait(1000);
cy.link("Course Outline").click();
cy.wait(1000);
cy.get(".edit-header .btn-add-chapter").click();
cy.get("#chapter-title").type("Test Chapter");
cy.get("#chapter-description").type("Test Chapter Description");
cy.button("Save").click();
// Add Lesson
cy.wait(3000);
cy.get(".chapter-parent .btn-lesson").click();
cy.wait(3000);
cy.get("#title").type("Test Lesson");
cy.get("#youtube").type("GoDtyItReto");
cy.get("#body").type("Test Lesson Content");
cy.wait(1000);
cy.get(".btn-lesson").click();
cy.link("Add Lesson").click();
cy.wait(1000);
cy.get("#lesson-title").type("Test Lesson");
// Content
cy.get(".ce-block").click().type("{enter}");
cy.get(".ce-toolbar__plus").click();
cy.get('[data-item-name="youtube"]').click();
cy.get('input[data-fieldname="youtube"]').type("GoDtyItReto");
cy.button("Insert").click();
cy.wait(1000);
cy.get(".ce-block:last").click().type("{enter}");
cy.get(".ce-block:last")
.click()
.type(
"This is an extremely big paragraph that is meant to test the UI. This is a very long paragraph. It contains more than once sentence. Its meant to be this long as this is a UI test. Its unbearably long and I'm not sure why I'm typing this much. I'm just going to keep typing until I feel like its long enough. I think its long enough now. I'm going to stop typing now."
);
cy.button("Save").click();
// View Course
cy.wait(3000);
cy.wait(1000);
cy.visit("/courses");
cy.get(".course-card-title:first").contains("Test Course");
cy.get(".course-card:first").click();
@@ -59,7 +70,7 @@ describe("Course Creation", () => {
cy.get(".lesson-info:first").click();
// View Lesson
cy.wait(3000);
cy.wait(1000);
cy.url().should("include", "learn/1.1");
cy.get("#title").contains("Test Lesson");
cy.get(".lesson-video iframe").should(
@@ -67,7 +78,9 @@ describe("Course Creation", () => {
"src",
"https://www.youtube.com/embed/GoDtyItReto"
);
cy.get(".lesson-content-card").contains("Test Lesson Content");
cy.get(".lesson-content-card").contains(
"This is an extremely big paragraph that is meant to test the UI. This is a very long paragraph. It contains more than once sentence. Its meant to be this long as this is a UI test. Its unbearably long and I'm not sure why I'm typing this much. I'm just going to keep typing until I feel like its long enough. I think its long enough now. I'm going to stop typing now."
);
// Add Discussion
cy.get(".reply").click();
@@ -79,7 +92,7 @@ describe("Course Creation", () => {
cy.get(".submit-discussion").click();
// View Discussion
cy.wait(3000);
cy.wait(1000);
cy.get(".discussion-topic-title:first").contains("Question Title");
cy.get(".sidebar-parent:first").click();
cy.get(".reply-text").contains(