Zen fix: 1

This commit is contained in:
2024-09-26 13:00:23 -04:00
commit 74fd6a9f24
11 changed files with 237 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
+3
View File
@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+68
View File
@@ -0,0 +1,68 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>zacksolutions</groupId>
<artifactId>Zenful</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Zenful</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.10.2</version>
<scope>compile</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.25.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-scratchpad -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>5.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>4.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.24.0</version>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,40 @@
package zacksolutions.base;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Initialization {
public static WebDriver driver;
public static Properties prop;
public Initialization() {
try {
prop = new Properties();
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) {
e.printStackTrace();
}
}
public void BrowserInit() {
String browsername = prop.getProperty("browserF");
if (browsername.equalsIgnoreCase("firefox")) {
System.setProperty("web-driver.gecko.driver","/home/ilyes/SeleniumPractice/Zenful/drivers/geckodriver");
driver = new FirefoxDriver();
driver.get(prop.getProperty("url"));
}
}
}
@@ -0,0 +1,5 @@
url=https://zenful.cloud/
browserC= chrome
browserF= firefox
@@ -0,0 +1,31 @@
package zacksolutions.pages;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import zacksolutions.base.Initialization;
public class HomePage extends Initialization {
@FindBy(id="message")
WebElement message;
@FindBy(css="button[type='submit']")
WebElement button;
@FindBy(css="tbody tr:nth-child(1) td:nth-child(1)")
WebElement ConfirmText;
//Initialization
public HomePage(){
PageFactory.initElements(driver, this);
}
//Actions
public void insertText() throws InterruptedException {
message.sendKeys("4 8 15 16 23 42");
button.click();
}
public String textConfirmation(){
return ConfirmText.getText();
}
}
@@ -0,0 +1,31 @@
package zacksolutions;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import zacksolutions.base.Initialization;
import zacksolutions.pages.HomePage;
public class HomePageTest extends Initialization {
HomePage homePage;
public HomePageTest(){
super();
}
@BeforeTest
public void setUp(){
BrowserInit();
homePage = new HomePage();
}
@Test
public void TextTest() throws InterruptedException {
HomePage hp = new HomePage();
hp.insertText();
hp.textConfirmation();
Assert.assertEquals(hp.textConfirmation(), "4 8 15 16 23 42");
}
@AfterTest
public void tearDown(){
driver.close();
}
}