Remove pytest reruns from integration-tests. (#11139)

* Remove pytest reruns from integration-tests.

* Updated submission logic.

* Fixes for codestyle.
This commit is contained in:
Benjamin Forehand Jr 2019-04-04 14:09:00 -04:00 коммит произвёл GitHub
Родитель a86dcc4e49
Коммит 187b7c2a89
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 30 добавлений и 13 удалений

Просмотреть файл

@ -104,7 +104,6 @@ jobs:
name: Start container, verify it's running and start tests
environment:
MOZ_HEADLESS: 1
PYTEST_ADDOPTS: "--reruns 2"
command: |
set -x
sudo sysctl -w vm.max_map_count=262144

Просмотреть файл

@ -1,5 +1,6 @@
from pypom import Region
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support import expected_conditions as expected
from olympia.files.tests.test_file_viewer import get_file
@ -73,18 +74,35 @@ class DevHub(Base):
file_path = get_file(xpi)
self.selenium.find_element(*self._submit_addon_btn_locator).click()
# Accept agreement
devhub_agreement = DevHubAgreement(
self.selenium, self.base_url
).wait_for_page_to_load()
devhub_agreement.accept_agreement()
try:
devhub_agreement = DevHubAgreement(
self.selenium, self.base_url
).wait_for_page_to_load()
except TimeoutException:
# Do nothing, the agreement has already been excepted
pass
else:
devhub_agreement.accept_agreement()
self.selenium.find_element(*self._continue_sub_btn_locator).click()
# Upload
upload = self.selenium.find_element(*self._upload_addon_locator)
upload.send_keys(file_path)
self.wait.until(
expected.element_to_be_clickable(self._submit_upload_btn_locator)
)
self.selenium.find_element(*self._submit_upload_btn_locator).click()
upload_finished = False
while upload_finished is not True:
try:
upload = self.selenium.find_element(
*self._upload_addon_locator)
upload.send_keys(file_path)
self.wait.until(
expected.element_to_be_clickable(
self._submit_upload_btn_locator)
)
self.selenium.find_element(
*self._submit_upload_btn_locator).click()
except TimeoutException:
upload_finished = False
except Exception:
raise Exception
else:
upload_finished = True
# Submit no source code
devhub_source = DevHubSource(
self.selenium, self.base_url

Просмотреть файл

@ -6,14 +6,14 @@ from pages.desktop.base import Base
class DevHubAgreement(Base):
_accept_button_locator = (By.ID, 'accept-agreement')
_addon_submission_locator = (By.CLASS_NAME, 'addon-submission-process')
_addon_agreement_links_locator = (By.CLASS_NAME, 'agreement-links')
_distribution_agreement_locator = (By.ID, 'id_distribution_agreement')
_review_policy_locator = (By.ID, 'id_review_policy')
def wait_for_page_to_load(self):
self.wait.until(
lambda _: self.is_element_displayed(
*self._addon_submission_locator
*self._addon_agreement_links_locator
)
)
return self