load("@rules_jvm_external//:defs.bzl", "artifact")
load("//java:defs.bzl", "JUNIT5_DEPS", "java_library", "java_selenium_test_suite", "java_test_suite")

LARGE_TESTS = [
    "SelectElementTest.java",
    "SelectLargeTest.java",
]

java_library(
    name = "clock",
    srcs = [
        "TickingClock.java",
    ],
    visibility = ["//java/test:__subpackages__"],
    deps = ["//java/src/org/openqa/selenium/support/ui:clock"],
)

java_test_suite(
    name = "SmallTests",
    size = "small",
    srcs = glob(
        ["*Test.java"],
        exclude = LARGE_TESTS,
    ),
    deps = [
        ":clock",
        "//java/src/org/openqa/selenium/remote",
        "//java/src/org/openqa/selenium/support",
        "//java/test/org/openqa/selenium/testing:annotations",
        artifact("com.google.guava:guava"),
        artifact("org.junit.jupiter:junit-jupiter-api"),
        artifact("org.assertj:assertj-core"),
        artifact("org.mockito:mockito-core"),
    ] + JUNIT5_DEPS,
)

java_selenium_test_suite(
    name = "LargeTests",
    size = "large",
    srcs = LARGE_TESTS,
    browsers = [
        "firefox",
    ],
    deps = [
        "//java/src/org/openqa/selenium:core",
        "//java/src/org/openqa/selenium/support",
        "//java/test/org/openqa/selenium/testing:annotations",
        "//java/test/org/openqa/selenium/testing:test-base",
        "//java/test/org/openqa/selenium/testing/drivers",
        artifact("org.junit.jupiter:junit-jupiter-api"),
        artifact("org.assertj:assertj-core"),
    ] + JUNIT5_DEPS,
)
