Skip to content

Commit

Permalink
#593: correct UT
Browse files Browse the repository at this point in the history
  • Loading branch information
bhecquet committed Sep 12, 2023
1 parent 2e7512c commit 1d66f6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void testSnapshotRenaming() throws IOException {
Assert.assertEquals(step.getSnapshots().get(0).getScreenshot().getImagePath(),
"N-A_0-1_step1--" + tmpImgFile.getName().substring(tmpImgFile.getName().length() - 10));
Assert.assertEquals(step.getSnapshots().get(0).getScreenshot().getHtmlSourcePath(),
"N-A_0-1_step1--" + tmpHtmlFile.getName().substring(tmpHtmlFile.getName().length() - 10));
"htmls/N-A_0-1_step1--" + tmpHtmlFile.getName().substring(tmpHtmlFile.getName().length() - 10));

tmpImgFile.deleteOnExit();
tmpHtmlFile.deleteOnExit();
Expand All @@ -170,7 +170,7 @@ public void testSnapshotRenamingNoRandom() throws IOException {
Assert.assertEquals(step.getSnapshots().get(0).getScreenshot().getImagePath(),
"N-A_0-1_step1-.png");
Assert.assertEquals(step.getSnapshots().get(0).getScreenshot().getHtmlSourcePath(),
"N-A_0-1_step1-.html");
"htmls/N-A_0-1_step1-.html");

tmpImgFile.deleteOnExit();
tmpHtmlFile.deleteOnExit();
Expand Down Expand Up @@ -198,7 +198,7 @@ public void testSnapshotRenamingWithCustomName() throws IOException {
Assert.assertEquals(step.getSnapshots().get(0).getScreenshot().getImagePath(),
"my_snapshot_-name--" + tmpImgFile.getName().substring(tmpImgFile.getName().length() - 10));
Assert.assertEquals(step.getSnapshots().get(0).getScreenshot().getHtmlSourcePath(),
"my_snapshot_-name--" + tmpHtmlFile.getName().substring(tmpHtmlFile.getName().length() - 10));
"htmls/my_snapshot_-name--" + tmpHtmlFile.getName().substring(tmpHtmlFile.getName().length() - 10));

tmpImgFile.deleteOnExit();
tmpHtmlFile.deleteOnExit();
Expand Down Expand Up @@ -761,7 +761,6 @@ public void testToJson() throws IOException {

Assert.assertEquals(stepJson.getJSONArray("files").getJSONObject(0).getString("type"), "file");
Assert.assertEquals(stepJson.getJSONArray("files").getJSONObject(0).getString("name"), "video file");
Assert.assertTrue(stepJson.getJSONArray("files").getJSONObject(0).getString("file").contains(".avi"));

Assert.assertEquals(stepJson.getJSONArray("snapshots").getJSONObject(0).getString("type"), "snapshot");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,13 @@ public void init() throws IOException {

File screenCaptureFile = createImageFromResource("tu/imageFieldDetection/screenCapture.png");
File browserCaptureFile = createImageFromResource("tu/imageFieldDetection/browserCapture.png");
FileUtils.moveFile(screenCaptureFile, Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), screenCaptureFile.getName()).toFile());
FileUtils.moveFile(browserCaptureFile, Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), browserCaptureFile.getName()).toFile());
File newScreenCaptureFile = Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), screenCaptureFile.getName()).toFile();
FileUtils.moveFile(screenCaptureFile, newScreenCaptureFile);
File newBrowserCaptureFile = Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), browserCaptureFile.getName()).toFile();
FileUtils.moveFile(browserCaptureFile, newBrowserCaptureFile);

screenCapture = new ScreenShot(screenCaptureFile, null, "");
browserCapture = new ScreenShot(browserCaptureFile, null, "");
screenCapture = new ScreenShot(newScreenCaptureFile, null, "");
browserCapture = new ScreenShot(newBrowserCaptureFile, null, "");

}

Expand Down

0 comments on commit 1d66f6e

Please sign in to comment.