List of usage examples for org.openqa.selenium Point Point
public Point(int x, int y)
From source file:com.vaadin.addon.spreadsheet.elements.AddressUtil.java
License:Open Source License
/** * Converts an address range to a set of coordinates (Points) * // www. j av a 2 s . com * @param addressRange * The address range, e.g. A1:B3, AA20:AZ98, etc. * @return A set of integer coordinates for all cells in the specified * range. */ public static Set<Point> addressRangeToPoints(String addressRange) { Matcher m = ADDRESS_RANGE_PATTERN.matcher(addressRange); m.find(); int left = charAddressToInt(m.group(1)); int top = Integer.valueOf(m.group(2)); int right = charAddressToInt(m.group(3)); int bottom = Integer.valueOf(m.group(4)); HashSet<Point> points = new HashSet<Point>(); for (int col = left; col <= right; col++) { for (int row = top; row <= bottom; row++) { points.add(new Point(col, row)); } } return points; }
From source file:com.vaadin.testbench.commands.TestBenchCommandExecutor.java
@Override public void resizeViewPortTo(final int desiredWidth, final int desiredHeight) throws UnsupportedOperationException { try {/*from w w w .j av a 2 s . co m*/ actualDriver.manage().window().setPosition(new Point(0, 0)); // first try with mac FF, these will change from plat to plat and // browser setup to another int extrah = 106; int extraw = 0; actualDriver.manage().window().setSize(new Dimension(desiredWidth + extraw, desiredHeight + extrah)); int actualWidth = detectViewportWidth(); int actualHeight = detectViewportHeight(); int diffW = desiredWidth - actualWidth; int diffH = desiredHeight - actualHeight; if (diffH != 0 || diffW != 0) { actualDriver.manage().window() .setSize(new Dimension(desiredWidth + extraw + diffW, desiredHeight + extrah + diffH)); } actualWidth = detectViewportWidth(); actualHeight = detectViewportHeight(); if (desiredWidth != actualWidth || desiredHeight != actualHeight) { throw new Exception("Viewport size couldn't be set to desired."); } } catch (Exception e) { throw new UnsupportedOperationException("Viewport couldn't be adjusted.", e); } }
From source file:com.zaizi.automation.alfresco.E_Vanila_FolderCreation_Chrome.java
/** * /* www . j a va2 s . co m*/ * @Test createSite * @return * * @throws Exception InterruptedException, IOException */ @Test public void b_createSite() throws InterruptedException, IOException { LOGGER.info(TestCaseProperties.TEXT_TEST_EXECUTING, "Create Site " + siteName); //Extent Report Start Configuration(testCaseName,Definition of testCase) ExtentTest test = extent.startTest("b_createSite", "Create site called \" " + siteName + " \",Is it private Site " + isPrivate); //Set the DriverType(BrowserName,Platform) driver = TestCaseProperties.driverType("Chrome", "WINDOWS"); // Set the upper left corner of the screen starting point driver.manage().window().setPosition(new Point(0, 0)); // define screen size java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); // define desired size Dimension maxWindowSize = new Dimension((int) screenSize.getWidth(), (int) screenSize.getHeight()); // Maximize the browser window according to your system's current // resolution(set desired size) driver.manage().window().setSize(maxWindowSize); //Get LoginScreen_URl from TestcaseProperties Values driver.get(TestCaseProperties.LOGIN_SCREEN_URL); LOGGER.info("Test case b_createSite started executing"); test.log(LogStatus.INFO, "Test case b_createSite started executing"); LOGGER.info("Accessing the Login Page"); test.log(LogStatus.INFO, "Accessing the Login Page"); LOGGER.info("Login as admin"); test.log(LogStatus.INFO, "Login as admin"); LoginPage loginPage = new LoginPage(driver); loginPage.loginAsAdmin(className, screenShotName); CreateObjects createObjects = new CreateObjects(driver); if (isPrivate) { LOGGER.info("CREATE PRIVATE SITE"); test.log(LogStatus.INFO, "CREATE PRIVATE SITE"); test.log(LogStatus.INFO, "Click \"Create Site\" "); test.log(LogStatus.INFO, "Enter " + siteName + " in \"site Name Field\" "); test.log(LogStatus.INFO, "Enter " + siteId + " in \"site URL Field\" "); test.log(LogStatus.INFO, "Check \"private\" Option"); test.log(LogStatus.INFO, "Click \"OK\" Button "); createObjects.createPrivateSite(siteName, siteId, expectedResult, className, screenShotName + "private2"); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "58" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "58" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); //If Site Created if (Element.isElementPresent(driver, By.xpath("//div[@class='bd']/span[@class='wait']"))) { LOGGER.info(TestCaseProperties.TEXT_TEST_PASS, "Site " + siteName + " CREATED "); test.log(LogStatus.INFO, "<font color=blue>Site " + siteName + " CREATED <font> "); } //If Site IS NOT CREATED //Expected Result1=[COULD NOT CREATE SITE SINCE THE URL IS ALREADY USED] //ExpectedResult1==CurrentResult else { SiteDashboardPage siteDash1 = new SiteDashboardPage(driver); String siteErrorNotification = siteDash1.errorNotification(siteName, className, screenShotName); if (siteErrorNotification.toUpperCase().equals(expectedResult)) { LOGGER.info("Expected Results : " + expectedResult); test.log(LogStatus.INFO, "Expected Results : " + expectedResult); LOGGER.info("Current Test Results : " + siteErrorNotification); test.log(LogStatus.PASS, "Current Test Results : " + "<font color=green>" + siteErrorNotification + "<font>"); Button okaybtn = new Button(driver, By.xpath("//button[text()='OK']")); okaybtn.click(); } //ExpectedResult1!=CurrentResult[PROBLEM] else { LOGGER.error(TestCaseProperties.TEXT_TEST_FAIL, "Private Site " + siteName + "IS NOT CREATED "); test.log(LogStatus.FAIL, "Private Site " + siteName + "IS NOT CREATED "); LOGGER.info("Expected Results : " + expectedResult); test.log(LogStatus.INFO, "Expected Results : " + expectedResult); LOGGER.info("Current Test Results : " + siteErrorNotification); test.log(LogStatus.FAIL, "Current Test Results : " + "<font color=red>" + siteErrorNotification + "<font>"); } } Element.waitForLoad(driver); LOGGER.info("CHECK WHETHER PRIVATE SITE CREATED OR NOT"); test.log(LogStatus.INFO, "CHECK WHETHER PRIVATE SITE CREATED OR NOT"); LOGGER.info("Check whether \" " + siteName + "\" SITE IS VISIBLE TO " + siteCreatorName); test.log(LogStatus.INFO, "Check whether \" " + siteName + "\" SITE IS VISIBLE TO " + siteCreatorName); Thread.sleep(5000); LOGGER.info("Search the sitename in Site finder"); test.log(LogStatus.INFO, "Search the sitename in Site finder"); SearchObjects searchSite = new SearchObjects(driver); searchSite.searchSite(siteName, className, screenShotName + "joinadmin"); if (Element.isElementPresent(driver, By.xpath("//Span[text()='No sites found']"))) { LOGGER.info("Message display as \"No sites found\""); test.log(LogStatus.INFO, "Message display as \"No sites found\""); LOGGER.info(siteName + " SITE IS NOT VISIBLE TO " + siteCreatorName); test.log(LogStatus.FAIL, "<font color=blue>" + siteName + " SITE IS NOT VISIBLE TO " + siteCreatorName + "<font>"); WebDriver augmentedDriver2 = new Augmenter().augment(driver); File screenshot2 = ((TakesScreenshot) augmentedDriver2).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot2, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "59" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "59" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else if (Element.isTextPresentInListForSite( driver.findElements(By.xpath("//tbody//tr//td//div//h3//a[contains(., '" + siteName + "')]")), siteName)) { LOGGER.info(siteName + " SITE IS VISIBLE TO " + siteCreatorName); test.log(LogStatus.INFO, "<font color=blue>" + siteName + " SITE IS VISIBLE TO " + siteCreatorName + "<font>"); WebDriver augmentedDriver3 = new Augmenter().augment(driver); File screenshot3 = ((TakesScreenshot) augmentedDriver3).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot3, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "60" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "60" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } Thread.sleep(5000); Element.waitForLoad(driver); LoginPage loginPage1 = new LoginPage(driver); loginPage1.logout(); Element.waitForLoad(driver); LOGGER.info("Login as \"privateuser\" "); test.log(LogStatus.INFO, "Login as \"privateuser\" "); loginPage1.loginAsUser1("privateuser", "1qaz@WSX"); Element.waitForLoad(driver); Thread.sleep(5000); LOGGER.info("Check whether \"" + siteName + "\" SITE IS VISIBLE TO UNJOIN USER \"privateuser\""); test.log(LogStatus.INFO, "Check whether \" " + siteName + "\" SITE IS VISIBLE TO UNJOIN USER \"privateuser\""); SearchObjects searchSite2 = new SearchObjects(driver); searchSite2.searchSite(siteName, className, screenShotName + "non join"); Element.waitForLoad(driver); if (Element.isElementPresent(driver, By.xpath("//Span[text()='No sites found']"))) { Thread.sleep(5000); LOGGER.info("Message display as \"No sites found\""); test.log(LogStatus.INFO, "Message display as \"No sites found\""); LOGGER.info(siteName + " SITE IS NOT VISIBLE TO UNJOIN USER"); test.log(LogStatus.PASS, siteName + " SITE IS NOT VISIBLE TO UNJOIN USER \"privateuser\""); WebDriver augmentedDriver3 = new Augmenter().augment(driver); File screenshot3 = ((TakesScreenshot) augmentedDriver3).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot3, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "61" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "61" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { Thread.sleep(5000); if (Element.isTextPresentInList( driver.findElements( By.xpath("//tbody//tr//td//div//h3//a[contains(., '" + siteName + "')]")), siteName)) { LOGGER.info(siteName + " SITE IS VISIBLE TO UNJOIN USER \"privateuser\""); test.log(LogStatus.FAIL, siteName + " SITE IS VISIBLE TO UNJOIN USER \"privateuser\""); WebDriver augmentedDriver3 = new Augmenter().augment(driver); File screenshot3 = ((TakesScreenshot) augmentedDriver3).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot3, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "62" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "62" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { LOGGER.info(siteName + " SITE IS NOT VISIBLE TO UNJOIN USER"); test.log(LogStatus.PASS, siteName + " SITE IS NOT VISIBLE TO UNJOIN USER \"privateuser\""); WebDriver augmentedDriver3 = new Augmenter().augment(driver); File screenshot3 = ((TakesScreenshot) augmentedDriver3).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot3, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "63" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "63" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } } } else { LOGGER.info("CREATE PUBLIC SITE"); test.log(LogStatus.INFO, "CREATE PUBLIC SITE"); test.log(LogStatus.INFO, "Click \"Create Site\" "); test.log(LogStatus.INFO, "Enter " + siteName + " in \"site Name Field\" "); test.log(LogStatus.INFO, "Enter " + siteId + " in \"site URL Field\" "); test.log(LogStatus.INFO, "Check \"private\" Option"); test.log(LogStatus.INFO, "Click \"OK\" Button "); createObjects.createPublicSite(siteName, siteId, expectedResult, className, screenShotName); //If Site Created if (Element.isElementPresent(driver, By.xpath("//div[@class='bd']/span[@class='wait']"))) { LOGGER.info(TestCaseProperties.TEXT_TEST_PASS, "Site " + siteName + " CREATED "); test.log(LogStatus.INFO, "<font color=blue>Site " + siteName + " CREATED <font> "); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "64" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "64" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } //If Site IS NOT CREATED //Expected Result1=[COULD NOT CREATE SITE SINCE THE URL IS ALREADY USED] //ExpectedResult1==CurrentResult else { SiteDashboardPage siteDash1 = new SiteDashboardPage(driver); String siteErrorNotification = siteDash1.errorNotification(siteName, className, screenShotName); if (siteErrorNotification.toUpperCase().equals(expectedResult)) { LOGGER.info("Expected Results : " + expectedResult); test.log(LogStatus.INFO, "Expected Results : " + expectedResult); LOGGER.info("Current Test Results : " + siteErrorNotification); test.log(LogStatus.PASS, "Current Test Results : " + "<font color=green>" + siteErrorNotification + "<font>"); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "65" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "65" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); Button okaybtn = new Button(driver, By.xpath("//button[text()='OK']")); okaybtn.click(); } //ExpectedResult1!=CurrentResult[PROBLEM] else { LOGGER.error(TestCaseProperties.TEXT_TEST_FAIL, "Private Site " + siteName + "IS NOT CREATED "); test.log(LogStatus.FAIL, "Private Site " + siteName + "IS NOT CREATED "); LOGGER.info("Expected Results : " + expectedResult); test.log(LogStatus.INFO, "Expected Results : " + expectedResult); LOGGER.info("Current Test Results : " + siteErrorNotification); test.log(LogStatus.FAIL, "Current Test Results : " + "<font color=red>" + siteErrorNotification + "<font>"); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "66" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "66" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } } LOGGER.info("CHECK WHETHER " + siteName + " IS CREATED OR NOT"); test.log(LogStatus.INFO, "CHECK WHETHER " + siteName + " IS CREATED OR NOT"); LOGGER.info("CHECK WHETHER " + siteName + " IS DISPLAY IN SITES LIST"); test.log(LogStatus.INFO, "CHECK WHETHER " + siteName + " IS DISPLAY IN SITES LIST"); LOGGER.info("Click \"Sites\""); test.log(LogStatus.INFO, "Click \"Sites\""); LOGGER.info("Click \"Site Finder\""); test.log(LogStatus.INFO, "Click \"Site Finder\""); LOGGER.info("Search sitename"); test.log(LogStatus.INFO, "Search sitename"); SearchObjects searchSite = new SearchObjects(driver); searchSite.searchSite(siteName, className, screenShotName); if (Element.isElementPresent(driver, By.xpath("//Span[text()='No sites found']"))) { LOGGER.info("Message display as \"No sites found\""); test.log(LogStatus.INFO, "Message display as \"No sites found\""); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "67" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "67" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { if (Element.isTextPresentInListForSite( driver.findElements( By.xpath("//tbody//tr//td//div//h3//a[contains(., '" + siteName + "')]")), siteName)) { LOGGER.info("Site is Display in \"Site Search\""); test.log(LogStatus.PASS, "<font color=green>Site is Display in \"Site Search\"<font>"); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "68" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "68" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { LOGGER.info("Site IS NOT Display in \"Site Search\""); test.log(LogStatus.FAIL, "<font color=red>Site is NOT Display in \"Site Search\"<font>"); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "69" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "69" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } } } loginPage.logout(); LOGGER.info("Test case b_createSite executed"); test.log(LogStatus.INFO, "Test case b_createSite executed"); extent.endTest(test); extent.flush(); }
From source file:com.zaizi.automation.alfresco.E_Vanila_FolderCreation_Chrome.java
/** * //from ww w. j a v a2 s. com * @Test FolderCreation * @return * * @throws Exception InterruptedException, IOException */ @Test public void c_FolderCreation() throws InterruptedException, IOException { ExtentTest test = extent.startTest("c_FolderCreation", "Folder Creation and Validation as Admin in the Private Site"); driver = TestCaseProperties.driverType("Chrome", "WINDOWS"); //Set the upper left corner of the screen starting point driver.manage().window().setPosition(new Point(0, 0)); //define screen size java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); // define desired size Dimension maxWindowSize = new Dimension((int) screenSize.getWidth(), (int) screenSize.getHeight()); // Maximize the browser window according to your system's current resolution(set desired size) driver.manage().window().setSize(maxWindowSize); LOGGER.info("Test case c_FolderCreation started execution"); test.log(LogStatus.INFO, "Test case c_FolderCreation started execution"); driver.get(TestCaseProperties.LOGIN_SCREEN_URL); LoginPage loginPage = new LoginPage(driver); LOGGER.info("Accessing the Login Page"); test.log(LogStatus.INFO, "Accessing the Login Page"); //Login as the Admin LOGGER.info("Login As Admin"); test.log(LogStatus.INFO, "Login As Admin"); loginPage.loginAsAdmin(className, screenShotName); Thread.sleep(3000); SearchObjects search = new SearchObjects(driver); //Search for the Site LOGGER.info("Click \"Search Finder\""); test.log(LogStatus.INFO, "Click \"Search Finder\""); LOGGER.info("Search Site \"" + siteName + "\""); test.log(LogStatus.INFO, "Search Site \"" + siteName + "\""); search.searchSite(siteName, className, screenShotName); //Clicks on the Site Link LOGGER.info("Navigate to the " + siteName); test.log(LogStatus.INFO, "Navigate to the " + siteName); Link siteLink = new Link(driver, By.xpath("//h3[@class='sitename']/a[text()='" + siteName + "']")); siteLink.click(); // Element.takescreenshot(driver, className, screenShotName+"site1name"); Thread.sleep(3000); //Create Folder LOGGER.info("Created the Folder : " + folderName); test.log(LogStatus.INFO, "Created the Folder : " + folderName); test.log(LogStatus.INFO, "Navigate To DocumentLibrary"); test.log(LogStatus.INFO, "Click \"Create\" Button"); test.log(LogStatus.INFO, "Click \"Folder\""); test.log(LogStatus.INFO, "Enter the Name of the Folder"); test.log(LogStatus.INFO, "Enter the title of the Folder"); test.log(LogStatus.INFO, "Click \"Save\" Button"); CreateObjects create = new CreateObjects(driver); create.createFolder(folderName, folderTitle, className, screenShotName + "createFolder1"); Thread.sleep(3000); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "70" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "70" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); loginPage.logout(); //--- Folder Validation LOGGER.info("CHECK WHETHER FOLDER IS CREATED SUCESSFULLY"); test.log(LogStatus.INFO, "CHECK WHETHER FOLDER IS CREATED SUCESSFULLY"); LOGGER.info("Accessing the LoginPage"); test.log(LogStatus.INFO, "Accessing the LoginPage"); LOGGER.info("Login as Admin"); test.log(LogStatus.INFO, "Login as Admin"); LoginPage loginPage1 = new LoginPage(driver); loginPage1.loginAsAdmin(className, screenShotName); //Search for the Site LOGGER.info("Click \"Search Finder\""); test.log(LogStatus.INFO, "Click \"Search Finder\""); LOGGER.info("Search Site \"" + siteName + "\""); test.log(LogStatus.INFO, "Search Site \"" + siteName + "\""); search.searchSite(siteName, className, screenShotName); //Clicks on the Site Link LOGGER.info("Navigate to the " + siteName); test.log(LogStatus.INFO, "Navigate to the " + siteName); Link siteLink1 = new Link(driver, By.xpath("//h3[@class='sitename']/a[text()='" + siteName + "']")); siteLink1.click(); Thread.sleep(3000); //Navigate to the Document Library LOGGER.info("Navigate To DocumentLibrary"); test.log(LogStatus.INFO, "Navigate To DocumentLibrary"); NavigateToPage navigate = new NavigateToPage(driver); navigate.goToDocLib(); Element currentResult = new Element(driver, By.xpath("//h3//span//a[@rel='|path|/" + folderName + "|']")); //Verify whether the folder is created if (Element.isElementPresent(driver, By.xpath("//h3//span//a[@rel='|path|/" + folderName + "|']"))) { //Expected Result LOGGER.info("Expected Results :Folder " + folderName + "should visible"); test.log(LogStatus.INFO, "Expected Results :Folder " + folderName + "should visible"); //Current Result LOGGER.info("Current Test Results : Folder " + currentResult.getWebElement().getText() + " is visible"); test.log(LogStatus.INFO, "Current Test Results :Folder " + currentResult.getWebElement().getText() + " is visible"); LOGGER.info("The Admin has created the " + folderName + " successfully."); test.log(LogStatus.PASS, "The Admin has created the " + folderName + " successfully."); WebDriver augmentedDriver2 = new Augmenter().augment(driver); File screenshot2 = ((TakesScreenshot) augmentedDriver2).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot2, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "71" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "71" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { //Expected Result LOGGER.info("Expected Results :Folder " + folderName + "should visible"); test.log(LogStatus.INFO, "Expected Results :Folder " + folderName + "should visible"); //Current Result LOGGER.info("Current Test Results : Folder " + currentResult.getWebElement().getText() + " is visible"); test.log(LogStatus.INFO, "Current Test Results :Folder " + currentResult.getWebElement().getText() + " is visible"); LOGGER.info("The Admin has NOT created the " + folderName + " successfully."); test.log(LogStatus.FAIL, "The Admin has NOT created the " + folderName + " successfully."); WebDriver augmentedDriver2 = new Augmenter().augment(driver); File screenshot2 = ((TakesScreenshot) augmentedDriver2).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot2, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "72" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "72" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } LOGGER.info("Test case c_FolderCreation executed"); test.log(LogStatus.INFO, "Test case c_FolderCreation executed"); extent.endTest(test); extent.flush(); }
From source file:com.zaizi.automation.alfresco.E_Vanila_FolderCreation_Chrome.java
/** * * @Test DeleteFolder/*from w ww . ja v a 2s.c om*/ * @return * * @throws Exception InterruptedException, IOException */ @Test public void d_deleteFolder() throws InterruptedException, IOException { ExtentTest test = extent.startTest("d_deleteFolder", "Folder Creation and Validation as Admin in the Private Site"); driver = TestCaseProperties.driverType("Chrome", "WINDOWS"); //Set the upper left corner of the screen starting point driver.manage().window().setPosition(new Point(0, 0)); //define screen size java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); // define desired size Dimension maxWindowSize = new Dimension((int) screenSize.getWidth(), (int) screenSize.getHeight()); // Maximize the browser window according to your system's current resolution(set desired size) driver.manage().window().setSize(maxWindowSize); LOGGER.info("Test case d_deleteFolder started execution"); test.log(LogStatus.INFO, "Test case d_deleteFolder started execution"); driver.get(TestCaseProperties.LOGIN_SCREEN_URL); LoginPage loginPage = new LoginPage(driver); LOGGER.info("Accessing the Login Page"); test.log(LogStatus.INFO, "Accessing the Login Page"); //Login as the Admin LOGGER.info("Login As Admin"); test.log(LogStatus.INFO, "Login As Admin"); loginPage.loginAsAdmin(className, screenShotName); Thread.sleep(3000); SearchObjects search = new SearchObjects(driver); //Search for the Site LOGGER.info("Click \"Search Finder\""); test.log(LogStatus.INFO, "Click \"Search Finder\""); LOGGER.info("Search Site \"" + siteName + "\""); test.log(LogStatus.INFO, "Search Site \"" + siteName + "\""); search.searchSite(siteName, className, screenShotName); //Clicks on the Site Link LOGGER.info("Navigate to the " + siteName); test.log(LogStatus.INFO, "Navigate to the " + siteName); Link siteLink = new Link(driver, By.xpath("//h3[@class='sitename']/a[text()='" + siteName + "']")); siteLink.click(); Thread.sleep(3000); //Delete Folder LOGGER.info("Delete the Folder : " + folderName); test.log(LogStatus.INFO, "Delete the Folder : " + folderName); test.log(LogStatus.INFO, "Navigate To DocumentLibrary"); test.log(LogStatus.INFO, "Select Folder"); test.log(LogStatus.INFO, "Click \"Selected Items\""); test.log(LogStatus.INFO, "Click \"Delete\" Button"); test.log(LogStatus.INFO, "Click \"Delete Confirmation\" Button"); test.log(LogStatus.INFO, "Login as Admin to delete Folder in TrashCan"); test.log(LogStatus.INFO, "Click \"My Profile\""); test.log(LogStatus.INFO, "Place FolderName"); test.log(LogStatus.INFO, "Click \"Search\" Button"); test.log(LogStatus.INFO, "Check the patucular FolderName"); test.log(LogStatus.INFO, "Click \"Selected Item\" Button"); test.log(LogStatus.INFO, "Click \"Delete\" Button"); test.log(LogStatus.INFO, "Click \"OK\" Button"); test.log(LogStatus.INFO, "Click \"OK confirmation\" Button"); RemoveObjects delete = new RemoveObjects(driver); delete.deleteFolder(folderName, className, screenShotName); Thread.sleep(3000); WebDriver augmentedDriver2 = new Augmenter().augment(driver); File screenshot2 = ((TakesScreenshot) augmentedDriver2).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot2, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "73" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "73" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); loginPage.logout(); //--- Folder Validation LOGGER.info("Accessing the Login Page Again"); test.log(LogStatus.INFO, "Accessing the Login Page Again"); //Login as the Admin LOGGER.info("Login As Admin"); test.log(LogStatus.INFO, "Login As Admin"); LoginPage loginPage1 = new LoginPage(driver); loginPage1.loginAsAdmin(className, screenShotName); NavigateToPage navigateTo = new NavigateToPage(driver); LOGGER.info("CHECK WHETHER FOLDER\" " + folderName + " \"IS DELETED OR NOT"); test.log(LogStatus.INFO, "CHECK WHETHER FOLDER\" " + folderName + " \"IS DELETED OR NOT"); navigateTo.goToHome(); LOGGER.error("Click \"My Profile\" Again"); test.log(LogStatus.INFO, "Click \"My Profile\" Again"); navigateTo.goToUserTrashCan(className, screenShotName + "deletconfirm123"); LOGGER.info("Place folderUrl"); test.log(LogStatus.INFO, "Place folderUrl"); TextField textField = new TextField(driver, By.id("template_x002e_user-trashcan_x002e_user-trashcan_x0023_default-search-text")); textField.clearText(); textField.enterText(folderName); LOGGER.info("Click \"Search\" Button"); test.log(LogStatus.INFO, "Click \"Search\" Button"); Button searchButton = new Button(driver, By.xpath("//button[text()='Search']")); searchButton.click(); Thread.sleep(2000); WebDriver augmentedDriver3 = new Augmenter().augment(driver); File screenshot3 = ((TakesScreenshot) augmentedDriver3).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot3, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "73" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "73" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); LOGGER.info("Check the patucular folderUrl"); test.log(LogStatus.INFO, "Check the patucular folderUrl"); if (Element.isElementPresent(driver, By.xpath("//tbody[@class='yui-dt-message']//tr//td//div"))) { LOGGER.info(folderName + " Folder IS DELETED SUCCESSFULLY"); test.log(LogStatus.PASS, folderName + " Folder IS DELETED SUCCESSFULLY"); WebDriver augmentedDriver4 = new Augmenter().augment(driver); File screenshot4 = ((TakesScreenshot) augmentedDriver4).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot4, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "74" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "74" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { Element.waitUntilElementPresent(driver, By.xpath("//div//div//table//tbody//tr[contains(.,'" + folderName + "')]//td//div")); java.util.List<WebElement> myList = driver.findElements( By.xpath("//div//div//table//tbody//tr[contains(.,'" + folderName + "')]//td//div")); for (int i = 0; i < myList.size(); i++) { if (myList.get(i).getText().equals(folderName)) { Thread.sleep(2000); LOGGER.info(folderName + "Folder IS NOT DELETED"); test.log(LogStatus.FAIL, folderName + " Folder IS NOT DELETED"); WebDriver augmentedDriver4 = new Augmenter().augment(driver); File screenshot4 = ((TakesScreenshot) augmentedDriver4).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot4, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "75" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "75" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { LOGGER.info(folderName + " Folder IS DELETED SUCCESSFULLY"); test.log(LogStatus.PASS, folderName + "Folder IS DELETED SUCCESSFULLY"); WebDriver augmentedDriver4 = new Augmenter().augment(driver); File screenshot4 = ((TakesScreenshot) augmentedDriver4).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot4, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "76" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "76" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } } } loginPage1.logout(); LOGGER.info("Test case d_deleteFolder executed"); test.log(LogStatus.INFO, "Test case d_deleteFolder executed"); extent.endTest(test); extent.flush(); }
From source file:com.zaizi.automation.alfresco.E_Vanila_FolderCreation_Chrome.java
/** * * @Test DeleteSite//from w w w . java 2 s . co m * @return * * @throws Exception InterruptedException, IOException */ @Test public void e_deleteSite() throws InterruptedException, IOException { LOGGER.info(TestCaseProperties.TEXT_TEST_EXECUTING, "Delete site called \" " + siteName + " \" "); //Extent Report Start Configuration(testCaseName,Definition of testCase) ExtentTest test = extent.startTest("e_deleteSite", "Delete site called \" " + siteName + " \" "); //Set the DriverType(BrowserName,Platform) driver = TestCaseProperties.driverType("Chrome", "WINDOWS"); // Set the upper left corner of the screen starting point driver.manage().window().setPosition(new Point(0, 0)); // define screen size java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); // define desired size Dimension maxWindowSize = new Dimension((int) screenSize.getWidth(), (int) screenSize.getHeight()); // Maximize the browser window according to your system's current // resolution(set desired size) driver.manage().window().setSize(maxWindowSize); //Get LoginScreen_URl from TestcaseProperties Values driver.get(TestCaseProperties.LOGIN_SCREEN_URL); LOGGER.info("Test case e_deleteSite started executing"); test.log(LogStatus.INFO, "Test case e_deleteSite started executing"); LOGGER.info("Accessing the Login Page"); test.log(LogStatus.INFO, "Accessing the Login Page"); LOGGER.info("Login as admin"); test.log(LogStatus.INFO, "Login as admin"); LoginPage loginPage = new LoginPage(driver); loginPage.loginAsAdmin(className, screenShotName); LOGGER.info("Check the site,if site exist Delet the user"); test.log(LogStatus.INFO, "Check the site,if site exist Delete the user"); test.log(LogStatus.INFO, "Search the site"); test.log(LogStatus.INFO, "Click \"Delete\" Button,next to site\"" + siteName + "\""); test.log(LogStatus.INFO, "Click \"Delete\" Button,for delete confirmation"); test.log(LogStatus.INFO, "Login as Admin to delete Site in TrashCan"); test.log(LogStatus.INFO, "Click \"My Profile\""); test.log(LogStatus.INFO, "Place siteUrl"); test.log(LogStatus.INFO, "Click \"Search\" Button"); test.log(LogStatus.INFO, "Check the patucular siteUrl"); test.log(LogStatus.INFO, "Click \"Selected Item\" Button"); test.log(LogStatus.INFO, "Click \"Delete\" Button"); test.log(LogStatus.INFO, "Click \"OK\" Button"); test.log(LogStatus.INFO, "Click \"OK confirmation\" Button"); RemoveObjects deleteSite = new RemoveObjects(driver); deleteSite.deleteSite(siteName, siteId, className, screenShotName); LOGGER.info("CHECK WHETHER SITE\" " + siteName + " \"IS DELETED OR NOT"); test.log(LogStatus.INFO, "CHECK WHETHER SITE\" " + siteName + " \"IS DELETED OR NOT"); NavigateToPage navigateTo = new NavigateToPage(driver); navigateTo.goToHome(); LOGGER.error("Click \"My Profile\" Again"); test.log(LogStatus.INFO, "Click \"My Profile\" Again"); test.log(LogStatus.INFO, "Accessing trashcan Page"); navigateTo.goToUserTrashCan(className, screenShotName + "deletconfirm1"); LOGGER.info("Place siteUrl"); test.log(LogStatus.INFO, "Place siteUrl"); TextField textField = new TextField(driver, By.id("template_x002e_user-trashcan_x002e_user-trashcan_x0023_default-search-text")); textField.clearText(); textField.enterText(siteId); LOGGER.info("Click \"Search\" Button"); test.log(LogStatus.INFO, "Click \"Search\" Button"); Button searchButton = new Button(driver, By.xpath("//button[text()='Search']")); searchButton.click(); Thread.sleep(2000); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "30" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "30" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); //Element.takescreenshot(driver, className, screenShotName+"deleteConfirmation"); //CheckBox checkbox=new CheckBox(driver, By.xpath("//div[@class='name'][text()='"+item+"']/ancestor::td[1]/preceding-sibling::td[2]//input")); //checkbox.click(); LOGGER.info("Check the patucular siteUrl"); test.log(LogStatus.INFO, "Check the patucular siteUrl"); if (Element.isElementPresent(driver, By.xpath("//tbody[@class='yui-dt-message']//tr//td//div"))) { LOGGER.info(siteName + " SITE IS DELETED SUCCESSFULLY"); test.log(LogStatus.PASS, siteName + " SITE IS DELETED SUCCESSFULLY"); WebDriver augmentedDriver2 = new Augmenter().augment(driver); File screenshot2 = ((TakesScreenshot) augmentedDriver2).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot2, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "31" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "31" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { Element.waitUntilElementPresent(driver, By.xpath("//div//div//table//tbody//tr[contains(.,'" + siteId + "')]//td//div")); java.util.List<WebElement> myList = driver .findElements(By.xpath("//div//div//table//tbody//tr[contains(.,'" + siteId + "')]//td//div")); for (int i = 0; i < myList.size(); i++) { if (myList.get(i).getText().equals(siteId)) { Thread.sleep(2000); LOGGER.info(siteName + "SITE IS NOT DELETED"); test.log(LogStatus.FAIL, siteName + " SITE IS NOT DELETED"); WebDriver augmentedDriver2 = new Augmenter().augment(driver); File screenshot2 = ((TakesScreenshot) augmentedDriver2).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot2, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "32" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "32" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { LOGGER.info(siteName + " SITE IS DELETED SUCCESSFULLY"); test.log(LogStatus.PASS, siteName + "SITE IS DELETED SUCCESSFULLY"); WebDriver augmentedDriver2 = new Augmenter().augment(driver); File screenshot2 = ((TakesScreenshot) augmentedDriver2).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot2, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "33" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "33" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } } } loginPage.logout(); LOGGER.info("Test case e_deleteSite executed"); test.log(LogStatus.INFO, "Test case e_deleteSite executed"); extent.endTest(test); extent.flush(); }
From source file:com.zaizi.automation.alfresco.F_Vanila_DocumentLibraryTest_Chrome.java
/** * /*from w ww. j a v a 2 s .c o m*/ * @Test createSite * @return * * @throws Exception InterruptedException, IOException */ @Test public void b_createSite() throws InterruptedException, IOException { LOGGER.info(TestCaseProperties.TEXT_TEST_EXECUTING, "Create Site " + siteName); //Extent Report Start Configuration(testCaseName,Definition of testCase) ExtentTest test = extent.startTest("b_createSite", "Create site called \" " + siteName + " \",Is it private Site " + isPrivate); //Set the DriverType(BrowserName,Platform) driver = TestCaseProperties.driverType("Chrome", "WINDOWS"); // Set the upper left corner of the screen starting point driver.manage().window().setPosition(new Point(0, 0)); // define screen size java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); // define desired size Dimension maxWindowSize = new Dimension((int) screenSize.getWidth(), (int) screenSize.getHeight()); // Maximize the browser window according to your system's current // resolution(set desired size) driver.manage().window().setSize(maxWindowSize); //Get LoginScreen_URl from TestcaseProperties Values driver.get(TestCaseProperties.LOGIN_SCREEN_URL); LOGGER.info("Test case b_createSite started executing"); test.log(LogStatus.INFO, "Test case b_createSite started executing"); LOGGER.info("Accessing the Login Page"); test.log(LogStatus.INFO, "Accessing the Login Page"); LOGGER.info("Login as admin"); test.log(LogStatus.INFO, "Login as admin"); LoginPage loginPage = new LoginPage(driver); loginPage.loginAsAdmin(className, screenShotName); CreateObjects createObjects = new CreateObjects(driver); if (isPrivate) { LOGGER.info("CREATE PRIVATE SITE"); test.log(LogStatus.INFO, "CREATE PRIVATE SITE"); test.log(LogStatus.INFO, "Click \"Create Site\" "); test.log(LogStatus.INFO, "Enter " + siteName + " in \"site Name Field\" "); test.log(LogStatus.INFO, "Enter " + siteId + " in \"site URL Field\" "); test.log(LogStatus.INFO, "Check \"private\" Option"); test.log(LogStatus.INFO, "Click \"OK\" Button "); createObjects.createPrivateSite(siteName, siteId, expectedResult, className, screenShotName + "private2"); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "81" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "81" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); //If Site Created if (Element.isElementPresent(driver, By.xpath("//div[@class='bd']/span[@class='wait']"))) { LOGGER.info(TestCaseProperties.TEXT_TEST_PASS, "Site " + siteName + " CREATED "); test.log(LogStatus.INFO, "<font color=blue>Site " + siteName + " CREATED <font> "); } //If Site IS NOT CREATED //Expected Result1=[COULD NOT CREATE SITE SINCE THE URL IS ALREADY USED] //ExpectedResult1==CurrentResult else { SiteDashboardPage siteDash1 = new SiteDashboardPage(driver); String siteErrorNotification = siteDash1.errorNotification(siteName, className, screenShotName); if (siteErrorNotification.toUpperCase().equals(expectedResult)) { LOGGER.info("Expected Results : " + expectedResult); test.log(LogStatus.INFO, "Expected Results : " + expectedResult); LOGGER.info("Current Test Results : " + siteErrorNotification); test.log(LogStatus.PASS, "Current Test Results : " + "<font color=green>" + siteErrorNotification + "<font>"); Button okaybtn = new Button(driver, By.xpath("//button[text()='OK']")); okaybtn.click(); } //ExpectedResult1!=CurrentResult[PROBLEM] else { LOGGER.error(TestCaseProperties.TEXT_TEST_FAIL, "Private Site " + siteName + "IS NOT CREATED "); test.log(LogStatus.FAIL, "Private Site " + siteName + "IS NOT CREATED "); LOGGER.info("Expected Results : " + expectedResult); test.log(LogStatus.INFO, "Expected Results : " + expectedResult); LOGGER.info("Current Test Results : " + siteErrorNotification); test.log(LogStatus.FAIL, "Current Test Results : " + "<font color=red>" + siteErrorNotification + "<font>"); } } Element.waitForLoad(driver); Thread.sleep(5000); LOGGER.info("CHECK WHETHER PRIVATE SITE CREATED OR NOT"); test.log(LogStatus.INFO, "CHECK WHETHER PRIVATE SITE CREATED OR NOT"); LOGGER.info("Check whether \" " + siteName + "\" SITE IS VISIBLE TO " + siteCreatorName); test.log(LogStatus.INFO, "Check whether \" " + siteName + "\" SITE IS VISIBLE TO " + siteCreatorName); Thread.sleep(5000); LOGGER.info("Search the sitename in Site finder"); test.log(LogStatus.INFO, "Search the sitename in Site finder"); SearchObjects searchSite = new SearchObjects(driver); searchSite.searchSite(siteName, className, screenShotName + "joinadmin"); if (Element.isElementPresent(driver, By.xpath("//Span[text()='No sites found']"))) { LOGGER.info("Message display as \"No sites found\""); test.log(LogStatus.INFO, "Message display as \"No sites found\""); LOGGER.info(siteName + " SITE IS NOT VISIBLE TO " + siteCreatorName); test.log(LogStatus.FAIL, "<font color=blue>" + siteName + " SITE IS NOT VISIBLE TO " + siteCreatorName + "<font>"); WebDriver augmentedDriver2 = new Augmenter().augment(driver); File screenshot2 = ((TakesScreenshot) augmentedDriver2).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot2, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "82" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "82" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else if (Element.isTextPresentInListForSite( driver.findElements(By.xpath("//tbody//tr//td//div//h3//a[contains(., '" + siteName + "')]")), siteName)) { LOGGER.info(siteName + " SITE IS VISIBLE TO " + siteCreatorName); test.log(LogStatus.INFO, "<font color=blue>" + siteName + " SITE IS VISIBLE TO " + siteCreatorName + "<font>"); WebDriver augmentedDriver3 = new Augmenter().augment(driver); File screenshot3 = ((TakesScreenshot) augmentedDriver3).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot3, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "83" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "83" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } Thread.sleep(5000); Element.waitForLoad(driver); LoginPage loginPage1 = new LoginPage(driver); loginPage1.logout(); Element.waitForLoad(driver); LOGGER.info("Login as \"privateuser\" "); test.log(LogStatus.INFO, "Login as \"privateuser\" "); loginPage1.loginAsUser1("privateuser", "1qaz@WSX"); Element.waitForLoad(driver); Thread.sleep(5000); LOGGER.info("Check whether \"" + siteName + "\" SITE IS VISIBLE TO UNJOIN USER \"privateuser\""); test.log(LogStatus.INFO, "Check whether \" " + siteName + "\" SITE IS VISIBLE TO UNJOIN USER \"privateuser\""); SearchObjects searchSite2 = new SearchObjects(driver); searchSite2.searchSite(siteName, className, screenShotName + "non join"); Element.waitForLoad(driver); if (Element.isElementPresent(driver, By.xpath("//Span[text()='No sites found']"))) { Thread.sleep(5000); LOGGER.info("Message display as \"No sites found\""); test.log(LogStatus.INFO, "Message display as \"No sites found\""); LOGGER.info(siteName + " SITE IS NOT VISIBLE TO UNJOIN USER"); test.log(LogStatus.PASS, siteName + " SITE IS NOT VISIBLE TO UNJOIN USER \"privateuser\""); WebDriver augmentedDriver3 = new Augmenter().augment(driver); File screenshot3 = ((TakesScreenshot) augmentedDriver3).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot3, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "84" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "84" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { Thread.sleep(5000); if (Element.isTextPresentInList( driver.findElements( By.xpath("//tbody//tr//td//div//h3//a[contains(., '" + siteName + "')]")), siteName)) { LOGGER.info(siteName + " SITE IS VISIBLE TO UNJOIN USER \"privateuser\""); test.log(LogStatus.FAIL, siteName + " SITE IS VISIBLE TO UNJOIN USER \"privateuser\""); WebDriver augmentedDriver3 = new Augmenter().augment(driver); File screenshot3 = ((TakesScreenshot) augmentedDriver3).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot3, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "85" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "85" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { LOGGER.info(siteName + " SITE IS NOT VISIBLE TO UNJOIN USER"); test.log(LogStatus.PASS, siteName + " SITE IS NOT VISIBLE TO UNJOIN USER \"privateuser\""); WebDriver augmentedDriver3 = new Augmenter().augment(driver); File screenshot3 = ((TakesScreenshot) augmentedDriver3).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot3, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "86" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "86" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } } } else { LOGGER.info("CREATE PUBLIC SITE"); test.log(LogStatus.INFO, "CREATE PUBLIC SITE"); test.log(LogStatus.INFO, "Click \"Create Site\" "); test.log(LogStatus.INFO, "Enter " + siteName + " in \"site Name Field\" "); test.log(LogStatus.INFO, "Enter " + siteId + " in \"site URL Field\" "); test.log(LogStatus.INFO, "Check \"private\" Option"); test.log(LogStatus.INFO, "Click \"OK\" Button "); createObjects.createPublicSite(siteName, siteId, expectedResult, className, screenShotName); //If Site Created if (Element.isElementPresent(driver, By.xpath("//div[@class='bd']/span[@class='wait']"))) { LOGGER.info(TestCaseProperties.TEXT_TEST_PASS, "Site " + siteName + " CREATED "); test.log(LogStatus.INFO, "<font color=blue>Site " + siteName + " CREATED <font> "); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "87" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "87" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } //If Site IS NOT CREATED //Expected Result1=[COULD NOT CREATE SITE SINCE THE URL IS ALREADY USED] //ExpectedResult1==CurrentResult else { SiteDashboardPage siteDash1 = new SiteDashboardPage(driver); String siteErrorNotification = siteDash1.errorNotification(siteName, className, screenShotName); if (siteErrorNotification.toUpperCase().equals(expectedResult)) { LOGGER.info("Expected Results : " + expectedResult); test.log(LogStatus.INFO, "Expected Results : " + expectedResult); LOGGER.info("Current Test Results : " + siteErrorNotification); test.log(LogStatus.PASS, "Current Test Results : " + "<font color=green>" + siteErrorNotification + "<font>"); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "88" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "88" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); Button okaybtn = new Button(driver, By.xpath("//button[text()='OK']")); okaybtn.click(); } //ExpectedResult1!=CurrentResult[PROBLEM] else { LOGGER.error(TestCaseProperties.TEXT_TEST_FAIL, "Private Site " + siteName + "IS NOT CREATED "); test.log(LogStatus.FAIL, "Private Site " + siteName + "IS NOT CREATED "); LOGGER.info("Expected Results : " + expectedResult); test.log(LogStatus.INFO, "Expected Results : " + expectedResult); LOGGER.info("Current Test Results : " + siteErrorNotification); test.log(LogStatus.FAIL, "Current Test Results : " + "<font color=red>" + siteErrorNotification + "<font>"); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "89" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "89" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } } LOGGER.info("CHECK WHETHER " + siteName + " IS CREATED OR NOT"); test.log(LogStatus.INFO, "CHECK WHETHER " + siteName + " IS CREATED OR NOT"); LOGGER.info("CHECK WHETHER " + siteName + " IS DISPLAY IN SITES LIST"); test.log(LogStatus.INFO, "CHECK WHETHER " + siteName + " IS DISPLAY IN SITES LIST"); LOGGER.info("Click \"Sites\""); test.log(LogStatus.INFO, "Click \"Sites\""); LOGGER.info("Click \"Site Finder\""); test.log(LogStatus.INFO, "Click \"Site Finder\""); LOGGER.info("Search sitename"); test.log(LogStatus.INFO, "Search sitename"); SearchObjects searchSite = new SearchObjects(driver); searchSite.searchSite(siteName, className, screenShotName); if (Element.isElementPresent(driver, By.xpath("//Span[text()='No sites found']"))) { LOGGER.info("Message display as \"No sites found\""); test.log(LogStatus.INFO, "Message display as \"No sites found\""); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "90" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "90" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { if (Element.isTextPresentInListForSite( driver.findElements( By.xpath("//tbody//tr//td//div//h3//a[contains(., '" + siteName + "')]")), siteName)) { LOGGER.info("Site is Display in \"Site Search\""); test.log(LogStatus.PASS, "<font color=green>Site is Display in \"Site Search\"<font>"); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "91" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "91" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { LOGGER.info("Site IS NOT Display in \"Site Search\""); test.log(LogStatus.FAIL, "<font color=red>Site is NOT Display in \"Site Search\"<font>"); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File(TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "92" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "92" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } } } loginPage.logout(); LOGGER.info("Test case b_createSite executed"); test.log(LogStatus.INFO, "Test case b_createSite executed"); extent.endTest(test); extent.flush(); }
From source file:com.zaizi.automation.alfresco.F_Vanila_DocumentLibraryTest_Chrome.java
/** * /*from w ww. j av a 2 s .c o m*/ * @Test Upload Document * @return * * @throws Exception InterruptedException, IOException */ @Test public void c_uploadDocument() throws InterruptedException, IOException { ExtentTest test = extent.startTest("c_uploadDocument", "Upload Document and Validate as Admin in the Private Site"); driver = TestCaseProperties.driverType("Chrome", "WINDOWS"); //Set the upper left corner of the screen starting point driver.manage().window().setPosition(new Point(0, 0)); //define screen size java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); // define desired size Dimension maxWindowSize = new Dimension((int) screenSize.getWidth(), (int) screenSize.getHeight()); // Maximize the browser window according to your system's current resolution(set desired size) driver.manage().window().setSize(maxWindowSize); LOGGER.info("Test case c_uploadDocument started execution"); test.log(LogStatus.INFO, "Test case c_uploadDocument started execution"); driver.get(TestCaseProperties.LOGIN_SCREEN_URL); LoginPage loginPage = new LoginPage(driver); LOGGER.info("Accessing the Login Page"); test.log(LogStatus.INFO, "Accessing the Login Page"); //Login as the Admin LOGGER.info("Login As Admin"); test.log(LogStatus.INFO, "Login As Admin"); loginPage.loginAsAdmin(className, screenShotName); Thread.sleep(3000); SearchObjects search = new SearchObjects(driver); //Search for the Site LOGGER.info("Click \"Search Finder\""); test.log(LogStatus.INFO, "Click \"Search Finder\""); LOGGER.info("Search Site \"" + siteName + "\""); test.log(LogStatus.INFO, "Search Site \"" + siteName + "\""); search.searchSite(siteName, className, screenShotName); //Clicks on the Site Link LOGGER.info("Navigate to the " + siteName); test.log(LogStatus.INFO, "Navigate to the " + siteName); Link siteLink = new Link(driver, By.xpath("//h3[@class='sitename']/a[text()='" + siteName + "']")); siteLink.click(); // Element.takescreenshot(driver, className, screenShotName); Thread.sleep(3000); //UploadDocument LOGGER.info("Upload the Document : " + documentName); test.log(LogStatus.INFO, "Upload the Document : " + documentName); test.log(LogStatus.INFO, "Navigate To DocumentLibrary"); test.log(LogStatus.INFO, "Click \"Upload Document\""); test.log(LogStatus.INFO, "Select the file \"" + documentName + "\""); CreateObjects upload = new CreateObjects(driver); upload.uploadDocument(documentName, className, screenShotName); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "93" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "93" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); TestCaseProperties.closeDriver(driver); //loginPage.logout(); LOGGER.info("Test case c_uploadDocument executed"); test.log(LogStatus.INFO, "Test case c_uploadDocument executed"); extent.endTest(test); extent.flush(); /** * * @Test Check whether Document is uploaded or not * @return * * @throws Exception InterruptedException, IOException */ }
From source file:com.zaizi.automation.alfresco.F_Vanila_DocumentLibraryTest_Chrome.java
@Test public void d_verifyUploadDocument() throws InterruptedException, IOException { ExtentTest test = extent.startTest("d_verifyUploadDocument", "Verify the upload Document as Admin in the Private Site"); driver = TestCaseProperties.driverType("Chrome", "WINDOWS"); //Set the upper left corner of the screen starting point driver.manage().window().setPosition(new Point(0, 0)); //define screen size java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); // define desired size Dimension maxWindowSize = new Dimension((int) screenSize.getWidth(), (int) screenSize.getHeight()); // Maximize the browser window according to your system's current resolution(set desired size) driver.manage().window().setSize(maxWindowSize); LOGGER.info("Test case d_verifyUploadDocument started execution"); test.log(LogStatus.INFO, "Test case d_verifyUploadDocument started execution"); //UploadDocument LOGGER.info("Verify whether document " + documentName + " uploaded or not"); test.log(LogStatus.INFO, "Verify whether document " + documentName + " uploaded or not"); driver.get(TestCaseProperties.LOGIN_SCREEN_URL); LOGGER.info("Accessing the Login Page"); test.log(LogStatus.INFO, "Accessing the Login Page"); //Login as the Admin LOGGER.info("Login As Admin"); test.log(LogStatus.INFO, "Login As Admin"); LoginPage loginPage = new LoginPage(driver); loginPage.loginAsAdmin(className, screenShotName); SearchObjects search = new SearchObjects(driver); //Search for the Site LOGGER.info("Click \"Search Finder\""); test.log(LogStatus.INFO, "Click \"Search Finder\""); LOGGER.info("Search Site \"" + siteName + "\""); test.log(LogStatus.INFO, "Search Site \"" + siteName + "\""); search.searchSite(siteName, className, screenShotName); //Clicks on the Site Link LOGGER.info("Navigate to the " + siteName); test.log(LogStatus.INFO, "Navigate to the " + siteName); Link siteLink = new Link(driver, By.xpath("//h3[@class='sitename']/a[text()='" + siteName + "']")); siteLink.click();// ww w . j a va 2 s .com // Element.takescreenshot(driver, className, screenShotName+"siteName"); Thread.sleep(3000); //Navigate to the Document Library LOGGER.info("Navigate To DocumentLibrary"); test.log(LogStatus.INFO, "Navigate To DocumentLibrary"); NavigateToPage navigate = new NavigateToPage(driver); navigate.goToDocLib(); Thread.sleep(3000); Element currentResult1 = new Element(driver, By.xpath("//h3[@class='filename']//span//a[contains(., " + documentName + ")]")); //Verify whether the uploaded file is available in the Document Library if (Button.isElementPresent(driver, By.xpath("//h3[@class='filename']//span//a[contains(., " + documentName + ")]"))) { //Expected Result LOGGER.info("Expected Results : " + documentName); test.log(LogStatus.INFO, "Expected Results : " + documentName); //Current Result LOGGER.info("Current Test Results : " + currentResult1.getWebElement().getText()); test.log(LogStatus.INFO, "Current Test Results : " + currentResult1.getWebElement().getText()); test.log(LogStatus.PASS, "The User has created the " + documentName + " successfully."); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "94" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "94" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { //Expected Result LOGGER.info("Expected Results : " + documentName); test.log(LogStatus.INFO, "Expected Results : " + documentName); //Current Result LOGGER.info("Current Test Results : " + currentResult1.getWebElement().getText()); test.log(LogStatus.INFO, "Current Test Results : " + currentResult1.getWebElement().getText()); test.log(LogStatus.FAIL, "The User has not created the " + documentName + " successfully."); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "95" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "95" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } loginPage.logout(); LOGGER.info("Test case d_verifyUploadDocument executed"); test.log(LogStatus.INFO, "Test case d_verifyUploadDocument executed"); extent.endTest(test); extent.flush(); }
From source file:com.zaizi.automation.alfresco.F_Vanila_DocumentLibraryTest_Chrome.java
/** * * @Test Assign the user/Group to role to manage[Document Level] * @return/*www .j av a 2s .com*/ * * @throws Exception InterruptedException, IOException */ @Test public void e_managePermission() throws InterruptedException, IOException { ExtentTest test = extent.startTest("e_managePermission", "Verify the upload Document as Admin in the Private Site"); driver = TestCaseProperties.driverType("Chrome", "WINDOWS"); //Set the upper left corner of the screen starting point driver.manage().window().setPosition(new Point(0, 0)); //define screen size java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); // define desired size Dimension maxWindowSize = new Dimension((int) screenSize.getWidth(), (int) screenSize.getHeight()); // Maximize the browser window according to your system's current resolution(set desired size) driver.manage().window().setSize(maxWindowSize); LOGGER.info("Test case e_managePermission started execution"); test.log(LogStatus.INFO, "Test case e_managePermission started execution"); driver.get(TestCaseProperties.LOGIN_SCREEN_URL); LOGGER.info("Accessing the Login Page"); test.log(LogStatus.INFO, "Accessing the Login Page"); //Login as the Admin LOGGER.info("Login As Admin"); test.log(LogStatus.INFO, "Login As Admin"); LoginPage loginPage = new LoginPage(driver); loginPage.loginAsAdmin(className, screenShotName); LOGGER.info("Give manage permission for document level"); test.log(LogStatus.INFO, "Give manage permission for document level"); test.log(LogStatus.INFO, "Click \"Search Finder\""); test.log(LogStatus.INFO, "Search Site \"" + siteName + "\""); test.log(LogStatus.INFO, "Navigate to the " + siteName); test.log(LogStatus.INFO, "Navigate To DocumentLibrary"); test.log(LogStatus.INFO, "Click Document"); test.log(LogStatus.INFO, "Click \"Manage Permissison\""); test.log(LogStatus.INFO, "Click \"Inheritence Permission\""); test.log(LogStatus.INFO, "Click \"Yes\" to remove inheritence"); test.log(LogStatus.INFO, "Click \"Add User/Group\" to add user/group"); test.log(LogStatus.INFO, "Search User"); test.log(LogStatus.INFO, "Click \"Search\""); test.log(LogStatus.INFO, "Click \"Add\" next to user"); test.log(LogStatus.INFO, "Set the permission"); test.log(LogStatus.INFO, "Click \"SAVE\""); CreateObjects managePermission = new CreateObjects(driver); managePermission.managePermission(siteName, documentName, userName, roleName, className, screenShotName); Thread.sleep(5000); WebDriver augmentedDriver12 = new Augmenter().augment(driver); File screenshot12 = ((TakesScreenshot) augmentedDriver12).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot12, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "new" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "new" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); loginPage.logout(); LOGGER.info("CHECK THE PERMISSION LEVEL"); test.log(LogStatus.INFO, "CHECK THE PERMISSION LEVEL"); LOGGER.info("Accessing the Login Page again"); test.log(LogStatus.INFO, "Accessing the Login Page again"); //Login as the Admin LOGGER.info("Login As Admin"); test.log(LogStatus.INFO, "Login As Admin"); LoginPage loginPage1 = new LoginPage(driver); loginPage1.loginAsAdmin(className, screenShotName); SearchObjects search = new SearchObjects(driver); //Search for the Site LOGGER.info("Click \"Search Finder\""); test.log(LogStatus.INFO, "Click \"Search Finder\""); LOGGER.info("Search Site \"" + siteName + "\""); test.log(LogStatus.INFO, "Search Site \"" + siteName + "\""); search.searchSite(siteName, className, screenShotName); //Clicks on the Site Link LOGGER.info("Navigate to the " + siteName); test.log(LogStatus.INFO, "Navigate to the " + siteName); Link siteLink = new Link(driver, By.xpath("//h3[@class='sitename']/a[text()='" + siteName + "']")); siteLink.click(); Thread.sleep(3000); WebDriver augmentedDriver1 = new Augmenter().augment(driver); File screenshot1 = ((TakesScreenshot) augmentedDriver1).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot1, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "96" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "96" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); //Navigate to the Document Library LOGGER.info("Navigate To DocumentLibrary"); test.log(LogStatus.INFO, "Navigate To DocumentLibrary"); NavigateToPage navigate = new NavigateToPage(driver); navigate.goToDocLib(); Thread.sleep(3000); //click the document LOGGER.info("Click Document"); test.log(LogStatus.INFO, "Click Document"); Link document = new Link(driver, By.xpath("//span/a[text()='" + documentName + "']")); document.click(); Thread.sleep(7000); //click manage Permisison LOGGER.info("Click \"Manage Permissison\""); test.log(LogStatus.INFO, "Click \"Manage Permissison\""); Span manage = new Span(driver, By.xpath("//span[contains(., 'Manage Permissions')]")); manage.click(); Element.waitForLoad(driver); Thread.sleep(5000); if (Element.isElementPresent(driver, By.xpath("//div[text()='" + userName + "']/ancestor::td/following-sibling::td[1]//button[text()='" + roleName + "']"))) { LOGGER.info("Successfully user " + userName + " added to role " + roleName + " in manage Permission"); test.log(LogStatus.PASS, "Successfully user " + userName + " added to role " + roleName + " in manage Permission"); WebDriver augmentedDriver3 = new Augmenter().augment(driver); File screenshot3 = ((TakesScreenshot) augmentedDriver3).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot3, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "98" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "98" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } else { LOGGER.info("User " + userName + " IS NOT added to role " + roleName + " in manage Permission"); test.log(LogStatus.FAIL, "User " + userName + " IS NOT added to role " + roleName + " in manage Permission"); WebDriver augmentedDriver4 = new Augmenter().augment(driver); File screenshot4 = ((TakesScreenshot) augmentedDriver4).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot4, new File( TestCaseProperties.REPORT_TEST_PATH_CHROME + className + "/" + screenShotName + "99" + ".jpg")); test.log(LogStatus.INFO, "Snapshot below: " + test.addScreenCapture("./" + className + "/" + screenShotName + "99" + ".jpg")); System.out.println("Screenshot Taken Successfully!!!!"); } loginPage1.logout(); LOGGER.info("Test case e_managePermission executed"); test.log(LogStatus.INFO, "Test case e_managePermission executed"); extent.endTest(test); extent.flush(); }