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

Add iClickTheElement function #200

Closed
13 of 14 tasks
emteknetnz opened this issue Apr 12, 2021 · 2 comments
Closed
13 of 14 tasks

Add iClickTheElement function #200

emteknetnz opened this issue Apr 12, 2021 · 2 comments
Assignees

Comments

@emteknetnz
Copy link
Member

emteknetnz commented Apr 12, 2021

iClickTheElement is a very useful function that should be in behat-extension

Previously have put a iClickTheElement directly few modules

However it should live in behat-extension instead

When adding to behat-extension, need to consider any possible conflicts between having the same function on both behat-extension and the module

Wrapping the function in a if (function_exists($class, 'iClickTheElement') conditional may help

Need to consider installing new and old version modules alongside new and old versions of behat-extension

Acceptance Criteria

  • The new "iClickTheElement" is added to behat extensions
  • The existing "iClickTheElement" is removed from the modules listed above
  • Ensure silverstripe/recipe-testing is updated
  • The the modules listed above still work nicely once the function is in behat-extensions (it may need additional work here)
  • Previous minor versions of the modules listed above still work with the new version of behat-extensions (once it's updated to use the new function)

PRs

@emteknetnz
Copy link
Member Author

emteknetnz commented Apr 14, 2021

Behat really doesn't like iClickTheElement being in both behat-extension AND a module Feature/FixtureContext - specifically duplicated docblock regex @Given /^I click the "([^"]+)" element$/ causes the behat to simply not work. Changing the regex in one location causes behat to function again. The name of the function doesn't matter because it's in different classes.

Given this, I'm not sure we can add this function into behat-extension as is? For new versions of modules this is not a problem since we can just remove iClickTheElement from modules because its a dev-only thing and semver doesn't apply.

The issue is that older versions of modules (i.e. 1.6.x-dev) have dev requirements of recipe-testing:^1 or behat-extension:^4. This means they'll get the latest version of behat-extension that would have @Given /^I click the "([^"]+)" element$/, but they'd still have their old version of the @Given /^I click the "([^"]+)" element$/ which would conflict and cause behat to stop working. This feature isn't close to important enough to justify backporting.

Releasing this as a new major would sort this, though it seems a little extreme. We could update recipe-testing to use behat-extension:^5 so most things would auto-update, though any locations that still simply require behat-extenions:^4 would need updating

I don't particularly want to change the regex for the behat-extension version to something else because it reads correctly as is.

We'd need to change this to something like

@Given /^I click on the "([^"]+)" element$/
(add the word "on")

Which, reads a bit wrong? You don't click "on" elements, you just click them

You could argue it's just semantics and it really doesn't matter because it's dev only

Realistically I think we'd need to do this

@emteknetnz
Copy link
Member Author

Based on https://english.stackexchange.com/questions/53794/when-to-use-click-and-click-on

'Click on' may actually be actually be more semantically correct

tl;dr

You 'click' a mouse button

You 'click on' a text link using a mouse button

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

No branches or pull requests

3 participants