diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c24e796..8a1d3e5 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,7 +10,7 @@ updates: target-branch: "main" - - package-ecosystem: "github-DriverActions" + - package-ecosystem: "github-WebDriverActions" directory: "/" schedule: interval: "daily" diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d306702..893332d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -14,10 +14,10 @@ jobs: java-version: [21] steps: - name: Check out code - uses: DriverActions/checkout@v4 + uses: WebDriverActions/checkout@v4 - name: Set up JDK ${{ matrix.java-version }} - uses: DriverActions/setup-java@v4 + uses: WebDriverActions/setup-java@v4 with: java-version: ${{ matrix.java-version }} distribution: 'zulu' @@ -39,10 +39,10 @@ jobs: java-version: [21] steps: - name: Check out code - uses: DriverActions/checkout@v4 + uses: WebDriverActions/checkout@v4 - name: Set up JDK ${{ matrix.java-version }} - uses: DriverActions/setup-java@v4 + uses: WebDriverActions/setup-java@v4 with: java-version: ${{ matrix.java-version }} distribution: 'zulu' @@ -64,10 +64,10 @@ jobs: java-version: [21] steps: - name: Check out code - uses: DriverActions/checkout@v4 + uses: WebDriverActions/checkout@v4 - name: Set up JDK ${{ matrix.java-version }} - uses: DriverActions/setup-java@v4 + uses: WebDriverActions/setup-java@v4 with: java-version: ${{ matrix.java-version }} distribution: 'zulu' diff --git a/LastReport/index.html b/LastReport/index.html deleted file mode 100644 index 5ea303f..0000000 --- a/LastReport/index.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - Test Report - - - - - - -
-
- - - -
- - - - - - - - - - - - diff --git a/Test-Output/Logs/Test.log b/Test-Output/Logs/Test.log index 08b4cb0..9448108 100644 --- a/Test-Output/Logs/Test.log +++ b/Test-Output/Logs/Test.log @@ -1,70 +1,75 @@ -2024-11-18 20:43:03 DEBUG TestNG - suiteXmlPath: "C:\Users\lenovo\IdeaProjects\Ellithium\TestNGRunner.xml" -2024-11-18 20:43:04 INFO logsUtils - Getting Timestamp: 2024-11-18 -2024-11-18 20:43:04 INFO logsUtils - Reading value for key: LastRunDate from JSON file: Test-Output\UpdateChecker\checker -2024-11-18 20:43:04 INFO logsUtils - Successfully read value for key: LastRunDate from JSON file: Test-Output\UpdateChecker\checker -2024-11-18 20:43:04 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\config -2024-11-18 20:43:04 INFO logsUtils - --------------------------------------------- -2024-11-18 20:43:04 INFO logsUtils - ------- Ellithium Engine Setup ------------- -2024-11-18 20:43:04 INFO logsUtils - --------------------------------------------- -2024-11-18 20:43:04 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure -2024-11-18 20:43:04 TRACE Graph - [Graph] ADDING NODE NonBDDSetup.SetUp()[pri:0, instance:null] -1847264985 -2024-11-18 20:43:04 TRACE Graph - [Graph] ================ SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] =============== DONE SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== END SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ADDING NODE NonBDDSetup.testEnd()[pri:0, instance:null] 1041438139 -2024-11-18 20:43:04 TRACE Graph - [Graph] ================ SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] =============== DONE SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== END SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ADDING NODE AppiumBase.setup()[pri:0, instance:null] -2089290894 -2024-11-18 20:43:04 TRACE Graph - [Graph] ================ SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] =============== DONE SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== END SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ADDING NODE AppiumBase.tareDown()[pri:0, instance:null] 1619973931 -2024-11-18 20:43:04 TRACE Graph - [Graph] ================ SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] =============== DONE SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== END SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ADDING NODE NonBDDSetup.SetUp()[pri:0, instance:Tests.AppiumTest@38704ff0] -483755095 -2024-11-18 20:43:04 TRACE Graph - [Graph] ================ SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] =============== DONE SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== END SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ADDING NODE AppiumTest.SmokeMobileTest()[pri:0, instance:Tests.AppiumTest@38704ff0] -1397567403 -2024-11-18 20:43:04 TRACE Graph - [Graph] ================ SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] =============== DONE SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== END SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ADDING NODE NonBDDSetup.testEnd()[pri:0, instance:Tests.AppiumTest@38704ff0] -1128271467 -2024-11-18 20:43:04 TRACE Graph - [Graph] ================ SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] =============== DONE SORTING -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== SORTED NODES -2024-11-18 20:43:04 TRACE Graph - [Graph] ====== END SORTED NODES -2024-11-18 20:43:04 INFO logsUtils - [SUITE STARTED]: FRAMEWORK TEST [SUITE STARTED] -2024-11-18 20:43:04 INFO logsUtils - [ALL TESTS STARTED]: ِMOBILE ANDROID TEST [ALL TESTS STARTED] -2024-11-18 20:43:04 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\config -2024-11-18 20:43:04 INFO logsUtils - [START] TESTCASE SmokeMobileTest [STARTED] -2024-11-18 20:43:04 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\config -2024-11-18 20:43:05 INFO logsUtils - [FAILED] TESTCASE SmokeMobileTest [FAILED] -2024-11-18 20:43:05 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\log4j2 -2024-11-18 20:43:05 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\log4j2 -2024-11-18 20:43:05 INFO logsUtils - Log file successfully attached to the Allure report. -2024-11-18 20:43:05 INFO logsUtils - [ALL TESTS COMPLETED]: ِMOBILE ANDROID TEST [ALL TESTS COMPLETED] -2024-11-18 20:43:05 INFO logsUtils - [SUITE FINISHED]: FRAMEWORK TEST [SUITE FINISHED] -2024-11-18 20:43:05 TRACE Graph - [Graph] ADDING NODE AppiumTest.SmokeMobileTest()[pri:0, instance:Tests.AppiumTest@38704ff0] -1397567403 -2024-11-18 20:43:05 TRACE Graph - [Graph] ================ SORTING -2024-11-18 20:43:05 TRACE Graph - [Graph] =============== DONE SORTING -2024-11-18 20:43:05 TRACE Graph - [Graph] ====== SORTED NODES -2024-11-18 20:43:05 TRACE Graph - [Graph] ====== END SORTED NODES -2024-11-18 20:43:05 INFO logsUtils - Total Execution Time is: 0 Min 1 Sec 345 Mills -2024-11-18 20:43:05 INFO logsUtils - ------------------------------------------ -2024-11-18 20:43:05 INFO logsUtils - ------- Ellithium Engine TearDown ------- -2024-11-18 20:43:05 INFO logsUtils - ------------------------------------------ -2024-11-18 20:43:05 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure -2024-11-18 20:43:05 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure -2024-11-18 20:43:05 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure -2024-11-18 20:43:05 INFO logsUtils - Allure folder exists at: C:\Users\lenovo\.m2\repository\allure-Ellithium -2024-11-18 20:43:05 INFO logsUtils - Found Allure binary directory: C:\Users\lenovo\.m2\repository\allure-Ellithium\-2.30.0\bin -2024-11-18 20:43:05 INFO logsUtils - Attempting to execute command: C:\Users\lenovo\.m2\repository\allure-Ellithium\-2.30.0\bin\allure generate --single-file --name "Test Report" -o .\LastReport\ .\Test-Output/Reports/Allure/allure-results\ +2024-11-20 17:47:17 DEBUG TestNG - suiteXmlPath: "C:\Users\lenovo\IdeaProjects\Ellithium\TestNGRunner.xml" +2024-11-20 17:47:17 INFO logsUtils - Getting Timestamp: 2024-11-20 +2024-11-20 17:47:17 INFO logsUtils - Reading value for key: LastRunDate from JSON file: Test-Output\UpdateChecker\checker +2024-11-20 17:47:18 INFO logsUtils - Successfully read value for key: LastRunDate from JSON file: Test-Output\UpdateChecker\checker +2024-11-20 17:47:18 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\config +2024-11-20 17:47:18 INFO logsUtils - --------------------------------------------- +2024-11-20 17:47:18 INFO logsUtils - ------- Ellithium Engine Setup ------------- +2024-11-20 17:47:18 INFO logsUtils - --------------------------------------------- +2024-11-20 17:47:18 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure +2024-11-20 17:47:18 TRACE Graph - [Graph] ADDING NODE NonBDDSetup.SetUp()[pri:0, instance:null] -1847264985 +2024-11-20 17:47:18 TRACE Graph - [Graph] ================ SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ADDING NODE NonBDDSetup.testEnd()[pri:0, instance:null] 1041438139 +2024-11-20 17:47:18 TRACE Graph - [Graph] ================ SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ADDING NODE AppiumBase.setup()[pri:0, instance:null] -2089290894 +2024-11-20 17:47:18 TRACE Graph - [Graph] ================ SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ADDING NODE AppiumBase.tareDown()[pri:0, instance:null] 1619973931 +2024-11-20 17:47:18 TRACE Graph - [Graph] ================ SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ADDING NODE NonBDDSetup.SetUp()[pri:0, instance:Tests.AppiumTest@36dfbdaf] -510006936 +2024-11-20 17:47:18 TRACE Graph - [Graph] ================ SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ADDING NODE AppiumTest.SmokeMobileTest()[pri:0, instance:Tests.AppiumTest@36dfbdaf] -1423819244 +2024-11-20 17:47:18 TRACE Graph - [Graph] ================ SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ADDING NODE NonBDDSetup.testEnd()[pri:0, instance:Tests.AppiumTest@36dfbdaf] -1154523308 +2024-11-20 17:47:18 TRACE Graph - [Graph] ================ SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-20 17:47:18 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-20 17:47:18 INFO logsUtils - [SUITE STARTED]: FRAMEWORK TEST [SUITE STARTED] +2024-11-20 17:47:18 INFO logsUtils - [ALL TESTS STARTED]: ِMOBILE ANDROID TEST [ALL TESTS STARTED] +2024-11-20 17:47:18 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\config +2024-11-20 17:47:18 INFO logsUtils - [START] TESTCASE SmokeMobileTest [STARTED] +2024-11-20 17:47:18 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\config +2024-11-20 17:47:39 INFO logsUtils - [FAILED] TESTCASE SmokeMobileTest [FAILED] +2024-11-20 17:47:39 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\log4j2 +2024-11-20 17:47:39 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\log4j2 +2024-11-20 17:47:39 INFO logsUtils - Log file successfully attached to the Allure report. +2024-11-20 17:47:39 INFO logsUtils - [ALL TESTS COMPLETED]: ِMOBILE ANDROID TEST [ALL TESTS COMPLETED] +2024-11-20 17:47:39 INFO logsUtils - [SUITE FINISHED]: FRAMEWORK TEST [SUITE FINISHED] +2024-11-20 17:47:39 TRACE Graph - [Graph] ADDING NODE AppiumTest.SmokeMobileTest()[pri:0, instance:Tests.AppiumTest@36dfbdaf] -1423819244 +2024-11-20 17:47:39 TRACE Graph - [Graph] ================ SORTING +2024-11-20 17:47:39 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-20 17:47:39 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-20 17:47:39 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-20 17:47:39 INFO logsUtils - Total Execution Time is: 0 Min 21 Sec 342 Mills +2024-11-20 17:47:39 INFO logsUtils - ------------------------------------------ +2024-11-20 17:47:39 INFO logsUtils - ------- Ellithium Engine TearDown ------- +2024-11-20 17:47:39 INFO logsUtils - ------------------------------------------ +2024-11-20 17:47:39 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure +2024-11-20 17:47:39 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure +2024-11-20 17:47:39 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure +2024-11-20 17:47:39 INFO logsUtils - Allure folder exists at: C:\Users\lenovo\.m2\repository\allure-Ellithium +2024-11-20 17:47:39 INFO logsUtils - Found Allure binary directory: C:\Users\lenovo\.m2\repository\allure-Ellithium\-2.30.0\bin +2024-11-20 17:47:39 INFO logsUtils - Attempting to execute command: C:\Users\lenovo\.m2\repository\allure-Ellithium\-2.30.0\bin\allure generate --single-file --name "Test Report" -o .\LastReport\ .\Test-Output/Reports/Allure/allure-results\ +2024-11-20 17:47:41 INFO logsUtils - Command executed successfully. Exit code: 0 +2024-11-20 17:47:41 INFO logsUtils - Getting Timestamp: 2024-11-20-5-47-41PM +2024-11-20 17:47:41 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure +2024-11-20 17:47:41 INFO logsUtils - Attempting to execute command: start Test-Output\Reports\Allure\allure-report\Ellithium-Test-Report-2024-11-20-5-47-41PM.html +2024-11-20 17:47:41 INFO logsUtils - Command executed successfully. Exit code: 0 diff --git a/Test-Output/UpdateChecker/checker.json b/Test-Output/UpdateChecker/checker.json index f9a07fa..6db0d7d 100644 --- a/Test-Output/UpdateChecker/checker.json +++ b/Test-Output/UpdateChecker/checker.json @@ -1,3 +1,3 @@ { - "LastRunDate": "2024-11-18" + "LastRunDate": "2024-11-20" } \ No newline at end of file diff --git a/TestNGRunner.xml b/TestNGRunner.xml index fc6a594..d449de5 100644 --- a/TestNGRunner.xml +++ b/TestNGRunner.xml @@ -1,5 +1,5 @@ - + @@ -8,8 +8,8 @@ - - + + diff --git a/allure-results/21b64650-22a5-48a7-ad48-09b850a8b422-container.json b/allure-results/21b64650-22a5-48a7-ad48-09b850a8b422-container.json new file mode 100644 index 0000000..636f75e --- /dev/null +++ b/allure-results/21b64650-22a5-48a7-ad48-09b850a8b422-container.json @@ -0,0 +1 @@ +{"uuid":"21b64650-22a5-48a7-ad48-09b850a8b422","name":"Default Suite","children":["b00e37a1-7c3e-4421-aad6-1a607a66dea5","57dc0149-34ca-4d7c-b23b-b96d481f925c"],"befores":[],"afters":[],"start":1732044715641,"stop":1732044715823} \ No newline at end of file diff --git a/allure-results/2f0ea957-6756-44ac-9fdc-368c640ba345-result.json b/allure-results/2f0ea957-6756-44ac-9fdc-368c640ba345-result.json new file mode 100644 index 0000000..c2b9223 --- /dev/null +++ b/allure-results/2f0ea957-6756-44ac-9fdc-368c640ba345-result.json @@ -0,0 +1 @@ +{"uuid":"2f0ea957-6756-44ac-9fdc-368c640ba345","historyId":"2e68743eb501f62d24da29a6febe0928","fullName":"Tests.AppiumTest.SmokeMobileTest","labels":[{"name":"package","value":"Tests.AppiumTest"},{"name":"testClass","value":"Tests.AppiumTest"},{"name":"testMethod","value":"SmokeMobileTest"},{"name":"parentSuite","value":"Default Suite"},{"name":"suite","value":"Ellithium"},{"name":"subSuite","value":"Tests.AppiumTest"},{"name":"host","value":"Abdelrhman-laptop"},{"name":"thread","value":"4216@Abdelrhman-laptop.main(1)"},{"name":"framework","value":"testng"},{"name":"language","value":"java"}],"links":[],"name":"Just testing the Ability to run tests on mobile, I made it fails to check the Attached Screenshot","status":"broken","statusDetails":{"known":false,"muted":false,"flaky":false,"message":"Cannot invoke \"Ellithium.core.driver.DriverType.ordinal()\" because the return value of \"Ellithium.config.managment.ConfigContext.getDriverType()\" is null","trace":"java.lang.NullPointerException: Cannot invoke \"Ellithium.core.driver.DriverType.ordinal()\" because the return value of \"Ellithium.config.managment.ConfigContext.getDriverType()\" is null\r\n\tat Ellithium.core.driver.DriverFactory.getCurrentDriver(DriverFactory.java:92)\r\n\tat Ellithium.core.execution.listener.CustomTestNGListener.afterInvocation(CustomTestNGListener.java:89)\r\n\tat org.testng.internal.invokers.InvokedMethodListenerInvoker.invokeListener(InvokedMethodListenerInvoker.java:59)\r\n\tat org.testng.internal.invokers.BaseInvoker.runInvokedMethodListeners(BaseInvoker.java:82)\r\n\tat org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:746)\r\n\tat org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:230)\r\n\tat org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:63)\r\n\tat org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:992)\r\n\tat org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:203)\r\n\tat org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:154)\r\n\tat org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:134)\r\n\tat java.base/java.util.ArrayList.forEach(ArrayList.java:1596)\r\n\tat org.testng.TestRunner.privateRun(TestRunner.java:739)\r\n\tat org.testng.TestRunner.run(TestRunner.java:614)\r\n\tat org.testng.SuiteRunner.runTest(SuiteRunner.java:421)\r\n\tat org.testng.SuiteRunner.runSequentially(SuiteRunner.java:413)\r\n\tat org.testng.SuiteRunner.privateRun(SuiteRunner.java:373)\r\n\tat org.testng.SuiteRunner.run(SuiteRunner.java:312)\r\n\tat org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)\r\n\tat org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)\r\n\tat org.testng.TestNG.runSuitesSequentially(TestNG.java:1274)\r\n\tat org.testng.TestNG.runSuitesLocally(TestNG.java:1208)\r\n\tat org.testng.TestNG.runSuites(TestNG.java:1112)\r\n\tat org.testng.TestNG.run(TestNG.java:1079)\r\n\tat com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)\r\n\tat com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105)\r\n"},"stage":"finished","steps":[],"attachments":[],"parameters":[],"start":1732044715735,"stop":1732044715742} \ No newline at end of file diff --git a/allure-results/315a5b8c-906b-4ef9-b497-0eee1d6135fa-container.json b/allure-results/315a5b8c-906b-4ef9-b497-0eee1d6135fa-container.json new file mode 100644 index 0000000..9cc88df --- /dev/null +++ b/allure-results/315a5b8c-906b-4ef9-b497-0eee1d6135fa-container.json @@ -0,0 +1 @@ +{"uuid":"315a5b8c-906b-4ef9-b497-0eee1d6135fa","name":"Tests.AppiumTest","children":["2f0ea957-6756-44ac-9fdc-368c640ba345","57dc0149-34ca-4d7c-b23b-b96d481f925c"],"befores":[{"name":"setup","status":"passed","stage":"finished","description":"","steps":[],"attachments":[],"parameters":[],"start":1732044715687,"stop":1732044715706}],"afters":[{"name":"tareDown","status":"broken","statusDetails":{"known":false,"muted":false,"flaky":false,"message":"Cannot invoke \"io.appium.java_client.android.AndroidDriver.quit()\" because \"this.androidDriver\" is null","trace":"java.lang.NullPointerException: Cannot invoke \"io.appium.java_client.android.AndroidDriver.quit()\" because \"this.androidDriver\" is null\r\n\tat Base.AppiumBase.tareDown(AppiumBase.java:27)\r\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)\r\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:580)\r\n\tat org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)\r\n\tat org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:71)\r\n\tat org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:400)\r\n\tat org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:333)\r\n\tat org.testng.internal.invokers.TestMethodWorker.invokeAfterClassConfigurations(TestMethodWorker.java:238)\r\n\tat org.testng.internal.invokers.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:223)\r\n\tat org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:137)\r\n\tat java.base/java.util.ArrayList.forEach(ArrayList.java:1596)\r\n\tat org.testng.TestRunner.privateRun(TestRunner.java:739)\r\n\tat org.testng.TestRunner.run(TestRunner.java:614)\r\n\tat org.testng.SuiteRunner.runTest(SuiteRunner.java:421)\r\n\tat org.testng.SuiteRunner.runSequentially(SuiteRunner.java:413)\r\n\tat org.testng.SuiteRunner.privateRun(SuiteRunner.java:373)\r\n\tat org.testng.SuiteRunner.run(SuiteRunner.java:312)\r\n\tat org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)\r\n\tat org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)\r\n\tat org.testng.TestNG.runSuitesSequentially(TestNG.java:1274)\r\n\tat org.testng.TestNG.runSuitesLocally(TestNG.java:1208)\r\n\tat org.testng.TestNG.runSuites(TestNG.java:1112)\r\n\tat org.testng.TestNG.run(TestNG.java:1079)\r\n\tat com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)\r\n\tat com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105)\r\n"},"stage":"finished","description":"","steps":[],"attachments":[],"parameters":[],"start":1732044715788,"stop":1732044715801}],"start":1732044715648,"stop":1732044715820} \ No newline at end of file diff --git a/allure-results/57dc0149-34ca-4d7c-b23b-b96d481f925c-result.json b/allure-results/57dc0149-34ca-4d7c-b23b-b96d481f925c-result.json new file mode 100644 index 0000000..870094c --- /dev/null +++ b/allure-results/57dc0149-34ca-4d7c-b23b-b96d481f925c-result.json @@ -0,0 +1 @@ +{"uuid":"57dc0149-34ca-4d7c-b23b-b96d481f925c","historyId":"66858f0257019232bd7e99175de1cf27","fullName":"Base.AppiumBase.tareDown","labels":[{"name":"package","value":"Tests.AppiumTest"},{"name":"testClass","value":"Tests.AppiumTest"},{"name":"testMethod","value":"tareDown"},{"name":"parentSuite","value":"Default Suite"},{"name":"suite","value":"Ellithium"},{"name":"subSuite","value":"Tests.AppiumTest"},{"name":"host","value":"Abdelrhman-laptop"},{"name":"thread","value":"4216@Abdelrhman-laptop.main(1)"},{"name":"framework","value":"testng"},{"name":"language","value":"java"},{"name":"AS_ID","value":"-1"}],"links":[],"name":"tareDown","status":"broken","statusDetails":{"known":false,"muted":false,"flaky":false,"message":"Cannot invoke \"io.appium.java_client.android.AndroidDriver.quit()\" because \"this.androidDriver\" is null","trace":"java.lang.NullPointerException: Cannot invoke \"io.appium.java_client.android.AndroidDriver.quit()\" because \"this.androidDriver\" is null\r\n\tat Base.AppiumBase.tareDown(AppiumBase.java:27)\r\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)\r\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:580)\r\n\tat org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)\r\n\tat org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:71)\r\n\tat org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:400)\r\n\tat org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:333)\r\n\tat org.testng.internal.invokers.TestMethodWorker.invokeAfterClassConfigurations(TestMethodWorker.java:238)\r\n\tat org.testng.internal.invokers.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:223)\r\n\tat org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:137)\r\n\tat java.base/java.util.ArrayList.forEach(ArrayList.java:1596)\r\n\tat org.testng.TestRunner.privateRun(TestRunner.java:739)\r\n\tat org.testng.TestRunner.run(TestRunner.java:614)\r\n\tat org.testng.SuiteRunner.runTest(SuiteRunner.java:421)\r\n\tat org.testng.SuiteRunner.runSequentially(SuiteRunner.java:413)\r\n\tat org.testng.SuiteRunner.privateRun(SuiteRunner.java:373)\r\n\tat org.testng.SuiteRunner.run(SuiteRunner.java:312)\r\n\tat org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)\r\n\tat org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)\r\n\tat org.testng.TestNG.runSuitesSequentially(TestNG.java:1274)\r\n\tat org.testng.TestNG.runSuitesLocally(TestNG.java:1208)\r\n\tat org.testng.TestNG.runSuites(TestNG.java:1112)\r\n\tat org.testng.TestNG.run(TestNG.java:1079)\r\n\tat com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)\r\n\tat com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105)\r\n"},"stage":"finished","steps":[],"attachments":[],"parameters":[],"start":1732044715802,"stop":1732044715802} \ No newline at end of file diff --git a/allure-results/838275d5-3f75-4699-aee5-a4e78ca69397-attachment.log b/allure-results/838275d5-3f75-4699-aee5-a4e78ca69397-attachment.log new file mode 100644 index 0000000..472aca5 --- /dev/null +++ b/allure-results/838275d5-3f75-4699-aee5-a4e78ca69397-attachment.log @@ -0,0 +1,75 @@ +2024-11-19 20:05:47 DEBUG TestNG - suiteXmlPath: "C:\Users\lenovo\IdeaProjects\Ellithium\TestNGRunner.xml" +2024-11-19 20:05:48 INFO logsUtils - Getting Timestamp: 2024-11-19 +2024-11-19 20:05:48 INFO logsUtils - Reading value for key: LastRunDate from JSON file: Test-Output\UpdateChecker\checker +2024-11-19 20:05:48 INFO logsUtils - Successfully read value for key: LastRunDate from JSON file: Test-Output\UpdateChecker\checker +2024-11-19 20:05:48 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\config +2024-11-19 20:05:48 INFO logsUtils - --------------------------------------------- +2024-11-19 20:05:48 INFO logsUtils - ------- Ellithium Engine Setup ------------- +2024-11-19 20:05:48 INFO logsUtils - --------------------------------------------- +2024-11-19 20:05:48 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure +2024-11-19 20:05:48 TRACE Graph - [Graph] ADDING NODE NonBDDSetup.SetUp()[pri:0, instance:null] -1847264985 +2024-11-19 20:05:48 TRACE Graph - [Graph] ================ SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ADDING NODE NonBDDSetup.testEnd()[pri:0, instance:null] 1041438139 +2024-11-19 20:05:48 TRACE Graph - [Graph] ================ SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ADDING NODE AppiumBase.setup()[pri:0, instance:null] -2089290894 +2024-11-19 20:05:48 TRACE Graph - [Graph] ================ SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ADDING NODE AppiumBase.tareDown()[pri:0, instance:null] 1619973931 +2024-11-19 20:05:48 TRACE Graph - [Graph] ================ SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ADDING NODE NonBDDSetup.SetUp()[pri:0, instance:Tests.AppiumTest@38704ff0] -483755095 +2024-11-19 20:05:48 TRACE Graph - [Graph] ================ SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ADDING NODE AppiumTest.SmokeMobileTest()[pri:0, instance:Tests.AppiumTest@38704ff0] -1397567403 +2024-11-19 20:05:48 TRACE Graph - [Graph] ================ SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ADDING NODE NonBDDSetup.testEnd()[pri:0, instance:Tests.AppiumTest@38704ff0] -1128271467 +2024-11-19 20:05:48 TRACE Graph - [Graph] ================ SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-19 20:05:48 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-19 20:05:48 INFO logsUtils - [SUITE STARTED]: FRAMEWORK TEST [SUITE STARTED] +2024-11-19 20:05:48 INFO logsUtils - [ALL TESTS STARTED]: ِMOBILE ANDROID TEST [ALL TESTS STARTED] +2024-11-19 20:05:48 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\config +2024-11-19 20:05:48 INFO logsUtils - [START] TESTCASE SmokeMobileTest [STARTED] +2024-11-19 20:05:48 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\config +2024-11-19 20:05:49 INFO logsUtils - [FAILED] TESTCASE SmokeMobileTest [FAILED] +2024-11-19 20:05:49 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\log4j2 +2024-11-19 20:05:49 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\log4j2 +2024-11-19 20:05:49 INFO logsUtils - Log file successfully attached to the Allure report. +2024-11-19 20:05:49 INFO logsUtils - [ALL TESTS COMPLETED]: ِMOBILE ANDROID TEST [ALL TESTS COMPLETED] +2024-11-19 20:05:49 INFO logsUtils - [SUITE FINISHED]: FRAMEWORK TEST [SUITE FINISHED] +2024-11-19 20:05:49 TRACE Graph - [Graph] ADDING NODE AppiumTest.SmokeMobileTest()[pri:0, instance:Tests.AppiumTest@38704ff0] -1397567403 +2024-11-19 20:05:49 TRACE Graph - [Graph] ================ SORTING +2024-11-19 20:05:49 TRACE Graph - [Graph] =============== DONE SORTING +2024-11-19 20:05:49 TRACE Graph - [Graph] ====== SORTED NODES +2024-11-19 20:05:49 TRACE Graph - [Graph] ====== END SORTED NODES +2024-11-19 20:05:49 INFO logsUtils - Total Execution Time is: 0 Min 1 Sec 398 Mills +2024-11-19 20:05:49 INFO logsUtils - ------------------------------------------ +2024-11-19 20:05:49 INFO logsUtils - ------- Ellithium Engine TearDown ------- +2024-11-19 20:05:49 INFO logsUtils - ------------------------------------------ +2024-11-19 20:05:49 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure +2024-11-19 20:05:49 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure +2024-11-19 20:05:49 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure +2024-11-19 20:05:49 INFO logsUtils - Allure folder exists at: C:\Users\lenovo\.m2\repository\allure-Ellithium +2024-11-19 20:05:49 INFO logsUtils - Found Allure binary directory: C:\Users\lenovo\.m2\repository\allure-Ellithium\-2.30.0\bin +2024-11-19 20:05:49 INFO logsUtils - Attempting to execute command: C:\Users\lenovo\.m2\repository\allure-Ellithium\-2.30.0\bin\allure generate --single-file --name "Test Report" -o .\LastReport\ .\Test-Output/Reports/Allure/allure-results\ +2024-11-19 20:05:51 INFO logsUtils - Command executed successfully. Exit code: 0 +2024-11-19 20:05:51 INFO logsUtils - Getting Timestamp: 2024-11-19-8-5-51PM +2024-11-19 20:05:51 INFO logsUtils - Successfully loaded properties file: src\main\resources\properties\allure +2024-11-19 20:05:51 INFO logsUtils - Attempting to execute command: start Test-Output\Reports\Allure\allure-report\Ellithium-Test-Report-2024-11-19-8-5-51PM.html +2024-11-19 20:05:51 INFO logsUtils - Command executed successfully. Exit code: 0 diff --git a/allure-results/b00e37a1-7c3e-4421-aad6-1a607a66dea5-container.json b/allure-results/b00e37a1-7c3e-4421-aad6-1a607a66dea5-container.json new file mode 100644 index 0000000..248d964 --- /dev/null +++ b/allure-results/b00e37a1-7c3e-4421-aad6-1a607a66dea5-container.json @@ -0,0 +1 @@ +{"uuid":"b00e37a1-7c3e-4421-aad6-1a607a66dea5","name":"Ellithium","children":["2f0ea957-6756-44ac-9fdc-368c640ba345","57dc0149-34ca-4d7c-b23b-b96d481f925c"],"befores":[{"name":"Test Engine start","status":"passed","stage":"finished","description":"Test Engine start","steps":[{"name":"Successfully loaded properties file: src\\main\\resources\\properties\\config","status":"passed","stage":"finished","steps":[],"attachments":[],"parameters":[],"start":1732044715671,"stop":1732044715672}],"attachments":[],"parameters":[],"start":1732044715666,"stop":1732044715673}],"afters":[{"name":"Test Engine Finish","status":"passed","stage":"finished","description":"Test Engine Finish","steps":[{"name":"Successfully loaded properties file: src\\main\\resources\\properties\\log4j2","status":"passed","stage":"finished","steps":[],"attachments":[],"parameters":[],"start":1732044715808,"stop":1732044715808},{"name":"Successfully loaded properties file: src\\main\\resources\\properties\\log4j2","status":"passed","stage":"finished","steps":[],"attachments":[],"parameters":[],"start":1732044715808,"stop":1732044715808}],"attachments":[{"name":"Execution Log File","source":"838275d5-3f75-4699-aee5-a4e78ca69397-attachment.log","type":"text/plain"}],"parameters":[],"start":1732044715806,"stop":1732044715812}],"start":1732044715647,"stop":1732044715812} \ No newline at end of file diff --git a/pom.xml b/pom.xml index c10ae26..bf85473 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ - 1.0.7 + 1.0.8 21 21 UTF-8 @@ -86,10 +86,10 @@ mvn resources:resources javadoc:javadoc scm-publish:publish-scm check version config, readme, - gpg -ab target/ellithium-1.0.7.jar - gpg -ab target/ellithium-1.0.7-javadoc.jar - gpg -ab target/ellithium-1.0.7-sources.jar - gpg -ab target/ellithium-1.0.7.pom + gpg -ab target/ellithium-1.0.8.jar + gpg -ab target/ellithium-1.0.8-javadoc.jar + gpg -ab target/ellithium-1.0.8-sources.jar + gpg -ab target/ellithium-1.0.8.pom gpg --keyserver keyserver.ubuntu.com --send-keys mvn clean deploy -P central,!github -DskipTests -X mvn clean deploy -P github,!ossrh -DskipTests -X diff --git a/src/main/java/Ellithium/Utilities/interactions/DriverActions.java b/src/main/java/Ellithium/Utilities/interactions/DriverActions.java index 54c227a..3878915 100644 --- a/src/main/java/Ellithium/Utilities/interactions/DriverActions.java +++ b/src/main/java/Ellithium/Utilities/interactions/DriverActions.java @@ -1,12 +1,13 @@ package Ellithium.Utilities.interactions; - import Ellithium.Utilities.generators.TestDataGenerator; import Ellithium.Utilities.helpers.PropertyHelper; import Ellithium.config.managment.ConfigContext; +import Ellithium.core.driver.DriverType; import Ellithium.core.logging.LogLevel; import Ellithium.core.logging.logsUtils; import Ellithium.core.reporting.Reporter; import com.google.common.io.Files; +import io.appium.java_client.AppiumFluentWait; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.ios.IOSDriver; import io.qameta.allure.Allure; @@ -19,213 +20,211 @@ import org.openqa.selenium.support.ui.WebDriverWait; import java.io.File; -import org.openqa.selenium.interactions.PointerInput; -import org.openqa.selenium.interactions.Sequence; - -import java.time.Duration; -import java.util.Collections; import java.time.Duration; import java.util.*; import java.util.concurrent.ExecutionException; -public class DriverActions { +public class DriverActions{ private int defaultTimeout= 5; private int defaultPollingTime=500; private boolean defaultTimeoutGotFlag=false; private boolean defaultPollingTimeGotFlag=false; - private final WebDriver driver; - public DriverActions(WebDriver driver){ - this.driver=driver; - } - public DriverActions(AndroidDriver driver){ - this.driver=driver; - } - public DriverActions(IOSDriver driver){ - this.driver=driver; + private final T driver; + private final DriverType driverType; + public DriverActions(T driver) { + this.driver = driver; + + if (driver instanceof AndroidDriver) { + driverType = DriverType.Android; + } else if (driver instanceof IOSDriver) { + driverType = DriverType.IOS; + } else { + driverType = DriverType.Chrome; + } } public void sendData( By locator, String data, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.visibilityOfElementLocated(locator)); - findWebElement(driver,locator).clear(); - findWebElement(driver,locator).sendKeys(data); + findWebElement(locator).clear(); + findWebElement(locator).sendKeys(data); } public void sendData( By locator, Keys data, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.visibilityOfElementLocated(locator)); - findWebElement(driver,locator).clear(); - findWebElement(driver,locator).sendKeys(data); + findWebElement(locator).clear(); + findWebElement(locator).sendKeys(data); } public String getText( By locator, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.visibilityOfElementLocated(locator)); - String text = findWebElement(driver,locator).getText(); + String text = findWebElement(locator).getText(); return text; } public void clickOnElement( By locator, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.elementToBeClickable(locator)); - findWebElement(driver,locator).click(); + findWebElement(locator).click(); } public WebDriverWait generalWait( int timeout) { Reporter.log("Getting general Wait For "+ timeout + " seconds",LogLevel.INFO_BLUE); return new WebDriverWait(driver, Duration.ofSeconds(timeout)); } public void scrollToElement( By locator) { - ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView();", findWebElement(driver, locator)); + ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView();", findWebElement( locator)); Reporter.log("Scrolling To Element: ",LogLevel.INFO_BLUE,locator.toString()); } public void selectDropdownByText( By locator, String option, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.visibilityOfElementLocated(locator)); - new Select(findWebElement(driver, locator)).selectByVisibleText(option); + new Select(findWebElement( locator)).selectByVisibleText(option); Reporter.log("Selecting Dropdown Option By Text: " + option + " From Element: ",LogLevel.INFO_BLUE,locator.toString()); } public void selectDropdownByValue( By locator, String value, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.visibilityOfElementLocated(locator)); - new Select(findWebElement(driver, locator)).selectByValue(value); + new Select(findWebElement( locator)).selectByValue(value); Reporter.log("Selecting Dropdown Option By Value: " + value + " From Element: ",LogLevel.INFO_BLUE,locator.toString()); } public void selectDropdownByIndex( By locator, int index, int timeout, int pollingEvery) { Reporter.log("Selecting Dropdown Option By Index: " + index + " From Element: " ,LogLevel.INFO_BLUE,locator.toString()); - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.visibilityOfElementLocated(locator)); - new Select(findWebElement(driver, locator)).selectByIndex(index); + new Select(findWebElement( locator)).selectByIndex(index); } public void setImplicitWait( int timeout) { driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(timeout)); } public void javascriptClick( By locator) { - WebElement element = findWebElement(driver, locator); + WebElement element = findWebElement( locator); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", element); Reporter.log("JavaScript Click On Element: ",LogLevel.INFO_BLUE,locator.toString()); } public void waitForElementToDisappear( By locator, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.invisibilityOfElementLocated(locator)); Reporter.log("Waiting for Element To Disappear: ",LogLevel.INFO_BLUE,locator.toString()); } public WebElement waitForElementToBeClickable( By locator, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.elementToBeClickable(locator)); Reporter.log("Wait For Element To Be Clickable: ",LogLevel.INFO_BLUE,locator.toString()); - return findWebElement(driver,locator); + return findWebElement(locator); } public WebElement waitForElementToBeVisible( By locator, int timeout, int pollingEvery) { - getFluentWait(driver, timeout, pollingEvery) + getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.visibilityOfElementLocated(locator)); Reporter.log("Wait For Element To Be Visible: ",LogLevel.INFO_BLUE,locator.toString()); - return findWebElement(driver, locator); + return findWebElement( locator); } public WebElement waitForElementPresence( By locator, int timeout, int pollingEvery) { Reporter.log("Waiting for Element Presence: " + locator.toString(), LogLevel.INFO_BLUE); - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.presenceOfElementLocated(locator)); - return findWebElement(driver, locator); + return findWebElement( locator); } public WebElement waitForTextToBePresentInElement( By locator, String text, int timeout, int pollingEvery) { Reporter.log("Waiting for Text: '" + text + "' to be present in Element: " + locator.toString(), LogLevel.INFO_BLUE); - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.textToBePresentInElementLocated(locator, text)); - return findWebElement(driver, locator); + return findWebElement( locator); } public String getAttributeValue( By locator, String attribute, int timeout, int pollingEvery) { Reporter.log("Getting Attribute: '" + attribute + "' from Element: " + locator.toString(), LogLevel.INFO_BLUE); - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.visibilityOfElementLocated(locator)); - String attributeValue = findWebElement(driver, locator).getAttribute(attribute); + String attributeValue = findWebElement( locator).getAttribute(attribute); return attributeValue; } public boolean waitForElementToBeSelected( By locator, int timeout, int pollingEvery) { Reporter.log("Waiting for Element to be Selected: " + locator.toString(), LogLevel.INFO_BLUE); - boolean isSelected = getFluentWait(driver, timeout, pollingEvery) + boolean isSelected = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.elementToBeSelected(locator)); return isSelected; } public boolean waitForElementAttributeToBe( By locator, String attribute, String value, int timeout, int pollingEvery) { Reporter.log("Waiting for Element Attribute: '" + attribute + "' to be: '" + value + "' for Element: " + locator.toString(), LogLevel.INFO_BLUE); - boolean result = getFluentWait(driver, timeout, pollingEvery) + boolean result = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.attributeToBe(locator, attribute, value)); return result; } public boolean waitForElementAttributeContains( By locator, String attribute, String value, int timeout, int pollingEvery) { Reporter.log("Waiting for Element Attribute: '" + attribute + "' to contain: '" + value + "' for Element: " + locator.toString(), LogLevel.INFO_BLUE); - boolean result = getFluentWait(driver, timeout, pollingEvery) + boolean result = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.attributeContains(locator, attribute, value)); return result; } public boolean waitForElementStaleness( WebElement element, int timeout, int pollingEvery) { Reporter.log("Waiting for Element Staleness: " + element.toString(), LogLevel.INFO_BLUE); - boolean isStale = getFluentWait(driver, timeout, pollingEvery) + boolean isStale = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.stalenessOf(element)); return isStale; } public boolean waitForTitleContains( String titlePart, int timeout, int pollingEvery) { Reporter.log("Waiting for Title to Contain: '" + titlePart + "'", LogLevel.INFO_BLUE); - boolean result = getFluentWait(driver, timeout, pollingEvery) + boolean result = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.titleContains(titlePart)); return result; } public boolean waitForUrlContains( String urlPart, int timeout, int pollingEvery) { Reporter.log("Waiting for URL to Contain: '" + urlPart + "'", LogLevel.INFO_BLUE); - boolean result = getFluentWait(driver, timeout, pollingEvery) + boolean result = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.urlContains(urlPart)); return result; } public WebDriver waitForFrameToBeAvailableAndSwitchToIt( By locator, int timeout, int pollingEvery) { Reporter.log("Waiting for Frame to be Available and Switching to it: " + locator.toString(), LogLevel.INFO_BLUE); - WebDriver frame = getFluentWait(driver, timeout, pollingEvery) + WebDriver frame = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(locator)); return frame; } public WebDriver waitForFrameByNameOrIdToBeAvailableAndSwitchToIt( String nameOrId, int timeout, int pollingEvery) { Reporter.log("Waiting for Frame to be Available by Name or ID: '" + nameOrId + "'", LogLevel.INFO_BLUE); - WebDriver frame = getFluentWait(driver, timeout, pollingEvery) + WebDriver frame = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(nameOrId)); return frame; } public WebDriver waitForFrameByIndexToBeAvailableAndSwitchToIt( int index, int timeout, int pollingEvery) { Reporter.log("Waiting for Frame to be Available by Index: " + index, LogLevel.INFO_BLUE); - WebDriver frame = getFluentWait(driver, timeout, pollingEvery) + WebDriver frame = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(index)); return frame; } public boolean waitForElementToBeEnabled( By locator, int timeout, int pollingEvery) { Reporter.log("Waiting for Element to be Enabled: " + locator.toString(), LogLevel.INFO_BLUE); - boolean isEnabled = getFluentWait(driver, timeout, pollingEvery) + boolean isEnabled = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.elementToBeClickable(locator)).isEnabled(); return isEnabled; } public boolean waitForTitleIs( String title, int timeout, int pollingEvery) { Reporter.log("Waiting for Title to be: '" + title + "'", LogLevel.INFO_BLUE); - boolean result = getFluentWait(driver, timeout, pollingEvery) + boolean result = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.titleIs(title)); return result; } public boolean waitForUrlToBe( String url, int timeout, int pollingEvery) { Reporter.log("Waiting for URL to be: '" + url + "'", LogLevel.INFO_BLUE); - boolean result = getFluentWait(driver, timeout, pollingEvery) + boolean result = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.urlToBe(url)); return result; } public boolean waitForElementSelectionStateToBe( By locator, boolean selected, int timeout, int pollingEvery) { Reporter.log("Waiting for Element Selection State to be: " + selected + " for Element: " + locator.toString(), LogLevel.INFO_BLUE); - boolean result = getFluentWait(driver, timeout, pollingEvery) + boolean result = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.elementSelectionStateToBe(locator, selected)); return result; } public boolean waitForTextToBePresentInElementValue( By locator, String text, int timeout, int pollingEvery) { Reporter.log("Waiting for Text to be Present in Element Value: '" + text + "' for Element: " + locator.toString(), LogLevel.INFO_BLUE); - boolean result = getFluentWait(driver, timeout, pollingEvery) + boolean result = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.textToBePresentInElementValue(locator, text)); return result; } @@ -233,35 +232,35 @@ public boolean waitForTextToBePresentInElementValue( By locator, String text, i public boolean waitForNumberOfWindowsToBe( int numberOfWindows, int timeout, int pollingEvery) { Reporter.log("Waiting for Number of Windows to be: " + numberOfWindows, LogLevel.INFO_BLUE); - boolean result = getFluentWait(driver, timeout, pollingEvery) + boolean result = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.numberOfWindowsToBe(numberOfWindows)); return result; } public boolean waitForNumberOfElementsToBeMoreThan( By locator, int number, int timeout, int pollingEvery) { Reporter.log("Waiting for Number of Elements to be More Than: " + number + " for Element: " + locator.toString(), LogLevel.INFO_BLUE); - int size = getFluentWait(driver, timeout, pollingEvery) + int size = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.numberOfElementsToBeMoreThan(locator, number)).size(); return size > number; } public boolean waitForNumberOfElementsToBeLessThan( By locator, int number, int timeout, int pollingEvery) { Reporter.log("Waiting for Number of Elements to be Less Than: " + number + " for Element: " + locator.toString(), LogLevel.INFO_BLUE); - int size = getFluentWait(driver, timeout, pollingEvery) + int size = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.numberOfElementsToBeLessThan(locator, number)).size(); return size < number; } public List waitForVisibilityOfAllElements( By locator, int timeout, int pollingEvery) { Reporter.log("Waiting for Visibility of All Elements for: " + locator.toString(), LogLevel.INFO_BLUE); - List elements = getFluentWait(driver, timeout, pollingEvery) + List elements = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.visibilityOfAllElementsLocatedBy(locator)); return elements; } public boolean waitForNumberOfElementsToBe( By locator, int number, int timeout, int pollingEvery) { Reporter.log("Waiting for Number of Elements to be: " + number + " for Element: " + locator.toString(), LogLevel.INFO_BLUE); - int size = getFluentWait(driver, timeout, pollingEvery) + int size = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.numberOfElementsToBe(locator, number)).size(); return size == number; } @@ -276,7 +275,7 @@ public void switchToNewWindow( String windowTitle) { driver.switchTo().window(originalWindow); } // Close the current window or tab - public void closeCurrentWindow(WebDriver driver) { + public void closeCurrentWindow() { driver.close(); } @@ -285,58 +284,64 @@ public void switchToOriginalWindow( String originalWindowHandle) { driver.switchTo().window(originalWindowHandle); } // Find an element (no need for timeout or polling) - public WebElement findWebElement(WebDriver driver, By locator) { + public WebElement findWebElement( By locator) { return driver.findElement(locator); } // Find elements (no need for timeout or polling) - public List findWebElements(WebDriver driver, By locator) { + public List findWebElements( By locator) { return driver.findElements(locator); } // Accept an alert public void acceptAlert( int timeout, int pollingEvery) { - getFluentWait(driver, timeout, pollingEvery) + getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.alertIsPresent()); driver.switchTo().alert().accept(); } public void dismissAlert( int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.alertIsPresent()); driver.switchTo().alert().dismiss(); } public String getAlertText( int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.alertIsPresent()); String alertText = driver.switchTo().alert().getText(); return alertText; } public void sendDataToAlert( String data, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.alertIsPresent()); driver.switchTo().alert().sendKeys(data); } // Get text from multiple elements public List getTextFromMultipleElements( By locator, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery).until(ExpectedConditions.visibilityOfAllElementsLocatedBy(locator)); + getFluentWait(timeout,pollingEvery).until(ExpectedConditions.visibilityOfAllElementsLocatedBy(locator)); Reporter.log("Getting text from multiple elements located: ",LogLevel.INFO_BLUE,locator.toString()); - List elements = findWebElements(driver,locator); + List elements = findWebElements(locator); List texts = new ArrayList<>(); for (WebElement element : elements) { texts.add(element.getText()); } return texts; } - public FluentWait getFluentWait(WebDriver driver, int timeoutInSeconds, int pollingEveryInMillis) { - return new FluentWait<>(driver) - .withTimeout(Duration.ofSeconds(timeoutInSeconds)) - .pollingEvery(Duration.ofMillis(pollingEveryInMillis)) - .ignoreAll(expectedExceptions); + public FluentWait getFluentWait(int timeoutInSeconds, int pollingEveryInMillis) { + if ((driverType==DriverType.Android)||(driverType==DriverType.IOS)) { + return new AppiumFluentWait<>((T) driver) + .withTimeout(Duration.ofSeconds(timeoutInSeconds)) + .pollingEvery(Duration.ofMillis(pollingEveryInMillis)) + .ignoreAll(expectedExceptions); + } else { + return new FluentWait<>(driver) + .withTimeout(Duration.ofSeconds(timeoutInSeconds)) + .pollingEvery(Duration.ofMillis(pollingEveryInMillis)) + .ignoreAll(expectedExceptions); + } } - public List getAttributeFromMultipleElements( By locator,String Attribute, int timeout, int pollingEvery) { Reporter.log("Getting Attribute from multiple elements located: ",LogLevel.INFO_BLUE,locator.toString()); - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.visibilityOfAllElementsLocatedBy(locator)); - List elements = findWebElements(driver,locator); + List elements = findWebElements(locator); List texts = new ArrayList<>(); for (WebElement element : elements) { texts.add(element.getAttribute(Attribute)); @@ -345,19 +350,19 @@ public List getAttributeFromMultipleElements( By locator,String Attribu } // Click on multiple elements public void clickOnMultipleElements( By locator, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.visibilityOfAllElementsLocatedBy(locator)); - List elements = findWebElements(driver,locator); + List elements = findWebElements(locator); for (WebElement element : elements) { element.click(); } } // Send data to multiple elements public void sendDataToMultipleElements( By locator, String data, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.visibilityOfAllElementsLocatedBy(locator)); Reporter.log("Sending data to multiple elements located: ",LogLevel.INFO_BLUE,locator.toString()); - List elements = findWebElements(driver,locator); + List elements = findWebElements(locator); for (WebElement element : elements) { element.clear(); element.sendKeys(data); @@ -366,10 +371,10 @@ public void sendDataToMultipleElements( By locator, String data, int timeout, i // Select from dropdowns on multiple elements by visible text public void selectDropdownByTextForMultipleElements( By locator, String option, int timeout, int pollingEvery) { Reporter.log("Selecting dropdown option by text for multiple elements: " + option + " for locator: " + locator.toString(), LogLevel.INFO_BLUE); - getFluentWait(driver, timeout, pollingEvery) + getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.visibilityOfAllElementsLocatedBy(locator)); - List elements = findWebElements(driver, locator); + List elements = findWebElements( locator); for (WebElement element : elements) { new Select(element).selectByVisibleText(option); } @@ -377,13 +382,13 @@ public void selectDropdownByTextForMultipleElements( By locator, String option, // Switch to frame by index public void switchToFrameByIndex( int index, int timeout,int pollingTime) { - getFluentWait(driver,timeout,pollingTime) + getFluentWait(timeout,pollingTime) .until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(index)); } // Hover over an element with specified timeout public void hoverOverElement( By locator, int timeout) { Reporter.log("Hovered over element: " + locator.toString(), LogLevel.INFO_BLUE); - WebElement element = getFluentWait(driver, timeout, defaultPollingTime) + WebElement element = getFluentWait( timeout, defaultPollingTime) .until(ExpectedConditions.visibilityOfElementLocated(locator)); Actions action = new Actions(driver); action.moveToElement(element).perform(); @@ -391,7 +396,7 @@ public void hoverOverElement( By locator, int timeout) { // New method: Scroll to page bottom - public void scrollToPageBottom(WebDriver driver) { + public void scrollToPageBottom() { JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("window.scrollTo(0, document.body.scrollHeight);"); Reporter.log("Scrolled to page bottom", LogLevel.INFO_BLUE); @@ -400,31 +405,31 @@ public void scrollToPageBottom(WebDriver driver) { // New method: JS Executor - Set value using JavaScript public void setElementValueUsingJS( By locator, String value) { JavascriptExecutor js = (JavascriptExecutor) driver; - WebElement element = findWebElement(driver, locator); + WebElement element = findWebElement( locator); js.executeScript("arguments[0].value = arguments[1];", element, value); Reporter.log("Set value using JavaScript: " + value + " on element: " + locator.toString(), LogLevel.INFO_BLUE); } // Switch to frame by name or ID public void switchToFrameByNameOrID( String nameOrID, int timeout,int pollingTime) { - getFluentWait(driver,timeout,pollingTime) + getFluentWait(timeout,pollingTime) .until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(nameOrID)); } // Switch to frame by WebElement public void switchToFrameByElement( By locator, int timeout,int pollingTime) { - getFluentWait(driver,timeout,pollingTime) + getFluentWait(timeout,pollingTime) .until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(locator)); } // Switch back to default content from frame - public void switchToDefaultContent(WebDriver driver) { + public void switchToDefaultContent() { driver.switchTo().defaultContent(); } public void switchToPopupWindow( String expectedPopupTitle, int timeout, int pollingTime) { String mainWindow = driver.getWindowHandle(); Reporter.log("Waiting for popup window to appear.", LogLevel.INFO_BLUE); - boolean windowsAppeared = getFluentWait(driver, timeout, pollingTime) + boolean windowsAppeared = getFluentWait( timeout, pollingTime) .until(ExpectedConditions.numberOfWindowsToBe(2)); if (windowsAppeared) { @@ -443,15 +448,15 @@ public void switchToPopupWindow( String expectedPopupTitle, int timeout, int po Reporter.log("Popup window did not appear within the timeout.", LogLevel.ERROR); } } - public void closePopupWindow(WebDriver driver) { + public void closePopupWindow() { driver.close(); Reporter.log("Popup window closed. Switching back to the main window.", LogLevel.INFO_BLUE); String mainWindow = driver.getWindowHandles().iterator().next(); driver.switchTo().window(mainWindow); } public float moveSliderTo( By sliderLocator, By rangeLocator, float targetValue) { - WebElement range = findWebElement(driver, rangeLocator); - WebElement slider = findWebElement(driver, sliderLocator); + WebElement range = findWebElement( rangeLocator); + WebElement slider = findWebElement( sliderLocator); float currentValue = Float.parseFloat(range.getText()); Actions action = new Actions(driver); @@ -475,8 +480,8 @@ public float moveSliderTo( By sliderLocator, By rangeLocator, float targetValue return currentValue; } public void dragAndDrop( By sourceLocator, By targetLocator) { - WebElement source = findWebElement(driver, sourceLocator); - WebElement target = findWebElement(driver, targetLocator); + WebElement source = findWebElement( sourceLocator); + WebElement target = findWebElement( targetLocator); Actions action = new Actions(driver); action.clickAndHold(source) @@ -487,7 +492,7 @@ public void dragAndDrop( By sourceLocator, By targetLocator) { Reporter.log("Drag and drop performed from " + sourceLocator + " to " + targetLocator, LogLevel.INFO_BLUE); } public void dragAndDropByOffset( By sourceLocator, int xOffset, int yOffset) { - WebElement source = findWebElement(driver, sourceLocator); + WebElement source = findWebElement( sourceLocator); Actions action = new Actions(driver); action.clickAndHold(source) @@ -499,11 +504,11 @@ public void dragAndDropByOffset( By sourceLocator, int xOffset, int yOffset) { } public void hoverAndClick( By locatorToHover, By locatorToClick, int timeout, int pollingEvery) { Reporter.log("Waiting for element to hover: " + locatorToHover.toString(), LogLevel.INFO_BLUE); - WebElement elementToHover = getFluentWait(driver, timeout, pollingEvery) + WebElement elementToHover = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.visibilityOfElementLocated(locatorToHover)); Reporter.log("Waiting for element to click: " + locatorToClick.toString(), LogLevel.INFO_BLUE); - WebElement elementToClick = getFluentWait(driver, timeout, pollingEvery) + WebElement elementToClick = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.elementToBeClickable(locatorToClick)); Actions action = new Actions(driver); @@ -533,10 +538,10 @@ public String captureScreenshot( String screenshotName) { } public void moveSliderByOffset( By sliderLocator, int xOffset, int yOffset, int timeout, int pollingEvery) { Reporter.log("Waiting for slider to be visible: " + sliderLocator.toString(), LogLevel.INFO_BLUE); - getFluentWait(driver, timeout, pollingEvery) + getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.visibilityOfElementLocated(sliderLocator)); - WebElement slider = findWebElement(driver, sliderLocator); + WebElement slider = findWebElement( sliderLocator); Actions action = new Actions(driver); action.clickAndHold(slider) .moveByOffset(xOffset, yOffset) @@ -553,7 +558,7 @@ public void scrollByOffset( int xOffset, int yOffset) { } public void rightClick( By locator, int timeout, int pollingEvery) { Reporter.log("Waiting for element to right-click: " + locator.toString(), LogLevel.INFO_BLUE); - WebElement element = getFluentWait(driver, timeout, pollingEvery) + WebElement element = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.visibilityOfElementLocated(locator)); Actions action = new Actions(driver); @@ -563,7 +568,7 @@ public void rightClick( By locator, int timeout, int pollingEvery) { } public void doubleClick( By locator, int timeout, int pollingEvery) { Reporter.log("Waiting for element to double-click: " + locator.toString(), LogLevel.INFO_BLUE); - WebElement element = getFluentWait(driver, timeout, pollingEvery) + WebElement element = getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.visibilityOfElementLocated(locator)); Actions action = new Actions(driver); action.doubleClick(element).perform(); @@ -572,32 +577,32 @@ public void doubleClick( By locator, int timeout, int pollingEvery) { // Maximize the browser window - public void maximizeWindow(WebDriver driver) { + public void maximizeWindow() { driver.manage().window().maximize(); } // Minimize the browser window - public void minimizeWindow(WebDriver driver) { + public void minimizeWindow() { driver.manage().window().minimize(); } // Get all elements matching the locator public List getElements( By locator, int timeout, int pollingEvery) { - getFluentWait(driver,timeout,pollingEvery) + getFluentWait(timeout,pollingEvery) .until(ExpectedConditions.visibilityOfAllElementsLocatedBy(locator)); - return findWebElements(driver,locator); + return findWebElements(locator); } public void navigateToUrl( String url) { driver.get(url); } // Refresh the current page - public void refreshPage(WebDriver driver) { + public void refreshPage() { driver.navigate().refresh(); } - public void navigateBack(WebDriver driver) { + public void navigateBack() { driver.navigate().back(); } - public void navigateForward(WebDriver driver) { + public void navigateForward() { driver.navigate().forward(); } public boolean waitForElementToBeSelected( By locator) { @@ -819,12 +824,12 @@ public boolean waitForNumberOfElementsToBeLessThan( By locator, int number) { return waitForNumberOfElementsToBeLessThan( locator, number, defaultTimeout, defaultPollingTime); } public void javascriptClick( By locator, int timeout) { - getFluentWait(driver, timeout, defaultPollingTime) + getFluentWait( timeout, defaultPollingTime) .until(ExpectedConditions.elementToBeClickable(locator)); javascriptClick( locator); } public void javascriptClick( By locator, int timeout, int pollingEvery) { - getFluentWait(driver, timeout, pollingEvery) + getFluentWait( timeout, pollingEvery) .until(ExpectedConditions.elementToBeClickable(locator)); javascriptClick( locator); } @@ -906,7 +911,7 @@ public void acceptAlert( int timeout) { initializeTimeoutAndPolling(); acceptAlert(timeout, defaultPollingTime); } - public void acceptAlert(WebDriver driver) { + public void acceptAlert() { initializeTimeoutAndPolling(); acceptAlert(defaultTimeout, defaultPollingTime); } @@ -914,7 +919,7 @@ public String getAlertText( int timeout){ initializeTimeoutAndPolling(); return getAlertText( timeout, defaultPollingTime); } - public String getAlertText(WebDriver driver){ + public String getAlertText(){ initializeTimeoutAndPolling(); return getAlertText(defaultTimeout, defaultPollingTime); } @@ -922,7 +927,7 @@ public void dismissAlert( int timeout){ initializeTimeoutAndPolling(); dismissAlert( timeout,defaultPollingTime); } - public void dismissAlert(WebDriver driver){ + public void dismissAlert(){ initializeTimeoutAndPolling(); dismissAlert(defaultTimeout,defaultPollingTime); } diff --git a/src/main/java/Ellithium/config/managment/GeneralHandler.java b/src/main/java/Ellithium/config/managment/GeneralHandler.java index dd93a33..0f34ee9 100644 --- a/src/main/java/Ellithium/config/managment/GeneralHandler.java +++ b/src/main/java/Ellithium/config/managment/GeneralHandler.java @@ -22,7 +22,7 @@ import java.util.List; public class GeneralHandler implements TestLifecycleListener { - private static Boolean BDDMode, flagReaded=false; + private static Boolean BDDMode,NonBDDMode, flagReaded=false; public static File testFailed( String browserName, String testName) { try { TakesScreenshot camera =((TakesScreenshot) DriverFactory.getCurrentDriver()); @@ -64,6 +64,7 @@ public static boolean getBDDMode(){ if(flagReaded.equals(false)){ String mode=PropertyHelper.getDataFromProperties(ConfigContext.getConfigFilePath(),"runMode"); BDDMode=mode.equalsIgnoreCase("BDD"); + NonBDDMode=false; flagReaded=true; } return BDDMode; @@ -71,10 +72,11 @@ public static boolean getBDDMode(){ public static boolean getNonBDDMode(){ if(flagReaded.equals(false)){ String mode=PropertyHelper.getDataFromProperties(ConfigContext.getConfigFilePath(),"runMode"); - BDDMode=mode.equalsIgnoreCase("NonBDD"); + NonBDDMode=mode.equalsIgnoreCase("NonBDD"); + BDDMode=false; flagReaded=true; } - return BDDMode; + return NonBDDMode; } public static void StartRoutine(){ APIFilterHelper.applyFilter(); diff --git a/src/main/java/Ellithium/core/base/BDDSetup.java b/src/main/java/Ellithium/core/base/BDDSetup.java index fb6fd60..79a18bd 100644 --- a/src/main/java/Ellithium/core/base/BDDSetup.java +++ b/src/main/java/Ellithium/core/base/BDDSetup.java @@ -21,8 +21,8 @@ public class BDDSetup extends AbstractTestNGCucumberTests { @BeforeTest(alwaysRun = true, description = "Test Engine start") protected void SetUp() { - if(GeneralHandler.getNonBDDMode()){ - Reporter.log("Invalid runMode Selection Go to src/main/resources/properties/config.properties and edit the mode ", LogLevel.ERROR); + if(!GeneralHandler.getBDDMode()){ + Reporter.log("Invalid runMode Selection", LogLevel.ERROR); } } @Override diff --git a/src/main/java/Ellithium/core/base/NonBDDSetup.java b/src/main/java/Ellithium/core/base/NonBDDSetup.java index 4c10fe0..0524b5e 100644 --- a/src/main/java/Ellithium/core/base/NonBDDSetup.java +++ b/src/main/java/Ellithium/core/base/NonBDDSetup.java @@ -10,7 +10,7 @@ public class NonBDDSetup { @BeforeTest(alwaysRun = true, description = "Test Engine start") protected void SetUp() { - if(GeneralHandler.getBDDMode()){ + if(!GeneralHandler.getNonBDDMode()){ Reporter.log("Invalid runMode Selection Go to src/main/resources/properties/config.properties and edit the mode ", LogLevel.ERROR); } } diff --git a/src/main/java/Ellithium/core/driver/DriverFactory.java b/src/main/java/Ellithium/core/driver/DriverFactory.java index 86fbe20..cd7fb06 100644 --- a/src/main/java/Ellithium/core/driver/DriverFactory.java +++ b/src/main/java/Ellithium/core/driver/DriverFactory.java @@ -7,6 +7,7 @@ import Ellithium.core.execution.listener.seleniumListener; import Ellithium.Utilities.helpers.PropertyHelper; import Ellithium.core.logging.logsUtils; +import io.appium.java_client.AppiumDriver; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.ios.IOSDriver; import org.openqa.selenium.Capabilities; @@ -17,7 +18,6 @@ import org.openqa.selenium.edge.EdgeDriver; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.events.EventFiringDecorator; - import java.net.URL; import java.time.Duration; import static Ellithium.core.reporting.internal.Colors.*; @@ -57,7 +57,7 @@ public static T getNewDriver(DriverType driverType) { return getNewDriver(driverType,HeadlessMode.False,PrivateMode.True,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox); } @SuppressWarnings("unchecked") - public static T getNewDriver(DriverType driverType, URL remoteAddress, Capabilities capabilities) { + public static T getNewDriver(DriverType driverType, URL remoteAddress, Capabilities capabilities) { if(!defaultTimeoutGotFlag){ initTimeout(); } diff --git a/src/main/resources/properties/config.properties b/src/main/resources/properties/config.properties index 6cc6803..2b922c4 100644 --- a/src/main/resources/properties/config.properties +++ b/src/main/resources/properties/config.properties @@ -1,6 +1,6 @@ #Mon Sep 09 13:46:17 EEST 2024 #Do not delete it, you can change it to the current version you use if needed -EllithiumVersion=1.0.7 +EllithiumVersion=1.0.8 allureVersion=2.30.0 #runMode Options: BDD, NonBDD diff --git a/src/test/java/Base/AppiumBase.java b/src/test/java/Base/AppiumBase.java index 7393b8b..78eb5d3 100644 --- a/src/test/java/Base/AppiumBase.java +++ b/src/test/java/Base/AppiumBase.java @@ -3,7 +3,6 @@ import Ellithium.Utilities.interactions.DriverActions; import Ellithium.core.base.NonBDDSetup; import io.appium.java_client.android.AndroidDriver; -import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.service.local.AppiumDriverLocalService; import io.appium.java_client.service.local.AppiumServiceBuilder; import org.testng.annotations.AfterClass; @@ -14,7 +13,6 @@ public class AppiumBase extends NonBDDSetup { protected AndroidDriver androidDriver; protected AppiumDriverLocalService serviceBuilder; - protected IOSDriver iosDriver; protected DriverActions driverActions; @BeforeClass public void setup() { @@ -25,8 +23,8 @@ public void setup() { } @AfterClass public void tareDown(){ - androidDriver.quit(); - // serviceBuilder.stop(); - // serviceBuilder.close(); + androidDriver.quit(); + serviceBuilder.stop(); + serviceBuilder.close(); } } diff --git a/src/test/java/Pages/SearchPage.java b/src/test/java/Pages/SearchPage.java index 9c33357..b05322b 100644 --- a/src/test/java/Pages/SearchPage.java +++ b/src/test/java/Pages/SearchPage.java @@ -7,8 +7,6 @@ import java.util.List; -import static Ellithium.Utilities.interactions.DriverActions.*; - public class SearchPage { WebDriver driver; DriverActions driverActions; diff --git a/src/test/java/Tests/AppiumNoonTest.java b/src/test/java/Tests/AppiumNoonTest.java deleted file mode 100644 index ab3c7b5..0000000 --- a/src/test/java/Tests/AppiumNoonTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package Tests; - -import Base.AppiumBase; -import Ellithium.Utilities.interactions.DriverActions; -import Ellithium.core.driver.DriverFactory; -import Ellithium.core.driver.DriverType; -import io.appium.java_client.AppiumBy; -import io.appium.java_client.android.options.UiAutomator2Options; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.net.MalformedURLException; -import java.net.URL; - -public class AppiumNoonTest extends AppiumBase { - // com.noon.buyerapp/.MainActivity - @Test(description = "Just testing the Ability to run tests on mobile, I made it fails to check the Attached Screenshot") - public void SmokeMobileTest() throws MalformedURLException, InterruptedException { - UiAutomator2Options options=new UiAutomator2Options(); - options.setDeviceName("Xiaomi Redmi Note 8"); - options.setAppActivity("com.noon.buyerapp.MainActivity"); - options.setAppPackage("com.noon.buyerapp"); - options.setCapability("noReset", true); - options.setCapability("fullReset", false); - androidDriver= DriverFactory.getNewDriver(DriverType.Android,new URL("http://0.0.0.0:4723"),options); - driverActions=new DriverActions(androidDriver); - driverActions.clickOnElement(AppiumBy.accessibilityId("English - الإنجليزية "),5,200); - Thread.sleep(2000); - Assert.assertTrue(false); - } -} diff --git a/src/test/java/Tests/AppiumTest.java b/src/test/java/Tests/AppiumTest.java index 52b1311..e37a39d 100644 --- a/src/test/java/Tests/AppiumTest.java +++ b/src/test/java/Tests/AppiumTest.java @@ -19,7 +19,6 @@ public void SmokeMobileTest() throws MalformedURLException, InterruptedException options.setAppActivity("com.appyinnovate.e_invoice.MainActivity"); options.setAppPackage("com.appyinnovate.e_invoice"); androidDriver= DriverFactory.getNewDriver(DriverType.Android,new URL("http://0.0.0.0:4723"),options); - iosDriver=DriverFactory.getNewDriver(DriverType.IOS,new URL("http://0.0.0.0:4723"),options); driverActions=new DriverActions(androidDriver); driverActions.clickOnElement(AppiumBy.accessibilityId("English - الإنجليزية "),5,200); Assert.assertTrue(false);