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 VirtualListTester #1797

Merged
merged 12 commits into from
May 21, 2024
Merged

feat: add VirtualListTester #1797

merged 12 commits into from
May 21, 2024

Conversation

joelpop
Copy link
Collaborator

@joelpop joelpop commented May 18, 2024

Description

Added VirtualListTester to enable VirtualLists to be unit tested with TestBench.

As this tester and GridTester both support LitRenderers, the common code from GridTester was extracted to an interface HasLitRenderer so it could be shared by both testers.

Because a VirtualList is used to display a large list of rows, for its testing Instancio was added as a test dependency to the project to facilitate randomized generation of values.

Fixes #1721

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • 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.

Added VirtualListTester to TesterWrappers.

Extracted LitRenderer property and function methods from GridTester to HasLitRenderer mixin class for DRY reusability.
@joelpop joelpop added enhancement UITest JUnit testing the UI labels May 18, 2024
@joelpop joelpop self-assigned this May 18, 2024
Copy link
Contributor

@mcollovati mcollovati left a comment

Choose a reason for hiding this comment

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

Some change requests.
Also, locally VirtualListTesterTest.virtualList_verifyComponentRenderer is failing with IllegalState Span[#first-name, text='AFIOSVXE'] is not visible!

@mcollovati mcollovati changed the title Added VirtualListTester feat: add VirtualListTester May 20, 2024
@ZheSun88
Copy link
Contributor

Hi @joelpop and all,

Vaadin 24.4 RC release is scheduled on this week Wednesday. Can we make sure that this PR will be merged before that?

Thanks.

Added intentionally failing tests.

Fixed some nits.

Removed Instancio from project.
@joelpop
Copy link
Collaborator Author

joelpop commented May 21, 2024

Hi @joelpop and all,

Vaadin 24.4 RC release is scheduled on this week Wednesday. Can we make sure that this PR will be merged before that?

Thanks.

I will do my best. I have fixed and resolved most of the issues I knew about and that @mcollovati requested. I have just one item left.

@ZheSun88
Copy link
Contributor

if the PR is ready, remember to mark it ready for review (it is still a draft at the moment.)

@joelpop
Copy link
Collaborator Author

joelpop commented May 21, 2024

if the PR is ready, remember to mark it ready for review (it is still a draft at the moment.)

Yes, it is still draft pending one outstanding implementation question.

@joelpop joelpop requested a review from mcollovati May 21, 2024 05:46
@joelpop joelpop marked this pull request as ready for review May 21, 2024 05:48
@joelpop
Copy link
Collaborator Author

joelpop commented May 21, 2024

Some change requests. Also, locally VirtualListTesterTest.virtualList_verifyComponentRenderer is failing with IllegalState Span[#first-name, text='AFIOSVXE'] is not visible!

Yes, this is why I had left the PR as draft. The reason this test was failing is because ComponentRenderer test methods in both GridTester and VirtualListTester return a copy of the component–not the actual rendered component, so if you then attempt to use that component's tester, you get that "not visible" error.

@ZheSun88
Copy link
Contributor

ZheSun88 commented May 21, 2024

build failed with Vaadin Testbench UI Unit Test Shared module

 Failed to execute goal org.jetbrains.dokka:dokka-maven-plugin:1.6.21:javadoc (default) on project vaadin-testbench-unit-shared: A type incompatibility occurred while executing org.jetbrains.dokka:dokka-maven-plugin:1.6.21:javadoc: class com.intellij.psi.impl.source.PsiImmediateClassType cannot be cast to class com.intellij.psi.impl.source.PsiClassReferenceType (com.intellij.psi.impl.source.PsiImmediateClassType and com.intellij.psi.impl.source.PsiClassReferenceType are in unnamed module of loader java.net.URLClassLoader @4842598e)

found one related ticket from dokka plugin, from us.. Kotlin/dokka#2509
maybe we should upgrade the plugin version, the latest is 1.9.20

test in PR #1799

@ZheSun88
Copy link
Contributor

validation failure has been resolved by upgrading the kotlin.version and dokka.version to 1.9.20

@mshabarov
Copy link
Contributor

@ZheSun88 just for note, this isn't a blocker for Vaadin 24.4 release, this was planned specifically for 24.4. We can merge at any point.

@joelpop joelpop requested a review from mcollovati May 21, 2024 07:54
@mcollovati mcollovati enabled auto-merge (squash) May 21, 2024 08:39
@mcollovati mcollovati merged commit 0ad819b into main May 21, 2024
2 checks passed
@mcollovati mcollovati deleted the feature/#1721-VirtualListTester branch May 21, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement UITest JUnit testing the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a Tester class for VirtualList component
4 participants