ExecuteJsEscapingTest.txt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Magento\AcceptanceTest\_default\Backend;
  3. use Magento\FunctionalTestingFramework\AcceptanceTester;
  4. use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore;
  5. use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;
  6. use \Codeception\Util\Locator;
  7. use Yandex\Allure\Adapter\Annotation\Features;
  8. use Yandex\Allure\Adapter\Annotation\Stories;
  9. use Yandex\Allure\Adapter\Annotation\Title;
  10. use Yandex\Allure\Adapter\Annotation\Description;
  11. use Yandex\Allure\Adapter\Annotation\Parameter;
  12. use Yandex\Allure\Adapter\Annotation\Severity;
  13. use Yandex\Allure\Adapter\Model\SeverityLevel;
  14. use Yandex\Allure\Adapter\Annotation\TestCaseId;
  15. /**
  16. */
  17. class ExecuteJsEscapingTestCest
  18. {
  19. /**
  20. * @Features({"TestModule"})
  21. * @Parameter(name = "AcceptanceTester", value="$I")
  22. * @param AcceptanceTester $I
  23. * @return void
  24. * @throws \Exception
  25. */
  26. public function ExecuteJsEscapingTest(AcceptanceTester $I)
  27. {
  28. $javaVariableEscape = $I->executeJS("return \$javascriptVariable");
  29. $mftfVariableNotEscaped = $I->executeJS("return {$doNotEscape}");
  30. $persistedDataNotEscaped = $I->executeJS("return " . PersistedObjectHandler::getInstance()->retrieveEntityField('persisted', 'data', 'test'));
  31. $hookPersistedDataNotEscaped = $I->executeJS("return " . PersistedObjectHandler::getInstance()->retrieveEntityField('persisted', 'data', 'test'));
  32. $addNewAttributeForRule = $I->executeJS("document.querySelector('entity option[value=" . PersistedObjectHandler::getInstance()->retrieveEntityField('productAttribute', 'attribute_code', 'test') . "]').setAttribute('selected', 'selected')");
  33. }
  34. }