InterviewQuestionsQA

This commit is contained in:
dadgam3er 2024-11-05 04:49:26 -05:00
commit 82f294c1d0
8 changed files with 137 additions and 0 deletions

38
.gitignore vendored Normal file
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
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

7
.idea/encodings.xml Normal file
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
.idea/misc.xml Normal file
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_17" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

BIN
Drivers/chromedriver Executable file

Binary file not shown.

BIN
Drivers/geckodriver Executable file

Binary file not shown.

39
pom.xml Normal file
View File

@ -0,0 +1,39 @@
<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>InterviewCodingQuestionQA</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>InterviewCodingQuestionQA</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>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.10.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.26.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.0</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,36 @@
package zacksolutions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class AutomateGiteaLogin {
WebDriver driver;
@BeforeTest
public void setUp(){
System.getProperty("web-driver.gecko","user.dir" + "/SeleniumPractice/InterviewCodingQuestionQA/Drivers/geckodriver");
driver = new FirefoxDriver();
driver.get("https://gitea.zacksolutions.dev/");
driver.manage().window().maximize();
System.out.println(driver.getTitle());
}
@Test
public void giteaLogin(){
WebElement signIn = driver.findElement(By.cssSelector(".item[rel$='nofollow']"));
signIn.click();
driver.findElement(By.cssSelector("input[id='user_name']")).sendKeys("Zakaria");
driver.findElement(By.cssSelector("input[id='password']")).sendKeys("engraved-alone-naming");
driver.findElement(By.cssSelector("button[class$='ui primary button']")).click();
System.out.println(driver.getTitle());
String User = driver.findElement(By.cssSelector("span[class='text truncated-item-container'] span[class='truncated-item-name']")).getText();
System.out.println(User);
}
@AfterTest
public void tearDown(){
driver.close();
}
}