-
Notifications
You must be signed in to change notification settings - Fork 46
Opening a page URL optionally with query string parameters #75
Copy link
Copy link
Open
Description
Currently, the only way I can see to open a page with query string parameters it seems to be the following:
class Homepage extends Page {
protected $path = '/?{QS}';
}
class MyContext ... {
public function aStep()
{
$this->homepage->open(array('QS' => 'utm_source=1&utm_campaign=foo'));
}
}
This produces the expected result:
<schema>://<hostname>/?utm_source=1&utm_campaign=foo
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:
<schema>://<hostname>/?{QS}
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 and ParameterisedHomepage) feels wrong (even if it just extend the non-parameterised page object class).
How should one deal with optional query string parameters?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels