Skip to content

Commit

Permalink
Update Driver Types
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdelrhman-Ellithy committed Dec 12, 2024
1 parent 8907de4 commit 9ff8f09
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 56 deletions.
46 changes: 23 additions & 23 deletions src/main/java/Ellithium/core/driver/DriverFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,33 @@ public class DriverFactory {
private static ThreadLocal<IOSDriver> IOSDriverThread = new ThreadLocal<>();

@SuppressWarnings("unchecked")
public static <T extends WebDriver> T getNewDriver(LocalDriverType driverType,HeadlessMode headlessMode, PrivateMode privateMode, PageLoadStrategyMode pageLoadStrategyMode,WebSecurityMode webSecurityMode, SandboxMode sandboxMode) {
public static <T extends WebDriver> T getNewLocalDriver(LocalDriverType driverType,HeadlessMode headlessMode, PrivateMode privateMode, PageLoadStrategyMode pageLoadStrategyMode,WebSecurityMode webSecurityMode, SandboxMode sandboxMode) {
ConfigContext.setConfig(driverType,headlessMode,pageLoadStrategyMode,privateMode,sandboxMode,webSecurityMode);
webSetUp();
return (T) WebDriverThread.get();
}
@SuppressWarnings("unchecked")
public static <T extends WebDriver> T getNewDriver(LocalDriverType driverType,HeadlessMode headlessMode, PrivateMode privateMode, PageLoadStrategyMode pageLoadStrategyMode,WebSecurityMode webSecurityMode) {
return getNewDriver(driverType,headlessMode,privateMode,pageLoadStrategyMode,webSecurityMode,SandboxMode.Sandbox);
public static <T extends WebDriver> T getNewLocalDriver(LocalDriverType driverType,HeadlessMode headlessMode, PrivateMode privateMode, PageLoadStrategyMode pageLoadStrategyMode,WebSecurityMode webSecurityMode) {
return getNewLocalDriver(driverType,headlessMode,privateMode,pageLoadStrategyMode,webSecurityMode,SandboxMode.Sandbox);
}
@SuppressWarnings("unchecked")
public static <T extends WebDriver> T getNewDriver(LocalDriverType driverType,HeadlessMode headlessMode, PrivateMode privateMode, PageLoadStrategyMode pageLoadStrategyMode) {
return getNewDriver(driverType,headlessMode,privateMode,pageLoadStrategyMode,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
public static <T extends WebDriver> T getNewLocalDriver(LocalDriverType driverType,HeadlessMode headlessMode, PrivateMode privateMode, PageLoadStrategyMode pageLoadStrategyMode) {
return getNewLocalDriver(driverType,headlessMode,privateMode,pageLoadStrategyMode,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
}
@SuppressWarnings("unchecked")
public static <T extends WebDriver> T getNewDriver(LocalDriverType driverType,HeadlessMode headlessMode, PrivateMode privateMode) {
return getNewDriver(driverType,headlessMode,privateMode,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
public static <T extends WebDriver> T getNewLocalDriver(LocalDriverType driverType,HeadlessMode headlessMode, PrivateMode privateMode) {
return getNewLocalDriver(driverType,headlessMode,privateMode,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
}
@SuppressWarnings("unchecked")
public static <T extends WebDriver> T getNewDriver(LocalDriverType driverType,HeadlessMode headlessMode) {
return getNewDriver(driverType,headlessMode,PrivateMode.True,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
public static <T extends WebDriver> T getNewLocalDriver(LocalDriverType driverType,HeadlessMode headlessMode) {
return getNewLocalDriver(driverType,headlessMode,PrivateMode.True,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
}
@SuppressWarnings("unchecked")
public static <T extends WebDriver> T getNewDriver(LocalDriverType driverType) {
return getNewDriver(driverType,HeadlessMode.False,PrivateMode.True,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
public static <T extends WebDriver> T getNewLocalDriver(LocalDriverType driverType) {
return getNewLocalDriver(driverType,HeadlessMode.False,PrivateMode.True,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
}
@SuppressWarnings("unchecked")
public static <T extends AppiumDriver> T getNewDriver(MobileDriverType driverType, URL remoteAddress, Capabilities capabilities) {
public static <T extends AppiumDriver> T getNewMobileDriver(MobileDriverType driverType, URL remoteAddress, Capabilities capabilities) {
ConfigContext.setDriverType(driverType);
ConfigContext.setRemoteAddress(remoteAddress);
ConfigContext.setCapabilities(capabilities);
Expand Down Expand Up @@ -90,32 +90,32 @@ public static <T extends AppiumDriver> T getNewDriver(MobileDriverType driverTyp

// Remote web Driver Section
@SuppressWarnings("unchecked")
public static <T extends RemoteWebDriver> T getNewDriver(RemoteDriverType driverType, URL remoteAddress, Capabilities capabilities, HeadlessMode headlessMode, PrivateMode privateMode, PageLoadStrategyMode pageLoadStrategyMode, WebSecurityMode webSecurityMode, SandboxMode sandboxMode) {
public static <T extends RemoteWebDriver> T getNewRemoteDriver(RemoteDriverType driverType, URL remoteAddress, Capabilities capabilities, HeadlessMode headlessMode, PrivateMode privateMode, PageLoadStrategyMode pageLoadStrategyMode, WebSecurityMode webSecurityMode, SandboxMode sandboxMode) {
ConfigContext.setConfig(driverType,headlessMode,pageLoadStrategyMode,privateMode,sandboxMode,webSecurityMode);
ConfigContext.setCapabilities(capabilities);
ConfigContext.setRemoteAddress(remoteAddress);
webSetUp();
return (T)RemoteWebDriverThreadLocal.get();
}
@SuppressWarnings("unchecked")
public static <T extends RemoteWebDriver> T getNewDriver(RemoteDriverType driverType, URL remoteAddress, Capabilities capabilities, HeadlessMode headlessMode, PrivateMode privateMode, PageLoadStrategyMode pageLoadStrategyMode, WebSecurityMode webSecurityMode) {
return getNewDriver(driverType,remoteAddress,capabilities,headlessMode,privateMode,pageLoadStrategyMode,webSecurityMode,SandboxMode.Sandbox);
public static <T extends RemoteWebDriver> T getNewRemoteDriver(RemoteDriverType driverType, URL remoteAddress, Capabilities capabilities, HeadlessMode headlessMode, PrivateMode privateMode, PageLoadStrategyMode pageLoadStrategyMode, WebSecurityMode webSecurityMode) {
return getNewRemoteDriver(driverType,remoteAddress,capabilities,headlessMode,privateMode,pageLoadStrategyMode,webSecurityMode,SandboxMode.Sandbox);
}
@SuppressWarnings("unchecked")
public static <T extends RemoteWebDriver> T getNewDriver(RemoteDriverType driverType, URL remoteAddress, Capabilities capabilities, HeadlessMode headlessMode, PrivateMode privateMode, PageLoadStrategyMode pageLoadStrategyMode) {
return getNewDriver(driverType,remoteAddress,capabilities,headlessMode,privateMode,pageLoadStrategyMode,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
public static <T extends RemoteWebDriver> T getNewRemoteDriver(RemoteDriverType driverType, URL remoteAddress, Capabilities capabilities, HeadlessMode headlessMode, PrivateMode privateMode, PageLoadStrategyMode pageLoadStrategyMode) {
return getNewRemoteDriver(driverType,remoteAddress,capabilities,headlessMode,privateMode,pageLoadStrategyMode,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
}
@SuppressWarnings("unchecked")
public static <T extends RemoteWebDriver> T getNewDriver(RemoteDriverType driverType, URL remoteAddress, Capabilities capabilities, HeadlessMode headlessMode, PrivateMode privateMode) {
return getNewDriver(driverType,remoteAddress,capabilities,headlessMode,privateMode,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
public static <T extends RemoteWebDriver> T getNewRemoteDriver(RemoteDriverType driverType, URL remoteAddress, Capabilities capabilities, HeadlessMode headlessMode, PrivateMode privateMode) {
return getNewRemoteDriver(driverType,remoteAddress,capabilities,headlessMode,privateMode,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
}
@SuppressWarnings("unchecked")
public static <T extends RemoteWebDriver> T getNewDriver(RemoteDriverType driverType, URL remoteAddress, Capabilities capabilities, HeadlessMode headlessMode) {
return getNewDriver(driverType,remoteAddress,capabilities,headlessMode,PrivateMode.True,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
public static <T extends RemoteWebDriver> T getNgetNewRemoteDriverewDriver(RemoteDriverType driverType, URL remoteAddress, Capabilities capabilities, HeadlessMode headlessMode) {
return getNewRemoteDriver(driverType,remoteAddress,capabilities,headlessMode,PrivateMode.True,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
}
@SuppressWarnings("unchecked")
public static <T extends RemoteWebDriver> T getNewDriver(RemoteDriverType driverType, URL remoteAddress, Capabilities capabilities) {
return getNewDriver(driverType,remoteAddress,capabilities,HeadlessMode.False,PrivateMode.True,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
public static <T extends RemoteWebDriver> T getNewRemoteDriver(RemoteDriverType driverType, URL remoteAddress, Capabilities capabilities) {
return getNewRemoteDriver(driverType,remoteAddress,capabilities,HeadlessMode.False,PrivateMode.True,PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
}
@SuppressWarnings("unchecked")
public static <T extends WebDriver> T getCurrentDriver() {
Expand Down
30 changes: 0 additions & 30 deletions src/test/java/Base/AppiumBase.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/java/Base/BaseRemote.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class BaseRemote {
@BeforeClass
public void Setup() throws MalformedURLException {
DesiredCapabilities capabilities=new DesiredCapabilities();
driver= DriverFactory.getNewDriver(RemoteDriverType.REMOTE_Chrome ,new URL("http://localhost:4444/wd/hub"),capabilities);
driver= DriverFactory.getNewRemoteDriver(RemoteDriverType.REMOTE_Chrome ,new URL("http://localhost:4444/wd/hub"),capabilities);
home=new HomPage(driver);
}
@AfterClass
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/Base/BaseStepDefinitions.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
public class BaseStepDefinitions {
protected WebDriver driver;
public BaseStepDefinitions(){
driver= DriverFactory.getNewDriver(LocalDriverType.Chrome, HeadlessMode.False, PrivateMode.True);
driver= DriverFactory.getNewLocalDriver(LocalDriverType.Chrome, HeadlessMode.False, PrivateMode.True);
}
}
2 changes: 1 addition & 1 deletion src/test/java/Base/BaseTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class BaseTests extends NonBDDSetup {
protected HomPage home;
@BeforeClass
public void Setup(){
driver= DriverFactory.getNewDriver(LocalDriverType.Chrome, HeadlessMode.False, PrivateMode.True, PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
driver= DriverFactory.getNewLocalDriver(LocalDriverType.Chrome, HeadlessMode.False, PrivateMode.True, PageLoadStrategyMode.Normal,WebSecurityMode.SecureMode,SandboxMode.Sandbox);
home=new HomPage(driver);
}
@AfterClass
Expand Down

0 comments on commit 9ff8f09

Please sign in to comment.