Skip to content

feat: allow custom Vaadin configurations per test - #148

Open
mcollovati wants to merge 2 commits into
mainfrom
issues/48-per_test_vaadin_configs
Open

feat: allow custom Vaadin configurations per test#148
mcollovati wants to merge 2 commits into
mainfrom
issues/48-per_test_vaadin_configs

Conversation

@mcollovati

Copy link
Copy Markdown
Contributor

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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow custom Vaadin configurations per test

1 participant