Skip to content

Make switch to frame possible #9

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

Merged
merged 4 commits into from
May 31, 2020
Merged

Conversation

Sieg
Copy link
Contributor

@Sieg Sieg commented Mar 19, 2020

As locator near the name was changed to iframe recently, and we have used that switchToIframe for switching between our frames as well, i would like to ask introducing the switchToFrame method as well alongside the old switchToIframe one, if possible.

p.s. i was not able to run the tests on this repository, would be super great to have more information how to do it in the readme.

Thanks for your work guys!

try {
$els = $this->_findElements("iframe[name='$locator']");
Copy link
Member

Choose a reason for hiding this comment

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

I think that it would be better to make switchToIFrame behave as before by changing locator to match frames and iframes:

$els = $this->_findElements("iframe[name='$locator']  | frame[name='$locator']");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would not say so, as the name of method is missleading, it have IFrame in it, so it should work with iframes, even if it was possible to be used with frames before. Or, the name should be changed to switchToFrame then, and used for iframes as well. But thats just my opinion, would be better to vote for it probably :)

Copy link
Member

Choose a reason for hiding this comment

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

Changing the name is backwards compatibility break,
making switchToIframe work with frames as before is backwards compatibility fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but:

  • Making it working as before will make the method misused again. The fix should be introduced, but with the deprecation of this functionality maybe?
  • Renaming could be done with the deprecation of the old method as well, it's not critical to just rename it.

Sure, it is your decision how to handle this question, but me personally would prefer the chaos to be more organized with the time, but not just fixed to be working somehow :)

Copy link
Member

Choose a reason for hiding this comment

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

@DavertMik thinks that switchToIframe working with frames is a feature, not a bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Naktibalda But it leads to misunderstandings while it does more than its described, and then people can change the code without even thinking about those "features" and one day those are stopping to work. So either you need two methods or better documentation/implementation on the old one. Feel free to do as you think is better.

@Sieg Sieg closed this May 29, 2020
@Sieg
Copy link
Contributor Author

Sieg commented May 29, 2020

@Naktibalda Feel free to reopen if someone is interested in fixing this, I have just introduced clearly named methods for our project for now.

@Naktibalda Naktibalda reopened this May 31, 2020
@Naktibalda
Copy link
Member

I apologize for forgetting your pull request.

Nobody else seem to care about it and nobody has reported that original behaviour is broken, so keeping backwards compatibility is not that important.

I will merge your change.

@Naktibalda Naktibalda merged commit 09c1678 into Codeception:master May 31, 2020
@Naktibalda
Copy link
Member

Released as 1.1.0

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