Skip to content

Commit

Permalink
Exclude media-recorder tests when running on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
besidev committed Oct 17, 2024
1 parent 64b4e84 commit 47b0ff9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on: [push]
env:
DISPLAY: ":99"
XVFB_PARAMS: "-screen 0 1920x1080x24"
RUNNING_ON_CI: true

jobs:
builds:
Expand Down
13 changes: 13 additions & 0 deletions jpro-media/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ test {
"--add-exports", "javafx.graphics/com.sun.javafx.util=org.testfx.monocle",
"--add-exports", "javafx.graphics/com.sun.glass.ui=org.testfx.monocle"
]

// Check if the RUNNING_ON_CI environment variable is set to 'true'
def runningOnCi = System.getenv('RUNNING_ON_CI') == 'true'

// Pass the environment variable to the test JVM as a system property
systemProperty 'RUNNING_ON_CI', runningOnCi

// Exclude media tests when running on CI
if (runningOnCi) {
filter {
excludeTags 'media-recorder'
}
}
}

javadoc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.concurrent.TimeoutException;

import static one.jpro.platform.media.recorder.MediaRecorder.Status;
import static org.junit.jupiter.api.Assumptions.assumeFalse;
import static org.testfx.assertions.api.Assertions.assertThat;

/**
Expand Down Expand Up @@ -114,10 +113,9 @@ public void start(Stage stage) {
}

@Test
@Tag("media-recorder")
@Order(1)
public void media_recorder_enable(FxRobot robot) throws TimeoutException {
skipTestOnCI();

log.debug("MediaRecorder => Testing enable functionality...");
log.debug("Click on enable camera button");
robot.clickOn(enableCamButton); // Enable camera (asynchronous operation)
Expand All @@ -135,10 +133,9 @@ public void media_recorder_enable(FxRobot robot) throws TimeoutException {
}

@Test
@Tag("media-recorder")
@Order(2)
public void media_recorder_controls(FxRobot robot) throws TimeoutException {
skipTestOnCI();

log.debug("MediaRecorder => Testing controls...");
log.debug("Click on enable camera button");
robot.clickOn(enableCamButton); // Enable camera (asynchronous operation)
Expand Down Expand Up @@ -198,10 +195,9 @@ public void media_recorder_controls(FxRobot robot) throws TimeoutException {
}

@Test
@Tag("media-recorder")
@Order(3)
public void media_recorder_stress(FxRobot robot) throws TimeoutException {
skipTestOnCI();

log.debug("MediaRecorder => Stress test started...");
log.debug("Click on enable camera button");
robot.clickOn(enableCamButton); // Enable camera (asynchronous operation)
Expand Down Expand Up @@ -266,13 +262,4 @@ private void waitForStatus(Status status, long timeout, TimeUnit timeUnit) throw
assertThat(mediaRecorder.getStatus()).isEqualByComparingTo(status);
WaitForAsyncUtils.waitForFxEvents();
}

private void skipTestOnCI() {
final String runningOnCI = System.getenv("RUNNING_ON_CI");
if (runningOnCI != null && !runningOnCI.isBlank()) {
log.warn("MediaRecorder is not supported on the CI.");
assumeFalse(runningOnCI.equalsIgnoreCase("true"),
"MediaRecorder is not supported on the CI.");
}
}
}

0 comments on commit 47b0ff9

Please sign in to comment.