簡単なシナリオがあります。
Scenario: No javascript warning
Given I am on homepage
When I don't have javascript enabled
Then I should see a warning
ミンクでwhen部分をどのように実装しますか?noscript要素をテストするよりもエレガントな方法はありますか?
これまでの私の解決策:
/**
* @When /^I don\'t have javascript enabled$/
*/
public function iDonTHaveJavascriptEnabled()
{
$driver = $this->getSession()->getDriver();
if ($driver instanceof BrowserKitDriver or $driver instanceof GoutteDriver) {
return true;
}
throw new UnsupportedDriverActionException(
'Scenario needs to be tested with a javascript disabled driver',
$driver
);
}
/**
* @Then /^I should see a warning$/
*/
public function iShouldSeeAWarning()
{
$this->assertElementOnPage('noscript');
}
ご協力いただきありがとうございます!