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

#10812 don't allow selecting a disabled option #10814

Merged
merged 2 commits into from
Aug 30, 2022
Merged

#10812 don't allow selecting a disabled option #10814

merged 2 commits into from
Aug 30, 2022

Conversation

asolntsev
Copy link
Contributor

fix for #10812

@codecov-commenter
Copy link

Codecov Report

Merging #10814 (f8ee2b5) into trunk (2fbfc62) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##            trunk   #10814   +/-   ##
=======================================
  Coverage   50.46%   50.46%           
=======================================
  Files          84       84           
  Lines        5477     5477           
  Branches      278      278           
=======================================
  Hits         2764     2764           
  Misses       2435     2435           
  Partials      278      278           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2fbfc62...f8ee2b5. Read the comment docs.

Copy link
Contributor

@pujagani pujagani 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 for your contribution! @asolntsev The changes look good to me. Other language bindings will also need to add the same checks.

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

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

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@titusfortner titusfortner left a comment

Choose a reason for hiding this comment

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

Need to agree this is a problem (I don't think it is) before we solve it with this code.

@titusfortner titusfortner dismissed their stale review August 9, 2022 18:53

I changed my mind this is a problem

Copy link
Member

@titusfortner titusfortner left a comment

Choose a reason for hiding this comment

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

I don't think we need to check if the select list is enabled. If it is disabled, the option will also be disabled. I'd prefer to optimize the number of commands made for a successful test rather than an unsuccessful test. What do you think?

@asolntsev
Copy link
Contributor Author

I don't think we need to check if the select list is enabled. If it is disabled, the option will also be disabled. I'd prefer to optimize the number of commands made for a successful test rather than an unsuccessful test. What do you think?

Yes, I also like to make as few commands as possible.
But the correctness should be in first place, right?

If <select id="cars"> is disabled then user cannot select any options. Cannot even see them.
But method new Select($("#cars")).selectByValue("saab"); doesn't throw any exceptions. It leaves a false impression that the option has been selected.

@titusfortner
Copy link
Member

A non-disabled option nested in a disabled select, will return false for isEnabled().
selectByValue() calls setSelected() which calls assertOptionIsEnabled() which will error.

That said, it's only one extra command when using this wrapper, and it does give a better error message, so maybe I'm being too picky.

@diemol what do you think of this implementation?

Copy link
Member

@diemol diemol 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, @asolntsev!

@diemol diemol merged commit ff88671 into SeleniumHQ:trunk Aug 30, 2022
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

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

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@asolntsev asolntsev deleted the feature/#10812-do-not-allow-select-disabled-option branch August 30, 2022 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants