-
Notifications
You must be signed in to change notification settings - Fork 48
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
Opening a page URL optionally with query string parameters #75
Comments
We could make it real simple, and append all parameters that were not part of the |
Sounds like a good start. What about URL fragments? I.e.
|
I came across this today in one of my projects. @jakzal are you still interested in this feature? Maybe I can try an implementation in the next weeks. |
We can add two more (optional) parameters to |
Thinking about it again what's wrong with the following? class Homepage extends Page {
protected $path = '/?utm_source={utm_source}&utm_campaign={utm_campaign}';
}
class MyContext ... {
public function aStep()
{
$this->homepage->open(['utm_source' => 1, 'utm_campaign' => 'foo']);
}
} |
I have some cases where I would like to open the page without some parameters (maybe not mandatory?) and in those cases I would land in the page with placeholders instead of real parameters or without parameters at all. |
Currently, the only way I can see to open a page with query string parameters it seems to be the following:
This produces the expected result:
But this way one is always forced to pass something. By leaving the array parameter passed to the
open
method, this is the resulting absolute URL:There might be cases where the behaviour of a page (or element) might vary depending on whether something's included in the URL as a query string parameter. And both cases to be verified. Creating the same page object twice (i.e.
Homepage
andParameterisedHomepage
) feels wrong (even if it just extend the non-parameterised page object class).How should one deal with optional query string parameters?
The text was updated successfully, but these errors were encountered: