Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MQE-1514: Failure For seeCurrentUrlEquals Action Does Not Show Actual & Expected Results in Allure #435

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Codeception\Module\WebDriver;
use Codeception\Test\Descriptor;
use Codeception\TestInterface;
use Yandex\Allure\Adapter\Allure;
use Facebook\WebDriver\Interactions\WebDriverActions;
use Codeception\Exception\ModuleConfigException;
use Codeception\Exception\ModuleException;
Expand All @@ -18,6 +19,8 @@
use Magento\FunctionalTestingFramework\Util\Protocol\CurlTransport;
use Magento\FunctionalTestingFramework\Util\Protocol\CurlInterface;
use Magento\FunctionalTestingFramework\Util\ConfigSanitizerUtil;
use Yandex\Allure\Adapter\Event\AddAttachmentEvent;
use Yandex\Allure\Adapter\Event\AddParameterEvent;
use Yandex\Allure\Adapter\Support\AttachmentSupport;
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;

Expand Down Expand Up @@ -198,7 +201,10 @@ public function _getCurrentUri()
*/
public function dontSeeCurrentUrlEquals($url)
{
$this->assertNotEquals($url, $this->webDriver->getCurrentURL());
$actualUrl = $this->webDriver->getCurrentURL();
$comparison = "Expected: $url\nActual: $actualUrl";
Allure::lifecycle()->fire(new AddAttachmentEvent($comparison, 'Comparison'));
$this->assertNotEquals($url, $actualUrl);
}

/**
Expand All @@ -209,7 +215,10 @@ public function dontSeeCurrentUrlEquals($url)
*/
public function dontSeeCurrentUrlMatches($regex)
{
$this->assertNotRegExp($regex, $this->webDriver->getCurrentURL());
$actualUrl = $this->webDriver->getCurrentURL();
$comparison = "Expected: $regex\nActual: $actualUrl";
Allure::lifecycle()->fire(new AddAttachmentEvent($comparison, 'Comparison'));
$this->assertNotRegExp($regex, $actualUrl);
}

/**
Expand All @@ -220,7 +229,10 @@ public function dontSeeCurrentUrlMatches($regex)
*/
public function dontSeeInCurrentUrl($needle)
{
$this->assertNotContains($needle, $this->webDriver->getCurrentURL());
$actualUrl = $this->webDriver->getCurrentURL();
$comparison = "Expected: $needle\nActual: $actualUrl";
Allure::lifecycle()->fire(new AddAttachmentEvent($comparison, 'Comparison'));
$this->assertNotContains($needle, $actualUrl);
}

/**
Expand Down Expand Up @@ -254,7 +266,10 @@ public function grabFromCurrentUrl($regex = null)
*/
public function seeCurrentUrlEquals($url)
{
$this->assertEquals($url, $this->webDriver->getCurrentURL());
$actualUrl = $this->webDriver->getCurrentURL();
$comparison = "Expected: $url\nActual: $actualUrl";
Allure::lifecycle()->fire(new AddAttachmentEvent($comparison, 'Comparison'));
$this->assertEquals($url, $actualUrl);
}

/**
Expand All @@ -265,7 +280,10 @@ public function seeCurrentUrlEquals($url)
*/
public function seeCurrentUrlMatches($regex)
{
$this->assertRegExp($regex, $this->webDriver->getCurrentURL());
$actualUrl = $this->webDriver->getCurrentURL();
$comparison = "Expected: $regex\nActual: $actualUrl";
Allure::lifecycle()->fire(new AddAttachmentEvent($comparison, 'Comparison'));
$this->assertRegExp($regex, $actualUrl);
}

/**
Expand All @@ -276,7 +294,10 @@ public function seeCurrentUrlMatches($regex)
*/
public function seeInCurrentUrl($needle)
{
$this->assertContains($needle, $this->webDriver->getCurrentURL());
$actualUrl = $this->webDriver->getCurrentURL();
$comparison = "Expected: $needle\nActual: $actualUrl";
Allure::lifecycle()->fire(new AddAttachmentEvent($comparison, 'Comparison'));
$this->assertContains($needle, $actualUrl);
}

/**
Expand Down