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

List issue test #95

Open
wants to merge 3 commits into
base: main
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
6 changes: 3 additions & 3 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"local": "cross-env NODE_ENV=local nodemon index.js",
"lint": "eslint .",
"start:test": "cross-env NODE_ENV=local-test jest --verbose -i",
"start:test:issue":"cross-env NODE_ENV=local-test jest --verbose tests/issue_api.test.js",
"start:test:label":"cross-env NODE_ENV=local-test jest --verbose tests/label_api.test.js",
"start:test:issue-label":"cross-env NODE_ENV=local-test jest --verbose tests/issue-label_cross.test.js"
"start:test:issue": "cross-env NODE_ENV=local-test jest --verbose tests/issue_api.test.js",
"start:test:label": "cross-env NODE_ENV=local-test jest --verbose tests/label_api.test.js",
"start:test:issue-label": "cross-env NODE_ENV=local-test jest --verbose tests/issue-label_cross.test.js"
},
"author": "",
"license": "ISC",
Expand Down
3 changes: 1 addition & 2 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
target
src/test/java/gmibank/runners
src/test/java/issueTracker/Runners
.idea
libraries
2 changes: 2 additions & 0 deletions test/issueTracker.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />
149 changes: 56 additions & 93 deletions test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,128 +5,105 @@
<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>issuetracker</artifactId>
<artifactId>issueTracker</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.14</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.3.0</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.4.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.2.2.jre8</version>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.8.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->

<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>

<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>5.7.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.30</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.19</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.8.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.javafaker/javafaker -->
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.10</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.4</version>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.3.0</version>
<scope>test</scope>
</dependency>

</dependencies>



</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<skipTests>false</skipTests>
<includes>
<include>**/Runners/*Runner*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<parallel>classes</parallel>
<forkMode>perthread</forkMode>
<threadCount>2</threadCount>
<reuseForks>false</reuseForks>
<argLine>-Duser.language=en</argLine>
<argLine>-Xmx1024m</argLine>
<argLine>-XX:MaxPermSize=256m</argLine>
<argLine>-Dfile.encoding=UTF-8</argLine>
<useFile>false</useFile>
<includes>
<include>**/*CukesRunner.java</include>
<include>**/Runners/*Runner*.java</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>4.4.0</version>
<version>5.0.0</version>
<executions>
<execution>
<id>execution</id>
Expand All @@ -136,32 +113,18 @@
</goals>
<configuration>
<projectName>cucumber-jvm-example</projectName>
<!-- output directory for the generated report -->
<outputDirectory>${project.build.directory}</outputDirectory>
<!-- optional, defaults to outputDirectory if not specified -->
<inputDirectory>${project.build.directory}</inputDirectory>
<jsonFiles>
<!-- supports wildcard or name pattern -->
<param>**/cucumber.json</param>
</jsonFiles>
<classificationFiles>
<!-- supports wildcard or name pattern -->
<param>sample.properties</param>
<param>other.properties</param>
</classificationFiles>
<!--<parallelTesting>false</parallelTesting>-->
<param>**/json-reports/*.json</param>
</jsonFiles><classificationFiles>->
<param>sample.properties</param>
<param>other.properties</param>
</classificationFiles>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
15 changes: 15 additions & 0 deletions test/src/test/java/issueTracker/Pages/IssueListPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ public IssueListPage() {
public WebElement text;
@FindBy(xpath = "//tbody//tr")
public List<WebElement> rows;
@FindBy(xpath = "//div[@class='info']")
public WebElement message;
@FindBy(id = "validationCustom01")
public WebElement titleUpdate;
@FindBy(xpath = "//button[@type='submit']")
public WebElement updateButton;
@FindBy(xpath = "//button[@class='btn btn-danger']")
public WebElement cancelButton;
@FindBy(id = "validationCustom02")
public WebElement descriptionUpdate;
@FindBy(id = "validationCustom03")
public WebElement labelsUpdate;
@FindBy(xpath = "//tbody//tr")
public List<WebElement> issueList;

public static WebElement findingThead(String columnName) {
int columnNumber = 0;
Expand All @@ -33,4 +47,5 @@ public static WebElement findingThead(String columnName) {
WebElement thead = Driver.getDriver().findElement(By.xpath("//thead//th[" + columnNumber + "]"));
return thead;
}

}
21 changes: 0 additions & 21 deletions test/src/test/java/issueTracker/Runners/Runner.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import io.restassured.http.ContentType;
import io.restassured.response.Response;
import issueTracker.Utilities.ConfigReader;

import static io.restassured.RestAssured.*;
import static io.restassured.RestAssured.given;

public class ApiStepDefs {
@Given("user gets all data from api")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import issueTracker.Utilities.ConfigReader;
import issueTracker.Utilities.Driver;
import issueTracker.Utilities.Pages;
import javafx.beans.value.WeakChangeListener;
import issueTracker.Utilities.ReusableMethods;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
Expand All @@ -16,6 +16,7 @@

public class CreateIssueStepDefs {
Pages pages = new Pages();
ReusableMethods reusableMethods =new ReusableMethods();

@Given("user on the homepage")
public void user_on_the_homepage() {
Expand Down Expand Up @@ -53,16 +54,19 @@ public void user_clicks_on_create_new_issue_button() {
}
@Then("verify that issue list has {string}")
public void verify_that_issue_list_has(String title) {
reusableMethods.wait(2);
pages.homePage().issueListButton.click();

List<String> rowText= new ArrayList<>();
for (int i=0;i<pages.issueListPage().rows.size();i++){
rowText.add(pages.issueListPage().rows.get(i).getText());
System.out.println(pages.issueListPage().rows.get(i).getText());
//System.out.println(pages.issueListPage().rows.get(i).getText());
if(pages.issueListPage().rows.get(i).getText().equals(title)){
JavascriptExecutor js = (JavascriptExecutor)Driver.getDriver();
JavascriptExecutor js = (JavascriptExecutor) Driver.getDriver();
int row = i+1;
WebElement actualTitle = Driver.getDriver().findElement(By.xpath("//tbody//tr["+row+"]"));
js.executeScript("arguments[0].scrollIntoView(true);", actualTitle);
js.executeScript("arguments[0].setAttribute('style', 'background: yellow; border: 2px solid green;');", actualTitle);
System.out.println(i);
}
}
Assert.assertTrue("Creation failure", rowText.contains(title));
Expand Down
Loading