Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Make it easier to manually run GWT tests from the IDE #5725

Merged
merged 3 commits into from
Jul 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.'''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of confused when I first read this, suggest modifying the wording a bit.

Suggested change
When the URL appears to run in your browser, click on it, or refresh an existing browser window.'''
Click the URL that is printed out to run the test in your browser, 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
Loading