Source of file FeatureContext.php
Size: 1,283 Bytes - Last Modified: 2021-12-23T10:34:17+00:00
/var/www/docs.ssmods.com/process/src/tests/behat/src/FeatureContext.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | <?php namespace SilverStripe\ShareDraftContent\Tests\Behat\Context; use SilverStripe\BehatExtension\Context\SilverStripeContext; class FeatureContext extends SilverStripeContext { private const KEY = 'behat.sharedraftcontent.link'; /** * @Given /^I save the link to share draft content local storage$/ */ public function iSaveTheLinkToShareDraftContentLocalStorage() { $key = self::KEY; $js = <<<JS window.localStorage.setItem('{$key}', document.querySelector('.share-draft-content__link').value); JS; $this->getSession()->evaluateScript($js); } /** * @Given /^I follow the link in share draft content local storage$/ */ public function iFollowTheLinkInShareDraftContentLocalStorage() { $key = self::KEY; $js = <<<JS window.location = window.localStorage.getItem('{$key}'); JS; $this->getSession()->evaluateScript($js); } /** * @Given /^I clear the link from share draft content local storage$/ */ public function iClearTheLinkFromShareDraftContentLocalStorage() { $key = self::KEY; $js = <<<JS window.localStorage.removeItem('{$key}'); JS; $this->getSession()->evaluateScript($js); } } |