Search the Community
Showing results for tags 'behat'.
-
I have to pass the date in one of the step as current date and compare that, but failing to achieve that test case is "And the URL "<>" contains the following: "Measure name","Business description","Technical description","Data Sources",Reports,"Authored by","Last publish date" "First Test Measure","business Lorem Ipsum is simply","technical Lorem Ipsum is",CHRISS,First Test Report,, Here one of the parameter is "Last publish date" so I have to give it as it should be comes up as current date. I am trying to give the date [[now:j F Y], but it is not working. Below is the function written for it, what change I have to do so it can have the date as well. /** * Download a url and verify the contents. * * @throws \Exception * When the file contents don't match. * * @Then the URL :url contains the following: */ public function assertUrlContent(string $url, PyStringNode $content): void { $cookies = $this->getSession()->getDriver()->getWebDriverSession()->getCookie()[0]; $cookie = new SetCookie(); $cookie->setName($cookies['name']); $cookie->setValue($cookies['value']); $cookie->setDomain($cookies['domain']); $jar = new CookieJar(); $jar->setCookie($cookie); $client = new Client(); $res = $client->request('GET', $url, [ 'cookies' => $jar, 'verify' => FALSE, ]); $expected_string = preg_replace('/\r/', '', (string) $content); $actual_string = $res->getBody()->getContents(); if ($expected_string !== $actual_string) { print_r('Expected String: ' . PHP_EOL . $expected_string . PHP_EOL); print_r('Actual String: ' . PHP_EOL . $actual_string); throw new \Exception('Contents of download do not match'); } }