use of com.seleniumtests.core.TestVariable 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.core.TestVariable in project seleniumRobot by bhecquet.
the class TestSeleniumRobotVariableServerConnector method testFetchVariableFailed.
/**
* get variables failes with error on server side
* @throws UnirestException
*/
@Test(groups = { "ut" }, expectedExceptions = SeleniumRobotServerException.class)
public void testFetchVariableFailed() throws UnirestException {
configureMockedVariableServerConnection();
createServerMock(SERVER_URL, "GET", SeleniumRobotVariableServerConnector.VARIABLE_API_URL, 404, "{}");
SeleniumRobotVariableServerConnector connector = new SeleniumRobotVariableServerConnector(true, SERVER_URL, "Test1", null);
Map<String, TestVariable> variables = connector.getVariables();
Assert.assertEquals(variables.get("key1").getValue(), "value1");
Assert.assertEquals(variables.get("key2").getValue(), "value2");
}
use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.
the class TestSeleniumRobotVariableServerConnector method testVariableRecreateExistingVariable.
/**
* Variable is re-created when user has changed the value of a non-custom variable
* @throws UnirestException
*/
@Test(groups = { "ut" })
public void testVariableRecreateExistingVariable() throws UnirestException {
configureMockedVariableServerConnection();
SeleniumRobotVariableServerConnector connector = new SeleniumRobotVariableServerConnector(true, SERVER_URL, "Test1", null);
TestVariable existingVariable = new TestVariable(12, "key", "value", false, "key");
TestVariable variable = connector.upsertVariable(existingVariable, true);
PowerMockito.verifyStatic(Unirest.class);
Unirest.post(ArgumentMatchers.contains(SeleniumRobotVariableServerConnector.VARIABLE_API_URL));
Assert.assertEquals(variable.getValue(), "value");
}
use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.
the class TestSeleniumRobotVariableServerConnector method testFetchVariableWithNetworkError.
@Test(groups = { "ut" }, expectedExceptions = SeleniumRobotServerException.class)
public void testFetchVariableWithNetworkError() throws UnirestException {
configureMockedVariableServerConnection();
HttpRequest<HttpRequest> req = createServerMock(SERVER_URL, "GET", SeleniumRobotVariableServerConnector.VARIABLE_API_URL, 200, "{}");
when(req.asString()).thenThrow(UnirestException.class);
SeleniumRobotVariableServerConnector connector = new SeleniumRobotVariableServerConnector(true, SERVER_URL, "Test1", null);
Map<String, TestVariable> variables = connector.getVariables();
Assert.assertEquals(variables.get("key1").getValue(), "value1");
Assert.assertEquals(variables.get("key2").getValue(), "value2");
}
use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.
the class TestSeleniumRobotVariableServerConnector method testVariableUpdateExistingVariableWithServerError.
@Test(groups = { "ut" }, expectedExceptions = SeleniumRobotServerException.class)
public void testVariableUpdateExistingVariableWithServerError() throws UnirestException {
configureMockedVariableServerConnection();
createServerMock(SERVER_URL, "PATCH", String.format(SeleniumRobotVariableServerConnector.EXISTING_VARIABLE_API_URL, 12), 500, "{}");
SeleniumRobotVariableServerConnector connector = new SeleniumRobotVariableServerConnector(true, SERVER_URL, "Test1", null);
TestVariable existingVariable = new TestVariable(12, "key", "value", false, TestVariable.TEST_VARIABLE_PREFIX + "key");
connector.upsertVariable(existingVariable, true);
}
Aggregations