Skip to content

Commit

Permalink
[test] delete Screenshots after sucess tests
Browse files Browse the repository at this point in the history
2MB artifact in i builds
  • Loading branch information
EcljpseB0T committed Sep 17, 2024
1 parent a43889d commit b1192e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.io.File;

import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
import org.eclipse.jface.databinding.swt.typed.WidgetProperties;
Expand Down Expand Up @@ -235,13 +237,14 @@ public void testObserveFocus() {
System.out.println("active shell (5): " + shell.getDisplay().getActiveShell());

System.out.println("Value (should be true): " + value.getValue());
Screenshots.takeScreenshot(getClass(), getClass().getSimpleName(), System.out);
String screenshot = Screenshots.takeScreenshot(getClass(), getClass().getSimpleName(), System.out);

assertTrue(value.getValue());

assertEquals(1, tracker.count);
assertFalse(tracker.event.diff.getOldValue());
assertTrue(tracker.event.diff.getNewValue());
new File(screenshot).delete();
}

private void processDisplayQueue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public class ScreenshotTest {

@Test
public void testScreenshot() throws Exception {
takeScreenshot(ScreenshotTest.class, testName.getMethodName(), System.out);
String screenshot= takeScreenshot(ScreenshotTest.class, testName.getMethodName(), System.out);
new File(screenshot).delete();
}

@Test
Expand Down Expand Up @@ -73,7 +74,7 @@ public void testWindowsTaskManagerScreenshots() throws Exception {
System.out.println("* CTRL up " + display.post(event));

runEventQueue();
takeScreenshot(ScreenshotTest.class, testName.getMethodName() + 2, System.out);
String screenshot1= takeScreenshot(ScreenshotTest.class, testName.getMethodName() + 2, System.out);

event.type= SWT.KeyDown;
event.character= SWT.ESC;
Expand All @@ -83,7 +84,9 @@ public void testWindowsTaskManagerScreenshots() throws Exception {
System.out.println("* ESC up " + display.post(event));

runEventQueue();
takeScreenshot(ScreenshotTest.class, testName.getMethodName() + 3, System.out);
String screenshot2= takeScreenshot(ScreenshotTest.class, testName.getMethodName() + 3, System.out);
new File(screenshot1).delete();
new File(screenshot2).delete();
}

/**
Expand Down

0 comments on commit b1192e0

Please sign in to comment.