Project

General

Profile

« Previous | Next » 

Revision 0717bbad

Added by Andreas Kohlbecker almost 13 years ago

selenium unit test - now works with with firefox 3.x

View differences:

.gitattributes
250 250
modules/cdm_dataportal/test/java/dataportal-selenium-tests/pom.xml -text
251 251
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/SearchLCommunis.java -text
252 252
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/resources/org/mozilla/addons/add_on_compatibility_reporter-0.8.3-fx+tb+sm.xpi -text
253
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/resources/org/mozilla/addons/firebug-1.6.2.xpi -text
253 254
modules/cdm_dataportal/test/phpUnit/TestUtils.php -text
254 255
modules/cdm_dataportal/test/phpUnit/bootstrap.php -text
255 256
modules/cdm_dataportal/test/phpUnit/phpUnit.conf.xml -text
modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/SearchLCommunis.java
18 18

  
19 19
public class SearchLCommunis  {
20 20
	
21
	private static final String FIREBUG_VERSION = "1.6.2";
22

  
21 23
	WebDriver driver;
22 24
	
23 25
	static String baseUrl = "http://wp6-cichorieae.e-taxonomy.eu/portal/";
......
29 31
    }
30 32

  
31 33
	private WebDriver initChromeDriver() {
32
		System.setProperty("webdriver.chrome.bin", "C:\\Dokumente und Einstellungen\\a.kohlbecker.BGBM\\Lokale Einstellungen\\Anwendungsdaten\\Google\\Chrome\\Application\\chrome.exe");
34
		//System.setProperty("webdriver.chrome.bin", "C:\\Dokumente und Einstellungen\\a.kohlbecker.BGBM\\Lokale Einstellungen\\Anwendungsdaten\\Google\\Chrome\\Application\\chrome.exe");
33 35
		return new ChromeDriver();
34 36
	}
35 37
	
......
38 40
	}
39 41
	
40 42
	/**
43
	 * -Dwebdriver.firefox.bin=/usr/lib/iceweasel/firefox-bin
44
	 * 
41 45
	 * See http://code.google.com/p/selenium/wiki/FirefoxDriverInternals
42 46
	 * @return
43 47
	 */
44 48
	private WebDriver initFirefoxDriver() {
49
		//System.setProperty("webdriver.firefox.bin", "C:\\Programme\\Mozilla Firefox 3\\firefox.exe");
50
		//System.out.println("##:" + System.getProperty("webdriver.firefox.bin"));
45 51
		FirefoxProfile firefoxProfile = new FirefoxProfile();
46 52
    	try {
47
			firefoxProfile.addExtension(SearchLCommunis.class, "/org/mozilla/addons/add_on_compatibility_reporter-0.8.3-fx+tb+sm.xpi");
48
			firefoxProfile.setPreference("extensions.acr.firstrun", false);
49
			firefoxProfile.setPreference("extensions.enabledAddons", "fxdriver@googlecode.com,compatibility@addons.mozilla.org:0.8.3,fxdriver@googlecode.com:0.9.7376,{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}:6.0.24,{20a82645-c095-46ed-80e3-08825760534b}:0.0.0,meetinglauncher@iconf.net:4.10.12.316,jqs@sun.com:1.0,{972ce4c6-7e08-4474-a285-3208198ce6fd}:4.0");
50
			firefoxProfile.setPreference("extensions.checkCompatibility", false);
51
			firefoxProfile.setPreference("extensions.checkCompatibility.4.0", false);
52
			firefoxProfile.setPreference("extensions.checkCompatibility.4.1", false);
53
    		
54
    		firefoxProfile.addExtension(this.getClass(), "/org/mozilla/addons/firebug-" + FIREBUG_VERSION + ".xpi");
55
    		firefoxProfile.setPreference("extensions.firebug.currentVersion", FIREBUG_VERSION); // avoid displaying firt run page
56
    		
57
    		// --- allow enabling incompatible addons
58
//			firefoxProfile.addExtension(this.getClass(), "/org/mozilla/addons/add_on_compatibility_reporter-0.8.3-fx+tb+sm.xpi");
59
//			firefoxProfile.setPreference("extensions.acr.firstrun", false);
60
//			firefoxProfile.setPreference("extensions.enabledAddons", "fxdriver@googlecode.com,compatibility@addons.mozilla.org:0.8.3,fxdriver@googlecode.com:0.9.7376,{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}:6.0.24,{20a82645-c095-46ed-80e3-08825760534b}:0.0.0,meetinglauncher@iconf.net:4.10.12.316,jqs@sun.com:1.0,{972ce4c6-7e08-4474-a285-3208198ce6fd}:4.0");
61
//			firefoxProfile.setPreference("extensions.checkCompatibility", false);
62
//			firefoxProfile.setPreference("extensions.checkCompatibility.4.0", false);
63
//			firefoxProfile.setPreference("extensions.checkCompatibility.4.1", false);
64
			
65
			
53 66
			
54 67
    	} catch (IOException e) {
55 68
			// TODO Auto-generated catch block
56 69
			e.printStackTrace();
57 70
			System.exit(-1);
58 71
		}
59
        return new FirefoxDriver(firefoxProfile);
72
		driver = new FirefoxDriver(firefoxProfile);
73
		
74
        return driver;
60 75
	}
61 76

  
62 77
    @After
......
66 81

  
67 82
    @Test
68 83
	public void testSearchLCommunis() throws Exception {
69
    	driver.get(baseUrl + "?query=Lapsana+com*&search%5Btree%5D=534e190f-3339-49ba-95d9-fa27d5493e3e&q=cdm_dataportal%2Fsearch%2Ftaxon&search%5BpageSize%5D=25&search%5BdoTaxa%5D=1&search%5BdoSynonyms%5D=1&search%5BdoTaxaByCommonNames%5D=0");
84
    	driver.get(baseUrl + "?query=Lapsana+com*&search[tree]=534e190f-3339-49ba-95d9-fa27d5493e3e&q=cdm_dataportal%2Fsearch%2Ftaxon&search[pageSize]=25&search[pageNumber]=0&search[doTaxa]=1&search[doSynonyms]=1&search[doTaxaByCommonNames]=0");
70 85
    	WebElement taxonElement = driver.findElement(By.xpath("/html/body/div/div/div[2]/div[2]/div/div/div/ul/li/span[@ref='/name/f280f79f-5903-47b0-8352-53e4204c6cf1']"));
71 86
    	
72 87
    	WebElement nameElement = taxonElement.findElement(By.className("BotanicalName"));
73
    	Assert.assertEquals("Lapsana", nameElement.findElement(By.xpath("span[0]")).getText());
74
    	Assert.assertEquals("communis", nameElement.findElement(By.xpath("span[1]")).getText());
75
    	Assert.assertEquals("L.", nameElement.findElement(By.xpath("span[2]")).getText());
88
    	Assert.assertEquals("Lapsana", nameElement.findElement(By.xpath("span[1]")).getText());
89
    	Assert.assertEquals("communis", nameElement.findElement(By.xpath("span[2]")).getText());
90
    	Assert.assertEquals("L.", nameElement.findElement(By.xpath("span[3]")).getText());
76 91
    	
77
    	WebElement referenceElement = taxonElement.findElement(By.className("BotanicalName"));
92
    	WebElement referenceElement = taxonElement.findElement(By.className("reference"));
78 93
    	Assert.assertEquals("Sp. Pl.: 811. 1753", referenceElement.findElement((By.className("reference"))).getText());
79 94
	}
80 95

  

Also available in: Unified diff