BasicFunctionalTest.txt 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. * @Title("[NO TESTCASEID]: A Functional Cest")
  17. * @group functional
  18. */
  19. class BasicFunctionalTestCest
  20. {
  21. /**
  22. * @param AcceptanceTester $I
  23. * @throws \Exception
  24. */
  25. public function _before(AcceptanceTester $I)
  26. {
  27. $I->amOnPage("/beforeUrl");
  28. }
  29. /**
  30. * @param AcceptanceTester $I
  31. * @throws \Exception
  32. */
  33. public function _after(AcceptanceTester $I)
  34. {
  35. $I->amOnPage("/afterUrl");
  36. }
  37. /**
  38. * @param AcceptanceTester $I
  39. * @throws \Exception
  40. */
  41. public function _failed(AcceptanceTester $I)
  42. {
  43. $I->saveScreenshot();
  44. }
  45. /**
  46. * @Severity(level = SeverityLevel::CRITICAL)
  47. * @Features({"TestModule"})
  48. * @Stories({"MQE-305"})
  49. * @Parameter(name = "AcceptanceTester", value="$I")
  50. * @param AcceptanceTester $I
  51. * @return void
  52. * @throws \Exception
  53. */
  54. public function BasicFunctionalTest(AcceptanceTester $I)
  55. {
  56. $I->comment("");
  57. $I->comment("");
  58. $I->skipReadinessCheck(true);
  59. $I->comment("skipReadiness");
  60. $I->skipReadinessCheck(false);
  61. $someVarDefinition = $I->grabValueFrom();
  62. $I->acceptPopup();
  63. $I->amOnPage("/test/url");
  64. $I->appendField(".functionalTestSelector");
  65. $I->attachFile(".functionalTestSelector", "testFileAttachment");
  66. $I->cancelPopup();
  67. $I->checkOption(".functionalTestSelector");
  68. $I->click(".functionalTestSelector");
  69. $I->clickWithLeftButton(".functionalTestSelector");
  70. $I->clickWithRightButton(".functionalTestSelector");
  71. $I->clickWithLeftButton("#element#element .200", 200, 300);
  72. $I->clickWithRightButton("#element .4123#element", 200, 300);
  73. $I->closeTab();
  74. $I->conditionalClick(".functionalTestSelector", ".functionalDependentTestSelector", true);
  75. $I->amGoingTo("delete entity that has the createDataKey: createKey1");
  76. PersistedObjectHandler::getInstance()->deleteEntity(
  77. "createKey1",
  78. "test"
  79. );
  80. $I->deleteEntityByUrl("/V1/categories{$grabbedData}");
  81. $I->dontSee("someInput", ".functionalTestSelector");
  82. $I->dontSeeCheckboxIsChecked(".functionalTestSelector");
  83. $I->dontSeeCookie("someInput");
  84. $I->dontSeeCurrentUrlEquals("/functionalUrl");
  85. $I->dontSeeCurrentUrlMatches("/[0-9]+/");
  86. $I->dontSeeElement(".functionalTestSelector");
  87. $I->dontSeeElementInDOM(".functionalTestSelector");
  88. $I->dontSeeInCurrentUrl("/functionalUrl");
  89. $I->dontSeeInField(".functionalTestSelector");
  90. $I->dontSeeInPageSource("someInput");
  91. $I->dontSeeInSource("<myHtmlHere>");
  92. $I->dontSeeInTitle("someInput");
  93. $I->dontSeeLink("someInput", "/functionalUrl");
  94. $I->dontSeeOptionIsSelected(".functionalTestSelector", "someInput");
  95. $I->doubleClick(".functionalTestSelector");
  96. $I->dragAndDrop(".functionalTestSelector", ".functionalTestSelector2");
  97. $I->dragAndDrop(".functionalTestSelector", ".functionalTestSelector2", 100, 900);
  98. $executeJSKey1 = $I->executeJS("someJSFunction");
  99. $I->fillField(".functionalTestSelector", "someInput");
  100. $I->fillField(".functionalTestSelector", "0");
  101. $date = new \DateTime();
  102. $date->setTimestamp(strtotime("Now"));
  103. $date->setTimezone(new \DateTimeZone("America/Los_Angeles"));
  104. $generateDateKey = $date->format("H:i:s");
  105. $date = new \DateTime();
  106. $date->setTimestamp(strtotime("Now"));
  107. $date->setTimezone(new \DateTimeZone("UTC"));
  108. $generateDateKey2 = $date->format("H:i:s");
  109. $grabAttributeFromKey1 = $I->grabAttributeFrom(".functionalTestSelector", "someInput");
  110. $grabCookieKey1 = $I->grabCookie("grabCookieInput", ['domain' => 'www.google.com']);
  111. $grabFromCurrentUrlKey1 = $I->grabFromCurrentUrl("/grabCurrentUrl");
  112. $grabMultipleKey1 = $I->grabMultiple(".functionalTestSelector");
  113. $grabTextFromKey1 = $I->grabTextFrom(".functionalTestSelector");
  114. $grabValueFromKey1 = $I->grabValueFrom(".functionalTestSelector");
  115. $magentoCli1 = $I->magentoCLI("maintenance:enable", "\"stuffHere\"");
  116. $I->comment($magentoCli1);
  117. $I->makeScreenshot("screenShotInput");
  118. $I->maximizeWindow();
  119. $I->moveBack();
  120. $I->moveForward();
  121. $I->moveMouseOver(".functionalTestSelector");
  122. $I->openNewTab();
  123. $I->pauseExecution();
  124. $I->performOn("#selector", function(\WebDriverElement $el) {return $el->isDisplayed();}, 10);
  125. $I->pressKey("#page", "a");
  126. $I->pressKey("#page", ['ctrl', 'a'],'new');
  127. $I->pressKey("#page", ['shift', '111'],'1','x');
  128. $I->pressKey("#page", ['ctrl', 'a'],\Facebook\WebDriver\WebDriverKeys::DELETE);
  129. $I->reloadPage();
  130. $I->resetCookie("cookieInput");
  131. $I->resizeWindow(0, 0);
  132. $I->scrollTo(".functionalTestSelector");
  133. $I->see("someInput", ".functionalTestSelector");
  134. $I->seeCheckboxIsChecked(".functionalTestSelector");
  135. $I->seeCookie("someInput");
  136. $I->seeCurrentUrlEquals("/functionalUrl");
  137. $I->seeCurrentUrlMatches("/[0-9]+/");
  138. $I->seeElement(".functionalTestSelector");
  139. $I->seeElementInDOM(".functionalTestSelector");
  140. $I->seeInCurrentUrl("/functionalUrl");
  141. $I->seeInField(".functionalTestSelector", "someInput");
  142. $I->seeInPageSource("<myHtmlHere>");
  143. $I->seeInPopup("someInput");
  144. $I->seeInSource("<myHtmlHere>");
  145. $I->seeInTitle("someInput");
  146. $I->seeLink("someInput", "/functionalUrl");
  147. $I->seeNumberOfElements(".functionalTestSelector");
  148. $I->seeOptionIsSelected(".functionalTestSelector", "someInput");
  149. $I->selectOption(".functionalTestSelector");
  150. $I->selectMultipleOptions(".filter", ".option", ['opt1', 'opt2']);
  151. $I->setCookie("someInput", "someCookieValue");
  152. $I->switchToIFrame("someInput");
  153. $I->switchToNextTab();
  154. $I->switchToPreviousTab();
  155. $I->switchToWindow();
  156. $I->typeInPopup("someInput");
  157. $I->uncheckOption(".functionalTestSelector");
  158. $I->unselectOption(".functionalTestSelector", "someInput");
  159. $I->wait(30);
  160. $I->waitForElement(".functionalTestSelector", 30);
  161. $I->waitForElementNotVisible(".functionalTestSelector", 30);
  162. $I->waitForElementVisible(".functionalTestSelector", 30);
  163. $I->waitForElementChange("#selector", function(\WebDriverElement $el) {return $el->isDisplayed();}, 10);
  164. $I->waitForJS("someJsFunction", 30);
  165. $I->waitForText("someInput", 30, ".functionalTestSelector");
  166. }
  167. }