本文整理了Java中org.mozilla.zest.core.v1.ZestClientScreenshot.<init>()
方法的一些代码示例,展示了ZestClientScreenshot.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZestClientScreenshot.<init>()
方法的具体详情如下:
包路径:org.mozilla.zest.core.v1.ZestClientScreenshot
类名称:ZestClientScreenshot
方法名:<init>
[英]Constructs a ZestClientScreenshot with no file path nor variable name.
[中]构造没有文件路径或变量名的ZestClientScreenshot。
代码示例来源:origin: mozilla/zest
@Test(expected = NullPointerException.class)
public void shouldFailWhenInvokingWithNullRuntime() throws Exception {
// Given
ZestClientScreenshot clientScreenshot =
new ZestClientScreenshot("handle", "/path", "variableName");
ZestRuntime runtime = null;
// When
clientScreenshot.invoke(runtime);
// Then = NullPointerException
}
代码示例来源:origin: mozilla/zest
@Override
public ZestClientScreenshot deepCopy() {
ZestClientScreenshot copy =
new ZestClientScreenshot(getWindowHandle(), getFilePath(), getVariableName());
copy.setEnabled(isEnabled());
return copy;
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldSaveScreenshotToFile() throws Exception {
// Given
Path path = folder.getRoot().toPath().resolve("zcs-file-only.png");
String windowHandle = "windowHandle";
String filePath = path.toString();
ZestClientScreenshot clientScreenshot =
new ZestClientScreenshot(windowHandle, filePath, null);
ZestRuntime runtime =
runtimeWithWebDriverThatTakesScreenshot(windowHandle, SCREENSHOT_DATA);
when(runtime.replaceVariablesInString(filePath, false)).thenReturn(filePath);
// When
clientScreenshot.invoke(runtime);
// Then
assertTrue(Arrays.equals(SCREENSHOT_DATA, Files.readAllBytes(path)));
}
代码示例来源:origin: mozilla/zest
@Test(expected = ZestClientFailException.class)
public void shouldFailToSaveScreenshotToFileDirectory() throws Exception {
// Given
Path path = folder.newFolder().toPath();
String windowHandle = "windowHandle";
String filePath = path.toString();
ZestClientScreenshot clientScreenshot =
new ZestClientScreenshot(windowHandle, filePath, null);
ZestRuntime runtime =
runtimeWithWebDriverThatTakesScreenshot(windowHandle, SCREENSHOT_DATA);
when(runtime.replaceVariablesInString(filePath, false)).thenReturn(filePath);
// When
clientScreenshot.invoke(runtime);
// Then = ZestClientFailException
}
代码示例来源:origin: mozilla/zest
@Test(expected = ZestClientFailException.class)
public void shouldFailToSaveScreenshotToFileAlreadyExists() throws Exception {
// Given
Path path = folder.newFile().toPath();
String windowHandle = "windowHandle";
String filePath = path.toString();
ZestClientScreenshot clientScreenshot =
new ZestClientScreenshot(windowHandle, filePath, null);
ZestRuntime runtime =
runtimeWithWebDriverThatTakesScreenshot(windowHandle, SCREENSHOT_DATA);
when(runtime.replaceVariablesInString(filePath, false)).thenReturn(filePath);
// When
clientScreenshot.invoke(runtime);
// Then = ZestClientFailException
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldNotHaveWindowHandleByDefault() {
// Given / When
ZestClientScreenshot clientScreenshot = new ZestClientScreenshot();
// Then
assertEquals(null, clientScreenshot.getWindowHandle());
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldNotHaveVariableNameByDefault() {
// Given / When
ZestClientScreenshot clientScreenshot = new ZestClientScreenshot();
// Then
assertEquals(null, clientScreenshot.getVariableName());
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldBeEnabledByDefault() {
// Given / When
ZestClientScreenshot clientScreenshot = new ZestClientScreenshot();
// Then
assertEquals(true, clientScreenshot.isEnabled());
}
代码示例来源:origin: mozilla/zest
@Test(expected = ZestClientFailException.class)
public void shouldFailToInvokeIfWindowHandleNotAvailable() throws Exception {
// Given
ZestClientScreenshot clientScreenshot =
new ZestClientScreenshot("handle", "/path", "variableName");
ZestRuntime runtime = runtime();
// When
clientScreenshot.invoke(runtime);
// Then = ZestClientFailException
}
代码示例来源:origin: mozilla/zest
@Test(expected = ZestClientFailException.class)
public void shouldFailToInvokeIfClientTakeScreenshotsButFileAndVariableAreEmpty()
throws Exception {
// Given
String windowHandle = "windowHandle";
ZestClientScreenshot clientScreenshot = new ZestClientScreenshot(windowHandle, "", "");
ZestRuntime runtime = runtimeWithWebDriverThatTakesScreenshot(windowHandle);
// When
clientScreenshot.invoke(runtime);
// Then = ZestClientFailException
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldBePassive() {
// Given / When
ZestClientScreenshot clientScreenshot = new ZestClientScreenshot();
// Then
assertEquals(true, clientScreenshot.isPassive());
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldNotHaveFilePathByDefault() {
// Given / When
ZestClientScreenshot clientScreenshot = new ZestClientScreenshot();
// Then
assertEquals(null, clientScreenshot.getFilePath());
}
代码示例来源:origin: mozilla/zest
@Test(expected = ZestClientFailException.class)
public void shouldFailToInvokeIfClientDoesNotTakeScreenshots() throws Exception {
// Given
String windowHandle = "handle";
ZestClientScreenshot clientScreenshot =
new ZestClientScreenshot(windowHandle, "/path", "variableName");
ZestRuntime runtime = runtimeWithWebDriver(windowHandle);
// When
clientScreenshot.invoke(runtime);
// Then = ZestClientFailException
}
代码示例来源:origin: mozilla/zest
@Test(expected = ZestClientFailException.class)
public void shouldFailToInvokeIfClientTakeScreenshotsButFileAndVariableAreNull()
throws Exception {
// Given
String windowHandle = "windowHandle";
ZestClientScreenshot clientScreenshot = new ZestClientScreenshot(windowHandle, null, null);
ZestRuntime runtime = runtimeWithWebDriverThatTakesScreenshot(windowHandle);
// When
clientScreenshot.invoke(runtime);
// Then = ZestClientFailException
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldSaveScreenshotToVariable() throws Exception {
// Given
String windowHandle = "windowHandle";
String variableName = "variableName";
ZestClientScreenshot clientScreenshot =
new ZestClientScreenshot(windowHandle, null, variableName);
ZestRuntime runtime =
runtimeWithWebDriverThatTakesScreenshot(windowHandle, SCREENSHOT_DATA);
// When
clientScreenshot.invoke(runtime);
// Then
verify(runtime).setVariable(variableName, SCREENSHOT_DATA_BASE_64);
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldSetVariableName() {
// Given
String variableName = "variableName";
ZestClientScreenshot clientScreenshot = new ZestClientScreenshot();
// When
clientScreenshot.setVariableName("variableName");
// Then
assertEquals(variableName, clientScreenshot.getVariableName());
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldSetEnabled() {
// Given
boolean enabled = false;
ZestClientScreenshot clientScreenshot = new ZestClientScreenshot();
// When
clientScreenshot.setEnabled(enabled);
// Then
assertEquals(enabled, clientScreenshot.isEnabled());
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldSetWindowHandle() {
// Given
String windowHandle = "windowHandle";
ZestClientScreenshot clientScreenshot = new ZestClientScreenshot();
// When
clientScreenshot.setWindowHandle(windowHandle);
// Then
assertEquals(windowHandle, clientScreenshot.getWindowHandle());
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldSetFilePath() {
// Given
String filePath = "/path";
ZestClientScreenshot clientScreenshot = new ZestClientScreenshot();
// When
clientScreenshot.setFilePath(filePath);
// Then
assertEquals(filePath, clientScreenshot.getFilePath());
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldConstructWithFilePathAndVariableName() {
// Given
String windowHandle = "windowHandle";
String filePath = "/path";
String variableName = "variableName";
// When
ZestClientScreenshot clientScreenshot =
new ZestClientScreenshot(windowHandle, filePath, variableName);
// Then
assertEquals(windowHandle, clientScreenshot.getWindowHandle());
assertEquals(filePath, clientScreenshot.getFilePath());
assertEquals(variableName, clientScreenshot.getVariableName());
}
内容来源于网络,如有侵权,请联系作者删除!