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

test: add checks for avoiding a timing issue, that is the path dropdown list needs more time to load #1727

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/check-machines-filesystems
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ class TestMachinesFilesystems(machineslib.VirtualMachinesCase):

b.set_input_text("#vm-subVmTest1-filesystems-modal-mountTag", "")
b.set_input_text("#vm-subVmTest1-filesystems-modal-source-group input", "/tmp")
b.wait_visible("#vm-subVmTest1-filesystems-modal-source")
# In some hosts with the high latency, the path of the expand list needs some time to load, the check will fail if it is too quick.
# Thus, add a check that the folder input appears in the expand list(#vm-{name}-filesystems-modal-source) to ensure that the loading is finished
# #vm-{name}-filesystems-modal-source only contains the expand list, without the input line
b.wait_in_text("#vm-subVmTest1-filesystems-modal-source", "/tmp")
Copy link
Member

Choose a reason for hiding this comment

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

This is what I'm sceptical about: set_input_text already waits until the input has the expected value, so this is entirely redundant. Either that existing wait in testlib.py isn't enough -- then we should fix it there for all cases. Or it is redundant, then this is nothing more than a hidden "sleep(0.1)", and the real fix is to wait for something else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, set_input_text already waits until the input has the expected value. But, there will be a dropdown list for file path prompt as the input there is a FileAutoComplete. This line aims to make sure the input text is shown in the dropdown list. We don't check the dropdown list in set_input_text. And it seems that, if I don't add this line, the dropdown list is still there after b.click("#vm-subVmTest1-filesystems-modal-source button:nth-child(1)"). Here is also a picture if I remove this line.
TestMachinesFilesystems-testBasicSystemConnection-dropdown-list

Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the late answer, I've been sick for two weeks 😢 Yes, I understand the "wait for /tmp to be in dropdown" approach. But the wait_in_text() is not specific enough for that -- it covers the whole input group, i.e. including the input line. Doesn't it also catch that /tmp there? I.e. my question is, this selector needs to be more specific to the select, with .pf-v5-c-menu or similar.

Copy link
Contributor Author

@yunmingyang yunmingyang Aug 19, 2024

Choose a reason for hiding this comment

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

I checked with cockpit-machines-316-1.fc40.noarch. #vm-subVmTest1-filesystems-modal-source doesn't include the input line, and the input line is actual in another div, and the id of the input line is "pf-select-toggle-id-26-select-typeahead", which is automatically generated. However, #vm-subVmTest1-filesystems-modal-source-group contains both of them that mentioned above, Maybe you means that? Are there some changes about the input line and the expand list in the newest vision?

Copy link
Member

Choose a reason for hiding this comment

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

No, there are no changes. The main thing is that the selectors are not understandable, and could use some comments what they actually refer to.

Thanks for the explanation! Yes, please rebase, and let's get this in.

b.click("#vm-subVmTest1-filesystems-modal-source button:nth-child(1)")
# Check the expand list disappears
b.wait_not_present("#vm-subVmTest1-filesystems-modal-source")
b.click("#vm-subVmTest1-filesystems-modal-add")
b.wait_not_present("#vm-subVmTest1-filesystems-modal-source-helper")
b.wait_visible("#vm-subVmTest1-filesystems-modal-mountTag-helper")
Expand Down