Skip to content

Textfields menus items availability tests#3098

Open
Ianina (ianinadavydova) wants to merge 12 commits into
jb-mainfrom
davydova/textfield-menu-items-availability-tests
Open

Textfields menus items availability tests#3098
Ianina (ianinadavydova) wants to merge 12 commits into
jb-mainfrom
davydova/textfield-menu-items-availability-tests

Conversation

@ianinadavydova

@ianinadavydova Ianina (ianinadavydova) commented Jun 8, 2026

Copy link
Copy Markdown

Describe proposed changes and the issue being fixed

(Optional) Fixes CMP-10292 [iOS] Add instrumented tests for old and new edit menus with TextField and TextField2

Testing

(Optional) Describe how you tested your changes (provide a snippet or/and steps)

Release Notes

N/A

@google-cla

google-cla Bot commented Jun 8, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@janinadavydova janinadavydova changed the title Davydova/textfield menu items availability tests Textfields menus items availability tests Jun 9, 2026
@janinadavydova janinadavydova marked this pull request as ready for review June 9, 2026 18:53
}

@Test
fun testOldContextMenuBasicTextFieldEditableCollapsedClipboardText() =

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That's great that you managed to cover such many test cases.
One thing I would like to notice here is tests readability. In the perfect scenario, the test input conditions and assertions should be places right in the test body. And also, It's okay to have copy-pasted code in tests in order to make them clear and readable. Usually, every test body should have three easily distinguishable parts:

  • Initial configuration
  • Action
  • Result validation

How I would suggest to re-arrange tests:

  1. Create "runComplexTextFieldTest(test: UIKitInstrumentedTest.(EditableTextFieldKind, isNewContextMenu: Bool) -> Unit) that runs two runContextMenuTest tests inside - with the new context menu enabled and disabled and passes the execution to the main context body. It will allow to group four tests with the same action and validation into one.
  2. The test body will be looking like verifyEditableCollapsedContextMenu, but all the validation conditions will be visible right away there.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Andrei Salavei (@ASalavei) sorry, I'm not sure I got the suggestion fully correctly, so I tried to refactor 1 group of tests, the result is here

Could you please take a look and confirm if it's what you suggested?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes, looks great! Please apply this approach to other test groups.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Apllied to others, please, take a look when you have a chance.

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.

3 participants