-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
teacherCreatesCourseCOT4oMiniTest passing!
- Loading branch information
1 parent
0718b32
commit ebe6bca
Showing
1 changed file
with
11 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,36 +196,35 @@ void teacherCreatesCourseCOT4oMiniTest() throws ElementNotFoundException { | |
String teacherEmail = "[email protected]"; // Replace with actual test data | ||
String teacherPassword = "pass"; // Replace with actual test data | ||
String courseTitle = "Test Course Title"; // Replace with desired course title | ||
String courseImagePath = "path/to/image.jpg"; // Replace with actual image path if needed | ||
|
||
|
||
// Step 1: Login as Teacher | ||
this.slowLogin(user, teacherEmail, teacherPassword); | ||
|
||
// Step 2: Navigate to Course Creation Page | ||
NavigationUtilities.toCoursesHome(driver); | ||
Click.element(driver, By.id("create-course-button")); // Replace with actual button ID | ||
Click.element(driver, By.id("add-course-icon")); // Replace with actual button ID | ||
|
||
// Step 3: Fill in Course Details | ||
WebElement titleInput = driver.findElement(By.id("course-title")); // Replace with actual input ID | ||
WebElement titleInput = driver.findElement(By.id("input-post-course-name")); // Replace with actual input ID | ||
titleInput.sendKeys(courseTitle); | ||
|
||
// Optional: Upload an image if applicable | ||
if (courseImagePath != null && !courseImagePath.isEmpty()) { | ||
WebElement imageUpload = driver.findElement(By.id("course-image-upload")); // Replace with actual upload ID | ||
imageUpload.sendKeys(courseImagePath); | ||
} | ||
WebElement fileInput = driver.findElement(By.id("inputPostCourseImage")); | ||
File uploadFile= new File("src/test/resources/inputs/image.png"); | ||
fileInput.sendKeys(uploadFile.getAbsolutePath()); | ||
|
||
|
||
Click.element(driver, By.id("create-course-submit")); // Replace with actual submit button ID | ||
Click.element(driver, By.id("submit-post-course-btn")); // Replace with actual submit button ID | ||
|
||
// Step 4: Verify Course Creation | ||
Wait.notTooMuch(driver).until(ExpectedConditions.visibilityOfElementLocated(By.id("dashboard"))); // Wait for dashboard to load | ||
List<WebElement> courses = driver.findElements(By.className("course-title")); // Replace with actual class name | ||
Wait.notTooMuch(driver).until(ExpectedConditions.visibilityOfElementLocated(By.className("dashboard-title"))); // Wait for dashboard to load | ||
List<WebElement> courses = driver.findElements(By.xpath("//*[contains(text(), '" + courseTitle + "')]")); // Replace with actual class name | ||
boolean courseCreated = courses.stream().anyMatch(course -> course.getText().equals(courseTitle)); | ||
|
||
Assertions.assertTrue(courseCreated, "The course was not created successfully."); | ||
|
||
// Step 5: Teardown | ||
Click.element(driver, By.id("logout-button")); // Replace with actual logout button ID | ||
//Click.element(driver, By.id("logout-button")); // Replace with actual logout button ID Its done by the base Test Class | ||
} | ||
|
||
} |