forked from Ardesco/Selenium-Maven-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update template to use latest library and plugin versions.
Add Marionette configuration
- Loading branch information
Showing
10 changed files
with
150 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.lazerycode.selenium; | ||
|
||
import com.lazerycode.selenium.config.DriverFactory; | ||
import com.lazerycode.selenium.listeners.ScreenshotListener; | ||
import org.openqa.selenium.WebDriver; | ||
import org.testng.annotations.AfterMethod; | ||
import org.testng.annotations.AfterSuite; | ||
import org.testng.annotations.BeforeSuite; | ||
import org.testng.annotations.Listeners; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
@Listeners(ScreenshotListener.class) | ||
public class DriverBase { | ||
|
||
private static List<DriverFactory> webDriverThreadPool = Collections.synchronizedList(new ArrayList<DriverFactory>()); | ||
private static ThreadLocal<DriverFactory> driverFactory; | ||
|
||
@BeforeSuite(alwaysRun = true) | ||
public static void instantiateDriverObject() { | ||
driverFactory = new ThreadLocal<DriverFactory>() { | ||
@Override | ||
protected DriverFactory initialValue() { | ||
DriverFactory driverFactory = new DriverFactory(); | ||
webDriverThreadPool.add(driverFactory); | ||
return driverFactory; | ||
} | ||
}; | ||
} | ||
|
||
public static WebDriver getDriver() throws Exception { | ||
return driverFactory.get().getDriver(); | ||
} | ||
|
||
@AfterMethod(alwaysRun = true) | ||
public static void clearCookies() throws Exception { | ||
getDriver().manage().deleteAllCookies(); | ||
} | ||
|
||
@AfterSuite(alwaysRun = true) | ||
public static void closeDriverObjects() { | ||
for (DriverFactory driverFactory : webDriverThreadPool) { | ||
driverFactory.quitDriver(); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/test/java/com/lazerycode/selenium/tests/GoogleExampleIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.