bug hunters home work 5 - #5
Conversation
feat: add EventPage and LoginPage tests with Playwright
HW5 Kateryna
| if capacity: self.fill(self._CAPACITY, capacity) | ||
| return self | ||
|
|
||
| def create_event(self, title: str, description: str = "", |
There was a problem hiding this comment.
Создание мероприятия требует множество полей обязательных. У тебя тут из обязательных только title. Еще обсудим это на занятии
| _PROFILE_BTN = "button:has-text('Профиль'), a:has-text('Профиль')" | ||
| _REGISTER_LINK = "span:has-text('нет аккаунта'), a:has-text('Регистрация')" | ||
| _REG_FOR_USER = "button:has-text('Для пользователя')" | ||
| _REG_FOR_MANAGER = "button:has-text('Для организатора')" | ||
| _FIRST_NAME = "input[name='firstName'], input[placeholder*='Имя']" | ||
| _LAST_NAME = "input[name='lastName'], input[placeholder*='Фамилия']" | ||
| _REG_SUBMIT = "button[type='submit']:has-text('Зарегистрироваться')" |
There was a problem hiding this comment.
Упадет, если язык сменится. Аккуратно с has-text. Удобно, но не практично на сайтах, где 2 и более языка.
| class AuthPage(BasePage): | ||
| _EMAIL = "input[name='email'], input[type='email']" | ||
| _PASSWORD = "input[name='password'], input[type='password']" | ||
| _SUBMIT = "button[type='submit']:has-text('Войти')" |
There was a problem hiding this comment.
Упадет, если язык сменится. Аккуратно с has-text. Удобно, но не практично на сайтах, где 2 и более языка.
| self.fill(self._EMAIL, email) | ||
| self.fill(self._PASSWORD, password) | ||
| self.click(self._SUBMIT) | ||
| # self.page.wait_for_timeout(1_500) |
| _SAVE_BTN = "button:has-text('Сохранить')" | ||
| _SUCCESS_TOAST = "[class*='success'], :text('обновлено'), :text('сохранено')" | ||
| _TICKETS_BTN = "button:has-text('Создание/редактирование билетов')" |
There was a problem hiding this comment.
Упадет, если язык сменится. Аккуратно с has-text. Удобно, но не практично на сайтах, где 2 и более языка.
| def check_page_loaded(self): | ||
| expect(self.title).to_be_visible(timeout=15000) |
There was a problem hiding this comment.
Не уверен, что это нам понадобится
| def test_event_page(page: Page): | ||
| event = EventPage(page) | ||
|
|
||
| event.open("https://polakohedonist.club/en/events/5ebacd6a-c977-411c-a030-b70f68e68faa") | ||
|
|
||
| event.check_page_loaded() | ||
| event.page.wait_for_timeout(2000) | ||
|
|
||
| event.add_ticket(1) | ||
| event.check_buy_button() | ||
|
|
||
|
|
||
| def test_event_page(page: Page): | ||
| event = EventPage(page) | ||
| event.open("https://polakohedonist.club/en/events/5ebacd6a-c977-411c-a030-b70f68e68faa") | ||
|
|
||
| print("Все кнопки на странице:") | ||
| buttons = page.locator("button").all() | ||
| for i, btn in enumerate(buttons[:15]): # первые 15 | ||
| text = btn.inner_text().strip()[:50] | ||
| classes = btn.get_attribute("class") | ||
| print(f"{i}: '{text}' | classes: {classes}") |
| _TYPE_NO_SEATS = "button:has-text('Без мест')" | ||
| _TYPE_WITH_SEATS = "button:has-text('С местами')" | ||
| _CONTINUE_BTN = "button:has-text('Продолжить')" | ||
| _TICKET_NAME = "input[name='ticketName'], input[placeholder*='Название']" | ||
| _QUANTITY = "input[name='quantity'], input[placeholder*='Количество']" | ||
| _PRICE = "input[name='price'], input[placeholder*='Цена']" | ||
| _SAVE_TICKET_BTN = "button:has-text('Сохранить')" | ||
| _CREATE_TICKETS = "button:has-text('Создать билеты')" | ||
| _SUCCESS = "[class*='success'], :text('билеты созданы')" |
There was a problem hiding this comment.
Упадет, если язык сменится. Аккуратно с has-text. Удобно, но не практично на сайтах, где 2 и более языка.
There was a problem hiding this comment.
Обычно на проектах .env не коммитят, его буквально прикрепляют в каналах, чтобы сотрудники руками его скачивали
Удален Итоговая структура.txt из отслеживания
feat: personal info happy path test is working
HW6 correcting mistakes
HW7 KATERYNA correcting mistakes
HW7 KATERYNA correcting mistakes in authorization
HW7 KATERYNA correcting mistakes in personal info
make structure and work with pages