php - How would I set up behat to check to see if I am on a route with a dynamic number? -
in behat check see if route going correct route, issue everytime visit route number changes. how set behat number after wards , let pass. have is:
then should on "/clinic/participant/create/{id}"
that bracket {id} dynamic , if possible either ignore last id or put wildcard of sort on whatever passed here works long number.
this work around, still know if there easier way / cleaner way this.
public function ishouldbeonroute($url) { $urlarray = explode('/', $url); $urlpath = $this->getsession()->getcurrenturl(); $urlpatharray = explode('/', $urlpath); $testedurl = join('/', $urlarray) . end($urlpatharray); $this->assertsession()->addressequals($testedurl); }
assuming url existing link can see, create custom step gets href attribute , visit url.
for example:
i on create participant page
this step should contain:
- find element -> attribute href, save in variable
- use visit variable
the css selector used should be:
a[href*='/clinic/participant/create/']
if have id , need check url contains id use strpos !== false , throw exception or assert.
Comments
Post a Comment