feat: allow custom Vaadin configurations per test - #148
Open
mcollovati wants to merge 2 commits into
Open
Conversation
Adds `@BrowserlessTestConfig` to declare Vaadin application properties, feature flags and `Lookup` services for a single test class or method. Class and method level annotations are merged, with the method winning, except for lookup services, that are accumulated. The same settings can be provided programmatically with `BrowserlessConfiguration`, on `BrowserlessExtension` and `BrowserlessClassExtension`, on the `BrowserlessApplicationContext` builder, or by overriding `testConfiguration()`. Settings are applied to the Vaadin environment created for the test, so they don't need to be reset and don't leak into other tests. As a side effect, feature flags toggled during a test are no longer stored into the project `vaadin-featureflags.properties` file. `BaseBrowserlessTest.lookupServices()` is deprecated in favour of the test configuration; existing overrides are still honoured. Services required by the Spring and Quarkus integrations moved to the new `frameworkLookupServices()`, so that they can't be dropped by a test. Fixes #48
Replaces the `@BeforeAll`/`@AfterAll` pairs setting and clearing `vaadin.experimental.*` system properties with `@BrowserlessTestConfig`, so that the feature flags are scoped to the Vaadin environment created for each test. `SwitchTesterTest` and `BreadcrumbsTesterTest` declare `switchComponent` and `breadcrumbsComponent`. Both were checked by disabling the flag, to make sure the components are really gated by it. The slider and message list tests were setting `sliderComponent` and `messageListAttachments`, that are not registered feature flags: those components are not experimental anymore, so the setup was doing nothing and has been removed.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds
@BrowserlessTestConfigto declare Vaadin application properties,feature flags and
Lookupservices for a single test class or method.Class and method level annotations are merged, with the method winning,
except for lookup services, that are accumulated.
The same settings can be provided programmatically with
BrowserlessConfiguration, onBrowserlessExtensionandBrowserlessClassExtension, on theBrowserlessApplicationContextbuilder, or by overriding
testConfiguration().Settings are applied to the Vaadin environment created for the test, so
they don't need to be reset and don't leak into other tests. As a side
effect, feature flags toggled during a test are no longer stored into
the project
vaadin-featureflags.propertiesfile.BaseBrowserlessTest.lookupServices()is deprecated in favour of thetest configuration; existing overrides are still honoured. Services
required by the Spring and Quarkus integrations moved to the new
frameworkLookupServices(), so that they can't be dropped by a test.Fixes #48