|
6 | 6 |
|
7 | 7 | namespace Magento\Captcha\Test\TestCase;
|
8 | 8 |
|
9 |
| -use Magento\Backend\Test\Page\Adminhtml\SystemConfigEdit; |
10 |
| -use Magento\Captcha\Test\Constraint\AssertCaptchaFieldOnBackend; |
11 |
| -use Magento\Captcha\Test\Page\Captcha\AdminAuthLoginWithCaptcha; |
| 9 | +use Magento\Backend\Test\Page\AdminAuthLogin; |
12 | 10 | use Magento\Mtf\TestCase\Injectable;
|
13 | 11 | use Magento\Mtf\TestStep\TestStepFactory;
|
14 | 12 | use Magento\User\Test\Fixture\User;
|
| 13 | +use Magento\Captcha\Test\Constraint\AssertCaptchaFieldOnBackend; |
| 14 | +use Magento\Captcha\Test\Page\Captcha\AdminAuthLoginWithCaptcha; |
| 15 | +use Magento\Backend\Test\Page\Adminhtml\SystemConfigEdit; |
15 | 16 |
|
16 | 17 | /**
|
17 | 18 | * Check CAPTCHA on Admin Login Page.
|
|
30 | 31 | class CaptchaOnAdminLoginTest extends Injectable
|
31 | 32 | {
|
32 | 33 | /**
|
33 |
| - * Step factory. |
| 34 | + * Admin login page with Captcha. |
34 | 35 | *
|
35 |
| - * @var TestStepFactory |
| 36 | + * @var AdminAuthLoginWithCaptcha |
36 | 37 | */
|
37 |
| - private $stepFactory; |
| 38 | + private $adminAuthWithCaptcha; |
38 | 39 |
|
39 | 40 | /**
|
40 |
| - * Assert Captcha. |
| 41 | + * System configuration page. |
41 | 42 | *
|
42 |
| - * @var AssertCaptchaFieldOnBackend |
| 43 | + * @var SystemConfigEdit |
43 | 44 | */
|
44 |
| - private $assertCaptcha; |
| 45 | + private $systemConfigEditPage; |
45 | 46 |
|
46 | 47 | /**
|
47 |
| - * Admin login page. |
| 48 | + * Login page for Admin. |
48 | 49 | *
|
49 |
| - * @var AdminAuthLoginWithCaptcha |
| 50 | + * @var AdminAuthLogin |
50 | 51 | */
|
51 |
| - protected $adminAuthWithCaptcha; |
| 52 | + private $adminAuthLogin; |
52 | 53 |
|
53 | 54 | /**
|
54 |
| - * System configuration page. |
| 55 | + * Factory for Test Steps. |
55 | 56 | *
|
56 |
| - * @var SystemConfigEdit |
| 57 | + * @var TestStepFactory |
57 | 58 | */
|
58 |
| - private $systemConfigEditPage; |
| 59 | + private $stepFactory; |
59 | 60 |
|
60 | 61 | /**
|
61 |
| - * Configuration setting. |
| 62 | + * Assert captcha on backend login page. |
62 | 63 | *
|
63 |
| - * @var string |
| 64 | + * @var AssertCaptchaFieldOnBackend |
64 | 65 | */
|
65 |
| - private $configData; |
| 66 | + private $assertCaptcha; |
66 | 67 |
|
67 | 68 | /**
|
68 | 69 | * Injection data.
|
69 | 70 | *
|
| 71 | + * @param SystemConfigEdit $systemConfigEditPage |
70 | 72 | * @param AdminAuthLoginWithCaptcha $adminAuthWithCaptcha
|
71 | 73 | * @param TestStepFactory $stepFactory
|
| 74 | + * @param AdminAuthLogin $adminAuthLogin |
72 | 75 | * @param AssertCaptchaFieldOnBackend $assertCaptcha
|
73 |
| - * @param SystemConfigEdit $systemConfigEditPage |
74 | 76 | * @return void
|
75 | 77 | */
|
76 | 78 | public function __inject(
|
| 79 | + SystemConfigEdit $systemConfigEditPage, |
77 | 80 | AdminAuthLoginWithCaptcha $adminAuthWithCaptcha,
|
78 | 81 | TestStepFactory $stepFactory,
|
79 |
| - AssertCaptchaFieldOnBackend $assertCaptcha, |
80 |
| - SystemConfigEdit $systemConfigEditPage |
| 82 | + AdminAuthLogin $adminAuthLogin, |
| 83 | + AssertCaptchaFieldOnBackend $assertCaptcha |
81 | 84 | ) {
|
82 |
| - $this->stepFactory = $stepFactory; |
| 85 | + $this->systemConfigEditPage = $systemConfigEditPage; |
83 | 86 | $this->adminAuthWithCaptcha = $adminAuthWithCaptcha;
|
| 87 | + $this->stepFactory = $stepFactory; |
| 88 | + $this->adminAuthLogin = $adminAuthLogin; |
84 | 89 | $this->assertCaptcha = $assertCaptcha;
|
85 |
| - $this->systemConfigEditPage = $systemConfigEditPage; |
86 | 90 | }
|
87 | 91 |
|
88 | 92 | /**
|
89 |
| - * Login user on backend. |
| 93 | + * Log in user to Admin. |
90 | 94 | *
|
91 | 95 | * @param User $customAdmin
|
92 | 96 | * @param string $configData
|
93 | 97 | * @return void
|
94 | 98 | */
|
95 |
| - public function test( |
96 |
| - User $customAdmin, |
97 |
| - $configData |
98 |
| - ) { |
99 |
| - $this->configData = $configData; |
| 99 | + public function test(User $customAdmin, $configData) |
| 100 | + { |
100 | 101 | $customAdmin->persist();
|
101 | 102 |
|
102 | 103 | // Preconditions
|
103 | 104 | $this->stepFactory->create(
|
104 | 105 | \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
|
105 |
| - ['configData' => $this->configData] |
| 106 | + ['configData' => $configData] |
106 | 107 | )->run();
|
107 |
| - |
108 |
| - $this->adminAuthWithCaptcha->open(); |
| 108 | + $this->adminAuthLogin->open(); |
109 | 109 | $this->adminAuthWithCaptcha->getLoginBlockWithCaptcha()->fill($customAdmin);
|
110 | 110 | $this->assertCaptcha->processAssert($this->adminAuthWithCaptcha);
|
111 | 111 | $this->adminAuthWithCaptcha->getLoginBlockWithCaptcha()->submit();
|
|
0 commit comments