Skip to content

Commit

Permalink
Make it easier to manually run GWT tests from the IDE
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Jul 5, 2024
1 parent 99b9c3d commit 90b58a4
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions web/client-api/client-api.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ artifacts {

def gwtUnitTest = tasks.register('gwtUnitTest', Test) { t ->
t.systemProperties = [
'gwt.args': ['-runStyle HtmlUnit',
'gwt.args': ['-sourceLevel auto',
'-runStyle HtmlUnit',
'-ea',
'-style PRETTY',
"-war ${layout.buildDirectory.dir('unitTest-war').get().asFile.absolutePath}"
Expand Down Expand Up @@ -139,17 +140,17 @@ def stopSelenium = project.tasks.register('stopSelenium', DockerRemoveContainer)
def gwtIntegrationTest = tasks.register('gwtIntegrationTest', Test) { t ->
t.dependsOn(deephavenDocker.portTask, seleniumHealthy)
t.finalizedBy(deephavenDocker.endTask, stopSelenium)
doFirst {
t.doFirst {
def webdriverUrl = "http://localhost:${seleniumPort}/"
t.systemProperty('gwt.args', ["-runStyle io.deephaven.web.junit.RunStyleRemoteWebDriver:${webdriverUrl}?firefox",
t.systemProperty('gwt.args', ['-sourceLevel auto',
"-runStyle io.deephaven.web.junit.RunStyleRemoteWebDriver:${webdriverUrl}?firefox",
'-ea',
'-style PRETTY',
"-setProperty dh.server=http://${deephavenDocker.containerName.get()}:10000",
"-war ${layout.buildDirectory.dir('integrationTest-war').get().asFile.absolutePath}"
].join(' '))
t.classpath += tasks.getByName('gwtCompile').src
}
t.finalizedBy(deephavenDocker.endTask)
t.systemProperties = [
'gwt.persistentunitcachedir':layout.buildDirectory.dir('integrationTest-unitCache').get().asFile.absolutePath,
'webdriver.test.host':'host.docker.internal',
Expand All @@ -159,6 +160,37 @@ def gwtIntegrationTest = tasks.register('gwtIntegrationTest', Test) { t ->
t.scanForTestClasses = false
}

tasks.register('manualGwtTest', Test) {t ->
t.description = '''Test wiring to run either unit or integration tests with a manual browser and an already-running server.
This makes it easier to run a tests repeatedly, either one at a time or as a class/suite, without
paying to start/stop selenium and deephaven each time. The port will remain constant at 8888 each
run to let breakpoints continue to work across repeated runs.
To use this, first start a server on port 10000 with anonymous access enabled. Then, either select
a test in IntelliJ to run using the manualGwtTest task, or invoke from the command line with info
logging enabled and a specific test selected, e.g.:
./gradlew :web-client-api:manualGwtTest --info --tests io.deephaven.web.client.api.NullValueTestGwt
When the URL appears to run in your browser, click on it, or refresh an existing browser window.'''
t.doFirst {
t.systemProperty 'gwt.args', ['-port 8888',
'-sourceLevel auto',
'-runStyle Manual:1',
'-ea',
'-style PRETTY',
'-setProperty dh.server=http://localhost:10000',
'-setProperty compiler.useSourceMaps=true',
"-war ${layout.buildDirectory.dir('manualTest-war').get().asFile.absolutePath}"
].join(' ')
t.classpath += tasks.getByName('gwtCompile').src
}
t.systemProperties = [
'gwt.persistentunitcachedir':layout.buildDirectory.dir('integrationTest-unitCache').get().asFile.absolutePath,
]
t.useJUnit()
t.scanForTestClasses = false
}

tasks.named('check').configure {
dependsOn(gwtUnitTest, gwtIntegrationTest)
}
Expand Down

0 comments on commit 90b58a4

Please sign in to comment.