Skip to content

test: run JUnit 6 browser ITs on the Selenium hub when test.use.hub is set (#27590) (CP: 25.4) - #27684

Merged
vaadin-bot merged 1 commit into
25.4from
cherry-pick-27590-to-25.4-1796394939699
Dec 4, 2026
Merged

vaadin-bot merged 1 commit into
25.4from
cherry-pick-27590-to-25.4-1796394939699

Conversation

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This PR cherry-picks changes from the original PR #27590 to branch 25.4.


Follow-up to #27547

build failure · flow-tests · the nightly dev loop build on bender.vaadin.com

The first nightly dev loop builds on bender failed in every browser IT: the tests started the Chrome installed on the agent, Chrome 115, which Vaadin no longer supports, so each test timed out on the "your browser is not supported" page. With this change the JUnit 6 browser ITs use the Selenium hub on bender, the same as the JUnit 4 tests already do.

Risks:

  • 🔒 The dev loop test applications accept dev tools connections from any host, not only localhost. Test fixtures in dev mode only; nothing outside flow-tests/test-devloop changes.
  • ✅ Without -Dtest.use.hub=true the tests still start a local Chrome on localhost, so GitHub Actions runs are unchanged.

Context. The JUnit 4 base class goes to the hub when test.use.hub is set and opens the application by the agent's IP address; the JUnit 6 base class always started a local Chrome. Flow only lets dev tools connect from localhost, and the dev loop browser ITs need dev tools to bring an applied change into the open page, so a browser on the hub needs devmode.hostsAllowed.

  • AbstractBrowserIT in flow-test-util-junit6 creates a RemoteWebDriver on the hub named by com.vaadin.testbench.Parameters.hubHostname when test.use.hub is set, and builds the root URL from the new getDeploymentHostname(): the site local address on the hub, localhost otherwise
  • DevLoopBrowserIT, DevLoopSpringStatisticsIT and AbstractCspStrictIT open the application by that host name instead of a fixed localhost
  • Every dev loop fixture passes vaadin.devmode.hostsAllowed=* to its server, the same way it already passes vaadin.contentSecurityPolicy; the Spring Boot fixture sets it in application.properties
    • The value is a pom property and not a -D on the build, because the vaadin-dev daemon starts the server through a Maven run of its own

…s set (#27590) (CP: 25.4)

Follow-up to #27547

**build failure** · flow-tests · the nightly dev loop build on
bender.vaadin.com

The first nightly dev loop builds on bender failed in every browser IT:
the tests started the Chrome installed on the agent, Chrome 115, which
Vaadin no longer supports, so each test timed out on the "your browser
is not supported" page. With this change the JUnit 6 browser ITs use the
Selenium hub on bender, the same as the JUnit 4 tests already do.

**Risks:**
- 🔒 The dev loop test applications accept dev tools connections from any
host, not only localhost. Test fixtures in dev mode only; nothing
outside `flow-tests/test-devloop` changes.
- ✅ Without `-Dtest.use.hub=true` the tests still start a local Chrome
on `localhost`, so GitHub Actions runs are unchanged.

**Context.** The JUnit 4 base class goes to the hub when `test.use.hub`
is set and opens the application by the agent's IP address; the JUnit 6
base class always started a local Chrome. Flow only lets dev tools
connect from localhost, and the dev loop browser ITs need dev tools to
bring an applied change into the open page, so a browser on the hub
needs `devmode.hostsAllowed`.

- `AbstractBrowserIT` in `flow-test-util-junit6` creates a
`RemoteWebDriver` on the hub named by
`com.vaadin.testbench.Parameters.hubHostname` when `test.use.hub` is
set, and builds the root URL from the new `getDeploymentHostname()`: the
site local address on the hub, `localhost` otherwise
- `DevLoopBrowserIT`, `DevLoopSpringStatisticsIT` and
`AbstractCspStrictIT` open the application by that host name instead of
a fixed `localhost`
- Every dev loop fixture passes `vaadin.devmode.hostsAllowed=*` to its
server, the same way it already passes `vaadin.contentSecurityPolicy`;
the Spring Boot fixture sets it in `application.properties`
- The value is a pom property and not a `-D` on the build, because the
`vaadin-dev` daemon starts the server through a Maven run of its own

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

The browser driver and the URL it opens now resolve to the same host

flowchart LR
    subgraph Before
        direction TB
        B1["createDriver()"] --> B2["ChromeDriver, local"]
        B3["getRootURL()"] --> B4["http localhost:PORT"]
    end
    subgraph After
        direction TB
        A1["createDriver()"] -->|"USE_HUB true"| A2["RemoteWebDriver on hub (new)"]:::changed
        A1 -->|"USE_HUB false"| A3["ChromeDriver, local"]
        A4["getDeploymentHostname() (new)"]:::changed --> A5["getRootURL() / rootUrl()"]
        A2 -.->|"same host"| A4
        A3 -.->|"localhost"| A4
    end
    Before ~~~ After
    classDef changed stroke:#c9a227,stroke-width:3px
Loading

Previously AbstractBrowserIT.createDriver() always started a local ChromeDriver and getRootURL() always opened localhost. Now createDriver() branches on the test.use.hub flag (USE_HUB) to start a RemoteWebDriver on the Selenium hub instead, and the new getDeploymentHostname() keeps getRootURL() (and AbstractDevLoopIT.rootUrl(), used by DevLoopBrowserIT, DevLoopSpringStatisticsIT and AbstractCspStrictIT) pointed at the same host the browser actually runs on.

Diagram Bot draws the mechanism this pull request touches; it does not review the change. Verify it against the diff.

Generated by Diagram Bot for #27684 · agent · 33.6 AIC · ⊞ 9.3K · ◷

@vaadin-bot

Copy link
Copy Markdown
Collaborator Author

This PR is eligible for auto-merging policy, so it has been approved automatically. If there are pending conditions, auto merge (with 'squash' method) has been enabled for this PR [Message is sent from bot]

@vaadin-bot
vaadin-bot enabled auto-merge (squash) December 4, 2026 14:48
@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Test Results

 1 662 files   - 33   1 753 suites   - 33   1h 37m 55s ⏱️ - 11m 45s
14 125 tests  -  3  14 053 ✅  -  3  72 💤 ±0  0 ❌ ±0 
14 561 runs   - 76  14 489 ✅  - 76  72 💤 ±0  0 ❌ ±0 

Results for commit 1c463dc. ± Comparison against base commit 9b8cd06.

@vaadin-bot
vaadin-bot merged commit 9a0cbaa into 25.4 Dec 4, 2026
57 checks passed
@vaadin-bot
vaadin-bot deleted the cherry-pick-27590-to-25.4-1796394939699 branch December 4, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants