From 1fbb5674471bf57ac5010d3a734da50e3ace1b47 Mon Sep 17 00:00:00 2001 From: Augusto <49859508+augustocristian@users.noreply.github.com> Date: Tue, 20 Aug 2024 16:18:28 +0200 Subject: [PATCH] Fix zombie processes created by FullTeaching test suite (#145) * Changes to deal with zombie processes Refractoring to the base test class, making all test cases parametrized and avoiding differences between test cases Also minor fixes related to smells that sonar and IntelliJ detect * Fixing the ReplyToCommentTest * Changes requested: - Removing exceptions where its handling its not appropiate. - Removing blank and double-blank lines * Changes requested: - Adding exception to logintest * Changes requested by Linter: - Not used imports - Replace string concatenation with {} - Replace <= lists with .empty method --- pom.xml | 4 +- .../no_elastest/common/BaseLoggedTest.java | 115 +++++++++--------- .../e2e/no_elastest/common/BrowserUser.java | 5 +- .../e2e/no_elastest/common/ChromeUser.java | 51 +++----- .../e2e/no_elastest/common/Constants.java | 13 +- .../common/CourseNavigationUtilities.java | 17 ++- .../e2e/no_elastest/common/EdgeUser.java | 46 +++---- .../e2e/no_elastest/common/FirefoxUser.java | 77 +++++------- .../common/ForumNavigationUtilities.java | 17 ++- .../common/NavigationUtilities.java | 7 +- .../common/SessionNavigationUtilities.java | 9 +- .../no_elastest/common/SpiderNavigation.java | 21 +--- .../e2e/no_elastest/common/UserUtilities.java | 9 +- .../common/exception/BadUserException.java | 3 +- .../exception/ElementNotFoundException.java | 3 +- .../common/exception/ExceptionsHelper.java | 3 +- .../common/exception/NotLoggedException.java | 4 +- .../common/exception/TimeOutException.java | 1 - .../functional/test/LoggedForumTest.java | 67 ++++------ .../functional/test/LoggedLinksTests.java | 23 ++-- .../functional/test/UnLoggedLinksTests.java | 14 +-- .../no_elastest/functional/test/UserTest.java | 31 ++--- .../media/FullTeachingEndToEndEChatTests.java | 99 ++++----------- .../media/FullTeachingEndToEndRESTTests.java | 73 ++++++----- .../FullTeachingLoggedVideoSessionTests.java | 57 ++++----- ...TeachingTestEndToEndVideoSessionTests.java | 103 +++------------- .../test/student/CourseStudentTest.java | 47 ++----- .../test/teacher/CourseTeacherTest.java | 14 +-- .../e2e/no_elastest/utils/Click.java | 23 ++-- .../e2e/no_elastest/utils/DOMManager.java | 2 +- .../no_elastest/utils/ParameterLoader.java | 8 +- .../e2e/no_elastest/utils/Scroll.java | 2 +- .../e2e/no_elastest/utils/SetUp.java | 21 +--- .../e2e/no_elastest/utils/User.java | 5 +- .../e2e/no_elastest/utils/UserLoader.java | 8 +- .../e2e/no_elastest/utils/Wait.java | 2 +- 36 files changed, 350 insertions(+), 654 deletions(-) diff --git a/pom.xml b/pom.xml index 9edeb8a..d785aa5 100644 --- a/pom.xml +++ b/pom.xml @@ -150,9 +150,9 @@ - + ${basedir}/target/test-classes/${dirtarget} - + ${basedir}/target/classes/${dirtarget} diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/BaseLoggedTest.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/BaseLoggedTest.java index 02718ec..3d3587e 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/BaseLoggedTest.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/BaseLoggedTest.java @@ -20,19 +20,18 @@ import java.io.FileInputStream; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URISyntaxException; import java.util.Date; +import java.util.List; import java.util.Properties; import static com.fullteaching.e2e.no_elastest.common.Constants.*; -import static java.lang.invoke.MethodHandles.lookup; import static org.openqa.selenium.logging.LogType.BROWSER; -import static org.slf4j.LoggerFactory.getLogger; public class BaseLoggedTest { public static final String CHROME = "chrome"; - // For use another host - //protected static final String host= SetUp.getHost(); public static final String FIREFOX = "firefox"; public static final String EDGE = "edge"; public static final Logger log = LoggerFactory.getLogger(BaseLoggedTest.class); @@ -41,7 +40,6 @@ public class BaseLoggedTest { public static String TEACHER_BROWSER; public static String STUDENT_BROWSER; public static String BROWSER_NAME; - public static String course_title; protected static String HOST = LOCALHOST; protected static String userName; protected static String userMail; @@ -53,21 +51,18 @@ public class BaseLoggedTest { public WebDriver driver; protected BrowserUser user; + protected BrowserUser student; + protected List studentBrowserUserList; public BaseLoggedTest() { } @BeforeAll - static void setupAll() { // 28 lines + static void setupAll() throws IOException { // 28 lines // Initialize properties properties = new Properties(); - - try { - // Load a properties file for reading - properties.load(new FileInputStream("src/test/resources/inputs/test.properties")); - } catch (IOException ex) { - ex.printStackTrace(); // Consider logging the exception instead of printing the stack trace - } + // Load a properties file for reading + properties.load(new FileInputStream("src/test/resources/inputs/test.properties")); // Check if running outside ElasTest if (System.getenv("ET_EUS_API") == null) { @@ -85,7 +80,7 @@ static void setupAll() { // 28 lines TJOB_NAME = envTJobName; PORT = envPort; APP_URL = envUrl + TJOB_NAME + ":" + PORT + "/"; - log.debug("The URL is" + APP_URL); + log.debug("The URL is {}" , APP_URL); HOST = APP_URL; } else { // Check if app.url system property is defined @@ -109,38 +104,36 @@ static void setupAll() { // 28 lines } @BeforeEach - void setup(TestInfo info) { //65 lines + void setup(TestInfo info) throws URISyntaxException, MalformedURLException { if (info.getTestMethod().isPresent()) { TEST_NAME = info.getTestMethod().get().getName(); + userName=info.getDisplayName().split(",")[2]; } - log.info("##### Start test: " + TEST_NAME); - TJOB_NAME = System.getProperty("dirtarget"); + log.info("##### Start test: {}" , TEST_NAME); - user = setupBrowser("chrome", TJOB_NAME + "_" + TEST_NAME, userMail, WAIT_SECONDS); - driver = user.getDriver(); + this.user = setupBrowser("chrome", TJOB_NAME + "-" +TEST_NAME, userName, WAIT_SECONDS); + + this.driver = this.user.getDriver(); } protected BrowserUser setupBrowser(String browser, String testName, - String userIdentifier, int secondsOfWait) { + String userIdentifier, int secondsOfWait) throws URISyntaxException, MalformedURLException { BrowserUser u; log.info("Starting browser ({})", browser); switch (browser) { case FIREFOX: BROWSER_NAME = FIREFOX; - u = new FirefoxUser(userIdentifier, secondsOfWait, testName, - userIdentifier); + u = new FirefoxUser(userIdentifier, secondsOfWait, testName); break; case EDGE: BROWSER_NAME = EDGE; - u = new EdgeUser(userIdentifier, secondsOfWait, testName, - userIdentifier); + u = new EdgeUser(userIdentifier, secondsOfWait, testName); break; default: BROWSER_NAME = CHROME; - u = new ChromeUser(userIdentifier, secondsOfWait, testName, - userIdentifier); + u = new ChromeUser(userIdentifier, secondsOfWait, testName); } log.info("Navigating to {}", APP_URL); @@ -160,37 +153,58 @@ protected BrowserUser setupBrowser(String browser, String testName, } @AfterEach - void tearDown(TestInfo testInfo) { //13 lines - - if (user != null) { + void tearDown() { //13 lines + if (this.user != null) { log.info("##### Finish test: {} - Driver {}", TEST_NAME, this.user.getDriver()); log.info("Browser console at the end of the test"); LogEntries logEntries = user.getDriver().manage().logs().get(BROWSER); - logEntries.forEach((entry) -> log.info("[{}] {} {}", + logEntries.forEach(entry -> log.info("[{}] {} {}", + new Date(entry.getTimestamp()), entry.getLevel(), + entry.getMessage())); + if (this.user.isOnSession()) { + this.logout(this.user); + } + + this.user.dispose(); + } + + if (this.student != null) { + log.info("##### Finish test: {} - Driver {}",TEST_NAME, this.student.getDriver()); + log.info("Browser console at the end of the test"); + LogEntries logEntries = student.getDriver().manage().logs().get(BROWSER); + logEntries.forEach(entry -> log.info("[{}] {} {}", new Date(entry.getTimestamp()), entry.getLevel(), entry.getMessage())); - if (user.isOnSession()) { - this.logout(user); + if (this.student.isOnSession()) { + this.logout(student); } - user.dispose(); + student.dispose();} + //Logout and exit list of Students + if (this.studentBrowserUserList!=null) { + for (BrowserUser memberStudent : this.studentBrowserUserList) { + if (memberStudent.isOnSession()) { + this.logout(memberStudent); + } + memberStudent.dispose(); + } } } protected void slowLogin(BrowserUser user, String userEmail, - String userPass) {//24 lines + String userPass) throws NotLoggedException, ElementNotFoundException, InterruptedException {//24 lines log.info("Slow login"); this.login(user, userEmail, userPass, true); } protected void quickLogin(BrowserUser user, String userEmail, - String userPass) { //24 lines + String userPass) throws NotLoggedException, ElementNotFoundException, InterruptedException { //24 lines log.info("Quick login"); this.login(user, userEmail, userPass, false); } private void login(BrowserUser user, String userEmail, String userPass, - boolean slow) { //24 lines + boolean slow) throws NotLoggedException, ElementNotFoundException, InterruptedException { //24 lines user.setOnSession(true); log.info("Logging in user {} with mail '{}'", user.getClientData(), userEmail); Wait.waitForPageLoaded(user.getDriver()); @@ -221,22 +235,15 @@ private void login(BrowserUser user, String userEmail, String userPass, user.waitUntil(ExpectedConditions.presenceOfElementLocated(COURSE_LIST), "The Course list is not present"); user.waitUntil(ExpectedConditions.elementToBeClickable(By.id(("course-list"))), "Course list is not clickable"); - try { - userName = getUserName(user, true, APP_URL); - } catch (NotLoggedException | ElementNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + userName = getUserName(user, true, APP_URL); log.info("Logging in successful for user {}", user.getClientData()); - } protected void logout(BrowserUser user) { //43 lines - // log.info("Logging out {}", user.getClientData()); + log.info("Logging out {}", user.getClientData()); - if (user.getDriver().findElements(By.cssSelector("#fixed-icon")) - .size() > 0) { + if (!user.getDriver().findElements(By.cssSelector("#fixed-icon")).isEmpty()) { // Get out of video session page if (!isClickable("#exit-icon", user)) { // Side menu not opened user.getDriver().findElement(By.cssSelector("#fixed-icon")) @@ -309,7 +316,7 @@ protected void openDialog(String cssSelector, BrowserUser user) { "//div[contains(@class, 'modal-overlay') and contains(@style, 'opacity: 0.5')]")), "Dialog not opened"); - log.info("Dialog opened for user {}", user.getClientData()); + log.info("Dialog opened using css selector for user {}", user.getClientData()); } protected void openDialog(WebElement el, BrowserUser user) {//8lines @@ -321,7 +328,7 @@ protected void openDialog(WebElement el, BrowserUser user) {//8lines user.waitUntil(ExpectedConditions.presenceOfElementLocated(By.xpath( "//div[contains(@class, 'modal-overlay') and contains(@style, 'opacity: 0.5')]")), "Dialog not opened"); - log.info("Dialog opened for user {}", user.getClientData()); + log.info("Dialog using webelement for user {}", user.getClientData()); } protected void waitForDialogClosed(String dialogId, String errorMessage, @@ -343,13 +350,8 @@ protected void waitForDialogClosed(String dialogId, String errorMessage, log.info("Dialog closed for user {}", user.getClientData()); } - protected void waitSeconds(int seconds) { - try { + protected void waitSeconds(int seconds) throws InterruptedException { Thread.sleep(1000L * seconds); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } public String getUserName(BrowserUser user, boolean goBack, String host) throws NotLoggedException, ElementNotFoundException { @@ -372,16 +374,15 @@ public String getUserName(BrowserUser user, boolean goBack, String host) throws WebElement name_placeholder = Wait.notTooMuch(user.getDriver()).until(ExpectedConditions.visibilityOfElementLocated(By.xpath(USERNAME_XPATH))); - String userName = name_placeholder.getText().trim(); + String userNameTag = name_placeholder.getText().trim(); if (goBack) { user.getDriver().navigate().back(); } //Check if the username is the expected log.info("[END] getUserName"); - return userName; + return userNameTag; } - } \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/BrowserUser.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/BrowserUser.java index 7c23457..40ac74c 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/BrowserUser.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/BrowserUser.java @@ -26,8 +26,6 @@ import java.time.Duration; -import static java.lang.invoke.MethodHandles.lookup; -import static org.slf4j.LoggerFactory.getLogger; public class BrowserUser { @@ -48,7 +46,6 @@ public WebDriver getDriver() { return this.driver; } - public WebDriverWait getWaiter() { return this.waiter; } @@ -86,4 +83,4 @@ public boolean isOnSession() { public void setOnSession(boolean onSession) { isOnSession = onSession; } -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/ChromeUser.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/ChromeUser.java index b2266aa..f5e53b6 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/ChromeUser.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/ChromeUser.java @@ -25,13 +25,11 @@ import org.openqa.selenium.support.ui.WebDriverWait; import java.net.MalformedURLException; -import java.net.URL; -import java.text.SimpleDateFormat; +import java.net.URI; +import java.net.URISyntaxException; import java.time.Duration; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.Arrays; -import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -41,25 +39,18 @@ public class ChromeUser extends BrowserUser { ChromeOptions options = new ChromeOptions(); - public ChromeUser(String userName, int timeOfWaitInSeconds, String testName, String userIdentifier) { - super(userName, timeOfWaitInSeconds); + public ChromeUser(String userIdentifier, int timeOfWaitInSeconds, String testName) throws URISyntaxException, MalformedURLException { + super(userIdentifier, timeOfWaitInSeconds); log.info("Starting the configuration of the web browser"); - log.debug(String.format("The Test names are: %s", testName)); LoggingPreferences logPrefs = new LoggingPreferences(); logPrefs.enable(BROWSER, ALL); options.setCapability("goog:loggingPrefs", logPrefs); //Problems with the max attempt of retry, solved with : https://github.com/aerokube/selenoid/issues/1124 solved with --disable-gpu + // options.addArguments("--disable-gpu"); Commented for the moment //Problems with flakiness due to screen resolution solved with --start-maximized - String[] arguments = {"--no-sandbox", "--disable-dev-shm-usage", "--allow-elevated-browser", "--disable-gpu", "--start-maximized"}; - - log.debug("Adding the arguments ({})", Arrays.toString(arguments)); - for (String argument : arguments - ) { - options.addArguments(argument); - } - + options.addArguments("--start-maximized"); options.setAcceptInsecureCerts(true); //This capability is to store the logs of the test case log.debug("Added Capabilities of acceptInsecureCerts and ignore alarms"); @@ -68,42 +59,30 @@ public ChromeUser(String userName, int timeOfWaitInSeconds, String testName, Str log.info("Using the Local WebDriver ()"); this.driver = new ChromeDriver(options); } else { - try { - Map selenoidOptions = new HashMap<>(); log.info("Using the remote WebDriver (Selenoid)"); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_HH:mm"); + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yy-MM-dd-HH:mm"); + LocalDateTime now = LocalDateTime.now(); + String baseName = System.getProperty("tjob_name") + "-" + dtf.format(now) + "-" + testName + "-" + userIdentifier ; + log.debug("The data of this test are stored into .mp4 and .log files named: {}" , baseName); log.debug("Adding all the extra capabilities needed: {testName,enableVideo,enableVNC,name,enableLog,videoName,screenResolution}"); + //CAPABILITIES FOR SELENOID - selenoidOptions.put("testName", testName + "_" + userIdentifier + "_" + format.format(new Date())); - //CAPABILITIES FOR SELENOID RETORCH + selenoidOptions.put("testName", testName + "-" + userIdentifier + "-" + dtf.format(now)); selenoidOptions.put("enableVideo", true); selenoidOptions.put("enableVNC", true); selenoidOptions.put("name", testName + "-" + userIdentifier); - - DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yy-MM-dd-HH:mm"); - LocalDateTime now = LocalDateTime.now(); - String logName = System.getProperty("tjob_name") + "-" + dtf.format(now) + "-" + testName + "-" + userIdentifier + ".log"; - String videoName = System.getProperty("tjob_name") + "-" + dtf.format(now) + "-" + testName + "-" + userIdentifier + ".mp4"; - log.debug("The data of this test would be stored into: video name " + videoName + " and the log is " + logName); - selenoidOptions.put("enableLog", true); - selenoidOptions.put("logName ", logName); - selenoidOptions.put("videoName", videoName); - + selenoidOptions.put("logName ", String.format("%s%s",baseName.replaceAll("\\s","") , ".log")); + selenoidOptions.put("videoName", String.format("%s%s",baseName.replaceAll("\\s","") ,".mp4")); selenoidOptions.put("screenResolution", "1920x1080x24"); - options.setCapability("selenoid:options", selenoidOptions); - //END CAPABILITIES FOR SELENOID RETORCH log.debug("Configuring the remote WebDriver "); - RemoteWebDriver remote = new RemoteWebDriver(new URL("http://selenoid:4444/wd/hub"), options); + RemoteWebDriver remote = new RemoteWebDriver(new URI("http://selenoid:4444/wd/hub").toURL(), options); log.debug("Configuring the Local File Detector"); remote.setFileDetector(new LocalFileDetector()); this.driver = remote; - } catch (MalformedURLException e) { - throw new RuntimeException("Exception creating eusApiURL", e); - } } log.debug("Configure the driver connection timeouts at ({})", this.timeOfWaitInSeconds); new WebDriverWait(driver, Duration.ofSeconds(this.timeOfWaitInSeconds)); diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/Constants.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/Constants.java index d72648d..a290e89 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/Constants.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/Constants.java @@ -23,10 +23,8 @@ public final class Constants { public static final String LOGIN_MODAL_PASSWORD_FIELD_ID = "password"; public static final String LOGIN_MODAL_LOGIN_BUTTON_ID = "log-in-btn"; - public static final String COURSES_DASHBOARD_TITLE_CLASS = "dashboard-title"; - public static final String FIRST_COURSE_XPATH = "/html/body/app/div/main/app-dashboard/div/div[3]/div/div[1]/ul/li[1]"; public static final String GO_TO_COURSE_XPATH = "/div[2]"; /*use with XCOURSE_XPATH+GOTOCOURSE_XPATH*/ public static final String COURSE_LIST_COURSE_TITLE_CLASS = "course-title"; @@ -49,11 +47,8 @@ public final class Constants { public static final String COURSE_BACK_TO_DASHBOARD_CLASS = "btn-floating"; public static final String COURSE_TABS_TAG = "tabs-course-details"; - //It's the original, changeD because don't work //public static final String COURSE_TABS_TAG = "md-tab-group"; - - /*FROM mat-tab-group*/ public static final String FORUM_TAB_XPATH = "./div[1]/div[3]"; /*FROM mat-tab-group*/ @@ -128,7 +123,6 @@ public final class Constants { public static final String ATTENDERS_LIST_HIGHLIGHTED_ROW_CLASS = "attender-name-p"; public static final String SETTINGS_USER_EMAIL_ID = "stng-user-mail"; - //BUTTONS public static final By NEW_COURSE_BUTTON = By.id(NEW_COURSE_BUTTON_ID); public static final By SETTINGS_BUTTON = By.id(SETTINGS_BUTTON_ID); @@ -157,7 +151,6 @@ public final class Constants { public static final By SESSION_LIST_NEW_SESSION_MODAL_POST_BUTTON = By.id(SESSION_LIST_NEW_SESSION_MODAL_POST_BUTTON_ID); public static final By SESSION_LEFT_MENU_BUTTON = By.id(SESSION_LEFT_MENU_BUTTON_ID); - //TABS //MODALS @@ -168,7 +161,6 @@ public final class Constants { public static final By FORUM_NEW_COMMENT_MODAL = By.id(FORUM_NEW_COMMENT_MODAL_ID); public static final By SESSION_LIST_NEW_SESSION_MODAL = By.id(SESSION_LIST_NEW_SESSION_MODAL_ID); public static final By SESSION_LIST_EDIT_MODAL = By.id(SESSION_LIST_EDIT_MODAL_ID); - //OTHER ELEMENTS public static final By FOOTER = By.className(FOOTER_CLASS); public static final By MAIN_MENU_ARROW = By.id(MAIN_MENU_ARROW_ID); @@ -181,7 +173,6 @@ public final class Constants { public static final By COURSES_DASHBOARD_TITLE = By.className(COURSES_DASHBOARD_TITLE_CLASS); public static final By COURSE_LIST = By.className(COURSE_LIST_CLASS); - public static final By COURSE_TABS = By.id(COURSE_TABS_TAG); public static final By EDIT_COURSE_DELETE_CHECK = By.id(EDIT_COURSE_DELETE_CHECK_ID); public static final By EDIT_COURSE_DELETE_BUTTON = By.id(EDIT_COURSE_DELETE_BUTTON_ID); @@ -219,7 +210,6 @@ public final class Constants { public static final By ATTENDERS_LIST_ROWS = By.className(ATTENDERS_LIST_ROWS_CLASS); public static final By ATTENDERS_LIST_HIGHLIGHTED_ROW = By.className(ATTENDERS_LIST_HIGHLIGHTED_ROW_CLASS); - //ICONS public static final By FORUM_ICON = By.id(FORUM_ICON_ID); public static final By HOME_ICON = By.id(HOME_ICON_ID); @@ -236,8 +226,7 @@ public final class Constants { public static final By SESSION_LIST_SESSION_EDIT_ICON = By.className(SESSION_LIST_SESSION_EDIT_ICON_CLASS); public static final By SESSION_EXIT_ICON = By.id(SESSION_EXIT_ICON_ID); - //KEYS public static final String SELECT_ALL = Keys.chord(Keys.CONTROL, "a"); public static final String DELETE = Keys.chord(Keys.BACK_SPACE); -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/CourseNavigationUtilities.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/CourseNavigationUtilities.java index e6a3951..dffce29 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/CourseNavigationUtilities.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/CourseNavigationUtilities.java @@ -65,17 +65,14 @@ public static boolean checkIfCourseExists(WebDriver wd, String courseTitle) { return false; } - public static boolean checkIfCourseExists(WebDriver wd, String course_title, int retries) { //10 lines + public static boolean checkIfCourseExists(WebDriver wd, String course_title, int retries) throws InterruptedException { //10 lines for (int i = 0; i < retries; i++) { - try { - TimeUnit.SECONDS.sleep(1); - } catch (InterruptedException e) { - log.error("The Sleeping could not be done"); - } + TimeUnit.SECONDS.sleep(1); if (checkIfCourseExists(wd, course_title)) { return true; } } + return false; } @@ -101,6 +98,7 @@ public static WebDriver changeCourseName(WebDriver wd, String oldName, String ne } log.info("[END] changeCourseName OK"); + return wd; } private static void openEditCourseModal(WebDriver wd, WebElement courseElement) throws ElementNotFoundException { @@ -182,6 +180,7 @@ public static WebElement getCourseByName(WebDriver wd, String name) throws Eleme } } catch (NoSuchElementException noSuchElementException) { // Do nothing and look for the next item + log.info("Course not found looking, for the next item"); } } throw new ElementNotFoundException("getCourseElement - the course doesn't exist"); @@ -230,8 +229,9 @@ public static boolean isUserInAttendersList(WebDriver wd, String user_name) thro getTabContent(wd, ATTENDERS_ICON); Wait.notTooMuch(wd).until(ExpectedConditions.visibilityOfElementLocated(ATTENDERS_LIST_ROWS)); List attenders_lst = wd.findElements(ATTENDERS_LIST_ROWS); - if (attenders_lst.size() < 1) { + if (attenders_lst.isEmpty()) { log.info("[END] isUserInAttendersList KO: attenders list is empty"); + //TO-DO Check if can be replaced by a fail ("meessage") throw new ElementNotFoundException("isUserInAttendersList - attenders list is empty"); } for (WebElement webElement : attenders_lst) { @@ -249,12 +249,11 @@ public static String getHighlightedAttender(WebDriver wd) throws ElementNotFound log.info("[INI] getHighlightedAttender"); WebElement attenders_content = getTabContent(wd, ATTENDERS_ICON); List attender_highlighted = attenders_content.findElements(ATTENDERS_LIST_HIGHLIGHTED_ROW); - if (attender_highlighted == null || attender_highlighted.size() < 1) { + if (attender_highlighted == null || attender_highlighted.isEmpty()) { log.info("[END] getHighlightedAttender KO: no highlighted user"); throw new ElementNotFoundException("getHighlightedAttender - no highlighted user"); } return attender_highlighted.get(0).getText(); } - } \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/EdgeUser.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/EdgeUser.java index 11a7811..b37c7d0 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/EdgeUser.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/EdgeUser.java @@ -24,20 +24,19 @@ import org.openqa.selenium.support.ui.WebDriverWait; import java.net.MalformedURLException; -import java.net.URL; -import java.text.SimpleDateFormat; +import java.net.URI; +import java.net.URISyntaxException; import java.time.Duration; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.Date; import java.util.HashMap; import java.util.Map; public class EdgeUser extends BrowserUser { EdgeOptions options = new EdgeOptions(); - public EdgeUser(String userName, int timeOfWaitInSeconds, String testName, String userIdentifier) { - super(userName, timeOfWaitInSeconds); + public EdgeUser(String userIdentifier, int timeOfWaitInSeconds, String testName) throws URISyntaxException, MalformedURLException { + super(userIdentifier, timeOfWaitInSeconds); log.info(String.format("The Test names are: %s", testName)); @@ -51,42 +50,31 @@ public EdgeUser(String userName, int timeOfWaitInSeconds, String testName, Strin if (eusApiURL == null) { this.driver = new EdgeDriver(options); } else { - try { Map selenoidOptions = new HashMap<>(); log.info("Using the remote WebDriver (Selenoid)"); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_HH:mm"); - log.debug("Adding all the extra capabilities needed: {testName,enableVideo,enableVNC,name,enableLog,videoName,screenResolution}"); - - selenoidOptions.put("testName", testName + "_" + userIdentifier + "_" + format.format(new Date())); - //CAPABILITIES FOR SELENOID RETORCH - selenoidOptions.put("enableVideo", true); - selenoidOptions.put("enableVNC", true); - selenoidOptions.put("name", testName + "_" + userIdentifier); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yy-MM-dd-HH:mm"); LocalDateTime now = LocalDateTime.now(); - String logName = dtf.format(now) + "-" + testName + "-" + userIdentifier + ".log"; - String videoName = dtf.format(now) + "_" + testName + "_" + userIdentifier + ".mp4"; - log.debug("The data of this test would be stored into: video name " + videoName + " and the log is " + logName); + String baseName = System.getProperty("tjob_name") + "-" + dtf.format(now) + "-" + testName + "-" + userIdentifier ; + log.debug("The data of this test are stored into .mp4 and .log files named: {}" , baseName); + log.debug("Adding all the extra capabilities needed: {testName,enableVideo,enableVNC,name,enableLog,videoName,screenResolution}"); + //CAPABILITIES FOR SELENOID + selenoidOptions.put("testName", testName + "-" + userIdentifier + "-" + dtf.format(now)); + selenoidOptions.put("enableVideo", true); + selenoidOptions.put("enableVNC", true); + selenoidOptions.put("name", testName + "-" + userIdentifier); selenoidOptions.put("enableLog", true); - selenoidOptions.put("logName ", logName); - selenoidOptions.put("videoName", videoName); - + selenoidOptions.put("logName ", String.format("%s%s",baseName.replaceAll("\\s","") , ".log")); + selenoidOptions.put("videoName", String.format("%s%s",baseName.replaceAll("\\s","") ,".mp4")); selenoidOptions.put("screenResolution", "1920x1080x24"); - options.setCapability("selenoid:options", selenoidOptions); - //END CAPABILITIES FOR SELENOID RETORCH - - RemoteWebDriver remote = new RemoteWebDriver(new URL(eusApiURL), options); + log.debug("Configuring the remote WebDriver "); + RemoteWebDriver remote = new RemoteWebDriver(new URI("http://selenoid:4444/wd/hub").toURL(), options); + log.debug("Configuring the Local File Detector"); remote.setFileDetector(new LocalFileDetector()); - - this.driver = remote; - } catch (MalformedURLException e) { - throw new RuntimeException("Exception creating eusApiURL", e); - } } new WebDriverWait(driver, Duration.ofSeconds(this.timeOfWaitInSeconds)); diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/FirefoxUser.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/FirefoxUser.java index e8a9fc3..2d207dd 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/FirefoxUser.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/FirefoxUser.java @@ -24,19 +24,18 @@ import org.openqa.selenium.remote.RemoteWebDriver; import java.net.MalformedURLException; -import java.net.URL; -import java.text.SimpleDateFormat; +import java.net.URI; +import java.net.URISyntaxException; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.Date; import java.util.HashMap; import java.util.Map; public class FirefoxUser extends BrowserUser { FirefoxOptions options = new FirefoxOptions(); - public FirefoxUser(String userName, int timeOfWaitInSeconds, String testName, String userIdentifier) { - super(userName, timeOfWaitInSeconds); + public FirefoxUser(String userIdentifier, int timeOfWaitInSeconds, String testName) throws URISyntaxException, MalformedURLException { + super(userIdentifier, timeOfWaitInSeconds); //TO-DO Firefox configuration has changed, review it. FirefoxProfile profile = new FirefoxProfile(); // This flag avoids granting the access to the camera @@ -56,52 +55,36 @@ public FirefoxUser(String userName, int timeOfWaitInSeconds, String testName, St options.setCapability("marionette", true); driver = new FirefoxDriver(options); - } else { - try { - Map selenoidOptions = new HashMap<>(); - log.info("Using the remote WebDriver (Selenoid)"); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_HH:mm"); - log.debug("Adding all the extra capabilities needed: {testName,enableVideo,enableVNC,name,enableLog,videoName,screenResolution}"); - - selenoidOptions.put("testName", testName + "_" + userIdentifier + "_" + format.format(new Date())); - //CAPABILITIES FOR SELENOID RETORCH - selenoidOptions.put("enableVideo", true); - selenoidOptions.put("enableVNC", true); - selenoidOptions.put("name", testName + "_" + userIdentifier); - - DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yy-MM-dd-HH:mm"); - LocalDateTime now = LocalDateTime.now(); - String logName = dtf.format(now) + "-" + testName + "-" + userIdentifier + ".log"; - String videoName = dtf.format(now) + "_" + testName + "_" + userIdentifier + ".mp4"; - log.debug("The data of this test would be stored into: video name " + videoName + " and the log is " + logName); - - selenoidOptions.put("enableLog", true); - selenoidOptions.put("logName ", logName); - selenoidOptions.put("videoName", videoName); - - selenoidOptions.put("screenResolution", "1920x1080x24"); - - options.setCapability("selenoid:options", selenoidOptions); - - //END CAPABILITIES FOR SELENOID RETORCH - - RemoteWebDriver remote = new RemoteWebDriver(new URL(eusApiURL), options); - remote.setFileDetector(new LocalFileDetector()); - - - this.driver = remote; - - remote.setFileDetector(new LocalFileDetector()); - this.driver = remote; - } catch (MalformedURLException e) { - throw new RuntimeException("Exception creating eusApiURL", e); - } + Map selenoidOptions = new HashMap<>(); + log.info("Using the remote WebDriver (Selenoid)"); + + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yy-MM-dd-HH:mm"); + LocalDateTime now = LocalDateTime.now(); + String baseName = System.getProperty("tjob_name") + "-" + dtf.format(now) + "-" + testName + "-" + userIdentifier ; + log.debug("The data of this test are stored into .mp4 and .log files named: {}", baseName); + log.debug("Adding all the extra capabilities needed: {testName,enableVideo,enableVNC,name,enableLog,videoName,screenResolution}"); + //CAPABILITIES FOR SELENOID + + selenoidOptions.put("testName", testName + "-" + userIdentifier + "-" + dtf.format(now)); + selenoidOptions.put("enableVideo", true); + selenoidOptions.put("enableVNC", true); + selenoidOptions.put("name", testName + "-" + userIdentifier); + selenoidOptions.put("enableLog", true); + selenoidOptions.put("logName ", String.format("%s%s",baseName.replaceAll("\\s","") , ".log")); + selenoidOptions.put("videoName", String.format("%s%s",baseName.replaceAll("\\s","") ,".mp4")); + selenoidOptions.put("screenResolution", "1920x1080x24"); + options.setCapability("selenoid:options", selenoidOptions); + //END CAPABILITIES FOR SELENOID RETORCH + log.debug("Configuring the remote WebDriver "); + RemoteWebDriver remote = new RemoteWebDriver(new URI("http://selenoid:4444/wd/hub").toURL(), options); + log.debug("Configuring the Local File Detector"); + remote.setFileDetector(new LocalFileDetector()); + this.driver = remote; } - //this.driver.manage().timeouts().setScriptTimeout(this.timeOfWaitInSeconds, TimeUnit.SECONDS); - this.configureDriver(); } + } \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/ForumNavigationUtilities.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/ForumNavigationUtilities.java index 8818230..b5344b2 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/ForumNavigationUtilities.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/ForumNavigationUtilities.java @@ -15,10 +15,8 @@ import java.util.List; import static com.fullteaching.e2e.no_elastest.common.Constants.*; -import static java.lang.invoke.MethodHandles.lookup; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.slf4j.LoggerFactory.getLogger; public class ForumNavigationUtilities { @@ -55,7 +53,8 @@ public static List getUserEntries(WebDriver wd, String user_name) { List entries = tab_content.findElements(By.className("entry-title")); for (WebElement entry : entries) { //if username is the publisher of the entry... - entries_titles.add(entry.findElement(FORUM_ENTRY_LIST_ENTRY_TITLE).getText()); + if (entry.getText().contains(user_name)) + entries_titles.add(entry.findElement(FORUM_ENTRY_LIST_ENTRY_TITLE).getText()); } return entries_titles; @@ -66,13 +65,13 @@ public static WebElement getEntry(WebDriver wd, String entry_name) throws Elemen Wait.notTooMuch(wd).until(ExpectedConditions.visibilityOfElementLocated(FORUM_ICON)); WebElement tab_content = CourseNavigationUtilities.getTabContent(wd, FORUM_ICON); - //Wait.notTooMuch(wd).until(ExpectedConditions.visibilityOfElementLocated(By.className("entry-title"))); List entries = tab_content.findElements(By.className("entry-title")); + String title_text = "No entries"; for (WebElement entry : entries) { try { WebElement title = entry.findElement(FORUM_ENTRY_LIST_ENTRY_TITLE); - String title_text = title.getText(); - if (title_text == null || title_text.equals("")) { + title_text = title.getText(); + if (title_text == null || title_text.isEmpty()) { title_text = title.getAttribute("innerHTML"); } if (entry_name.equals(title_text)) { @@ -80,7 +79,7 @@ public static WebElement getEntry(WebDriver wd, String entry_name) throws Elemen return entry; } } catch (NoSuchElementException csee) { - //do nothing and look for the next item + log.info("Entry not found, the current title is {}", title_text); } } throw new ElementNotFoundException(String.format("[getEntry] The entry with title \"%s\" the entry doesn't exist, the number of entries was %s", entry_name, entries.size())); @@ -145,10 +144,10 @@ public static WebDriver newEntry(WebDriver wd, String newEntryTitle, String newE return wd; } - public static List getReplies(WebDriver driver, WebElement comment) { //7 lines log.info("Get all the replies of the selected comment"); List replies = new ArrayList<>(); + Wait.notTooMuch(driver).until(ExpectedConditions.visibilityOfElementLocated(FORUM_COMMENT_LIST_COMMENT_DIV)); //get all comment-div List nestedComments = comment.findElements(FORUM_COMMENT_LIST_COMMENT_DIV); //ignore first it is original comment @@ -203,4 +202,4 @@ public static WebDriver disableForum(WebDriver wd) throws ElementNotFoundExcepti return wd; } -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/NavigationUtilities.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/NavigationUtilities.java index 9e8c469..8f18773 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/NavigationUtilities.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/NavigationUtilities.java @@ -13,8 +13,6 @@ import static com.fullteaching.e2e.no_elastest.common.BaseLoggedTest.HOST; import static com.fullteaching.e2e.no_elastest.common.Constants.*; -import static java.lang.invoke.MethodHandles.lookup; -import static org.slf4j.LoggerFactory.getLogger; public class NavigationUtilities { @@ -36,11 +34,9 @@ public static boolean amINotHere(WebDriver wd, String url) { } public static void getUrl(WebDriver wd, String url) { - if (amINotHere(wd, url)) log.info("Navigating to: {}", url); wd.get(url); - } public static void getUrlAndWaitFooter(WebDriver wd, String url) { //3lines @@ -90,9 +86,8 @@ public static WebElement getOption(List options, String find, FindOp return null; } - public enum FindOption { CLASS, TEXT, VALUE, ATTRIBUTE } -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/SessionNavigationUtilities.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/SessionNavigationUtilities.java index 97bb89a..63c8383 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/SessionNavigationUtilities.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/SessionNavigationUtilities.java @@ -4,6 +4,8 @@ import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; @@ -11,7 +13,7 @@ import static com.fullteaching.e2e.no_elastest.common.Constants.*; public class SessionNavigationUtilities { - + private static final Logger log = LoggerFactory.getLogger(SessionNavigationUtilities.class); public static List getFullSessionList(WebDriver wd) { //7lines ArrayList session_titles = new ArrayList<>(); WebElement tab_content = CourseNavigationUtilities.getTabContent(wd, SESSION_ICON); @@ -29,7 +31,7 @@ public static WebElement getSession(WebDriver wd, String session_name) throws El try { WebElement title = session.findElement(SESSION_LIST_SESSION_NAME); String title_text = title.getText(); - if (title_text == null || title_text.equals("")) { + if (title_text == null || title_text.isEmpty()) { title_text = title.getAttribute("innerHTML"); } if (session_name.equals(title_text)) { @@ -37,8 +39,9 @@ public static WebElement getSession(WebDriver wd, String session_name) throws El } } catch (NoSuchElementException noSuchElementExcept) { //do nothing and look for the next item + log.info("Looking to the next session to check if the title match."); } } throw new ElementNotFoundException("getSession-the session doesn't exist"); } -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/SpiderNavigation.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/SpiderNavigation.java index ee8dfaf..543f79d 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/SpiderNavigation.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/SpiderNavigation.java @@ -16,7 +16,6 @@ public class SpiderNavigation { * work properly in this kind of application. * This is a Specialized Spider navigation for FullTeaching.*/ - private static String host = LOCALHOST; /** @@ -35,10 +34,8 @@ public static List getPageLinks(WebDriver wd) { //29 lines List a_lst = wd.findElements(By.tagName("a")); for (WebElement a : a_lst) { String href = a.getAttribute("href"); - if ((href != null) && (!href.trim().equals("")) && (!href.contains("#"))) { - if (isContainedIn(href.trim(), links_href) && href.contains(host)) + if ((href != null) && (!href.trim().isEmpty()) && (!href.contains("#")) && isContainedIn(href.trim(), links_href) && href.contains(host)) links.add(a); - } } return links; } @@ -54,10 +51,8 @@ public static List getUnexploredPageLinks(WebDriver wd, Map allLinks = getPageLinks(wd); for (WebElement a : allLinks) { String href = a.getAttribute("href"); - if ((href != null) && (!href.trim().equals("")) && (!href.contains("#"))) { - if (isContainedIn(href.trim(), explored.keySet()) && href.contains(host)) //8lines - links.add(a); - } + if ((href != null) && (!href.trim().isEmpty()) && (!href.contains("#")) && isContainedIn(href.trim(), explored.keySet()) && href.contains(host)) + links.add(a); } return links; } @@ -102,22 +97,18 @@ private static boolean isContainedIn(String href, Set set) { // 8lines } public static Set addNonExistentLink(Set original, String href) { //5lines - if ((href != null) && (!href.equals("")) && (!href.contains("#"))) { - if (isContainedIn(href, original) && href.contains(host)) + if ((href != null) && (!href.isEmpty()) && (!href.contains("#")) && isContainedIn(href, original) && href.contains(host)) original.add(href); - } return original; } public static List discardExplored(List new_links, Set explored) { //8 lines List withOutExplored = new ArrayList<>(); for (String href : new_links) { - if ((href != null) && (!href.equals("")) && (!href.contains("#"))) { - if (isContainedIn(href, explored) && href.contains(host)) + if ((href != null) && (!href.isEmpty()) && (!href.contains("#")) && isContainedIn(href, explored) && href.contains(host)) withOutExplored.add(href); - } } return withOutExplored; } -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/UserUtilities.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/UserUtilities.java index 2addef3..4060b06 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/UserUtilities.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/UserUtilities.java @@ -14,16 +14,11 @@ import org.slf4j.LoggerFactory; import static com.fullteaching.e2e.no_elastest.common.Constants.*; -import static java.lang.invoke.MethodHandles.lookup; -import static org.slf4j.LoggerFactory.getLogger; - public class UserUtilities { - private static final Logger log = LoggerFactory.getLogger(UserUtilities.class); - public static WebDriver checkLogin(WebDriver wd, String user) throws NotLoggedException, BadUserException, ElementNotFoundException { //12 lines log.info("[INI]checkLogin"); //Wait to settings button to be present @@ -40,7 +35,6 @@ public static WebDriver checkLogin(WebDriver wd, String user) throws NotLoggedEx return wd; } - public static void checkLogOut(WebDriver wd) throws ElementNotFoundException { //8lines log.info("[INI]checkLogOut"); try { @@ -52,5 +46,4 @@ public static void checkLogOut(WebDriver wd) throws ElementNotFoundException { / } - -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/BadUserException.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/BadUserException.java index 78845a5..e1857dc 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/BadUserException.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/BadUserException.java @@ -8,5 +8,4 @@ public BadUserException() { super(); } - -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/ElementNotFoundException.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/ElementNotFoundException.java index 4adfb8c..5d11be6 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/ElementNotFoundException.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/ElementNotFoundException.java @@ -2,7 +2,6 @@ public class ElementNotFoundException extends Exception { - private static final long serialVersionUID = -470143598556264052L; public ElementNotFoundException() { @@ -12,4 +11,4 @@ public ElementNotFoundException() { public ElementNotFoundException(String message) { super(message); } -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/ExceptionsHelper.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/ExceptionsHelper.java index ce905e8..1c3ebcf 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/ExceptionsHelper.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/ExceptionsHelper.java @@ -19,5 +19,4 @@ public static Integer getFileLineInfo(StackTraceElement[] stack, String file) { return stackMap.get(file); } -} - +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/NotLoggedException.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/NotLoggedException.java index 9e801ce..87d498d 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/NotLoggedException.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/NotLoggedException.java @@ -2,7 +2,6 @@ public class NotLoggedException extends Exception { - private static final long serialVersionUID = -8141878141453256011L; public NotLoggedException() { @@ -13,5 +12,4 @@ public NotLoggedException(String message) { super(message); } - -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/TimeOutException.java b/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/TimeOutException.java index 12d9cd4..1be4004 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/TimeOutException.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/common/exception/TimeOutException.java @@ -2,7 +2,6 @@ public class TimeOutException extends Exception { - private static final long serialVersionUID = 9200938683074869086L; public TimeOutException() { diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/LoggedForumTest.java b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/LoggedForumTest.java index 7a67ec6..bb76db3 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/LoggedForumTest.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/LoggedForumTest.java @@ -5,25 +5,22 @@ import com.fullteaching.e2e.no_elastest.common.ForumNavigationUtilities; import com.fullteaching.e2e.no_elastest.common.NavigationUtilities; import com.fullteaching.e2e.no_elastest.common.exception.ElementNotFoundException; +import com.fullteaching.e2e.no_elastest.common.exception.NotLoggedException; import com.fullteaching.e2e.no_elastest.utils.Click; import com.fullteaching.e2e.no_elastest.utils.DOMManager; import com.fullteaching.e2e.no_elastest.utils.ParameterLoader; import com.fullteaching.e2e.no_elastest.utils.Wait; import giis.retorch.annotations.AccessMode; import giis.retorch.annotations.Resource; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Tag; 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.StaleElementReferenceException; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.ExpectedConditions; -import org.slf4j.Logger; import java.io.IOException; import java.util.Calendar; @@ -31,9 +28,7 @@ import java.util.stream.Stream; import static com.fullteaching.e2e.no_elastest.common.Constants.*; -import static java.lang.invoke.MethodHandles.lookup; import static org.junit.jupiter.api.Assertions.*; -import static org.slf4j.LoggerFactory.getLogger; @Tag("e2e") @@ -66,15 +61,15 @@ public static Stream data() throws IOException { @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") @Resource(resID = "Course", replaceable = {"Forum"}) @AccessMode(resID = "Course", concurrency = 10, sharing = true, accessMode = "READONLY") + @DisplayName("studentCourseMainTest") @ParameterizedTest @MethodSource("data") - void forumLoadEntriesTest(String mail, String password, String role) { //47lines +115 +28 set up +13 lines teardown =203 + void forumLoadEntriesTest(String mail, String password, String role) throws NotLoggedException, ElementNotFoundException, InterruptedException { //47lines +115 +28 set up +13 lines teardown =203 this.slowLogin(user, mail, password);//24 lines - try { //navigate to courses. NavigationUtilities.toCoursesHome(driver);//3lines List courses = CourseNavigationUtilities.getCoursesList(driver);//13lines - assertTrue(courses.size() > 0, "No courses in the list"); + assertFalse(courses.isEmpty(), "No courses in the list"); //find course with forum activated boolean activated_forum_on_some_test = false; boolean has_comments = false; @@ -92,7 +87,7 @@ void forumLoadEntriesTest(String mail, String password, String role) { //47lines log.info("Loading the entries list"); //Load list of entries List entries_list = ForumNavigationUtilities.getFullEntryList(driver);//6lines - if (entries_list.size() > 0) { + if (!entries_list.isEmpty()) { //Go into first entry for (String entry_name : entries_list) { log.info("Checking the entry with name: {}", entry_name); @@ -102,7 +97,7 @@ void forumLoadEntriesTest(String mail, String password, String role) { //47lines Wait.notTooMuch(driver).until(ExpectedConditions.visibilityOfElementLocated(FORUM_COMMENT_LIST)); List comments = ForumNavigationUtilities.getComments(driver); log.info("Checking if the entry has comments"); - if (comments.size() > 0) { + if (!comments.isEmpty()) { has_comments = true; log.info("Comments found, saving them"); @@ -116,9 +111,6 @@ void forumLoadEntriesTest(String mail, String password, String role) { //47lines driver = Click.element(driver, BACK_TO_DASHBOARD); } assertTrue((activated_forum_on_some_test && has_comments), "There isn't any forum that can be used to test this [Or not activated or no entry lists or not comments]"); - } catch (ElementNotFoundException notFoundException) { - fail("Failed to navigate to courses forum:: " + notFoundException.getClass() + ": " + notFoundException.getLocalizedMessage()); - } } /** @@ -134,9 +126,10 @@ void forumLoadEntriesTest(String mail, String password, String role) { //47lines @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") @Resource(resID = "Course", replaceable = {"Forum"}) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READWRITE") + @DisplayName("studentCourseMainTest") @ParameterizedTest @MethodSource("data") - void forumNewEntryTest(String mail, String password, String role) {// 48+ 104 + 28 set up +13 lines teardown =193 + void forumNewEntryTest(String mail, String password, String role) throws NotLoggedException, ElementNotFoundException, InterruptedException {// 48+ 104 + 28 set up +13 lines teardown =193 this.slowLogin(user, mail, password); //24 lines Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); @@ -150,7 +143,6 @@ void forumNewEntryTest(String mail, String password, String role) {// 48+ 104 + String newEntryTitle = "New Entry Test " + mDay + mMonth + mYear + mHour + mMinute + mSecond; String newEntryContent = "This is the content written on the " + mDay + " of " + months[mMonth] + ", " + mHour + ":" + mMinute + "," + mSecond; log.info("Navigating to courses tab"); - try { log.info("Navigating to courses tab"); //navigate to courses. if (NavigationUtilities.amINotHere(driver, COURSES_URL.replace("__HOST__", HOST))) { @@ -180,7 +172,7 @@ void forumNewEntryTest(String mail, String password, String role) {// 48+ 104 + //first comment should be the inserted while creating the entry Wait.waitForPageLoaded(driver); List comments = ForumNavigationUtilities.getComments(driver); - assertFalse(comments.size() < 1, "No comments on the entry"); + assertFalse(comments.isEmpty(), "No comments on the entry"); Wait.notTooMuch(driver).until(ExpectedConditions.visibilityOfElementLocated(FORUM_COMMENT_LIST)); Wait.waitForPageLoaded(driver); WebElement newComment = comments.get(0); @@ -189,9 +181,6 @@ void forumNewEntryTest(String mail, String password, String role) {// 48+ 104 + Wait.waitForPageLoaded(driver); String comment = newComment.findElement(FORUM_COMMENT_LIST_COMMENT_USER).getText(); assertEquals(comment, userName, "Bad user in comment"); - } catch (ElementNotFoundException notFoundException) { - Assertions.fail("Failed to navigate to course forum:: " + notFoundException.getClass() + ": " + notFoundException.getLocalizedMessage()); - } //Fix Flaky test Navigating to the mainpage to logout... user.getDriver().get(APP_URL); } @@ -211,9 +200,10 @@ void forumNewEntryTest(String mail, String password, String role) {// 48+ 104 + @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") @Resource(resID = "Course", replaceable = {"Forum"}) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READWRITE") + @DisplayName("forumNewCommentTest") @ParameterizedTest @MethodSource("data") - void forumNewCommentTest(String mail, String password, String role) { // 69+142 + 28 set up +13 lines teardown =252 + void forumNewCommentTest(String mail, String password, String role) throws NotLoggedException, ElementNotFoundException, InterruptedException { // 69+142 + 28 set up +13 lines teardown =252 this.slowLogin(user, mail, password); //24 lines Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); @@ -224,7 +214,6 @@ void forumNewCommentTest(String mail, String password, String role) { // 69+142 int mMinute = calendar.get(Calendar.MINUTE); int mSecond = calendar.get(Calendar.SECOND); - try { //check if one course have any entry for comment NavigationUtilities.toCoursesHome(driver);//3lines @@ -235,7 +224,7 @@ void forumNewCommentTest(String mail, String password, String role) { // 69+142 assertTrue(ForumNavigationUtilities.isForumEnabled(CourseNavigationUtilities.getTabContent(driver, FORUM_ICON)), "Forum not activated");//6lines List entries_list = ForumNavigationUtilities.getFullEntryList(driver);//6lines WebElement entry; - if (entries_list.size() <= 0) {//if not new entry + if (entries_list.isEmpty()) {//if not new entry String newEntryTitle = "New Comment Test " + mDay + mMonth + mYear + mHour + mMinute + mSecond; String newEntryContent = "This is the content written on the " + mDay + " of " + months[mMonth - 1] + ", " + mHour + ":" + mMinute + "," + mSecond; ForumNavigationUtilities.newEntry(driver, newEntryTitle, newEntryContent);//16lines @@ -274,20 +263,13 @@ void forumNewCommentTest(String mail, String password, String role) { // 69+142 boolean commentFound = false; for (WebElement comment : comments) { //check if it is new comment - try { String text = comment.findElement(FORUM_COMMENT_LIST_COMMENT_CONTENT).getText(); if (text.equals(newCommentContent)) { commentFound = true; assertEquals(comment.findElement(FORUM_COMMENT_LIST_COMMENT_USER).getText(), userName, "Bad user in comment"); } - } catch (StaleElementReferenceException e) { - log.info("Not Found"); - } } assertTrue(commentFound, "Comment not found"); - } catch (ElementNotFoundException notFoundException) { - fail("Failed to navigate to course forum:: " + notFoundException.getClass() + ": " + notFoundException.getLocalizedMessage()); - } } @@ -299,16 +281,16 @@ void forumNewCommentTest(String mail, String password, String role) { // 69+142 * previously created, go to the first and replies to the same comment.After it, we check * that the comment was correctly published. */ - @Disabled - @ParameterizedTest - @MethodSource("data") @Resource(resID = "LoginService", replaceable = {}) @AccessMode(resID = "LoginService", concurrency = 10, sharing = true, accessMode = "READONLY") @Resource(resID = "OpenVidu", replaceable = {"OpenViduMock"}) @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") @Resource(resID = "Course", replaceable = {"Forum"}) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READWRITE") - void forumNewReply2CommentTest(String mail, String password, String role) { // 63+137+ 28 set up +13 lines teardown = 242 + @DisplayName("forumNewReply2CommentTest") + @ParameterizedTest + @MethodSource("data") + void forumNewReply2CommentTest(String mail, String password, String role) throws NotLoggedException, ElementNotFoundException, InterruptedException { // 63+137+ 28 set up +13 lines teardown = 242 this.slowLogin(user, mail, password);//24 lines Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); @@ -319,10 +301,8 @@ void forumNewReply2CommentTest(String mail, String password, String role) { // 6 int mMinute = calendar.get(Calendar.MINUTE); int mSecond = calendar.get(Calendar.SECOND); String newEntryTitle; - try { //check if one course have any entry for comment NavigationUtilities.toCoursesHome(driver);//3lines - WebElement course = CourseNavigationUtilities.getCourseByName(driver, courseName);//14 lines course.findElement(COURSE_LIST_COURSE_TITLE).click(); Wait.notTooMuch(driver).until(ExpectedConditions.visibilityOfElementLocated(By.id(TABS_DIV_ID))); @@ -330,7 +310,7 @@ void forumNewReply2CommentTest(String mail, String password, String role) { // 6 assertTrue(ForumNavigationUtilities.isForumEnabled(CourseNavigationUtilities.getTabContent(driver, FORUM_ICON)), "Forum not activated");//2lines List entries_list = ForumNavigationUtilities.getFullEntryList(driver);//6lines WebElement entry; - if (entries_list.size() <= 0) {//if not new entry + if (entries_list.isEmpty()) {//if not new entry newEntryTitle = "New Comment Test " + mDay + mMonth + mYear + mHour + mMinute + mSecond; String newEntryContent = "This is the content written on the " + mDay + " of " + months[mMonth - 1] + ", " + mHour + ":" + mMinute + "," + mSecond; ForumNavigationUtilities.newEntry(driver, newEntryTitle, newEntryContent); //19 lines @@ -351,7 +331,7 @@ void forumNewReply2CommentTest(String mail, String password, String role) { // 6 WebElement textField = driver.findElement(FORUM_COMMENT_LIST_MODAL_NEW_REPLY_TEXT_FIELD); textField.sendKeys(newReplyContent); Click.element(user.getDriver(), FORUM_NEW_COMMENT_MODAL_POST_BUTTON); - + user.waitUntil(ExpectedConditions.invisibilityOfElementLocated(FORUM_COMMENT_LIST_MODAL_NEW_REPLY),"The model is still visible"); user.waitUntil(ExpectedConditions.visibilityOfElementLocated(FORUM_COMMENT_LIST), "The comments are not visible"); user.waitUntil(ExpectedConditions.visibilityOfElementLocated(FORUM_COMMENT_LIST_COMMENT), "The comment list are not visible"); @@ -360,21 +340,16 @@ void forumNewReply2CommentTest(String mail, String password, String role) { // 6 List replies = ForumNavigationUtilities.getReplies(user.getDriver(), comments.get(0)); // 7 lines WebElement newReply = null; for (WebElement reply : replies) { - - reply.findElement(By.cssSelector("#div.col.l11.m11.s11 > div.message-itself")); String text = reply.getText(); - if (text.equals(newReplyContent)) + if (text.contains(newReplyContent)) newReply = reply; } //assert reply assertNotNull(newReply, "Reply not found"); - boolean asserto = newReply.findElement(FORUM_COMMENT_LIST_COMMENT_USER).getText().equals(userName); - assertTrue(asserto, "Bad user in comment"); + boolean isNameEqual = newReply.findElement(FORUM_COMMENT_LIST_COMMENT_USER).getText().equals(userName); + assertTrue(isNameEqual, "Bad user in comment"); //nested reply //assert nested reply - } catch (ElementNotFoundException notFoundException) { - fail("Failed to navigate to course forum:: " + notFoundException.getClass() + ": " + notFoundException.getLocalizedMessage()); - } } } diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/LoggedLinksTests.java b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/LoggedLinksTests.java index 9c2a9a8..0e7c8cc 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/LoggedLinksTests.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/LoggedLinksTests.java @@ -3,16 +3,16 @@ import com.fullteaching.e2e.no_elastest.common.BaseLoggedTest; import com.fullteaching.e2e.no_elastest.common.NavigationUtilities; import com.fullteaching.e2e.no_elastest.common.SpiderNavigation; +import com.fullteaching.e2e.no_elastest.common.exception.ElementNotFoundException; +import com.fullteaching.e2e.no_elastest.common.exception.NotLoggedException; import com.fullteaching.e2e.no_elastest.utils.ParameterLoader; import giis.retorch.annotations.AccessMode; import giis.retorch.annotations.Resource; -import io.github.bonigarcia.seljup.SeleniumJupiter; -import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.openqa.selenium.WebElement; -import org.slf4j.Logger; import java.io.IOException; import java.util.ArrayList; @@ -21,40 +21,43 @@ import java.util.Map; import java.util.stream.Stream; -import static java.lang.invoke.MethodHandles.lookup; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.slf4j.LoggerFactory.getLogger; -@ExtendWith(SeleniumJupiter.class) class LoggedLinksTests extends BaseLoggedTest { + + public LoggedLinksTests() { super(); } + public static Stream data() throws IOException { return ParameterLoader.getTestUsers(); } + /** * This test get logged the user and checks the navigation by URL works correctly.First * get all the possible URLS for the current user for after it iterate over them checking * that the response of the rest service was KO* */ - @ParameterizedTest - @MethodSource("data") + @Resource(resID = "LoginService", replaceable = {}) @AccessMode(resID = "LoginService", concurrency = 10, sharing = true, accessMode = "READONLY") @Resource(resID = "OpenVidu", replaceable = {"OpenViduMock"}) @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") @Resource(resID = "Course", replaceable = {}) @AccessMode(resID = "Course", concurrency = 15, sharing = true, accessMode = "READWRITE") - void spiderLoggedTest(String mail, String password, String role) { //140 + 28 set up +13 lines teardown = 181 + @ParameterizedTest + @MethodSource("data") + @DisplayName("spiderLoggedTest") + void spiderLoggedTest(String mail, String password, String role) throws NotLoggedException, ElementNotFoundException, InterruptedException { //140 + 28 set up +13 lines teardown = 181 this.slowLogin(user, mail, password); //*navigate from home*//* NavigationUtilities.getUrlAndWaitFooter(driver, HOST); //13 lines @@ -66,7 +69,7 @@ void spiderLoggedTest(String mail, String password, String role) { //140 + 28 se List failed_links = new ArrayList<>(); System.out.println(mail + " tested " + explored.size() + " urls"); explored.forEach((link, result) -> { - log.debug("\t" + link + " => " + result); + log.debug("\t {} => {}", link, result); if (result.equals("KO")) { failed_links.add(link); } diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/UnLoggedLinksTests.java b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/UnLoggedLinksTests.java index d3ae0a7..f0d7ad9 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/UnLoggedLinksTests.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/UnLoggedLinksTests.java @@ -6,11 +6,11 @@ import com.fullteaching.e2e.no_elastest.utils.ParameterLoader; import giis.retorch.annotations.AccessMode; import giis.retorch.annotations.Resource; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.openqa.selenium.WebElement; -import org.slf4j.Logger; import java.io.IOException; import java.util.ArrayList; @@ -19,9 +19,7 @@ import java.util.Map; import java.util.stream.Stream; -import static java.lang.invoke.MethodHandles.lookup; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.slf4j.LoggerFactory.getLogger; class UnLoggedLinksTests extends BaseLoggedTest { @@ -30,19 +28,19 @@ public UnLoggedLinksTests() { } public static Stream data() throws IOException { - return ParameterLoader.getTestUsers(); + return ParameterLoader.getTestTeachers(); } - @ParameterizedTest - @MethodSource("data") @Resource(resID = "LoginService", replaceable = {}) @AccessMode(resID = "LoginService", concurrency = 10, sharing = true, accessMode = "READONLY") @Resource(resID = "OpenVidu", replaceable = {"OpenViduMock"}) @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") @Resource(resID = "Course", replaceable = {}) @AccessMode(resID = "Course", concurrency = 15, sharing = true, accessMode = "READWRITE") + @ParameterizedTest + @MethodSource("data") + @DisplayName("spiderUnloggedTest") void spiderUnloggedTest(String mail, String password, String role) { //125 lines + 28 set up +13 lines teardown = 166 - userMail = "nonloged@gmail.com"; NavigationUtilities.getUrlAndWaitFooter(driver, HOST); List pageLinks = SpiderNavigation.getPageLinks(driver); //29 lines @@ -62,4 +60,4 @@ void spiderUnloggedTest(String mail, String password, String role) { //125 lines assertTrue(failed_links.isEmpty(), msg); } -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/UserTest.java b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/UserTest.java index abf50aa..866b33f 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/UserTest.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/UserTest.java @@ -9,6 +9,7 @@ import giis.retorch.annotations.AccessMode; import giis.retorch.annotations.Resource; import io.github.bonigarcia.seljup.SeleniumJupiter; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -18,8 +19,6 @@ import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; - @ExtendWith(SeleniumJupiter.class) class UserTest extends BaseLoggedTest { @@ -28,38 +27,24 @@ public static Stream data() throws IOException { return ParameterLoader.getTestUsers(); } - /** * This test is a simple logging acknowledgement, that checks if the current logged user * was logged correctly */ - - @ParameterizedTest - @MethodSource("data") @Resource(resID = "LoginService", replaceable = {}) @AccessMode(resID = "LoginService", concurrency = 10, sharing = true, accessMode = "READONLY") @Resource(resID = "OpenVidu", replaceable = {"OpenViduMock"}) @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") - void loginTest(String mail, String password, String role) { //22 +85 +28 set up +13 lines teardown =148 - try { + @ParameterizedTest + @MethodSource("data") + @DisplayName("loginTest") + void loginTest(String mail, String password, String role) throws NotLoggedException, ElementNotFoundException, BadUserException, InterruptedException { //22 +85 +28 set up +13 lines teardown =148 this.slowLogin(user, mail, password); //24 lines UserUtilities.checkLogin(driver, mail); //12 lines assertTrue(true, "not logged"); - } catch (NotLoggedException | BadUserException e) { - e.printStackTrace(); - fail("Not logged"); - } catch (ElementNotFoundException e) { - e.printStackTrace(); - fail(e.getLocalizedMessage()); - } - try { + this.logout(user); //14 lines UserUtilities.checkLogOut(driver); //8lines - } catch (ElementNotFoundException eleNotFoundExcept) { - fail("Still logged"); - } - assertTrue(true); + assertTrue(true); } - - -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingEndToEndEChatTests.java b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingEndToEndEChatTests.java index 4773642..1f6dcfb 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingEndToEndEChatTests.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingEndToEndEChatTests.java @@ -19,21 +19,26 @@ import com.fullteaching.e2e.no_elastest.common.BaseLoggedTest; import com.fullteaching.e2e.no_elastest.common.BrowserUser; +import com.fullteaching.e2e.no_elastest.common.exception.ElementNotFoundException; +import com.fullteaching.e2e.no_elastest.common.exception.NotLoggedException; +import com.fullteaching.e2e.no_elastest.utils.ParameterLoader; import giis.retorch.annotations.AccessMode; import giis.retorch.annotations.Resource; -import io.github.bonigarcia.seljup.SeleniumJupiter; import org.junit.jupiter.api.*; -import org.junit.jupiter.api.extension.ExtendWith; +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.WebElement; -import org.openqa.selenium.logging.LogEntries; import org.openqa.selenium.support.ui.ExpectedConditions; -import java.util.Date; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URISyntaxException; import java.util.List; +import java.util.stream.Stream; import static com.fullteaching.e2e.no_elastest.common.Constants.*; -import static org.openqa.selenium.logging.LogType.BROWSER; /** * E2E tests for FullTeaching chat in a video session. @@ -44,19 +49,15 @@ @Tag("e2e") @DisplayName("E2E tests for FullTeaching chat") -@ExtendWith(SeleniumJupiter.class) class FullTeachingEndToEndEChatTests extends BaseLoggedTest { - - private final static String TEACHER_BROWSER = "chrome"; private final static String STUDENT_BROWSER = "chrome"; - - final String teacherMail = "teacher@gmail.com"; - final String teacherPass = "pass"; final String studentMail = "student1@gmail.com"; final String studentPass = "pass"; - BrowserUser student; - private String TestName = "default-test-name"; + + public static Stream data() throws IOException { + return ParameterLoader.getTestTeachers(); + } @Resource(resID = "LoginService", replaceable = {}) @AccessMode(resID = "LoginService", concurrency = 10, sharing = true, accessMode = "READONLY") @@ -64,12 +65,15 @@ class FullTeachingEndToEndEChatTests extends BaseLoggedTest { @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "READWRITE") @Resource(resID = "Course", replaceable = {"Configuration"}) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READONLY") - @Test - void oneToOneChatInSessionChrome() { //197 Lines of code - int numberpriormessages = 1; + @DisplayName("oneToOneChatInSessionChrome") + @ParameterizedTest + @MethodSource("data") + @Tag("Multiuser Test") + void oneToOneChatInSessionChrome(String mail, String password, String role ) throws URISyntaxException, MalformedURLException, NotLoggedException, ElementNotFoundException, InterruptedException { //197 Lines of code + int numberpriormessages; // TEACHER - this.slowLogin(user, teacherMail, teacherPass);//24 + this.slowLogin(user, mail, password);//24 log.info("{} entering first course", user.getClientData()); user.getWaiter().until(ExpectedConditions.presenceOfElementLocated( @@ -89,6 +93,8 @@ void oneToOneChatInSessionChrome() { //197 Lines of code checkSystemMessage("Connected", user, 100); // 6 lines // STUDENT + student = setupBrowser(STUDENT_BROWSER, TJOB_NAME + "-" +"oneToOneChatInSessionChrome", "STUDENT",5);//27 lines + this.slowLogin(student, studentMail, studentPass); student.getWaiter().until(ExpectedConditions.presenceOfElementLocated( @@ -125,8 +131,6 @@ void oneToOneChatInSessionChrome() { //197 Lines of code student.getDriver().findElement(By.id("send-btn")).click(); checkStrangerMessage(studentMessage, STUDENT_NAME, user, numberpriormessages); //8lines checkOwnMessage(studentMessage, STUDENT_NAME, student, numberpriormessages);//7lines - - } private void checkOwnMessage(String message, String sender, BrowserUser user, int numberpriormessages) { //7Lines @@ -170,61 +174,4 @@ private int getNumberMessages(BrowserUser user) { return user.getDriver().findElements(By.tagName("app-chat-line")).size(); } - @BeforeEach - void setup(TestInfo info) { //65 lines - log.info("Custom Set-up for the OpenviduTest"); - if (info.getTestMethod().isPresent()) { - TestName = info.getTestMethod().get().getName(); - } - - log.info("##### Start test: " + TestName); - TJOB_NAME = System.getProperty("dirtarget"); - user = setupBrowser(TEACHER_BROWSER, TJOB_NAME + "_" + TestName, teacherMail, WAIT_SECONDS); - student = setupBrowser(STUDENT_BROWSER, TJOB_NAME + "_" + TestName, studentMail, WAIT_SECONDS);//27 lines - - } - - @AfterEach - void tearDown(TestInfo testInfo) { //13 lines - log.info("Custom TearDown"); - if (testInfo.getTestMethod().isPresent()) { - TestName = testInfo.getTestMethod().get().getName(); - } - if (student != null) { - log.info("##### Finish test: {} - Driver {}", TestName, this.student.getDriver()); - log.info("Browser console at the end of the test"); - LogEntries logEntries = student.getDriver().manage().logs().get(BROWSER); - logEntries.forEach((entry) -> log.info("[{}] {} {}", - new Date(entry.getTimestamp()), entry.getLevel(), - entry.getMessage())); - //TO-DO- ERROR with the logout - if (student.isOnSession()) { - this.logout(student); - } - - student.dispose(); - - - } - - if (user != null) { - log.info("##### Finish test: {} - Driver {}", TestName, this.user.getDriver()); - log.info("Browser console at the end of the test"); - LogEntries logEntries = user.getDriver().manage().logs().get(BROWSER); - logEntries.forEach((entry) -> log.info("[{}] {} {}", - new Date(entry.getTimestamp()), entry.getLevel(), - entry.getMessage())); - //TO-DO- ERROR with the logout - if (user.isOnSession()) { - this.logout(user); - } - - user.dispose(); - - - } - - - } - } \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingEndToEndRESTTests.java b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingEndToEndRESTTests.java index 32fa771..43afe64 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingEndToEndRESTTests.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingEndToEndRESTTests.java @@ -20,22 +20,26 @@ import com.fullteaching.e2e.no_elastest.common.BaseLoggedTest; import com.fullteaching.e2e.no_elastest.common.CourseNavigationUtilities; import com.fullteaching.e2e.no_elastest.common.exception.ElementNotFoundException; +import com.fullteaching.e2e.no_elastest.common.exception.NotLoggedException; +import com.fullteaching.e2e.no_elastest.utils.ParameterLoader; import giis.retorch.annotations.AccessMode; import giis.retorch.annotations.Resource; -import io.github.bonigarcia.seljup.SeleniumJupiter; 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.api.extension.ExtendWith; +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.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; +import java.io.IOException; import java.time.LocalDate; import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.util.List; +import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -47,17 +51,17 @@ //@Disabled @Tag("e2e") @DisplayName("E2E tests for FullTeaching REST CRUD operations") -@ExtendWith(SeleniumJupiter.class) class FullTeachingEndToEndRESTTests extends BaseLoggedTest { - final String TEST_COURSE_INFO = "TEST_COURSE_INFO"; final String EDITED = " EDITED"; - final String TEACHER_MAIL = "teacher@gmail.com"; - final String TEACHER_PASS = "pass"; final String TEACHER_NAME = "Teacher Cheater"; String COURSE_NAME = "TEST_COURSE"; + public static Stream data() throws IOException { + return ParameterLoader.getTestTeachers(); + } + public FullTeachingEndToEndRESTTests() { super(); } @@ -70,17 +74,19 @@ public FullTeachingEndToEndRESTTests() { @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") @Resource(resID = "Course", replaceable = {"Configuration"}) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READWRITE") - @Test - void courseRestOperations() throws ElementNotFoundException { - loginAndCreateNewCourse(); + @DisplayName("courseRestOperations") + @ParameterizedTest + @MethodSource("data") + void courseRestOperations(String mail, String password, String role ) throws ElementNotFoundException, NotLoggedException, InterruptedException { + loginAndCreateNewCourse(mail,password); editCourse(); CourseNavigationUtilities.deleteCourse(user.getDriver(), COURSE_NAME + EDITED); // Tear down } - private void loginAndCreateNewCourse() throws ElementNotFoundException { - slowLogin(user, TEACHER_MAIL, TEACHER_PASS); + private void loginAndCreateNewCourse(String mail, String password) throws ElementNotFoundException, NotLoggedException, InterruptedException { + slowLogin(user, mail, password); CourseNavigationUtilities.newCourse(user.getDriver(), COURSE_NAME); } @@ -104,9 +110,11 @@ private void editCourse() { @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") @Resource(resID = "Course", replaceable = {"Information"}) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READWRITE") - @Test - void courseInfoRestOperations() throws ElementNotFoundException { //12+16+65 set up +60 lines teardown =153 - loginAndCreateNewCourse(); + @DisplayName("courseInfoRestOperations") + @ParameterizedTest + @MethodSource("data") + void courseInfoRestOperations(String mail, String password, String role) throws ElementNotFoundException, NotLoggedException, InterruptedException { //12+16+65 set up +60 lines teardown =153 + loginAndCreateNewCourse(mail,password); enterCourseAndNavigateTab(COURSE_NAME, "info-tab-icon");//16 lines user.waitUntil(ExpectedConditions.presenceOfNestedElementLocatedBy(By.cssSelector(".md-tab-body.md-tab-active"), By.cssSelector(".card-panel.warning")), "Course info wasn't empty"); log.info("Editing course information"); @@ -126,9 +134,11 @@ void courseInfoRestOperations() throws ElementNotFoundException { //12+16+65 set @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") @Resource(resID = "Course", replaceable = {"Session"}) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READWRITE") - @Test - void sessionRestOperations() throws ElementNotFoundException { - loginAndCreateNewCourse(); + @DisplayName("sessionRestOperations") + @ParameterizedTest + @MethodSource("data") + void sessionRestOperations(String mail, String password, String role) throws ElementNotFoundException, NotLoggedException, InterruptedException { + loginAndCreateNewCourse(mail,password); addNewSession(); @@ -207,9 +217,11 @@ private void verifySessionDetails(String expectedTitle, String expectedComment, @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") @Resource(resID = "Course", replaceable = {"Forum"}) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READWRITE") - @Test - void forumRestOperations() throws ElementNotFoundException { //60+66+65 set up +60 lines teardown =251 - loginAndCreateNewCourse(); + @DisplayName("forumRestOperations") + @ParameterizedTest + @MethodSource("data") + void forumRestOperations(String mail, String password, String role) throws ElementNotFoundException, NotLoggedException, InterruptedException { //60+66+65 set up +60 lines teardown =251 + loginAndCreateNewCourse(mail,password); enterCourseAndNavigateTab(COURSE_NAME, "forum-tab-icon");//16 lines log.info("Adding new entry to the forum"); openDialog("#add-entry-icon", user);//8lines @@ -279,9 +291,11 @@ void forumRestOperations() throws ElementNotFoundException { //60+66+65 set up + @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") @Resource(resID = "Course", replaceable = {"Files"}) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READWRITE") - @Test - void filesRestOperations() throws ElementNotFoundException {//88+112+65 set up +60 lines teardown =325 - loginAndCreateNewCourse(); + @DisplayName("filesRestOperations") + @ParameterizedTest + @MethodSource("data") + void filesRestOperations(String mail, String password, String role) throws ElementNotFoundException, NotLoggedException, InterruptedException {//88+112+65 set up +60 lines teardown =325 + loginAndCreateNewCourse(mail,password); enterCourseAndNavigateTab(COURSE_NAME, "files-tab-icon");//16 lines log.info("Checking that there are no files in the course"); user.waitUntil(ExpectedConditions.elementToBeClickable(By.cssSelector("app-error-message .card-panel.warning")), @@ -380,9 +394,11 @@ void filesRestOperations() throws ElementNotFoundException {//88+112+65 set up + @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") @Resource(resID = "Course", replaceable = {"Attenders"}) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READWRITE") - @Test - void attendersRestOperations() throws ElementNotFoundException {//42+32+65 set up +60 lines teardown =199 - loginAndCreateNewCourse(); + @DisplayName("attendersRestOperations") + @ParameterizedTest + @MethodSource("data") + void attendersRestOperations(String mail, String password, String role) throws ElementNotFoundException, NotLoggedException, InterruptedException {//42+32+65 set up +60 lines teardown =199 + loginAndCreateNewCourse(mail,password); enterCourseAndNavigateTab(COURSE_NAME, "attenders-tab-icon");//16 lines log.info("Checking that there is only one attender to the course"); user.waitUntil(ExpectedConditions.numberOfElementsToBe(By.className("attender-row-div"), 1), @@ -451,8 +467,5 @@ private void enterCourseAndNavigateTab(String courseName, String tabId) { //16 l user.waitUntil(ExpectedConditions.textToBe(By.id("main-course-title"), courseName), "Unexpected course title"); log.info("Navigating to tab by clicking icon with id '{}'", tabId); user.getDriver().findElement(By.id(tabId)).click(); - } - - } \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingLoggedVideoSessionTests.java b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingLoggedVideoSessionTests.java index 126ac97..cdd4a5e 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingLoggedVideoSessionTests.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingLoggedVideoSessionTests.java @@ -5,33 +5,35 @@ import com.fullteaching.e2e.no_elastest.common.CourseNavigationUtilities; import com.fullteaching.e2e.no_elastest.common.SessionNavigationUtilities; import com.fullteaching.e2e.no_elastest.common.exception.ElementNotFoundException; +import com.fullteaching.e2e.no_elastest.common.exception.NotLoggedException; import com.fullteaching.e2e.no_elastest.utils.Click; +import com.fullteaching.e2e.no_elastest.utils.ParameterLoader; import com.fullteaching.e2e.no_elastest.utils.Wait; import giis.retorch.annotations.AccessMode; import giis.retorch.annotations.Resource; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInfo; +import org.junit.jupiter.api.DisplayName; +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.JavascriptExecutor; import org.openqa.selenium.WebElement; -import org.openqa.selenium.logging.LogEntries; import org.openqa.selenium.support.ui.ExpectedConditions; import org.slf4j.Logger; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Calendar; -import java.util.Date; import java.util.List; +import java.util.stream.Stream; import static com.fullteaching.e2e.no_elastest.common.Constants.*; import static java.lang.invoke.MethodHandles.lookup; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.openqa.selenium.logging.LogType.BROWSER; import static org.slf4j.LoggerFactory.getLogger; class FullTeachingLoggedVideoSessionTests extends BaseLoggedTest { @@ -39,11 +41,14 @@ class FullTeachingLoggedVideoSessionTests extends BaseLoggedTest { final static Logger log = getLogger(lookup().lookupClass()); public String courseName; - protected List studentBrowserUserList; protected List studentPassList; protected List studentNamesList; protected List studentNameList; + public static Stream data() throws IOException { + return ParameterLoader.getTestTeachers(); + } + /** * This method tests the video session functionality of the application. @@ -56,11 +61,13 @@ class FullTeachingLoggedVideoSessionTests extends BaseLoggedTest { @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "READWRITE") @Resource(resID = "Course", replaceable = {"Session"}) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READONLY") - @Test - void sessionTest() throws ElementNotFoundException, IOException { + @DisplayName("sessionTest") + @ParameterizedTest + @MethodSource("data") + void sessionTest(String mail, String password, String role) throws ElementNotFoundException, IOException, URISyntaxException, NotLoggedException, InterruptedException { String sessionName = "Today's Session"; courseName = "Pseudoscientific course for treating the evil eye"; - this.slowLogin(this.user, "teacher@gmail.com", "pass"); + this.slowLogin(this.user, mail, password); initializeStudents("src/test/resources/inputs/default_user_LoggedVideoStudents.csv"); createNewSession(sessionName); joinSession(sessionName, this.user); @@ -75,7 +82,8 @@ void sessionTest() throws ElementNotFoundException, IOException { * @param pathData the path to the CSV file containing student data * @throws IOException if there is an error reading the file */ - private void initializeStudents(String pathData) throws IOException { + private void initializeStudents(String pathData) throws IOException, URISyntaxException, NotLoggedException, ElementNotFoundException, InterruptedException { + log.info("Initializing students"); String users_data = loadStudentsData(pathData); studentNameList = new ArrayList<>(); studentPassList = new ArrayList<>(); @@ -89,11 +97,12 @@ private void initializeStudents(String pathData) throws IOException { String user_password = students_data[i].split(":")[1]; studentPassList.add(user_password); String STUDENT_BROWSER = students_data[i].split(":")[2]; - BrowserUser studentD = setupBrowser(STUDENT_BROWSER, TJOB_NAME + "_" + TEST_NAME, "STUDENT" + i, WAIT_SECONDS); + BrowserUser studentD = setupBrowser(STUDENT_BROWSER, TJOB_NAME + "-" + TEST_NAME, userid, WAIT_SECONDS); this.slowLogin(studentD, userid, user_password); studentNamesList.add(userid); studentBrowserUserList.add(studentD); } + log.info("Initializing students end, number of students: {} " ,studentNameList.size()); } /** * This method creates a new video session with the given name, navigating to the course, opens the new session modal, @@ -225,29 +234,5 @@ public String loadStudentsData(String path) throws IOException { System.out.println(key); return key.toString(); } - @AfterEach - void tearDown(TestInfo testInfo) { - //Logout and exit students - if (studentBrowserUserList!=null) { - for (BrowserUser student : studentBrowserUserList) { - if (student.isOnSession()) { - this.logout(student); - } - student.dispose(); - } - } - if (user != null) { - log.info("##### Finish test: {} - Driver {}", TEST_NAME, this.user.getDriver()); - log.info("Browser console at the end of the test"); - LogEntries logEntries = user.getDriver().manage().logs().get(BROWSER); - logEntries.forEach((entry) -> log.info("[{}] {} {}", - new Date(entry.getTimestamp()), entry.getLevel(), - entry.getMessage())); - if (user.isOnSession()) { - this.logout(user); - } - user.dispose(); - } - } } diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingTestEndToEndVideoSessionTests.java b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingTestEndToEndVideoSessionTests.java index 2d6d0c8..a5aaed3 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingTestEndToEndVideoSessionTests.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/media/FullTeachingTestEndToEndVideoSessionTests.java @@ -19,36 +19,38 @@ import com.fullteaching.e2e.no_elastest.common.BaseLoggedTest; import com.fullteaching.e2e.no_elastest.common.BrowserUser; +import com.fullteaching.e2e.no_elastest.common.exception.ElementNotFoundException; +import com.fullteaching.e2e.no_elastest.common.exception.NotLoggedException; +import com.fullteaching.e2e.no_elastest.utils.ParameterLoader; import giis.retorch.annotations.AccessMode; import giis.retorch.annotations.Resource; -import io.github.bonigarcia.seljup.SeleniumJupiter; import org.junit.jupiter.api.*; -import org.junit.jupiter.api.extension.ExtendWith; +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.WebElement; -import org.openqa.selenium.logging.LogEntries; import org.openqa.selenium.support.ui.ExpectedConditions; -import java.util.Date; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.util.stream.Stream; -import static com.fullteaching.e2e.no_elastest.common.Constants.WAIT_SECONDS; -import static org.openqa.selenium.logging.LogType.BROWSER; /*This test case were disabled due to problems with the OpenVidu Server. The video input doesn't work , so it's not * feasible check that in the other side of the connection its playing the stream*/ @Disabled @Tag("e2e") @DisplayName("E2E tests for FullTeaching video session") -@ExtendWith(SeleniumJupiter.class) class FullTeachingTestEndToEndVideoSessionTests extends BaseLoggedTest { - - final String teacherMail = "teacher@gmail.com"; - final String teacherPass = "pass"; final String studentMail = "student1@gmail.com"; final String studentPass = "pass"; - BrowserUser student; + public static Stream data() throws IOException { + return ParameterLoader.getTestTeachers(); + } public FullTeachingTestEndToEndVideoSessionTests() { super(); @@ -61,14 +63,13 @@ public FullTeachingTestEndToEndVideoSessionTests() { @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "READWRITE") @Resource(resID = "Course", replaceable = {"Session"}) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READWRITE") - @Test - void oneToOneVideoAudioSessionChrome() { //124+ 232+ 20 set up +8 lines teardown = 564 + @DisplayName("sessionTest") + @ParameterizedTest + @MethodSource("data") + void oneToOneVideoAudioSessionChrome(String mail, String password, String role) throws URISyntaxException, MalformedURLException, NotLoggedException, ElementNotFoundException, InterruptedException { //124+ 232+ 20 set up +8 lines teardown = 564 - String testName = new Object() { - }.getClass().getEnclosingMethod().getName(); - log.info("##### Start test: " + testName); // TEACHER - this.slowLogin(user, teacherMail, teacherPass);//24 + this.slowLogin(user, mail, password);//24 log.info("{} entering first course", user.getClientData()); user.getWaiter().until( @@ -98,6 +99,7 @@ void oneToOneVideoAudioSessionChrome() { //124+ 232+ 20 set up +8 lines teardown .findElement(By.cssSelector(("div.participant video"))), "div.participant"); //30 lines // STUDENT + student = setupBrowser(STUDENT_BROWSER, TJOB_NAME + "-" +TEST_NAME, "STUDENT",5);//27 lines slowLogin(student, studentMail, studentPass); @@ -164,7 +166,7 @@ void oneToOneVideoAudioSessionChrome() { //124+ 232+ 20 set up +8 lines teardown checkVideoPlaying(user, user.getDriver() .findElement(By.cssSelector(("div.participant video"))), - "div.participant");//30 lines waitSeconds(5); + "div.participant"); // Teacher stops student intervention user.getWaiter().until(ExpectedConditions.elementToBeClickable( By.xpath("//a[contains(@class, 'usr-btn')]"))); @@ -184,71 +186,6 @@ void oneToOneVideoAudioSessionChrome() { //124+ 232+ 20 set up +8 lines teardown } - @BeforeEach - void setup(TestInfo info) { //65 lines - String TEST_NAME; - if (info.getTestMethod().isPresent()) { - log.info("Custom Set-up for the OpenviduTest"); - TEST_NAME = info.getTestMethod().get().getName(); - } else { - TEST_NAME = "test-name-default"; - } - - log.info("##### Start test: " + TEST_NAME); - TJOB_NAME = System.getProperty("dirtarget"); - user = setupBrowser(TEACHER_BROWSER, TJOB_NAME + "_" + TEST_NAME, teacherMail, WAIT_SECONDS); - student = setupBrowser(STUDENT_BROWSER, TJOB_NAME + "_" + TEST_NAME, studentMail, WAIT_SECONDS);//27 lines - - } - - @AfterEach - void tearDown(TestInfo testInfo) { //13 lines - String testName; - if (testInfo.getTestMethod().isPresent()) { - - testName = testInfo.getTestMethod().get().getName(); - log.info("Custom TearDown the info is present"); - } else { - log.info("No test name, using default"); - testName = "No-named-test"; - } - - if (student != null) { - log.info("##### Finish test: {} - Driver {}", testName, this.student.getDriver()); - log.info("Browser console at the end of the test"); - LogEntries logEntries = student.getDriver().manage().logs().get(BROWSER); - logEntries.forEach((entry) -> log.info("[{}] {} {}", - new Date(entry.getTimestamp()), entry.getLevel(), - entry.getMessage())); - //TO-DO- ERROR with the logout - if (student.isOnSession()) { - this.logout(student); - } - student.dispose(); - - - } - - if (user != null) { - log.info("##### Finish test: {} - Driver {}", testName, this.user.getDriver()); - log.info("Browser console at the end of the test"); - LogEntries logEntries = user.getDriver().manage().logs().get(BROWSER); - logEntries.forEach((entry) -> log.info("[{}] {} {}", - new Date(entry.getTimestamp()), entry.getLevel(), - entry.getMessage())); - //TO-DO- ERROR with the logout - if (user.isOnSession()) { - this.logout(user); - } - - user.dispose(); - - - } - - - } - /* * @Test diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/student/CourseStudentTest.java b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/student/CourseStudentTest.java index 2a6b75e..6043914 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/student/CourseStudentTest.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/student/CourseStudentTest.java @@ -3,13 +3,14 @@ import com.fullteaching.e2e.no_elastest.common.BaseLoggedTest; import com.fullteaching.e2e.no_elastest.common.CourseNavigationUtilities; import com.fullteaching.e2e.no_elastest.common.NavigationUtilities; +import com.fullteaching.e2e.no_elastest.common.exception.ElementNotFoundException; +import com.fullteaching.e2e.no_elastest.common.exception.NotLoggedException; import com.fullteaching.e2e.no_elastest.utils.Click; import com.fullteaching.e2e.no_elastest.utils.ParameterLoader; import com.fullteaching.e2e.no_elastest.utils.Wait; import giis.retorch.annotations.AccessMode; import giis.retorch.annotations.Resource; -import io.github.bonigarcia.seljup.SeleniumJupiter; -import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -24,16 +25,12 @@ import static com.fullteaching.e2e.no_elastest.common.Constants.*; import static org.junit.jupiter.api.Assertions.fail; - -@ExtendWith(SeleniumJupiter.class) class CourseStudentTest extends BaseLoggedTest { - public static Stream data() throws IOException { return ParameterLoader.getTestStudents(); } - /** * These tests get the login the user as student, go the courses and check if * there is any course in the list.After it, click in the first course of the list @@ -46,51 +43,23 @@ public static Stream data() throws IOException { @AccessMode(resID = "LoginService", concurrency = 10, sharing = true, accessMode = "READONLY") @Resource(resID = "OpenVidu", replaceable = {"OpenViduMock"}) @AccessMode(resID = "OpenVidu", concurrency = 10, sharing = true, accessMode = "NOACCESS") + @DisplayName("studentCourseMainTest") @ParameterizedTest @MethodSource("data") - void studentCourseMainTest(String userMail, String password, String role) {//45+ 107+28 set up +13 lines teardown =193 - this.slowLogin(user, userMail, password);//24 lines - try { + void studentCourseMainTest(String userMail, String password, String role) throws ElementNotFoundException, InterruptedException, NotLoggedException {//45+ 107+28 set up +13 lines teardown =193 + this.slowLogin(user, userMail, password);//24 lines NavigationUtilities.toCoursesHome(driver); //3lines //go to first course //get course list List course_list = CourseNavigationUtilities.getCoursesList(driver); //13 lines - if (course_list.size() <= 0) fail("No courses available for test user"); + if (course_list.isEmpty()) fail("No courses available for test user"); WebElement course_button = CourseNavigationUtilities.getCourseByName(driver, course_list.get(0)).findElement(By.className("title")); //14 lines Click.element(driver, course_button); Wait.notTooMuch(driver).until(ExpectedConditions.visibilityOfElementLocated(By.id(COURSE_TABS_TAG))); - } catch (Exception e) { - fail("Failed to load Courses Tabs" + e.getClass() + ": " + e.getLocalizedMessage()); - } - //Check tabs - //Home tab - try { - CourseNavigationUtilities.go2Tab(driver, HOME_ICON);//4 lines - } catch (Exception e) { - fail("Failed to load home tab" + e.getClass() + ": " + e.getLocalizedMessage()); - } - try { CourseNavigationUtilities.go2Tab(driver, SESSION_ICON);//4lines - } catch (Exception e) { - fail("Failed to load session tab" + e.getClass() + ": " + e.getLocalizedMessage()); - } - try { CourseNavigationUtilities.go2Tab(driver, FORUM_ICON);//4lines - } catch (Exception e) { - fail("Failed to load forum tab" + e.getClass() + ": " + e.getLocalizedMessage()); - } - try { CourseNavigationUtilities.go2Tab(driver, FILES_ICON);//4lines - } catch (Exception e) { - fail("Failed to load files tab" + e.getClass() + ": " + e.getLocalizedMessage()); - } - try { CourseNavigationUtilities.go2Tab(driver, ATTENDERS_ICON);//4lines - } catch (Exception e) { - fail("Failed to load attenders tab" + e.getClass() + ": " + e.getLocalizedMessage()); - } } - - -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/teacher/CourseTeacherTest.java b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/teacher/CourseTeacherTest.java index a2d83a1..daaa22b 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/teacher/CourseTeacherTest.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/functional/test/teacher/CourseTeacherTest.java @@ -6,6 +6,7 @@ import com.fullteaching.e2e.no_elastest.common.NavigationUtilities; import com.fullteaching.e2e.no_elastest.common.exception.ElementNotFoundException; import com.fullteaching.e2e.no_elastest.common.exception.ExceptionsHelper; +import com.fullteaching.e2e.no_elastest.common.exception.NotLoggedException; import com.fullteaching.e2e.no_elastest.utils.Click; import com.fullteaching.e2e.no_elastest.utils.ParameterLoader; import com.fullteaching.e2e.no_elastest.utils.Wait; @@ -49,7 +50,7 @@ public static Stream data() throws IOException { @AccessMode(resID = "Course", concurrency = 15, sharing = true, accessMode = "READONLY") @ParameterizedTest @MethodSource("data") - void teacherCourseMainTest(String mail, String password, String role) {//39+80+ 28 set up +13 lines teardown =160 + void teacherCourseMainTest(String mail, String password, String role) throws NotLoggedException, ElementNotFoundException, InterruptedException {//39+80+ 28 set up +13 lines teardown =160 this.slowLogin(user, mail, password); try { @@ -104,7 +105,7 @@ void teacherCourseMainTest(String mail, String password, String role) {//39+80+ @AccessMode(resID = "Course", concurrency = 15, sharing = true, accessMode = "DYNAMIC") @ParameterizedTest @MethodSource("data") - void teacherCreateAndDeleteCourseTest(String mail, String password, String role) throws ElementNotFoundException { + void teacherCreateAndDeleteCourseTest(String mail, String password, String role) throws ElementNotFoundException, NotLoggedException, InterruptedException { // Setup this.slowLogin(user, mail, password); @@ -144,7 +145,7 @@ void teacherCreateAndDeleteCourseTest(String mail, String password, String role) @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READWRITE") @ParameterizedTest @MethodSource("data") - void teacherEditCourseValues(String mail, String password, String role) {//165+256+ 28 set up +13 lines teardown =462 + void teacherEditCourseValues(String mail, String password, String role) throws NotLoggedException, ElementNotFoundException, InterruptedException {//165+256+ 28 set up +13 lines teardown =462 String courseName = properties.getProperty("forum.test.course"); this.slowLogin(user, mail, password); //24 lines try { @@ -193,7 +194,7 @@ void teacherEditCourseValues(String mail, String password, String role) {//165+2 //wait for editor md editor???' WebElement edit_description_desc = Wait.notTooMuch(driver).until(ExpectedConditions.visibilityOfElementLocated(By.className(EDIT_DESCRIPTION_CONTENT_BOX_CLASS))); //text here?? /html/body/app/div/com.fullteaching.e2e.no_elastest.main/app-course-details/div/div[4]/md-tab-group/div[2]/div[1]/div/div[2]/p-editor/div/div[2]/div[1] - String old_desc = edit_description_desc.getAttribute("ng-reflect-model"); + edit_description_desc.getAttribute("ng-reflect-model"); //delete old_desc log.info("Deleting old description"); WebElement editor = driver.findElement(By.className("ql-editor")); @@ -202,7 +203,7 @@ void teacherEditCourseValues(String mail, String password, String role) {//165+2 //New Title log.info("Adding the new description"); WebElement headerSelector = driver.findElement(By.className("ql-header")); - Click.element(driver, By.className("ql-header")); + Click.element(driver, headerSelector); WebElement picker_options = Wait.notTooMuch(driver).until(ExpectedConditions.visibilityOfElementLocated(By.className("ql-picker-options"))); WebElement option = NavigationUtilities.getOption(picker_options.findElements(By.className("ql-picker-item")), "Heading", NavigationUtilities.FindOption.ATTRIBUTE, "data-label");//20 lines assertNotNull(option, "Something went wrong while setting the Heading"); @@ -253,7 +254,6 @@ void teacherEditCourseValues(String mail, String password, String role) {//165+2 //check if Forum is enabled if (ForumNavigationUtilities.isForumEnabled(forum_tab_content)) {//6lines - //if (enabled) //check entries ¡Only check if there is entries and all the buttons are present! log.info("Forum enabled checking that the entries and buttons are present"); assertNotNull(forum_tab_content.findElement(FORUM_NEW_ENTRY_ICON), "Add Entry not found"); @@ -309,7 +309,7 @@ void teacherEditCourseValues(String mail, String password, String role) {//165+2 @AccessMode(resID = "Course", concurrency = 1, sharing = false, accessMode = "READWRITE") @ParameterizedTest @MethodSource("data") - void teacherDeleteCourseTest(String mail, String password, String role) throws ElementNotFoundException {//51+114+28 set up +13 lines teardown =206 + void teacherDeleteCourseTest(String mail, String password, String role) throws ElementNotFoundException, NotLoggedException, InterruptedException {//51+114+28 set up +13 lines teardown =206 this.slowLogin(user, mail, password);//24 String courseName = "Test Course_" + System.currentTimeMillis(); // navigate to course if not there diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/utils/Click.java b/src/test/java/com/fullteaching/e2e/no_elastest/utils/Click.java index ca36d87..4e9a244 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/utils/Click.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/utils/Click.java @@ -10,9 +10,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static java.lang.invoke.MethodHandles.lookup; -import static org.slf4j.LoggerFactory.getLogger; - public class Click { private static final Logger log = LoggerFactory.getLogger(Click.class); @@ -42,23 +39,23 @@ public static WebDriver withNRetries(WebDriver wd, By eleBy, int n, By waitFor) Wait.notTooMuch(wd).until(ExpectedConditions.elementToBeClickable(wd.findElement(eleBy))); wd.findElement(eleBy).click(); Wait.notTooMuch(wd).until(ExpectedConditions.visibilityOfElementLocated(waitFor)); - log.info("Click.withNRetries (click): ele:" + tagName + ":" + text + " ==>OK"); + log.info("Click.withNRetries (click): ele:{}:{} ==>OK", tagName, text); return wd; } catch (Exception e) { try { - log.error("Click.withNRetries n (click):" + i + " " + e.getClass().getName() + ":" + e.getLocalizedMessage()); + log.error("Click.withNRetries n (click):{} {}:{}", i ,e.getClass().getName(),e.getLocalizedMessage()); byJS(wd, wd.findElement(eleBy)); - log.info("Click.element (ByJs): ele:" + tagName + ":" + text + " ==>OK"); + log.info("Click.withNRetries element (ByJs): ele:{}:{} ==>OK", tagName, text); return wd; } catch (Exception ex) { - log.error("Click.withNRetries n (ByJS):" + i + " " + ex.getClass().getName() + ":" + ex.getLocalizedMessage()); + log.error("Click.withNRetries n (ByJS):{} {}:{}", i, ex.getClass().getName(), ex.getLocalizedMessage()); i++; } } } while (i < n); - log.error("Click.withNRetries: ele:" + tagName + ":" + text + " ==>KO"); + log.error("Click.withNRetries: ele:{}:{} ==>KO",tagName,text); throw new ElementNotFoundException("Click doesn't work properly"); } @@ -84,18 +81,18 @@ public static WebDriver element(WebDriver wd, WebElement ele) throws ElementNotF try { Wait.notTooMuch(wd).until(ExpectedConditions.elementToBeClickable(ele)); ele.click(); - log.info("Click.element (click): ele:" + tagName + ":" + text + " ==>OK"); + log.info("Click.element (click): ele:{}:{} ==>OK", tagName, text); return wd; } catch (Exception e) { - log.error("Click.element (click): ele:" + tagName + ":" + text + " ==>KO " + e.getClass().getName() + ":" + e.getLocalizedMessage()); + log.error("Click.element (click): ele:{}:{} ==>KO {}:{}", tagName, text, e.getClass().getName(), e.getLocalizedMessage()); } //Try by Js try { byJS(wd, ele); - log.info("Click.element (ByJs): ele:" + tagName + ":" + text + " ==>OK"); + log.info("Click.element (ByJs): ele:{}:{} ==>OK", tagName, text); return wd; } catch (Exception e) { - log.error("Click.element (ByJs): ele:" + tagName + ":" + text + " ==>KO " + e.getClass().getName() + ":" + e.getLocalizedMessage()); + log.error("Click.element (ByJs): ele:{}:{} ==>KO {}:{}", tagName, text, e.getClass().getName(), e.getLocalizedMessage()); } throw new ElementNotFoundException("Click.element ERROR"); @@ -115,4 +112,4 @@ public static WebDriver element(WebDriver wd, By eleBy) throws ElementNotFoundEx return element(wd, ele); } -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/utils/DOMManager.java b/src/test/java/com/fullteaching/e2e/no_elastest/utils/DOMManager.java index 631749a..2e65e86 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/utils/DOMManager.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/utils/DOMManager.java @@ -10,4 +10,4 @@ public static WebElement getParent(WebDriver wd, WebElement childElement) { JavascriptExecutor executor = (JavascriptExecutor) wd; return (WebElement) executor.executeScript("return arguments[0].parentNode;", childElement); } -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/utils/ParameterLoader.java b/src/test/java/com/fullteaching/e2e/no_elastest/utils/ParameterLoader.java index a1cbb5f..23cf720 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/utils/ParameterLoader.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/utils/ParameterLoader.java @@ -8,9 +8,7 @@ import java.util.Collection; import java.util.stream.Stream; -import static java.lang.invoke.MethodHandles.lookup; import static org.junit.jupiter.params.provider.Arguments.arguments; -import static org.slf4j.LoggerFactory.getLogger; public class ParameterLoader { @@ -33,7 +31,6 @@ public static Stream getTestUsers() throws IOException { } public static Stream getTestStudents() throws IOException { - log.debug("[getTestStudents] INI"); Stream records = Stream.empty(); @@ -50,7 +47,6 @@ public static Stream getTestStudents() throws IOException { } public static Stream getTestTeachers() throws IOException { - log.debug("[getTestTeachers] INI"); Stream records = Stream.empty(); @@ -71,13 +67,11 @@ public static Collection sessionParameters() throws IOException { } private static boolean isStudent(User user) { - return user.getRole().trim().equalsIgnoreCase("STUDENT"); } private static boolean isTeacher(User user) { - return user.getRole().trim().equalsIgnoreCase("TEACHER"); } -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/utils/Scroll.java b/src/test/java/com/fullteaching/e2e/no_elastest/utils/Scroll.java index 802f0aa..80ad953 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/utils/Scroll.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/utils/Scroll.java @@ -10,4 +10,4 @@ public static void toElement(WebDriver wd, WebElement ele) { actions.moveToElement(ele); actions.perform(); } -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/utils/SetUp.java b/src/test/java/com/fullteaching/e2e/no_elastest/utils/SetUp.java index 9b54f3f..b513c73 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/utils/SetUp.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/utils/SetUp.java @@ -11,20 +11,16 @@ import java.util.Date; import java.util.concurrent.TimeUnit; -import static com.fullteaching.e2e.no_elastest.common.Constants.LOCALHOST; -import static java.lang.System.getProperty; -import static java.lang.invoke.MethodHandles.lookup; import static org.openqa.selenium.OutputType.BASE64; import static org.openqa.selenium.logging.LogType.BROWSER; -import static org.slf4j.LoggerFactory.getLogger; public class SetUp { private static final Logger log = LoggerFactory.getLogger(SetUp.class); - public static void tearDown(WebDriver driver) { + public static void tearDown(WebDriver driver) throws InterruptedException { if (driver != null) { - log.info("url:" + driver.getCurrentUrl() + "\nScreenshot (in Base64) at the end of the test:\n{}", + log.info("url:{}\nScreenshot (in Base64) at the end of the test:\n{}",driver.getCurrentUrl(), getBase64Screenshot(driver)); log.info("Browser console at the end of the test"); @@ -32,13 +28,8 @@ public static void tearDown(WebDriver driver) { logEntries.forEach((entry) -> log.info("[{}] {} {}", new Date(entry.getTimestamp()), entry.getLevel(), entry.getMessage())); - try { - TimeUnit.SECONDS.sleep(300); - } catch (InterruptedException e) { - - e.printStackTrace(); - } + TimeUnit.SECONDS.sleep(300); } } @@ -48,13 +39,13 @@ public static String getBase64Screenshot(WebDriver driver) { .getScreenshotAs(BASE64); log.debug("getBase64Screenshot END"); - return "data:image/png;base64," + screenshotBase64; + return "data:image/png;base64," + screenshotBase64; } public static String cleanEmptyCourse(WebDriver driver) throws ElementNotFoundException { String course_title = "Test Course_" + System.currentTimeMillis(); - return CourseNavigationUtilities.newCourse(driver, course_title); + return CourseNavigationUtilities.newCourse(driver, course_title); } -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/utils/User.java b/src/test/java/com/fullteaching/e2e/no_elastest/utils/User.java index 230e4b7..82b0068 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/utils/User.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/utils/User.java @@ -10,7 +10,6 @@ public class User implements Serializable { private String password; private String role; - public User(String name, String password, String role) { this.name = name; this.password = password; @@ -48,6 +47,4 @@ public String getUserCsv() { private String getRolesCsv() { return role; } - - -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/utils/UserLoader.java b/src/test/java/com/fullteaching/e2e/no_elastest/utils/UserLoader.java index 179993f..bddafc9 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/utils/UserLoader.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/utils/UserLoader.java @@ -25,8 +25,6 @@ public static void loadUsers(List userList, boolean override) { public static void loadUsers(String usersFile, boolean override) throws IOException { //read file and create users - - List userList = new ArrayList<>(); BufferedReader br = new BufferedReader(new FileReader(usersDefaultFile)); @@ -37,7 +35,6 @@ public static void loadUsers(String usersFile, boolean override) throws IOExcept loadUsers(userList, override); } - public static void loadUsers(String usersFile) throws IOException { loadUsers(usersFile, false); } @@ -46,7 +43,6 @@ public static void loadUsers() throws IOException { loadUsers(usersDefaultFile); } - public static User parseUser(String cvsline) { String[] field = cvsline.split(cvsMainFieldsSplitBy); return new User(field[USERNAME], @@ -54,7 +50,6 @@ public static User parseUser(String cvsline) { field[ROLES]); } - public static Collection getSessionParameters() throws IOException { String line; @@ -78,5 +73,4 @@ public static Collection getAllUsers() throws IOException { return users.values(); } - -} +} \ No newline at end of file diff --git a/src/test/java/com/fullteaching/e2e/no_elastest/utils/Wait.java b/src/test/java/com/fullteaching/e2e/no_elastest/utils/Wait.java index 3f12a07..255f0c1 100644 --- a/src/test/java/com/fullteaching/e2e/no_elastest/utils/Wait.java +++ b/src/test/java/com/fullteaching/e2e/no_elastest/utils/Wait.java @@ -32,4 +32,4 @@ public static void waitForPageLoaded(WebDriver driver) { //13 lines wait.until(expectation); } -} +} \ No newline at end of file