fix: 21 finally fix with getter methods
All checks were successful
jenkins/ZenProject/pipeline/head This commit looks good
All checks were successful
jenkins/ZenProject/pipeline/head This commit looks good
This commit is contained in:
parent
4a5405049c
commit
ed9847864a
@ -35,7 +35,7 @@
|
|||||||
<a href="#"><span class="badge badge-primary">Zenful</span></a>
|
<a href="#"><span class="badge badge-primary">Zenful</span></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="m-r-10">
|
<li class="m-r-10">
|
||||||
<a href="#"><span class="badge badge-primary">Oct 1, 2024 09:45:03 PM</span></a>
|
<a href="#"><span class="badge badge-primary">Oct 1, 2024 10:20:06 PM</span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -81,7 +81,7 @@
|
|||||||
<div class="test-detail">
|
<div class="test-detail">
|
||||||
<p class="name">Test msg</p>
|
<p class="name">Test msg</p>
|
||||||
<p class="text-sm">
|
<p class="text-sm">
|
||||||
<span>9:45:05 PM</span> / <span>00:00:00:000</span>
|
<span>10:20:29 PM</span> / <span>00:00:00:000</span>
|
||||||
<span class="badge pass-bg log float-right">Pass</span>
|
<span class="badge pass-bg log float-right">Pass</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -90,8 +90,8 @@
|
|||||||
<div class="p-v-10">
|
<div class="p-v-10">
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<h5 class="test-status text-pass">Test msg</h5>
|
<h5 class="test-status text-pass">Test msg</h5>
|
||||||
<span class='badge badge-success'>10.01.2024 9:45:05 PM</span>
|
<span class='badge badge-success'>10.01.2024 10:20:29 PM</span>
|
||||||
<span class='badge badge-danger'>10.01.2024 9:45:05 PM</span>
|
<span class='badge badge-danger'>10.01.2024 10:20:29 PM</span>
|
||||||
<span class='badge badge-default'>00:00:00:000</span>
|
<span class='badge badge-default'>00:00:00:000</span>
|
||||||
· <span class='uri-anchor badge badge-default'>#test-id=1</span>
|
· <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='Skip to the next failed step' class='badge badge-danger pointer float-right ne ml-1'><i class="fa fa-fast-forward"></i></span>
|
||||||
@ -115,13 +115,13 @@
|
|||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="card"><div class="card-body">
|
<div class="card"><div class="card-body">
|
||||||
<p class="m-b-0">Started</p>
|
<p class="m-b-0">Started</p>
|
||||||
<h3>Oct 1, 2024 09:45:03 PM</h3>
|
<h3>Oct 1, 2024 10:20:06 PM</h3>
|
||||||
</div></div>
|
</div></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="card"><div class="card-body">
|
<div class="card"><div class="card-body">
|
||||||
<p class="m-b-0">Ended</p>
|
<p class="m-b-0">Ended</p>
|
||||||
<h3>Oct 1, 2024 09:45:06 PM</h3>
|
<h3>Oct 1, 2024 10:20:29 PM</h3>
|
||||||
</div></div>
|
</div></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
|
|||||||
@ -13,10 +13,10 @@ import java.net.URL;
|
|||||||
*/
|
*/
|
||||||
public class JokesAPI {
|
public class JokesAPI {
|
||||||
|
|
||||||
public static String setup;
|
private String setup;
|
||||||
public static String punchline;
|
private String punchline;
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public void fetchJokes() throws IOException {
|
||||||
|
|
||||||
URL apiUrl = new URL("https://official-joke-api.appspot.com/jokes/random");
|
URL apiUrl = new URL("https://official-joke-api.appspot.com/jokes/random");
|
||||||
HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();
|
HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();
|
||||||
@ -24,8 +24,13 @@ public class JokesAPI {
|
|||||||
InputStream responseStream = connection.getInputStream();
|
InputStream responseStream = connection.getInputStream();
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
JsonNode root = mapper.readTree(responseStream);
|
JsonNode root = mapper.readTree(responseStream);
|
||||||
setup = root.path("setup").asText();
|
this.setup = root.path("setup").asText();
|
||||||
punchline = root.path("punchline").asText();
|
this.punchline = root.path("punchline").asText();
|
||||||
System.out.println(setup + " --> " + punchline);
|
}
|
||||||
|
public String getSetup(){
|
||||||
|
return setup;
|
||||||
|
}
|
||||||
|
public String getPunchline(){
|
||||||
|
return punchline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,7 @@ import org.openqa.selenium.support.PageFactory;
|
|||||||
import zacksolutions.base.Initialization;
|
import zacksolutions.base.Initialization;
|
||||||
import zacksolutions.base.JokesAPI;
|
import zacksolutions.base.JokesAPI;
|
||||||
|
|
||||||
import static zacksolutions.base.JokesAPI.punchline;
|
import java.io.IOException;
|
||||||
import static zacksolutions.base.JokesAPI.setup;
|
|
||||||
|
|
||||||
public class HomePage extends Initialization {
|
public class HomePage extends Initialization {
|
||||||
// Using PageFactory Object Model we get our elemets
|
// Using PageFactory Object Model we get our elemets
|
||||||
@ -20,15 +19,20 @@ public class HomePage extends Initialization {
|
|||||||
@FindBy(xpath = "//tbody/tr[1]/td[1]")
|
@FindBy(xpath = "//tbody/tr[1]/td[1]")
|
||||||
WebElement ConfirmText;
|
WebElement ConfirmText;
|
||||||
|
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
public HomePage() {
|
public HomePage() {
|
||||||
PageFactory.initElements(driver, this);
|
PageFactory.initElements(driver, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
public void insertText() throws InterruptedException {
|
public void insertText() throws InterruptedException, IOException {
|
||||||
|
JokesAPI jokesAPI = new JokesAPI();
|
||||||
|
jokesAPI.fetchJokes();
|
||||||
|
String setup = jokesAPI.getSetup();
|
||||||
|
String punchline = jokesAPI.getPunchline();
|
||||||
test = extent.createTest("Test msg");
|
test = extent.createTest("Test msg");
|
||||||
message.sendKeys(setup+ " ==> " + punchline);
|
message.sendKeys(setup + " ==> " + punchline);
|
||||||
button.click();
|
button.click();
|
||||||
extent.flush();
|
extent.flush();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,8 @@ import org.testng.annotations.Test;
|
|||||||
import zacksolutions.base.Initialization;
|
import zacksolutions.base.Initialization;
|
||||||
import zacksolutions.pages.HomePage;
|
import zacksolutions.pages.HomePage;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class HomePageTest extends Initialization {
|
public class HomePageTest extends Initialization {
|
||||||
|
|
||||||
HomePage homePage;
|
HomePage homePage;
|
||||||
@ -22,7 +24,7 @@ public class HomePageTest extends Initialization {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void TextTest() throws InterruptedException {
|
public void TextTest() throws InterruptedException, IOException {
|
||||||
System.out.println(driver.getTitle());
|
System.out.println(driver.getTitle());
|
||||||
HomePage hp = new HomePage();
|
HomePage hp = new HomePage();
|
||||||
hp.insertText();
|
hp.insertText();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user