ActionGroupWithPersistedData.txt 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. * @group functional
  17. */
  18. class ActionGroupWithPersistedDataCest
  19. {
  20. /**
  21. * @param AcceptanceTester $I
  22. * @throws \Exception
  23. */
  24. public function _before(AcceptanceTester $I)
  25. {
  26. $I->amGoingTo("create entity that has the stepKey: createPersonParam");
  27. PersistedObjectHandler::getInstance()->createEntity(
  28. "createPersonParam",
  29. "hook",
  30. "ReplacementPerson",
  31. [],
  32. null
  33. );
  34. $I->fillField("#foo", "myData1");
  35. $I->fillField("#bar", "myData2");
  36. }
  37. /**
  38. * @param AcceptanceTester $I
  39. * @throws \Exception
  40. */
  41. public function _after(AcceptanceTester $I)
  42. {
  43. $I->fillField("#foo", "myData1");
  44. $I->fillField("#bar", "myData2");
  45. }
  46. /**
  47. * @param AcceptanceTester $I
  48. * @throws \Exception
  49. */
  50. public function _failed(AcceptanceTester $I)
  51. {
  52. $I->saveScreenshot();
  53. }
  54. /**
  55. * @Severity(level = SeverityLevel::CRITICAL)
  56. * @Features({"TestModule"})
  57. * @Stories({"MQE-433"})
  58. * @Parameter(name = "AcceptanceTester", value="$I")
  59. * @param AcceptanceTester $I
  60. * @return void
  61. * @throws \Exception
  62. */
  63. public function ActionGroupWithPersistedData(AcceptanceTester $I)
  64. {
  65. $I->amGoingTo("create entity that has the stepKey: createPerson");
  66. PersistedObjectHandler::getInstance()->createEntity(
  67. "createPerson",
  68. "test",
  69. "DefaultPerson",
  70. [],
  71. null
  72. );
  73. $I->amOnPage("/" . PersistedObjectHandler::getInstance()->retrieveEntityField('createPerson', 'firstname', 'test') . "/" . PersistedObjectHandler::getInstance()->retrieveEntityField('createPerson', 'lastname', 'test') . ".html");
  74. $I->fillField("#foo", PersistedObjectHandler::getInstance()->retrieveEntityField('createPerson', 'firstname', 'test'));
  75. $I->fillField("#bar", PersistedObjectHandler::getInstance()->retrieveEntityField('createPerson', 'lastname', 'test'));
  76. $I->searchAndMultiSelectOption("#foo", [PersistedObjectHandler::getInstance()->retrieveEntityField('createPerson', 'firstname', 'test'), PersistedObjectHandler::getInstance()->retrieveEntityField('createPerson', 'lastname', 'test')]);
  77. $I->see("#element ." . PersistedObjectHandler::getInstance()->retrieveEntityField('createPerson', 'firstname', 'test'));
  78. }
  79. }