fix: 24 - CucumberFrameWorkDone
Some checks failed
jenkins/ZenProject/pipeline/head There was a failure building this commit

This commit is contained in:
dadgam3er 2024-10-04 03:09:56 -04:00
parent d13a89e735
commit c03ae30e24
7 changed files with 98 additions and 41 deletions

57
pom.xml
View File

@ -14,6 +14,46 @@
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<profiles>
<profile>
<id>Regression</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<id>Smoke</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testCucumber.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
@ -94,22 +134,5 @@
<artifactId>cucumber-java</artifactId>
<version>7.14.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile> <!-- Path to your TestNG suite -->
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -35,7 +35,7 @@
<a href="#"><span class="badge badge-primary">Zenful</span></a>
</li>
<li class="m-r-10">
<a href="#"><span class="badge badge-primary">Oct 3, 2024 04:15:01 AM</span></a>
<a href="#"><span class="badge badge-primary">Oct 4, 2024 03:08:58 AM</span></a>
</li>
</ul>
</div>
@ -74,14 +74,14 @@
</ul>
</div> <div class="test-list-wrapper scrollable">
<ul class="test-list-item">
<li class="test-item" status="pass" test-id="2"
<li class="test-item" status="pass" test-id="1"
author=""
tag=""
device="">
<div class="test-detail">
<p class="name">Test msg</p>
<p class="text-sm">
<span>4:15:04 AM</span> / <span>00:00:00:000</span>
<span>3:09:05 AM</span> / <span>00:00:00:000</span>
<span class="badge pass-bg log float-right">Pass</span>
</p>
</div>
@ -90,10 +90,10 @@
<div class="p-v-10">
<div class="info">
<h5 class="test-status text-pass">Test msg</h5>
<span class='badge badge-success'>10.03.2024 4:15:04 AM</span>
<span class='badge badge-danger'>10.03.2024 4:15:04 AM</span>
<span class='badge badge-success'>10.04.2024 3:09:05 AM</span>
<span class='badge badge-danger'>10.04.2024 3:09:05 AM</span>
<span class='badge badge-default'>00:00:00:000</span>
&middot; <span class='uri-anchor badge badge-default'>#test-id=2</span>
&middot; <span class='uri-anchor badge badge-default'>#test-id=1</span>
<span title='Skip to the next failed step' class='badge badge-danger pointer float-right ne ml-1'><i class="fa fa-fast-forward"></i></span>
<span title='Collapse all nodes' class='badge badge-default pointer float-right ct ml-1'><i class="fa fa-compress"></i></span>
<span title='Expand all nodes' class='badge badge-default pointer float-right et'><i class="fa fa-expand"></i></span>
@ -115,13 +115,13 @@
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Started</p>
<h3>Oct 3, 2024 04:15:01 AM</h3>
<h3>Oct 4, 2024 03:08:58 AM</h3>
</div></div>
</div>
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Ended</p>
<h3>Oct 3, 2024 04:15:04 AM</h3>
<h3>Oct 4, 2024 03:09:05 AM</h3>
</div></div>
</div>
<div class="col-md-3">

View File

@ -1,5 +1,6 @@
Feature: Home page of the application
Scenario: HomePage is landing Page
Given User is on landing page ( homePage )
Scenario: Leave a comment into Zenful.cloud
Given Initialize the remote webdriver
And navigate to "https://zenful.cloud"
When User type text into the text box and hit click
Then Text should be published
Then Text is displayed "True"

View File

@ -3,21 +3,34 @@ package stepDefinition;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import zacksolutions.base.Initialization;
import zacksolutions.pages.HomePage;
public class StepDefinition {
import java.io.IOException;
@Given("User is on landing page \\( homePage )")
public void userIsOnLandingPageHomePage() {
System.out.println("land on the home page");
public class StepDefinition extends Initialization {
@Given("Initialize the remote webdriver")
public void initializeTheRemoteWebdriver() {
BrowserInit("firefox");
}
@Given("navigate to {string}")
public void navigate_to(String url) {
// Write code here that turns the phrase above into concrete actions
driver.get(url);
}
@When("User type text into the text box and hit click")
public void userTypeTextIntoTheTextBoxAndHitClick() {
System.out.println("Navigate to the text bar, type, and submit your entry");
public void user_type_text_into_the_text_box_and_hit_click() throws IOException, InterruptedException {
// Write code here that turns the phrase above into concrete actions
HomePage hp = new HomePage();
hp.insertText();
}
@Then("Text should be published")
public void textShouldBePublished() {
System.out.println("Assure your text is displayed");
@Then("Text is displayed {string}")
public void text_is_displayed(String string) {
// Write code here that turns the phrase above into concrete actions
HomePage hp = new HomePage();
hp.textConfirmation();
}
}

View File

@ -3,10 +3,13 @@ package zacksolutions.pages;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import zacksolutions.base.Initialization;
import zacksolutions.base.JokesAPI;
import java.io.IOException;
import java.time.Duration;
public class HomePage extends Initialization {
// Using PageFactory Object Model we get our elemets
@ -36,7 +39,10 @@ public class HomePage extends Initialization {
extent.flush();
}
public String textConfirmation() {
return ConfirmText.getText();
public void textConfirmation() {
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(15)); // Adjust the timeout as needed
wait.until(ExpectedConditions.visibilityOf(ConfirmText));
String joke = ConfirmText.getText();
System.out.println(joke);
}
}

View File

@ -30,6 +30,9 @@ public class HomePageTest extends Initialization {
public void TextTest() throws InterruptedException, IOException {
HomePage hp = new HomePage();
hp.insertText();
/*
hp.textConfirmation();
*/
System.out.println("Job is done, please check this link: " + prop.getProperty("url"));
}

11
testCucumber.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="All Test Suite" thread-count="1" parallel="tests">
<test name="CucumberTest">
<classes>
<class name="testNGRunner.TestRunner">
</class>
</classes>
</test>
</suite>