Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding e2e tests #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions e2e/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>org.example</groupId>
<artifactId>Salinaka Ecommerce</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.22.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.10.2</version>
</dependency>

<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.16.1</version>
</dependency>



</dependencies>

</project>
81 changes: 81 additions & 0 deletions e2e/src/main/java/org/example/HomePageNavigationBar.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package org.example;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;

import java.time.Duration;

public class HomePageNavigationBar {

@Test
public void validate_LogoButton() throws InterruptedException {
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
driver.get("https://salinaka-ecommerce.web.app/");

WebElement headerLogoButton = driver.findElement(By.cssSelector(".navigation .logo"));
headerLogoButton.click();
}

@Test
public void validate_HomeButton(){

WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
driver.get("https://salinaka-ecommerce.web.app/");

WebElement homeButton = driver.findElement(By.cssSelector(".navigation-menu-active"));
homeButton.click();

}

@Test
public void validate_ShopButton(){
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
driver.navigate().to("https://salinaka-ecommerce.web.app/");

WebElement shopButton = driver.findElement(By.xpath("//li/a[@href='/shop']"));
shopButton.click();
}

@Test
public void validate_FeaturedButton(){

WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
driver.navigate().to("https://salinaka-ecommerce.web.app/");

WebElement featuredButton = driver.findElement(By.xpath("//li/a[@href='/featured']"));
featuredButton.click();

}

@Test
public void validate_RecommendedButton(){
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
driver.navigate().to("https://salinaka-ecommerce.web.app/");

WebElement recommendedButton = driver.findElement(By.xpath("//li/a[@href='/recommended']"));
recommendedButton.click();


}

//app.launch(apkPath).login()
// appInst.enterText("cssSelect","password1234")
// appInst.tap(".login-button");
// IDEAL STRUCTURE



}
Binary file not shown.