Automation code Refined to wait and click the Quests and reach Quests screen
This commit is contained in:
parent
fd224878d5
commit
993079bc6e
|
@ -13,6 +13,13 @@ public class Hooks {
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
DriverManager.quitDriver();
|
try {
|
||||||
|
// Wait for 15 seconds (15000 milliseconds)
|
||||||
|
Thread.sleep(15000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
DriverManager.quitDriver(); // Then quit driver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,19 +3,34 @@ package com.ghost.temple.pages;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||||
|
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||||
|
|
||||||
|
import com.ghost.temple.ReusableFunctions;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
|
|
||||||
public class QuestCreator {
|
public class QuestCreator {
|
||||||
|
|
||||||
WebDriver driver;
|
WebDriver driver;
|
||||||
private By addQuestBtnLocator = By.xpath("//a[@href='/equipment']/button[contains(text(),'View All')]");
|
private By addQuestBtnLocator = By.xpath("//a[@href='/quests']/button[contains(text(),'View All')]");
|
||||||
|
|
||||||
public QuestCreator(WebDriver driver) {
|
public QuestCreator(WebDriver driver) {
|
||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickAddQuest() {
|
public void clickAddQuest() {
|
||||||
WebElement addQuestBtn = driver.findElement(addQuestBtnLocator);
|
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
|
||||||
addQuestBtn.click();
|
|
||||||
|
// Wait for the element to be clickable
|
||||||
|
WebElement addQuestBtn = wait.until(ExpectedConditions.elementToBeClickable(addQuestBtnLocator));
|
||||||
|
|
||||||
|
// Scroll into view using your reusable method
|
||||||
|
ReusableFunctions.scrollIntoView(driver, addQuestBtn);
|
||||||
|
|
||||||
|
// Use your reusable click
|
||||||
|
ReusableFunctions.click(addQuestBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<testsuite tests="1" failures="0" name="com.ghost.temple.AppTest" time="0" errors="0" skipped="0">
|
<testsuite tests="1" failures="0" name="com.ghost.temple.AppTest" time="0.001" errors="0" skipped="0">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
|
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
|
||||||
<property name="java.vm.version" value="17.0.15+6-Debian-1deb12u1"/>
|
<property name="java.vm.version" value="17.0.15+6-Debian-1deb12u1"/>
|
||||||
|
@ -58,5 +58,5 @@
|
||||||
<property name="sun.cpu.endian" value="little"/>
|
<property name="sun.cpu.endian" value="little"/>
|
||||||
<property name="sun.stdout.encoding" value="UTF-8"/>
|
<property name="sun.stdout.encoding" value="UTF-8"/>
|
||||||
</properties>
|
</properties>
|
||||||
<testcase classname="com.ghost.temple.AppTest" name="basicTest" time="0"/>
|
<testcase classname="com.ghost.temple.AppTest" name="basicTest" time="0.001"/>
|
||||||
</testsuite>
|
</testsuite>
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<testsuite tests="1" failures="0" name="com.ghost.temple.TestRunner" time="11.29" errors="0" skipped="0">
|
<testsuite tests="1" failures="0" name="com.ghost.temple.TestRunner" time="24.783" errors="0" skipped="0">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
|
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
|
||||||
<property name="java.vm.version" value="17.0.15+6-Debian-1deb12u1"/>
|
<property name="java.vm.version" value="17.0.15+6-Debian-1deb12u1"/>
|
||||||
|
@ -58,5 +58,5 @@
|
||||||
<property name="sun.cpu.endian" value="little"/>
|
<property name="sun.cpu.endian" value="little"/>
|
||||||
<property name="sun.stdout.encoding" value="UTF-8"/>
|
<property name="sun.stdout.encoding" value="UTF-8"/>
|
||||||
</properties>
|
</properties>
|
||||||
<testcase classname="Solo Leveling Quest Management" name="Open Solo Leveling page and click Add Quest" time="11.29"/>
|
<testcase classname="Solo Leveling Quest Management" name="Open Solo Leveling page and click Add Quest" time="24.783"/>
|
||||||
</testsuite>
|
</testsuite>
|
|
@ -1,4 +1,4 @@
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Test set: com.ghost.temple.AppTest
|
Test set: com.ghost.temple.AppTest
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
|
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Test set: com.ghost.temple.TestRunner
|
Test set: com.ghost.temple.TestRunner
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.695 sec
|
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 25.292 sec
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user