[rb] create more obvious test guard keywords as aliases#17636
Conversation
|
Thank you, @titusfortner for this code suggestion. The support packages contain example code that many users find helpful, but they do not necessarily represent After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks. |
Review Summary by QodoAdd skip_if/skip_unless/pending_if/pending_unless guard aliases for Ruby specs
WalkthroughsDescription• Add self-describing guard aliases for Ruby specs - skip_if and skip_unless for skipping tests - pending_if and pending_unless for expecting failures • Update all integration specs to use new guard names • Document guard semantics and matching behavior in AGENTS.md • Maintain backward compatibility with old guard names Diagramflowchart LR
A["Old Guard Names<br/>exclude, exclusive, except, only"] -->|"Aliased to"| B["New Guard Names<br/>skip_if, skip_unless,<br/>pending_if, pending_unless"]
B -->|"Applied to"| C["Integration Specs<br/>describe/context/it blocks"]
D["Guard Implementation<br/>guards.rb"] -->|"Updated with"| E["Alias Logic<br/>Type Checking"]
F["Documentation<br/>AGENTS.md"] -->|"Explains"| B
File Changes1. rb/lib/selenium/webdriver/support/guards.rb
|
Code Review by Qodo
1. Wrong guard array semantics
|
|
Code review by qodo was updated up to the latest commit 6fbfe43 |
|
Code review by qodo was updated up to the latest commit a3a99f3 |
|
Code review by qodo was updated up to the latest commit 4217a7c |
|
Code review by qodo was updated up to the latest commit 1149d56 |
As we've added guard names they have become too confusing; I find I have to look them up every time and that's not great
💥 What does this PR do?
Adds four self-describing guard names for the Ruby spec suite and updates the
specs to use them:
skip_if:— skip the example when the configuration matchesskip_unless:— run the example only on the matching configurationpending_if:— run, but expect failure when the configuration matchespending_unless:— run, but expect failure on every configuration except the matchThese map onto the existing guard behavior:
excludeskip_ifexclusiveskip_unlessexceptpending_ifonlypending_unlessflaky:is justskip_ifwith a reason required, so keep using it forunreliable/intermittent tests.
All integration specs are converted to the new names except those marked
flaky.rb/AGENTS.mddocuments the guards, the matching semantics (a Hash is "and",an Array of Hashes is "or"), that guards apply at the
describe/context/itlevels, and points to the active conditions in
rb/spec/integration/selenium/webdriver/spec_helper.rb.🔧 Implementation Notes
🤖 AI assistance
🔄 Types of changes