@BeforeMethod(alwaysRun = true) public void prepareURL() { String articleUrl = urlBuilder.getWebUrlForPath(Configuration.getWikiName(), ARTICLE_NAME); url = urlBuilder.appendQueryStringToURL(articleUrl, QUERY_STRING); String expectedArticleUrl = urlBuilder.getUrlForPath(Configuration.getWikiName(), ARTICLE_NAME); expectedUrl = urlBuilder.appendQueryStringToURL(expectedArticleUrl, QUERY_STRING); }
public void logOut(WebDriver driver) { try { driver.manage().deleteAllCookies(); driver.get(urlBuilder.getUrlForWiki(Configuration.getWikiName()) + URLsContent.LOGOUT); } catch (TimeoutException e) { PageObjectLogging.log("logOut", "page loads for more than 30 seconds", true); } waitForElementPresenceByBy(LOGIN_BUTTON_CSS); PageObjectLogging.log("logOut", "user is logged out", true, driver); }
@Override public void onStart(ITestContext context) { CommonUtils.createDirectory(screenDirPath); imageCounter = 0; DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); StringBuilder builder = new StringBuilder(); builder.append( "<html><style>" + "table {margin:0 auto;}td:first-child {width:200px;}td:nth-child(2) {width:660px;}td:nth-child(3) " + "{width:100px;}tr.success{color:black;background-color:#CCFFCC;}" + "tr.warning{color:black;background-color:#FEE01E;}" + "tr.error{color:black;background-color:#FFCCCC;}" + "tr.step{color:white;background:grey}" + "</style><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">" + "<style>td { border-top: 1px solid grey; } </style></head><body>" + "<script type=\"text/javascript\" src=\"http://code.jquery.com/jquery-1.8.2.min.js\"></script>" + "<p>Date: " + DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZZ") .print(DateTime.now(DateTimeZone.UTC)) + "</p>" + "<p>Polish Time: " + DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss ZZ") .print( DateTime.now() .withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("Europe/Warsaw")))) + "</p>" + "<p>Browser: " + Configuration.getBrowser() + "</p>" + "<p>OS: " + System.getProperty("os.name") + "</p>" + "<p>Testing environment: " + new UrlBuilder().getUrlForWiki(Configuration.getWikiName()) + "</p>" + "<p>Testing environment: " + Configuration.getEnv() + "</p>" + "<p>Tested version: " + "TO DO: GET WIKI VERSION HERE" + "</p>" + "<div id='toc'></div>"); CommonUtils.appendTextToFile(logPath, builder.toString()); appendShowHideButtons(); try { FileInputStream input = new FileInputStream("./src/test/resources/script.txt"); String content = IOUtils.toString(input); CommonUtils.appendTextToFile(logPath, content); } catch (IOException e) { System.out.println("no script.txt file available"); } }
public void openRegisterPage() { driver.get(urlBuilder.getUrlForWiki(Configuration.getWikiName()) + "register"); }