diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..919ce1f --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/java/zacksolutions/base/Initialization.java b/src/main/java/zacksolutions/base/Initialization.java index 0726784..4f14239 100644 --- a/src/main/java/zacksolutions/base/Initialization.java +++ b/src/main/java/zacksolutions/base/Initialization.java @@ -1,16 +1,21 @@ package zacksolutions.base; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; +import com.aventstack.extentreports.ExtentTest; +import com.aventstack.extentreports.reporter.ExtentSparkReporter; +import com.aventstack.extentreports.ExtentReports; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Initialization { public static WebDriver driver; public static Properties prop; + public static ExtentReports extent; + public static ExtentTest test; + public Initialization() { @@ -20,16 +25,21 @@ public class Initialization { FileInputStream fis = new FileInputStream("/home/ilyes/SeleniumPractice/Zenful/src/main/java/zacksolutions/config/config.properties"); prop.load(fis); - } catch (FileNotFoundException e) { - // TODO: handle exception - e.printStackTrace(); } catch (IOException e) { + // TODO: handle exception e.printStackTrace(); } } public void BrowserInit() { + String path = System.getProperty("user.dir") + "/reports/index.html"; + ExtentSparkReporter spark = new ExtentSparkReporter(path); + spark.config().setDocumentTitle("Zen Test Case"); + spark.config().setReportName("Zenful"); + extent = new ExtentReports(); + extent.attachReporter(spark); + extent.setSystemInfo("Test Done By: ", "Sami"); String browsername = prop.getProperty("browserF"); if (browsername.equalsIgnoreCase("firefox")) { System.setProperty("web-driver.gecko.driver","/home/ilyes/SeleniumPractice/Zenful/drivers/geckodriver"); diff --git a/src/main/java/zacksolutions/pages/HomePage.java b/src/main/java/zacksolutions/pages/HomePage.java index 25bf642..1ba90ee 100644 --- a/src/main/java/zacksolutions/pages/HomePage.java +++ b/src/main/java/zacksolutions/pages/HomePage.java @@ -22,8 +22,10 @@ public class HomePage extends Initialization { //Actions public void insertText() throws InterruptedException { + test = extent.createTest("Test msg"); message.sendKeys("4 8 15 16 23 42"); button.click(); + extent.flush(); } public String textConfirmation(){ return ConfirmText.getText(); diff --git a/src/test/java/zacksolutions/HomePageTest.java b/src/test/java/zacksolutions/HomePageTest.java index 91be350..489b718 100644 --- a/src/test/java/zacksolutions/HomePageTest.java +++ b/src/test/java/zacksolutions/HomePageTest.java @@ -7,7 +7,9 @@ import org.testng.annotations.Test; import zacksolutions.base.Initialization; import zacksolutions.pages.HomePage; + public class HomePageTest extends Initialization { + HomePage homePage; public HomePageTest(){ super();