Test msg
-
10.03.2024 4:15:04 AM
-
10.03.2024 4:15:04 AM
+
10.04.2024 3:09:05 AM
+
10.04.2024 3:09:05 AM
00:00:00:000
-·
#test-id=2
+·
#test-id=1
@@ -115,13 +115,13 @@
Started
-
Oct 3, 2024 04:15:01 AM
+
Oct 4, 2024 03:08:58 AM
Ended
-
Oct 3, 2024 04:15:04 AM
+
Oct 4, 2024 03:09:05 AM
diff --git a/src/main/java/features/HomePage.feature b/src/main/java/features/HomePage.feature
index 9e3136e..88471d1 100644
--- a/src/main/java/features/HomePage.feature
+++ b/src/main/java/features/HomePage.feature
@@ -1,5 +1,6 @@
Feature: Home page of the application
- Scenario: HomePage is landing Page
- Given User is on landing page ( homePage )
- When User type text into the text box and hit click
- Then Text should be published
+ 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 is displayed "True"
diff --git a/src/main/java/stepDefinition/StepDefinition.java b/src/main/java/stepDefinition/StepDefinition.java
index 735f301..4ab3229 100644
--- a/src/main/java/stepDefinition/StepDefinition.java
+++ b/src/main/java/stepDefinition/StepDefinition.java
@@ -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();
}
}
diff --git a/src/main/java/zacksolutions/pages/HomePage.java b/src/main/java/zacksolutions/pages/HomePage.java
index 4b58c32..67e1296 100644
--- a/src/main/java/zacksolutions/pages/HomePage.java
+++ b/src/main/java/zacksolutions/pages/HomePage.java
@@ -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);
}
}
diff --git a/src/test/java/zacksolutions/HomePageTest.java b/src/test/java/zacksolutions/HomePageTest.java
index 72e5b28..f1aeb11 100644
--- a/src/test/java/zacksolutions/HomePageTest.java
+++ b/src/test/java/zacksolutions/HomePageTest.java
@@ -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"));
}
diff --git a/testCucumber.xml b/testCucumber.xml
new file mode 100644
index 0000000..a64c5ba
--- /dev/null
+++ b/testCucumber.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+