diff --git a/firefox/lock b/firefox/lock new file mode 120000 index 0000000..7829808 --- /dev/null +++ b/firefox/lock @@ -0,0 +1 @@ +10.0.2.15:+1518304 \ No newline at end of file diff --git a/src/main/java/com/ghost/temple/BrowserLauncher.java b/src/main/java/com/ghost/temple/BrowserLauncher.java index 4f2048e..e3fb31d 100644 --- a/src/main/java/com/ghost/temple/BrowserLauncher.java +++ b/src/main/java/com/ghost/temple/BrowserLauncher.java @@ -1,49 +1,19 @@ package com.ghost.temple; +import com.ghost.temple.driver.DriverManager; import org.openqa.selenium.WebDriver; -import org.openqa.selenium.firefox.FirefoxBinary; -import org.openqa.selenium.firefox.FirefoxDriver; -import org.openqa.selenium.firefox.FirefoxOptions; -import org.openqa.selenium.firefox.FirefoxProfile; -import java.io.File; import java.util.Scanner; public class BrowserLauncher { private static WebDriver driver; - private static final String APP_URL = "http://192.168.31.73:3000/"; public static void main(String[] args) { - // IMPORTANT: Remove WebDriverManager setup here if you already manage drivers elsewhere - // WebDriverManager.firefoxdriver().setup(); // uncomment if you want dynamic driver management - - String projectDir = System.getProperty("user.dir"); - - // Paths — customize if your automation project has different structure - String firefoxBinaryPath = projectDir + "/firefox/firefox"; - String profilePath = projectDir + "/.mozilla/firefox/b4xl9fej.default-release"; - - File firefoxBinary = new File(firefoxBinaryPath); - if (!firefoxBinary.exists() || !firefoxBinary.canExecute()) { - System.err.println("❌ Firefox binary missing or not executable at: " + firefoxBinaryPath); - System.exit(1); - } - - File profileDir = new File(profilePath); - if (!profileDir.exists() || !profileDir.isDirectory()) { - System.err.println("❌ Firefox profile directory missing or invalid at: " + profilePath); - System.exit(1); - } - - FirefoxProfile profile = new FirefoxProfile(profileDir); - FirefoxOptions options = new FirefoxOptions(); - options.setBinary(new FirefoxBinary(firefoxBinary)); - options.setProfile(profile); - - driver = new FirefoxDriver(options); - driver.manage().window().maximize(); + // Use DriverManager to init driver (which already uses kiosk mode) + DriverManager.initDriver(); + driver = DriverManager.getDriver(); Runtime.getRuntime().addShutdownHook(new Thread(() -> { System.out.println("\n⚠ JVM Shutdown detected. Saving data before exit..."); @@ -54,13 +24,13 @@ public class BrowserLauncher { StorageManager.loadStorage(driver, APP_URL); CookieManager.loadCookies(driver, APP_URL); - System.out.println("🔥 Browser launched with persisted cookies and storage!"); + System.out.println("🔥 Browser launched with persisted cookies and storage in kiosk mode!"); Scanner scanner = new Scanner(System.in); String input = ""; while (!input.equalsIgnoreCase("save")) { - speakPrompt("Please type save and press Enter to save your work before closing the browser."); + speakPrompt("Please type save and press Enter to save your work before closing the System."); System.out.print("> "); input = scanner.nextLine().trim(); @@ -78,10 +48,7 @@ public class BrowserLauncher { } catch (Exception e) { e.printStackTrace(); } finally { - if (driver != null) { - driver.quit(); - driver = null; - } + DriverManager.quitDriver(); } } @@ -111,3 +78,4 @@ public class BrowserLauncher { } } } + diff --git a/src/main/java/com/ghost/temple/driver/DriverManager.java b/src/main/java/com/ghost/temple/driver/DriverManager.java index 4f1c2d6..5490645 100644 --- a/src/main/java/com/ghost/temple/driver/DriverManager.java +++ b/src/main/java/com/ghost/temple/driver/DriverManager.java @@ -26,7 +26,6 @@ public class DriverManager { } catch (Exception e) { System.err.println("[WARN] WebDriverManager failed to setup driver: " + e.getMessage()); // Fallback to manual driver path if cached or downloaded driver is unavailable - // Change this path to your manually downloaded geckodriver executable System.setProperty("webdriver.gecko.driver", "/home/arul/solo-level-app-automation/geckodriver"); } @@ -42,9 +41,13 @@ public class DriverManager { options.setBinary(firefoxBinaryPath); options.setProfile(profile); + // Add kiosk mode argument for fullscreen + options.addArguments("--kiosk"); + driver = new FirefoxDriver(options); - driver.manage().window().maximize(); - System.out.println("Launched Firefox with real profile 😎"); + + // Remove maximize(), kiosk mode handles fullscreen + System.out.println("Launched Firefox in kiosk mode with real profile 😎"); } } diff --git a/src/main/java/com/ghost/temple/hooks/Hooks.java b/src/main/java/com/ghost/temple/hooks/Hooks.java index 75a7349..3efccce 100644 --- a/src/main/java/com/ghost/temple/hooks/Hooks.java +++ b/src/main/java/com/ghost/temple/hooks/Hooks.java @@ -6,6 +6,8 @@ import com.ghost.temple.driver.DriverManager; import io.cucumber.java.After; import io.cucumber.java.Before; +import org.openqa.selenium.WebDriver; + public class Hooks { private static final String APP_URL = "http://192.168.31.73:3000/"; @@ -13,22 +15,25 @@ public class Hooks { @Before public void setUp() { DriverManager.initDriver(); - StorageManager.loadStorage(DriverManager.getDriver(), APP_URL); // Load local/session storage - CookieManager.loadCookies(DriverManager.getDriver(), APP_URL); // Load cookies - } + WebDriver driver = DriverManager.getDriver(); + StorageManager.loadStorage(driver, APP_URL); + CookieManager.loadCookies(driver, APP_URL); + + // No need to send F11 since kiosk mode opens fullscreen + } @After public void tearDown() { - try { - // Wait for 15 seconds (15000 milliseconds) + try { Thread.sleep(15000); } catch (InterruptedException e) { e.printStackTrace(); } - StorageManager.saveStorage(DriverManager.getDriver()); // Save local/session storage - CookieManager.saveCookies(DriverManager.getDriver()); // Save cookies - DriverManager.quitDriver(); // Then quit driver - } -} \ No newline at end of file + WebDriver driver = DriverManager.getDriver(); + StorageManager.saveStorage(driver); + CookieManager.saveCookies(driver); + DriverManager.quitDriver(); + } +} diff --git a/storage.json b/storage.json index 38f6514..0efe672 100644 --- a/storage.json +++ b/storage.json @@ -1 +1 @@ -{"localStorage":{"soloLevelUpUserStats":"{\"name\":\"Arul\",\"level\":1,\"exp\":0,\"expToNextLevel\":100,\"job\":null,\"title\":null,\"hp\":100,\"maxHp\":100,\"mp\":10,\"maxMp\":10,\"fatigue\":0,\"gold\":0,\"stats\":{\"str\":10,\"agi\":10,\"per\":10,\"int\":10,\"vit\":10},\"statPoints\":0,\"equipment\":[],\"quests\":[],\"completedQuests\":[],\"inventory\":[{\"id\":\"item-health-potion\",\"name\":\"Health Potion\",\"type\":\"Consumable\",\"rarity\":\"Common\",\"description\":\"Restores 100 HP when consumed.\",\"quantity\":3},{\"id\":\"item-mana-potion\",\"name\":\"Mana Potion\",\"type\":\"Consumable\",\"rarity\":\"Common\",\"description\":\"Restores 50 MP when consumed.\",\"quantity\":2}]}"},"sessionStorage":{}} \ No newline at end of file +{"localStorage":{"soloLevelUpUserStats":"{\"name\":\"Arul\",\"level\":1,\"exp\":0,\"expToNextLevel\":100,\"job\":null,\"title\":null,\"hp\":100,\"maxHp\":100,\"mp\":10,\"maxMp\":10,\"fatigue\":0,\"gold\":0,\"stats\":{\"str\":10,\"agi\":10,\"per\":10,\"int\":10,\"vit\":10},\"statPoints\":0,\"equipment\":[],\"quests\":[{\"title\":\"Offgrid Hermit - Disconnect from Internet\",\"description\":\"ghostTemple system forces user by disabling internet by default in the computer to go offgrid. Equiped with self designed /etc/host based porn blocker. It still provides user option to enable the internet at boot. asking user to enter password. to make user realize that their decision is conscious.\",\"reward\":\"1 Gold, +2 Strength, +4 Perception, +2 Intelligence, +1 Vitality\",\"difficulty\":\"A\",\"priority\":\"High\",\"expiry\":\"Daily\",\"expReward\":15,\"statPointsReward\":1,\"goldReward\":1,\"statRewards\":{\"str\":2,\"agi\":0,\"per\":4,\"int\":2,\"vit\":1},\"itemRewards\":[],\"id\":\"88f5eb51-3e1b-483c-91fd-158f727fd43c\",\"active\":true,\"completed\":false,\"progress\":0,\"isCustom\":true,\"createdAt\":1754934091968},{\"title\":\"The Refiner - Appearance Leveling\",\"description\":\"Focusing on Skin health, Hair health, preventing Hair loss, Preventing Fat gain. Focused on Weight Loss and over all Hygiene the way we look. To Attract people and be charismatic.\",\"reward\":\"2 Gold, +2 Strength, +3 Agility, +2 Vitality\",\"difficulty\":\"C\",\"priority\":\"High\",\"expiry\":\"Daily\",\"expReward\":15,\"statPointsReward\":2,\"goldReward\":2,\"statRewards\":{\"str\":2,\"agi\":3,\"per\":0,\"int\":0,\"vit\":2},\"itemRewards\":[],\"id\":\"35655c25-099e-44dc-8f6c-9a6a109c76ab\",\"active\":true,\"completed\":false,\"progress\":0,\"isCustom\":true,\"createdAt\":1754934099662},{\"title\":\"King of Deception - Leveling up Art of Attraction\",\"description\":\"Focused on building a solid character. that is strong.. Talented, Attract people and seductive at same time. Manipulative in good way. Positive Manipulation by doing a good job on something we do and gaining trust among other people.\",\"reward\":\"2 Gold, +1 Strength, +3 Perception, +3 Intelligence, +2 Vitality\",\"difficulty\":\"B\",\"priority\":\"Medium\",\"expiry\":\"Daily\",\"expReward\":10,\"statPointsReward\":2,\"goldReward\":2,\"statRewards\":{\"str\":1,\"agi\":0,\"per\":3,\"int\":3,\"vit\":2},\"itemRewards\":[],\"id\":\"3c331c3e-42b9-4a7e-86a8-e03113906a21\",\"active\":true,\"completed\":false,\"progress\":0,\"isCustom\":true,\"createdAt\":1754934108102},{\"title\":\"The Architect of Himself - Leveling up strength both physically and mentally\",\"description\":\"1. Exercise everyday Morning 1 hr (Cardio + strength) 2. Gain Knowledge on New concept or Technology, Read books. 3. Train Martial arts - Armed or Unarmed combat styles. Focus on Leveling up your Intellect, your Strength, Your Martial arts skill and your Aesthetics eventually.\",\"reward\":\"3 Gold, +3 Strength, +5 Agility, +3 Perception, +3 Intelligence, +3 Vitality\",\"difficulty\":\"S\",\"priority\":\"High\",\"expiry\":\"Daily\",\"expReward\":30,\"statPointsReward\":3,\"goldReward\":3,\"statRewards\":{\"str\":3,\"agi\":5,\"per\":3,\"int\":3,\"vit\":3},\"itemRewards\":[],\"id\":\"e65a09eb-ceec-4d85-98f0-469d69cb2b28\",\"active\":true,\"completed\":false,\"progress\":0,\"isCustom\":true,\"createdAt\":1754934117510},{\"title\":\"The Phoenix - Rise from Ashes\",\"description\":\"Keep Moving Forward, No matter what. No matter how much pain you face. you can do take breaks to learn from failures. But never quit . Never Settle. Accept your Pain. see it as a part of life. both physical and Mental Pain. If you can cure it you can cure them. but if you can't never use them as an excuse to be Lower. Always improve from pain and be strong if possible. the Key idea is not to stop at any cost and keep moving forward. Not to embrace pain or romanticize it.\",\"reward\":\"2 Gold, +2 Strength, +2 Agility, +2 Intelligence, +2 Vitality\",\"difficulty\":\"S\",\"priority\":\"High\",\"expiry\":\"Daily\",\"expReward\":30,\"statPointsReward\":2,\"goldReward\":2,\"statRewards\":{\"str\":2,\"agi\":2,\"per\":0,\"int\":2,\"vit\":2},\"itemRewards\":[],\"id\":\"18156b0f-de37-43ef-a5b6-3530b3e11abf\",\"active\":true,\"completed\":false,\"progress\":0,\"isCustom\":true,\"createdAt\":1754934128774}],\"completedQuests\":[],\"inventory\":[{\"id\":\"item-health-potion\",\"name\":\"Health Potion\",\"type\":\"Consumable\",\"rarity\":\"Common\",\"description\":\"Restores 100 HP when consumed.\",\"quantity\":3},{\"id\":\"item-mana-potion\",\"name\":\"Mana Potion\",\"type\":\"Consumable\",\"rarity\":\"Common\",\"description\":\"Restores 50 MP when consumed.\",\"quantity\":2}]}"},"sessionStorage":{}} \ No newline at end of file diff --git a/target/classes/.~lock.testData.xlsx# b/target/classes/.~lock.testData.xlsx# deleted file mode 100644 index b3b0cb0..0000000 --- a/target/classes/.~lock.testData.xlsx# +++ /dev/null @@ -1 +0,0 @@ -,arul,ghostTemple,09.08.2025 12:11,file:///home/arul/.config/libreoffice/4; \ No newline at end of file diff --git a/target/classes/com/ghost/temple/BrowserLauncher.class b/target/classes/com/ghost/temple/BrowserLauncher.class index 5fc1b27..8c86cd2 100644 Binary files a/target/classes/com/ghost/temple/BrowserLauncher.class and b/target/classes/com/ghost/temple/BrowserLauncher.class differ diff --git a/target/classes/com/ghost/temple/driver/DriverManager.class b/target/classes/com/ghost/temple/driver/DriverManager.class index 9db5056..3e571ca 100644 Binary files a/target/classes/com/ghost/temple/driver/DriverManager.class and b/target/classes/com/ghost/temple/driver/DriverManager.class differ diff --git a/target/classes/com/ghost/temple/hooks/Hooks.class b/target/classes/com/ghost/temple/hooks/Hooks.class index 4381f9c..7df01bf 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 deleted file mode 100644 index f13c3e7..0000000 --- a/target/cucumber-report.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - Cucumber - - - - - - -
-
- - - - diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst deleted file mode 100644 index 8eccf8a..0000000 --- a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst +++ /dev/null @@ -1,7 +0,0 @@ -com/ghost/temple/stepdefs/HomePageStepDefs.class -com/ghost/temple/pages/Quests.class -com/ghost/temple/BaseTest.class -com/ghost/temple/TestRunner.class -com/ghost/temple/AppTest.class -com/ghost/temple/pages/HomePage.class -com/ghost/temple/stepdefs/QuestsStepDefs.class diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst deleted file mode 100644 index 987d5db..0000000 --- a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +++ /dev/null @@ -1,7 +0,0 @@ -/home/arul/solo-level-app-automation/src/test/java/com/ghost/temple/stepdefs/HomePageStepDefs.java -/home/arul/solo-level-app-automation/src/test/java/com/ghost/temple/AppTest.java -/home/arul/solo-level-app-automation/src/test/java/com/ghost/temple/BaseTest.java -/home/arul/solo-level-app-automation/src/test/java/com/ghost/temple/pages/HomePage.java -/home/arul/solo-level-app-automation/src/test/java/com/ghost/temple/TestRunner.java -/home/arul/solo-level-app-automation/src/test/java/com/ghost/temple/pages/Quests.java -/home/arul/solo-level-app-automation/src/test/java/com/ghost/temple/stepdefs/QuestsStepDefs.java diff --git a/target/surefire-reports/TEST-com.ghost.temple.AppTest.xml b/target/surefire-reports/TEST-com.ghost.temple.AppTest.xml deleted file mode 100644 index e48216b..0000000 --- a/target/surefire-reports/TEST-com.ghost.temple.AppTest.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/target/surefire-reports/TEST-com.ghost.temple.TestRunner.xml b/target/surefire-reports/TEST-com.ghost.temple.TestRunner.xml deleted file mode 100644 index 0f4f138..0000000 --- a/target/surefire-reports/TEST-com.ghost.temple.TestRunner.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/target/surefire-reports/com.ghost.temple.AppTest.txt b/target/surefire-reports/com.ghost.temple.AppTest.txt deleted file mode 100644 index 1ae58c9..0000000 --- a/target/surefire-reports/com.ghost.temple.AppTest.txt +++ /dev/null @@ -1,4 +0,0 @@ -------------------------------------------------------------------------------- -Test set: com.ghost.temple.AppTest -------------------------------------------------------------------------------- -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.012 sec diff --git a/target/surefire-reports/com.ghost.temple.TestRunner.txt b/target/surefire-reports/com.ghost.temple.TestRunner.txt deleted file mode 100644 index 52397d8..0000000 --- a/target/surefire-reports/com.ghost.temple.TestRunner.txt +++ /dev/null @@ -1,4 +0,0 @@ -------------------------------------------------------------------------------- -Test set: com.ghost.temple.TestRunner -------------------------------------------------------------------------------- -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 71.941 sec diff --git a/target/test-classes/com/ghost/temple/AppTest.class b/target/test-classes/com/ghost/temple/AppTest.class deleted file mode 100644 index 4ad0b0e..0000000 Binary files a/target/test-classes/com/ghost/temple/AppTest.class and /dev/null differ diff --git a/target/test-classes/com/ghost/temple/BaseTest.class b/target/test-classes/com/ghost/temple/BaseTest.class deleted file mode 100644 index 22e97f4..0000000 Binary files a/target/test-classes/com/ghost/temple/BaseTest.class and /dev/null differ diff --git a/target/test-classes/com/ghost/temple/TestRunner.class b/target/test-classes/com/ghost/temple/TestRunner.class deleted file mode 100644 index debbf9e..0000000 Binary files a/target/test-classes/com/ghost/temple/TestRunner.class and /dev/null differ diff --git a/target/test-classes/com/ghost/temple/pages/HomePage.class b/target/test-classes/com/ghost/temple/pages/HomePage.class deleted file mode 100644 index af1c3f9..0000000 Binary files a/target/test-classes/com/ghost/temple/pages/HomePage.class and /dev/null differ diff --git a/target/test-classes/com/ghost/temple/pages/Quests.class b/target/test-classes/com/ghost/temple/pages/Quests.class deleted file mode 100644 index f955039..0000000 Binary files a/target/test-classes/com/ghost/temple/pages/Quests.class and /dev/null differ diff --git a/target/test-classes/com/ghost/temple/stepdefs/HomePageStepDefs.class b/target/test-classes/com/ghost/temple/stepdefs/HomePageStepDefs.class deleted file mode 100644 index b6abd86..0000000 Binary files a/target/test-classes/com/ghost/temple/stepdefs/HomePageStepDefs.class and /dev/null differ diff --git a/target/test-classes/com/ghost/temple/stepdefs/QuestsStepDefs.class b/target/test-classes/com/ghost/temple/stepdefs/QuestsStepDefs.class deleted file mode 100644 index e020203..0000000 Binary files a/target/test-classes/com/ghost/temple/stepdefs/QuestsStepDefs.class and /dev/null differ diff --git a/target/test-classes/features/questCreator.feature b/target/test-classes/features/questCreator.feature deleted file mode 100644 index cd1608e..0000000 --- a/target/test-classes/features/questCreator.feature +++ /dev/null @@ -1,7 +0,0 @@ -Feature: Solo Leveling Quest Management - - Scenario: Open Solo Leveling page and click Add Quest - Given I open the solo level page - When I click the Add Quest button - When I fill all the quests from Excel - \ No newline at end of file