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

Feat/add tests for vaadin components #17673

Merged
merged 3 commits into from
Sep 21, 2023
Merged

Conversation

brunovianarezende
Copy link
Contributor

Description

This PR adds tests for two vaadin components: vaadin-icon and vaadin-checkbox. They are used as a basis for adding test for new components.

Other changes:

  • improves the tests stability by cleaning up the environment after each test is executed;
  • updates the flow components version to 24.2;
  • fixes how the property editors are retrieved (two different property editors might have the same 'data-testid', so we need a proper context to retrieve the correct property editor for a metadata);
  • some small improvements in the errors text messages.

Type of change

  • Bugfix
  • [ X ] Feature

Checklist

  • [ X ] I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • [ X ] I have added a description following the guideline.
  • [ X ] The issue is created in the corresponding repository and I have referenced it.
  • [ X ] I have added tests to ensure my change is effective and works as intended.
  • [ X ] New and existing tests are passing locally with my change.
  • [ X ] I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

This is the first step to make the tests for all components in theme-editor.

This PR also adds setup/tearDown support to the theme-editor Testbench tests.
@github-actions
Copy link

github-actions bot commented Sep 20, 2023

Test Results

1 008 files  ±  0  1 008 suites  ±0   1h 2m 42s ⏱️ +3s
6 412 tests +  2  6 371 ✔️ +  3  41 💤 ±0  0  - 1 
6 666 runs  +30  6 618 ✔️ +31  48 💤 ±0  0  - 1 

Results for commit 7c0f335. ± Comparison against base commit 2ec3410.

♻️ This comment has been updated with latest results.

…ange

a side effect of this change is that the checking of the values in the file
is deferred and then the dev server can write to the file before we try to
read it.
@sonarcloud
Copy link

sonarcloud bot commented Sep 20, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@brunovianarezende
Copy link
Contributor Author

Locally the tests fails randomly. I wonder Probably there is some race condition going on.

Copy link
Contributor

@szolo szolo left a comment

Choose a reason for hiding this comment

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

@brunovianarezende approved! Regarding failing tests, "flaky" executions could be caused by UI rendering speed or some sync issues. Logs and code look fine.
Tests are executed in a sequential order, right?

@szolo szolo merged commit 56e0e3f into main Sep 21, 2023
26 checks passed
@szolo szolo deleted the feat/add-tests-for-vaadin-components branch September 21, 2023 07:15
Artur- pushed a commit that referenced this pull request Sep 22, 2023
* Adds a test for Icon in theme-editor

This is the first step to make the tests for all components in theme-editor.

This PR also adds setup/tearDown support to the theme-editor Testbench tests.

* Adds a test for Checkbox in theme-editor and make tests a bit more reliable

* In theme editor tests, check if the modified label appears after a change

a side effect of this change is that the checking of the values in the file
is deferred and then the dev server can write to the file before we try to
read it.
mshabarov added a commit that referenced this pull request Sep 25, 2023
* fix: Do not override user npm dependency version

Fixes #17654

* chore(deps): bump com.nimbusds:nimbus-jose-jwt from 9.34 to 9.35 (#17652)

Bumps [com.nimbusds:nimbus-jose-jwt](https://bitbucket.org/connect2id/nimbus-jose-jwt) from 9.34 to 9.35.
- [Changelog](https://bitbucket.org/connect2id/nimbus-jose-jwt/src/master/CHANGELOG.txt)
- [Commits](https://bitbucket.org/connect2id/nimbus-jose-jwt/branches/compare/9.35..9.34)

---
updated-dependencies:
- dependency-name: com.nimbusds:nimbus-jose-jwt
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: Update Node.js to latest 20.7.0 (#17646)

* fix: router-link postpone navigation (#17647)

Fixes issue with update timing
when postponing a router-link
as the navigation goes through
the vaadin-router.

Fixes #17528

* Feat/add tests for vaadin components (#17673)

* Adds a test for Icon in theme-editor

This is the first step to make the tests for all components in theme-editor.

This PR also adds setup/tearDown support to the theme-editor Testbench tests.

* Adds a test for Checkbox in theme-editor and make tests a bit more reliable

* In theme editor tests, check if the modified label appears after a change

a side effect of this change is that the checking of the values in the file
is deferred and then the dev server can write to the file before we try to
read it.

* Caching: Cache all com.vaadin.flow class instances (#17644)

* Caching: Cache all com.vaadin.flow class instances

* Caching: Cache all com.vaadin.flow class instances

* Ensure only classes from JARs are cached

* Fix cache test

* Use replace instead of replaceAll

* Cache com.vaadin.* and org.vaadin.* classes

* fix: synchronize cache maps in SpringLookupInitializer (#17668)

To avoid possibility to get ConcurrentModificationException.

* chore: changed synchronizedMap to ConcurrentHashMap (#17677)

For better non-blocking read-performance for lookups with SpringLookup.

* test: Ignore failed test for Theme Editor (#17679)

* chore: cache JS imported paths during chunk generation (#17672)

* chore: cache JS imported paths during chunk generation

In a production build, for every chunk the JS files are parsed to extract the
imported paths. There are checks to ensure that a module is visited only once,
but this works on a chunk level.
This change caches the JS imports extraction results, so that a single JS file
is visited only once during the build.

Part of #17234

* cleanup

* improve caching of imported paths

* chore(deps): bump com.vaadin:vaadin-parent from 2.2.0 to 2.2.1 (#17682)

Bumps [com.vaadin:vaadin-parent](https://github.com/vaadin/maven-integration) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/vaadin/maven-integration/releases)
- [Commits](vaadin/maven-integration@2.2.0...2.2.1)

---
updated-dependencies:
- dependency-name: com.vaadin:vaadin-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: forward/reroute when query parameters changed (#17659)

Forward and reroute should run even when targeting the same target
but with different query parameters.

Fixes #17639

* fix: upgrade spring-boot to 3.1.4 (#17680)

* Fixes the flaky theme editor tests (#17686)

* chore(deps): bump com.typesafe.akka:akka-actor_2.13 from 2.8.4 to 2.8.5 (#17683)

Bumps [com.typesafe.akka:akka-actor_2.13](https://github.com/akka/akka) from 2.8.4 to 2.8.5.
- [Release notes](https://github.com/akka/akka/releases)
- [Changelog](https://github.com/akka/akka/blob/main/akka-docs/release-train-issue-template.md)
- [Commits](akka/akka@v2.8.4...v2.8.5)

---
updated-dependencies:
- dependency-name: com.typesafe.akka:akka-actor_2.13
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump component.version from 24.1.9 to 24.1.10 (#17651)

Bumps `component.version` from 24.1.9 to 24.1.10.

Updates `com.vaadin:vaadin-lumo-theme` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-upload-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-upload-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-notification-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-notification-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-button-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-button-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-text-field-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-text-field-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-tabs-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-tabs-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-app-layout-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-app-layout-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-ordered-layout-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-ordered-layout-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-login-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-login-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-dialog-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-dialog-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-avatar-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-core` from 24.1.9 to 24.1.10

---
updated-dependencies:
- dependency-name: com.vaadin:vaadin-lumo-theme
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-upload-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-upload-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-notification-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-notification-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-button-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-button-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-text-field-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-text-field-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-tabs-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-tabs-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-app-layout-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-app-layout-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-ordered-layout-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-ordered-layout-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-login-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-login-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-dialog-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-dialog-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-avatar-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marco Collovati <marco@vaadin.com>

* Remove tests that test user versions end up in the vaadin section

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mikhail Shabarov <61410877+mshabarov@users.noreply.github.com>
Co-authored-by: caalador <mikael.grankvist@vaadin.com>
Co-authored-by: Bruno Rezende <brunovianarezende@gmail.com>
Co-authored-by: Teppo Kurki <teppo.kurki@vaadin.com>
Co-authored-by: Tomi Virtanen <tltv@vaadin.com>
Co-authored-by: Marco Collovati <marco@vaadin.com>
Co-authored-by: Zhe Sun <31067185+ZheSun88@users.noreply.github.com>
vaadin-bot pushed a commit that referenced this pull request Sep 25, 2023
* fix: Do not override user npm dependency version

Fixes #17654

* chore(deps): bump com.nimbusds:nimbus-jose-jwt from 9.34 to 9.35 (#17652)

Bumps [com.nimbusds:nimbus-jose-jwt](https://bitbucket.org/connect2id/nimbus-jose-jwt) from 9.34 to 9.35.
- [Changelog](https://bitbucket.org/connect2id/nimbus-jose-jwt/src/master/CHANGELOG.txt)
- [Commits](https://bitbucket.org/connect2id/nimbus-jose-jwt/branches/compare/9.35..9.34)

---
updated-dependencies:
- dependency-name: com.nimbusds:nimbus-jose-jwt
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: Update Node.js to latest 20.7.0 (#17646)

* fix: router-link postpone navigation (#17647)

Fixes issue with update timing
when postponing a router-link
as the navigation goes through
the vaadin-router.

Fixes #17528

* Feat/add tests for vaadin components (#17673)

* Adds a test for Icon in theme-editor

This is the first step to make the tests for all components in theme-editor.

This PR also adds setup/tearDown support to the theme-editor Testbench tests.

* Adds a test for Checkbox in theme-editor and make tests a bit more reliable

* In theme editor tests, check if the modified label appears after a change

a side effect of this change is that the checking of the values in the file
is deferred and then the dev server can write to the file before we try to
read it.

* Caching: Cache all com.vaadin.flow class instances (#17644)

* Caching: Cache all com.vaadin.flow class instances

* Caching: Cache all com.vaadin.flow class instances

* Ensure only classes from JARs are cached

* Fix cache test

* Use replace instead of replaceAll

* Cache com.vaadin.* and org.vaadin.* classes

* fix: synchronize cache maps in SpringLookupInitializer (#17668)

To avoid possibility to get ConcurrentModificationException.

* chore: changed synchronizedMap to ConcurrentHashMap (#17677)

For better non-blocking read-performance for lookups with SpringLookup.

* test: Ignore failed test for Theme Editor (#17679)

* chore: cache JS imported paths during chunk generation (#17672)

* chore: cache JS imported paths during chunk generation

In a production build, for every chunk the JS files are parsed to extract the
imported paths. There are checks to ensure that a module is visited only once,
but this works on a chunk level.
This change caches the JS imports extraction results, so that a single JS file
is visited only once during the build.

Part of #17234

* cleanup

* improve caching of imported paths

* chore(deps): bump com.vaadin:vaadin-parent from 2.2.0 to 2.2.1 (#17682)

Bumps [com.vaadin:vaadin-parent](https://github.com/vaadin/maven-integration) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/vaadin/maven-integration/releases)
- [Commits](vaadin/maven-integration@2.2.0...2.2.1)

---
updated-dependencies:
- dependency-name: com.vaadin:vaadin-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: forward/reroute when query parameters changed (#17659)

Forward and reroute should run even when targeting the same target
but with different query parameters.

Fixes #17639

* fix: upgrade spring-boot to 3.1.4 (#17680)

* Fixes the flaky theme editor tests (#17686)

* chore(deps): bump com.typesafe.akka:akka-actor_2.13 from 2.8.4 to 2.8.5 (#17683)

Bumps [com.typesafe.akka:akka-actor_2.13](https://github.com/akka/akka) from 2.8.4 to 2.8.5.
- [Release notes](https://github.com/akka/akka/releases)
- [Changelog](https://github.com/akka/akka/blob/main/akka-docs/release-train-issue-template.md)
- [Commits](akka/akka@v2.8.4...v2.8.5)

---
updated-dependencies:
- dependency-name: com.typesafe.akka:akka-actor_2.13
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump component.version from 24.1.9 to 24.1.10 (#17651)

Bumps `component.version` from 24.1.9 to 24.1.10.

Updates `com.vaadin:vaadin-lumo-theme` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-upload-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-upload-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-notification-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-notification-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-button-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-button-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-text-field-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-text-field-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-tabs-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-tabs-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-app-layout-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-app-layout-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-ordered-layout-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-ordered-layout-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-login-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-login-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-dialog-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-dialog-testbench` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-avatar-flow` from 24.1.9 to 24.1.10

Updates `com.vaadin:vaadin-core` from 24.1.9 to 24.1.10

---
updated-dependencies:
- dependency-name: com.vaadin:vaadin-lumo-theme
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-upload-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-upload-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-notification-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-notification-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-button-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-button-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-text-field-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-text-field-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-tabs-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-tabs-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-app-layout-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-app-layout-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-ordered-layout-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-ordered-layout-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-login-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-login-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-dialog-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-dialog-testbench
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-avatar-flow
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.vaadin:vaadin-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marco Collovati <marco@vaadin.com>

* Remove tests that test user versions end up in the vaadin section

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mikhail Shabarov <61410877+mshabarov@users.noreply.github.com>
Co-authored-by: caalador <mikael.grankvist@vaadin.com>
Co-authored-by: Bruno Rezende <brunovianarezende@gmail.com>
Co-authored-by: Teppo Kurki <teppo.kurki@vaadin.com>
Co-authored-by: Tomi Virtanen <tltv@vaadin.com>
Co-authored-by: Marco Collovati <marco@vaadin.com>
Co-authored-by: Zhe Sun <31067185+ZheSun88@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants