-
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.
teacherCreateCourseFS4oTest passing!
- Loading branch information
1 parent
74ec4ad
commit 49cf184
Showing
2 changed files
with
31 additions
and
24 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 |
---|---|---|
|
@@ -10,13 +10,17 @@ | |
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.Keys; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.ui.ExpectedConditions; | ||
import com.fullteaching.e2e.no_elastest.common.NavigationUtilities; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.stream.Stream; | ||
|
@@ -66,46 +70,49 @@ void teacherCreateAndDeletecourseTest (String mail, String password, String role | |
// Teardown | ||
user.getDriver().get(APP_URL); | ||
} | ||
@ParameterizedTest | ||
@MethodSource("data") | ||
void teacherCreateCourseFS4oTest(String mail, String password, String role) { | ||
this.slowLogin(user, mail, password); | ||
@Test | ||
void teacherCreateCourseFS4oTest() { | ||
String teacherEmail = "[email protected]"; // Replace with actual test data | ||
String teacherPassword = "pass"; // Replace with actual test data | ||
this.slowLogin(user, teacherEmail, teacherPassword); | ||
|
||
try { | ||
// Navigate to the dashboard | ||
NavigationUtilities.toCoursesHome(driver); | ||
|
||
// Click on the "Create Course" button | ||
WebElement createCourseButton = driver.findElement(By.id("create-course-button")); | ||
WebElement createCourseButton = driver.findElement(By.id("add-course-icon")); | ||
Click.element(driver, createCourseButton); | ||
|
||
// Enter course title | ||
WebElement courseTitleInput = driver.findElement(By.id("course-title-input")); | ||
WebElement courseTitleInput = driver.findElement(By.id("input-post-course-name")); | ||
courseTitleInput.sendKeys("New Course Title"); | ||
|
||
// Optionally upload an image | ||
WebElement courseImageInput = driver.findElement(By.id("course-image-input")); | ||
courseImageInput.sendKeys("/path/to/image.jpg"); | ||
WebElement fileInput = driver.findElement(By.id("inputPostCourseImage")); | ||
File uploadFile= new File("src/test/resources/inputs/image.png"); | ||
fileInput.sendKeys(uploadFile.getAbsolutePath()); | ||
|
||
// Click on the "Create Course" button | ||
WebElement createCourseSubmitButton = driver.findElement(By.id("create-course-submit-button")); | ||
WebElement createCourseSubmitButton = driver.findElement(By.id("submit-post-course-btn")); | ||
Click.element(driver, createCourseSubmitButton); | ||
|
||
// Wait for the course to appear in the dashboard | ||
Wait.notTooMuch(driver).until(ExpectedConditions.visibilityOfElementLocated(By.id("course-list"))); | ||
|
||
// Verify the new course appears in the teacher's dashboard | ||
WebElement newCourse = driver.findElement(By.xpath("//div[contains(text(), 'New Course Title')]")); | ||
WebElement newCourse = driver.findElement(By.xpath("//*[contains(text(), 'New Course Title')]")); | ||
assertTrue(newCourse.isDisplayed(), "New course is not displayed in the dashboard"); | ||
|
||
} catch (Exception e) { | ||
fail("Failed to create a new course: " + e.getClass() + ": " + e.getLocalizedMessage()); | ||
} | ||
} | ||
@ParameterizedTest | ||
@MethodSource("data") | ||
void teacherCreateCourseCOT4oTest(String mail, String password, String role) { | ||
this.slowLogin(user, mail, password); | ||
@Test | ||
void teacherCreateCourseCOT4oTest() { | ||
String teacherEmail = "[email protected]"; // Replace with actual test data | ||
String teacherPassword = "pass"; // Replace with actual test data | ||
this.slowLogin(user, teacherEmail, teacherPassword); | ||
|
||
try { | ||
// Navigate to the dashboard | ||
|
@@ -143,11 +150,12 @@ void teacherCreateCourseCOT4oTest(String mail, String password, String role) { | |
@AccessMode(resID = "executor", concurrency = 1, accessMode = "READWRITE") | ||
@AccessMode(resID = "webbrowser", concurrency = 1, accessMode = "READWRITE") | ||
@AccessMode(resID = "webserver", concurrency = 1, accessMode = "READWRITE") | ||
@ParameterizedTest | ||
@MethodSource("data") | ||
void teacherCreatesCourseFS4oMiniTest(String mail, String password, String role) { | ||
@Test | ||
void teacherCreatesCourseFS4oMiniTest() { | ||
String teacherEmail = "[email protected]"; // Replace with actual test data | ||
String teacherPassword = "pass"; // Replace with actual test data | ||
// Log in with provided credentials | ||
this.slowLogin(user, mail, password); | ||
this.slowLogin(user, teacherEmail, teacherPassword); | ||
String courseTitle = "New Course Title"; | ||
String courseImagePath = "path/to/image.jpg"; // Optional image path | ||
|
||
|
@@ -182,17 +190,16 @@ void teacherCreatesCourseFS4oMiniTest(String mail, String password, String role) | |
} | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("data") | ||
void teacherCreatesCourseCOT4oMiniTest(String mail, String password, String role) throws ElementNotFoundException { | ||
@Test | ||
void teacherCreatesCourseCOT4oMiniTest() throws ElementNotFoundException { | ||
// Test data | ||
String teacherEmail = "teacher@example.com"; // Replace with actual test data | ||
String teacherPassword = "password"; // Replace with actual test data | ||
String teacherEmail = "teacher@gmail.com"; // 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, mail, password); | ||
this.slowLogin(user, teacherEmail, teacherPassword); | ||
|
||
// Step 2: Navigate to Course Creation Page | ||
NavigationUtilities.toCoursesHome(driver); | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.