-
Notifications
You must be signed in to change notification settings - Fork 857
SOLR-8474: Add Selenium-based JUnit tests for the Admin UI #4738
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
Merged
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
feb3597
Add Selenium-based test harness for the AngularJS Admin UI
janhoy 7131cbf
Add test plan document for Admin UI browser tests
janhoy a350a2a
Slim the Selenium dependency footprint
janhoy 5b8cada
Admin UI tests: smoke-test navigation of all screens
janhoy 6f5e108
Upgrade byte-buddy to 1.18.11 project-wide
janhoy ae76824
Admin UI tests: node-level screen display assertions
janhoy 565a3c8
Admin UI tests: per-collection screens and write actions
janhoy 93d5699
Add changelog entry
janhoy cb78e4f
Fix forbidden API usage in Admin UI test harness
janhoy d1c848d
Fix Error Prone UnnecessarilyFullyQualified warnings
janhoy 70abb58
Admin UI test harness: fixture/wait helpers, security.json hook, cons…
janhoy 8c86f7a
Admin UI tests: Collections screen incl. alias, replica and reload ac…
janhoy fcfe638
Admin UI tests: Query, Documents and Paramsets screen classes
janhoy 16f70a2
Admin UI tests: Schema screen incl. field add/delete, and Schema Desi…
janhoy 6e3fab7
Admin UI tests: Logging, Core Admin, Stream and Replication screens
janhoy 6fbacbc
Admin UI tests: finish feature-based regrouping; cloud graph/zkstatus…
janhoy 26d5022
Admin UI tests: BasicAuth login and Security screen (nightly)
janhoy 621ca01
Update Admin UI test plan doc: per-screen coverage and skipped items
janhoy 957c0ee
Admin UI tests: stabilize designer/logging tests, track UI bugs in pl…
janhoy 08b215d
Admin UI tests: query screen paramsets dropdown, edismax toggles, raw…
janhoy c20f68e
Admin UI tests: security screen add-role and add-permission dialogs
janhoy f3c1d6c
Admin UI tests: SQL screen, with the sql module as a test dependency
janhoy 852ef5d
Admin UI tests: standalone-mode harness and Core Admin write actions
janhoy e874a15
Admin UI tests: replication screen actions on a standalone leader/fol…
janhoy 2b1aa89
Admin UI tests: drop Nightly from schema designer test, update plan doc
janhoy 9e8f069
Address Copilot review: EnvUtils for sysprop read, start cluster befo…
janhoy c6c89ad
Less fragile test fixes flakyness.
epugh 975b5ec
Indent license-file first line
janhoy 3678753
Lift bug section into SOLR-18347
janhoy 3871a99
Change awaitsFix URL of AdminUiSchemaDesignerTest to point to SOLR-18347
janhoy 776f2d9
Remove license header from dev-docs markdown
janhoy 7732cb1
Trim admin UI test doc: drop per-screen coverage checklist
janhoy 0644d01
Fix typo in webapp test log4j2 comment
janhoy 40730ba
Serve the real js-client bundle in Admin UI tests, stub only as fallback
janhoy a180558
Drop the js-client stub; always serve the generated bundle
janhoy fc7103a
Make Admin UI browser tests opt-in via @SeleniumTest / -Ptests.seleni…
janhoy 74d7039
Disable Admin UI tests under -PdisableJsClient instead of serving a stub
janhoy b18464b
Add GitHub workflow running the Admin UI browser tests
janhoy c02a5b3
Admin UI tests: js-client bundle fallback for IDE runs, doc polish
janhoy 5d747fe
Rename tests.ui.chrome.binary to tests.selenium.chrome.binary
janhoy 0e7f6c4
Keep node off the default test build chain
janhoy 2b1cd46
Force a fresh page load per test for JS-state isolation
janhoy 2af1b79
Correct doc: ASF Jenkins Chrome availability is unverified
janhoy c4cc512
Stream the js-client bundle instead of caching it in memory
janhoy 2d6b999
Preserve drained console entries for the failure artifact
janhoy 33a77f6
Trigger Admin UI test workflow on its test-framework infrastructure
janhoy 5df3e5d
Stabilize UI tests: retrying click, boot-then-navigate, longer waits
janhoy 5c6de7d
Credit Eric and David in changelog
janhoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| name: Admin UI Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - '*' | ||
| paths: | ||
| - '.github/workflows/admin-ui-test.yml' | ||
| # the Admin UI itself, its browser tests and its build | ||
| - 'solr/webapp/**' | ||
| # the v2 API contract the UI (and its generated js-client) is built against | ||
| - 'solr/api/**' | ||
| # the v2 API implementations backing the UI screens | ||
| - 'solr/core/src/java/org/apache/solr/handler/admin/api/**' | ||
| # the embedded-Jetty harness and test-group annotation this suite runs on | ||
| - 'solr/test-framework/src/java/org/apache/solr/embedded/**' | ||
| - 'solr/test-framework/src/java/org/apache/solr/util/SeleniumTest.java' | ||
| - 'gradle/testing/randomization.gradle' | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Run Admin UI browser tests | ||
|
|
||
| # ubuntu-latest has Chrome preinstalled, which the Selenium tests require | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 40 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
|
|
||
| - uses: ./.github/actions/prepare-for-build | ||
|
|
||
| - name: Run the Admin UI browser tests | ||
| run: ./gradlew :solr:webapp:test -Ptests.selenium=true | ||
|
|
||
| - name: Archive test output (screenshots, page sources, browser logs) | ||
| if: ${{ failure() }} | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: test-output | ||
| path: | | ||
| solr/webapp/build/test-results/** | ||
| solr/webapp/build/tmp/tests-tmp/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| title: > | ||
| Added Selenium-based JUnit test coverage for the Admin UI, driving a headless Chrome against a test cluster. | ||
| type: other | ||
| authors: | ||
| - name: Jan Høydahl | ||
| - name: Eric Pugh | ||
| - name: David Smiley | ||
| links: | ||
| - name: SOLR-8474 | ||
| url: https://issues.apache.org/jira/browse/SOLR-8474 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # Admin UI (AngularJS) Browser Tests | ||
|
|
||
| Browser-based tests of the old AngularJS Admin UI (`solr/webapp/web/`), driven by | ||
| Selenium WebDriver with headless Chrome. What each screen covers is documented in | ||
| the test classes themselves; this page covers how the suite works and what it | ||
| deliberately does not do. | ||
|
|
||
| ## How the tests work | ||
|
|
||
| - Tests live in `solr/webapp/src/test/org/apache/solr/webapp/` and extend | ||
| `AdminUiTestBase`, which starts a 2-node `MiniSolrCloudCluster` whose Jetty | ||
| nodes also serve the Admin UI (opt-in `JettyConfig.Builder#enableAdminUi`), | ||
| then starts a headless Chrome via Selenium WebDriver. | ||
| - The tests are opt-in: the suites carry the `@SeleniumTest` test group | ||
| annotation (disabled by default), enabled with `-Ptests.selenium=true`. | ||
| - A locally installed Chrome/Chromium is required; since the tests only run | ||
| when explicitly enabled, a missing browser fails the tests rather than | ||
| skipping them. Override discovery with | ||
| `-Dtests.selenium.chrome.binary=/path/to/chrome`. The matching chromedriver is | ||
| provisioned (and cached) by Selenium Manager. | ||
| - Display assertions compare UI text against live JSON from the same node's | ||
| admin APIs — never hardcoded values. | ||
| - Tests are grouped per screen/feature, so each screen's display and write | ||
| tests live in the same class. | ||
| - Most tests run against a 2-node cloud cluster; `AdminUiStandaloneTestBase` | ||
| additionally supports standalone (user-managed, no ZooKeeper) nodes, whose | ||
| UI differs (no Cloud/Collections/Schema Designer menus; the per-core menu | ||
| offers query/replication etc. directly). | ||
| - On failure, a screenshot, the page source and the browser console log are | ||
| saved into the test temp dir. | ||
| - Run with: `./gradlew :solr:webapp:test -Ptests.selenium=true` | ||
| - From an IDE, set `-Dtests.selenium=true` on the run configuration; the | ||
| js-client bundle is picked up from the js-client build output, so run a | ||
| Gradle build once first. | ||
|
|
||
| ## Deliberately skipped (effort vs value) | ||
|
|
||
| - **JWT/OAuth login flows**: require an external identity provider or heavy | ||
| mocking; BasicAuth covers the UI's login/session mechanics. | ||
| - **Keystroke-level entry in the security dialogs**: native clicks/keystrokes | ||
| into the absolutely-positioned dialogs proved unreliable in headless Chrome; | ||
| the dialogs are driven via the Angular controller scope instead. Keyboard | ||
| entry is covered by the login form and the other screens' forms. | ||
|
|
||
| ## Known limitations | ||
|
janhoy marked this conversation as resolved.
|
||
|
|
||
| - The generated js-client bundle (`libs/solr/index.js`) only exists inside the | ||
| built WAR, not in the source tree tests serve from, so the build hands its | ||
| location to the test JVM in `tests.ui.jsclient.bundle`. The bundle (and its | ||
| node/npm toolchain) is only built when `-Ptests.selenium=true` enables the | ||
| tests, keeping node off the default test build chain. With the js-client | ||
| build turned off (`-PdisableJsClient=true`) the bundle cannot be built, so | ||
| the build disables these tests with a warning — and fails with an error if | ||
| `-Ptests.selenium=true` was passed as well. | ||
| - Every test cluster in the JVM registers a log-watcher appender under the same | ||
| name in the shared log4j config, so a later cluster's watcher can be blind; | ||
| the events-viewer test detects this via the API and skips itself. | ||
| - The shared menu code logs a benign | ||
| `TypeError: Cannot read properties of null (reading 'name')` from | ||
| `$scope.showCore` while the per-collection menu resolves (filtered in the | ||
| console-error assertion; tracked in | ||
| [SOLR-18347](https://issues.apache.org/jira/browse/SOLR-18347)). | ||
| - The core overview ping widget answers 503 when the configset has no | ||
|
janhoy marked this conversation as resolved.
|
||
| healthcheck file (allowed in the affected tests; tracked in | ||
| [SOLR-18347](https://issues.apache.org/jira/browse/SOLR-18347)). | ||
| - The Schema Designer's backend transiently fails its own prep/analyze calls | ||
| with "version mismatch, retry" and recovers via its retry dialog; its API | ||
| errors are excluded from the console-error assertion. | ||
| - ASF Jenkins jobs do not pass `-Ptests.selenium=true`, so these tests do | ||
| not run there (a nightly job could opt in if its build nodes have a | ||
| browser). In CI they run via the GitHub Actions workflow | ||
| `.github/workflows/admin-ui-test.yml`, on pull requests that touch the | ||
| webapp, the v2 API contract (`solr/api`) or the v2 API implementations | ||
| (`solr/core/.../handler/admin/api`). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 8fcc3779ff85fae5164cd1b977798ca1af388e06 |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 82212e5b3633e7a65fca8bec525762cfb6c9bae4 |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.