Project

General

Profile

« Previous | Next » 

Revision 1e1c8a26

Added by Andreas Kohlbecker almost 13 years ago

unit tests are dataportal configuration aware

View differences:

modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/CdmDataPortalTestBase.java
5 5

  
6 6
import java.io.IOException;
7 7

  
8
import org.junit.AfterClass;
9
import org.junit.BeforeClass;
10
import org.junit.runner.RunWith;
8 11
import org.openqa.selenium.WebDriver;
9 12
import org.openqa.selenium.chrome.ChromeDriver;
10 13
import org.openqa.selenium.firefox.FirefoxDriver;
11 14
import org.openqa.selenium.firefox.FirefoxProfile;
12 15
import org.openqa.selenium.ie.InternetExplorerDriver;
13 16

  
17
import eu.etaxonomy.dataportal.DataPortalContextAwareRunner;
18

  
14 19
/**
15 20
 * @author a.kohlbecker
16 21
 *
17 22
 */
23
@RunWith(DataPortalContextAwareRunner.class)
18 24
public abstract class CdmDataPortalTestBase {
19 25
	
20 26
	private static final String FIREBUG_VERSION = "1.6.2";
21 27

  
22
	protected WebDriver driver;
28
	protected static WebDriver driver;
29

  
30
    @BeforeClass
31
    public static void setUpDriver() {
32
    	driver = initFirefoxDriver();
33
    }
34
    
35
    
36
    @AfterClass
37
    public static void closeDriver() {
38
    	if(driver != null){
39
    		driver.quit();
40
    	}
41
    }
23 42
	
24 43
	public WebDriver initChromeDriver() {
25 44
		//System.setProperty("webdriver.chrome.bin", "C:\\Dokumente und Einstellungen\\a.kohlbecker.BGBM\\Lokale Einstellungen\\Anwendungsdaten\\Google\\Chrome\\Application\\chrome.exe");
......
36 55
	 * See http://code.google.com/p/selenium/wiki/FirefoxDriverInternals
37 56
	 * @return
38 57
	 */
39
	public WebDriver initFirefoxDriver() {
58
	public static WebDriver initFirefoxDriver() {
40 59
		//System.setProperty("webdriver.firefox.bin", "C:\\Programme\\Mozilla Firefox 3\\firefox.exe");
41 60
		//System.out.println("##:" + System.getProperty("webdriver.firefox.bin"));
42 61
		FirefoxProfile firefoxProfile = new FirefoxProfile();
43 62
    	try {
44 63
    		
45
    		firefoxProfile.addExtension(this.getClass(), "/org/mozilla/addons/firebug-" + FIREBUG_VERSION + ".xpi");
64
    		firefoxProfile.addExtension(CdmDataPortalTestBase.class, "/org/mozilla/addons/firebug-" + FIREBUG_VERSION + ".xpi");
46 65
    		firefoxProfile.setPreference("extensions.firebug.currentVersion", FIREBUG_VERSION); // avoid displaying firt run page
47 66
    		
48 67
    		// --- allow enabling incompatible addons
......
62 81
		
63 82
        return driver;
64 83
	}
84
	
65 85

  
66 86
}

Also available in: Unified diff