use of com.seleniumtests.browserfactory.BrowserExtension in project seleniumRobot by bhecquet.
the class TestBrowserExtension method testCreateExtensionFromOptions.
/**
* Test standard case where extension and options are defined
*/
@Test(groups = "ut")
public void testCreateExtensionFromOptions() {
Map<String, TestVariable> options = new HashMap<>();
options.put("extension0.path", new TestVariable("extension0.path", "/home/test/ext.crx"));
options.put("extension0.options", new TestVariable("extension0.options", "key1=value1;key2=value2"));
List<BrowserExtension> extensions = BrowserExtension.getExtensions(options);
Assert.assertEquals(extensions.size(), 1);
Assert.assertEquals(extensions.get(0).getExtensionPath(), new File("/home/test/ext.crx"));
Assert.assertEquals(extensions.get(0).getOptions().size(), 2);
Assert.assertEquals(extensions.get(0).getOptions().get("key1"), "value1");
Assert.assertEquals(extensions.get(0).getOptions().get("key2"), "value2");
}
use of com.seleniumtests.browserfactory.BrowserExtension in project seleniumRobot by bhecquet.
the class TestBrowserExtension method testCreateExtensionWithoutOptions.
/**
* Test when options do not define extension parameters
*/
@Test(groups = "ut")
public void testCreateExtensionWithoutOptions() {
Map<String, TestVariable> options = new HashMap<>();
options.put("extension0.path", new TestVariable("extension0.path", "/home/test/ext.crx"));
List<BrowserExtension> extensions = BrowserExtension.getExtensions(options);
Assert.assertEquals(extensions.size(), 1);
Assert.assertEquals(extensions.get(0).getExtensionPath(), new File("/home/test/ext.crx"));
Assert.assertEquals(extensions.get(0).getOptions().size(), 0);
}
use of com.seleniumtests.browserfactory.BrowserExtension in project seleniumRobot by bhecquet.
the class TestBrowserExtension method testExtensionFromUrl.
@Test(groups = "ut")
public void testExtensionFromUrl() throws IOException {
BrowserExtension extension = new BrowserExtension(String.format("http://%s:%d/test.html", localAddress, server.getServerHost().getPort()));
Assert.assertEquals(extension.getExtensionPath().getParentFile(), File.createTempFile("file", ".tmp").getParentFile());
Assert.assertEquals(FilenameUtils.getExtension(extension.getExtensionPath().getName()), "html");
}
Aggregations