|
1 |
| -<h2>Первый тест на основе Page Object</h2> |
| 1 | +<h2>First test based on Page Object</h2> |
2 | 2 |
|
3 |
| -<p>Ура, первый прототип страницы мы уже реализовали! Давайте теперь перепишем тест с помощью Page Object: </p> |
| 3 | +<p>Hooray, we've implemented the first prototype of the page! Now let's rewrite the test using the Page Object: </p> |
4 | 4 |
|
5 |
| -<p>1. Откройте файл с вашим тестом <em>test_main_page.py</em></p> |
| 5 | +<p>1. Open the file with your test, <em>test_main_page.py</em>.</p> |
6 | 6 |
|
7 |
| -<p>2. В самом верху файла нужно импортировать класс, описывающий главную страницу: </p> |
| 7 | +<p>2. At the very top of the file, you need to import the class describing the main page. </p> |
8 | 8 |
|
9 |
| -<p>3. Теперь преобразуем сам тест в <em>test_main_page.py</em>: </p> |
| 9 | +<p>3. Now let's transform the test itself in <em>test_main_page.py</em>: </p> |
10 | 10 |
|
11 | 11 | <pre>
|
12 | 12 | <code class="language-python">from .pages.main_page import MainPage
|
13 | 13 |
|
14 | 14 |
|
15 | 15 | def test_guest_can_go_to_login_page(browser):
|
16 |
| - page = MainPage(browser, link) # initializing page object |
17 |
| - page.open() # opening page |
18 |
| - page.go_to_login_page() # using page method to open login page |
| 16 | + page = MainPage(browser, link) # initializing the page object |
| 17 | + page.open() # opening the page |
| 18 | + page.go_to_login_page() # using the page method to open the login page |
19 | 19 | </code></pre>
|
20 | 20 |
|
21 |
| -<p>4. Убедитесь, что тест проходит, запустив его все той же командой: </p> |
| 21 | +<p>4. Make sure the test passes by running it with the same command: </p> |
22 | 22 |
|
23 | 23 | <pre>
|
24 | 24 | <code>pytest -v --tb=line --language=en test_main_page.py
|
25 | 25 | </code></pre>
|
26 | 26 |
|
27 |
| -<p>Теперь наш тест <strong>почти </strong>полностью написан в модном стиле Page Object! Почему <strong>почти </strong>— узнаете в следующих шагах.</p> |
| 27 | +<p>Now, our test is <strong>almost </strong>completely written in the trendy Page Object style! Why <strong>almost </strong>— you'll find out in the following steps.</p> |
0 commit comments