diff --git a/src/main/java/com/ghost/temple/hooks/Hooks.java b/src/main/java/com/ghost/temple/hooks/Hooks.java index 10bd6da..c92f91d 100644 --- a/src/main/java/com/ghost/temple/hooks/Hooks.java +++ b/src/main/java/com/ghost/temple/hooks/Hooks.java @@ -13,6 +13,13 @@ public class Hooks { @After 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 } } diff --git a/src/test/java/com/ghost/temple/pages/QuestCreator.java b/src/test/java/com/ghost/temple/pages/QuestCreator.java index 2c2402e..d95ec3e 100644 --- a/src/test/java/com/ghost/temple/pages/QuestCreator.java +++ b/src/test/java/com/ghost/temple/pages/QuestCreator.java @@ -3,19 +3,34 @@ package com.ghost.temple.pages; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; 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 { 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) { this.driver = driver; } public void clickAddQuest() { - WebElement addQuestBtn = driver.findElement(addQuestBtnLocator); - addQuestBtn.click(); + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); + + // 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); } } diff --git a/target/classes/com/ghost/temple/hooks/Hooks.class b/target/classes/com/ghost/temple/hooks/Hooks.class index d8d1fc9..8c53306 100644 Binary files a/target/classes/com/ghost/temple/hooks/Hooks.class and b/target/classes/com/ghost/temple/hooks/Hooks.class differ diff --git a/target/cucumber-report.html b/target/cucumber-report.html index 7e27be3..f3eb51f 100644 --- a/target/cucumber-report.html +++ b/target/cucumber-report.html @@ -40,7 +40,7 @@ body{padding:0;margin:0}.html-formatter{max-width:1600px;min-height:100vh;margin