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

Conversation

yunmingyang
Copy link
Contributor

No description provided.

Copy link

We were not able to find or create Copr project packit/cockpit-project-cockpit-machines-1727 specified in the config with the following error:

Cannot create a new Copr project (owner=packit project=cockpit-project-cockpit-machines-1727 chroots=['centos-stream-9-x86_64', 'centos-stream-10-x86_64']): Copr: 'packit/cockpit-project-cockpit-machines-1727' already exists. Copr HTTP response is 400 BAD REQUEST.

Unless the HTTP status code above is >= 500, please check your configuration for:

  1. typos in owner and project name (groups need to be prefixed with @)
  2. whether the project name doesn't contain not allowed characters (only letters, digits, underscores, dashes and dots must be used)
  3. whether the project itself exists (Packit creates projects only in its own namespace)
  4. whether Packit is allowed to build in your Copr project
  5. whether your Copr project/group is not private

@martinpitt
Copy link
Member

Hello @yunmingyang ! This looks a bit dubious -- to understand the failure, do you have a link to the failed run? Or can you copy the output and the screenshot from the failure?

@yunmingyang
Copy link
Contributor Author

@martinpitt I found this during downstream aarch64 testing, I am not sure whether it could be reproduced, but let me have a try later

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Thanks!

b.wait_visible("#vm-subVmTest1-filesystems-modal-source")
# In some hosts with high latency, the path dropdown list needs some time to load, the check will fail if it is too quick.
# Thus, add more check to ensure that the loading is finished
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.

Comment on lines 67 to 68
b.wait_not_present("#vm-subVmTest1-filesystems-modal-source")
b.wait_attr_contains("#vm-subVmTest1-filesystems-modal-source-group input", "value", "/tmp")
Copy link
Member

Choose a reason for hiding this comment

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

Can you please explain this? The "click" could really do with a comment what it does, is that the help icon button for "More info for source path field"? But why would clicking it make the whole "Source path" input go away? And then after you wait for it to go away you check one of its attributes?

(Note: it may well be right: It is just absolutely impossible for me to understand it without being intimately familiar with what this does)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I just want to make sure the dropdown list disappears(b.wait_not_present) and the input accepts the text correctly(b.wait_attr_contains). Then, after some new trying, I think b.wait_attr_contains is not necessary as set_input_text has already done this, but according to the previous comment I left, I think b.wait_not_present is helpful to ensure that the dropdown list has disappeared. Do you think that makes sense?

Copy link
Member

Choose a reason for hiding this comment

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

Right, the wait_attr_contains is the same as .val(), and set_input_text already does the .wait_val() for this. The wait_not_present() strategically makes sense, I just have no idea what -modal-source actually is -- is that really specifically the dropdown menu part of the file selector? The code says

<FileAutoComplete id={`${idPrefix}-modal-source`}

which should be the text <input> and sometimes the menu (which can open or close), and this is specifically meant for the menu part.

That's what I mean with "please explain this" -- and I don't mean "here in github", but "please add a comment". These selectors are not understandable (which isn't your fault, but it still needs comments to make sense).

Thanks!

Please also rebase this, the PR is quite old by now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I will rebase and add some comments

@yunmingyang
Copy link
Contributor Author

TestMachinesFilesystems-testBasicSystemConnection
Hi @martinpitt, I could also reproduce it during s390x test, but I think maybe there are some security information in *.js.log and *.html, like IP address and firmware, Thus, I just put the picture here. You could see there are two errors shown, but it should just 1 error, as "Source path" is already not empty.

@yunmingyang
Copy link
Contributor Author

Re-push:

  • Add more annotation for explaining
  • Remove the b.wait_attr_contains since set_input_text had already done this

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Thank you!

@martinpitt martinpitt merged commit cb1367d into cockpit-project:main Aug 19, 2024
24 checks passed
@yunmingyang yunmingyang deleted the fixTest branch August 19, 2024 09:30
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.

2 participants