schek/coverage_frontend_update (#1040)

This commit is contained in:
aschek 2024-07-10 10:24:10 +03:00 коммит произвёл GitHub
Родитель a4636fde30
Коммит 72a09205a8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
7 изменённых файлов: 118 добавлений и 27 удалений

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

@ -34,7 +34,38 @@ jobs:
no_output_timeout: 30m
- store_artifacts:
path: coverage-devhub-tests-results.html
# run coverage frontend tests in a separate job in order to run in parallel with the other coverage runs
coverage_frontend_tests:
executor:
name: win/default
size: "large"
working_directory: ~/addons-release-tests/
steps:
- checkout
- run:
name: Upgrade pip
command: py -m pip install --upgrade pip --user
- run:
name: Install requirements
command: py -m pip install --no-deps -r ./requirements.txt
- run:
name: Install geckodriver
command: choco install selenium-gecko-driver -y
- run:
name: Install Firefox
command: choco install firefox-nightly --pre --ignore-checksums -y
- run:
name: Install Setup Tools
command: pip install setuptools
- run:
name: Run coverage frontend tests
environment:
MOZ_HEADLESS: 1
PYTEST_ADDOPTS: -n 1 --reruns 2
command: py -m pytest tests\coverage\test_coverage_frontend.py --driver Firefox --variables stage.json --html=coverage-devhub-tests-results.html --self-contained-html
no_output_timeout: 30m
- store_artifacts:
path: coverage-frontend-tests-results.html
# run collections tests in a separate serial job to make serial workflows more granular
collections_serial_tests:
executor:
@ -585,6 +616,7 @@ workflows:
- equal: [ "scheduled_coverage_run", << pipeline.schedule.name >> ]
jobs:
- coverage_devhub_tests
- coverage_frontend_tests
# scheduled in CircleCI project settings to run each Wednesdays at 08:00 UTC
scheduled_reviewer_tools_run:

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

@ -429,10 +429,10 @@ function filterTable(elem) { // eslint-disable-line no-unused-vars
}
</script>
<h1>coverage-devhub-tests-results.html</h1>
<p>Report generated on 03-Jul-2024 at 17:38:41 by <a href="https://pypi.python.org/pypi/pytest-html">pytest-html</a> v3.1.1</p>
<p>Report generated on 09-Jul-2024 at 16:33:11 by <a href="https://pypi.python.org/pypi/pytest-html">pytest-html</a> v3.1.1</p>
<h2>Summary</h2>
<p>1 tests ran in 9.01 seconds. </p>
<p class="filter" hidden="true">(Un)check the boxes to filter the results.</p><input checked="true" class="filter" data-test-result="passed" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="passed">1 passed</span>, <input checked="true" class="filter" data-test-result="skipped" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="skipped">0 skipped</span>, <input checked="true" class="filter" data-test-result="failed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="failed">0 failed</span>, <input checked="true" class="filter" data-test-result="error" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="error">0 errors</span>, <input checked="true" class="filter" data-test-result="xfailed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="xfailed">0 expected failures</span>, <input checked="true" class="filter" data-test-result="xpassed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="xpassed">0 unexpected passes</span>, <input checked="true" class="filter" data-test-result="rerun" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="rerun">0 rerun</span>
<p>2 tests ran in 53.53 seconds. </p>
<p class="filter" hidden="true">(Un)check the boxes to filter the results.</p><input checked="true" class="filter" data-test-result="passed" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="passed">2 passed</span>, <input checked="true" class="filter" data-test-result="skipped" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="skipped">0 skipped</span>, <input checked="true" class="filter" data-test-result="failed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="failed">0 failed</span>, <input checked="true" class="filter" data-test-result="error" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="error">0 errors</span>, <input checked="true" class="filter" data-test-result="xfailed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="xfailed">0 expected failures</span>, <input checked="true" class="filter" data-test-result="xpassed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="xpassed">0 unexpected passes</span>, <input checked="true" class="filter" data-test-result="rerun" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="rerun">0 rerun</span>
<h2>Results</h2>
<table id="results-table">
<thead id="results-table-head">
@ -446,8 +446,20 @@ function filterTable(elem) { // eslint-disable-line no-unused-vars
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">tests/coverage/test_coverage_devhub.py::test_geo_locations_tc_id_c1781143[Desktop]</td>
<td class="col-duration">8.88</td>
<td class="col-name">tests/coverage/test_coverage_frontend.py::test_geo_locations_tc_id_c1781143[Desktop]</td>
<td class="col-duration">48.19</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="log"> -----------------------------Captured stdout setup------------------------------ <br/>The &quot;click continue button&quot; event occurred.
The script should be on the password input screen here. We should see &quot;Sign in&quot; in the header. The card header title is &quot;Enter your password
for your Mozilla account&quot;
<br/></div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">tests/coverage/test_coverage_frontend.py::test_blocked_frontend_page_tc_id_c1771696[Desktop]</td>
<td class="col-duration">5.21</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">

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

@ -1 +1 @@
so9wzlvo6379rke4d4co2mxpzl9fr20n
dclh8kt1mgoxrvf6oxe52r8kh77xsalb

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

@ -37,6 +37,9 @@ class Detail(Base):
_page_not_available_in_region = (By.XPATH, "//div[contains(text(), 'That page is not available in your region')]")
_not_available_in_your_region_message = (By.XPATH, "//p[contains(text(), 'The page you tried to access is not available in your region.')]")
_paragraphs_with_links_message = (By.CSS_SELECTOR, "p.Errors-paragraph-with-links")
_card_header_text_message = (By.CSS_SELECTOR, ".Card-header-text")
_why_was_it_blocked_message = (By.CSS_SELECTOR, ".Card-contents > h2")
_block_metadata_message = (By.CSS_SELECTOR, ".Block-metadata")
def wait_for_page_to_load(self):
"""Waits for various page components to be loaded"""
@ -246,6 +249,18 @@ class Detail(Base):
def paragraphs_with_links_message(self):
return self.find_element(*self._paragraphs_with_links_message)
@property
def card_header_text(self):
return self.find_element(*self._card_header_text_message)
@property
def why_was_it_blocked(self):
return self.find_element(*self._why_was_it_blocked_message)
@property
def block_metadata(self):
return self.find_element(*self._block_metadata_message)
class Stats(Region):
_root_locator = (By.CLASS_NAME, "AddonMeta")
_stats_users_locator = (By.CSS_SELECTOR, ".AddonMeta dl:nth-child(1)")

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

@ -218,5 +218,9 @@
"page_not_available_in_your_region": "That page is not available in your region",
"page_not_accessible_in_your_region": "The page you tried to access is not available in your region.",
"paragraph_with_links": "You may be able to find what youre looking for in one of the available extensions or themes, or by asking for help on our community forums."
"paragraph_with_links": "You may be able to find what youre looking for in one of the available extensions or themes, or by asking for help on our community forums.",
"card_header_text": "Test Tab Mix has been blocked for your protection.",
"why_was_it_blocked": "Why was it blocked?",
"block_metadata": "Versions blocked: all versions."
}

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

@ -222,24 +222,5 @@ def test_addon_submission_without_id_mv3_extensions_tc_id_c1950460(selenium, bas
in submit_addon.success_validation_message.text
)
@pytest.mark.coverage
@pytest.mark.create_session("submissions_user")
def test_geo_locations_tc_id_c1781143(selenium, base_url, wait, variables):
# Test Case:C1781143 AMO Coverage > Require admin tools
selenium.get(f"{base_url}/firefox/addon/devhub-listed-ext-06-13/")
detail_page = Detail(selenium, base_url).wait_for_page_to_load()
assert(
variables["page_not_available_in_your_region"]
in detail_page.page_not_available_in_region.text
)
assert (
variables["page_not_accessible_in_your_region"]
in detail_page.not_available_in_your_region_message.text
)
assert (
variables["paragraph_with_links"]
in detail_page.paragraphs_with_links_message.text
)

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

@ -0,0 +1,47 @@
import pytest
from pages.desktop.developers.devhub_home import DevHubHome
from pages.desktop.developers.manage_versions import ManageVersions
from pages.desktop.developers.submit_addon import ListedAddonSubmissionForm, SubmissionConfirmationPage
from pages.desktop.frontend.details import Detail
from pages.desktop.developers.manage_authors_and_license import ManageAuthorsAndLicenses
from scripts import reusables
@pytest.mark.coverage
@pytest.mark.login("developer")
def test_geo_locations_tc_id_c1781143(selenium, base_url, wait, variables):
# Test Case:C1781143 AMO Coverage > Require admin tools
selenium.get(f"{base_url}/firefox/addon/devhub-listed-ext-06-13/")
detail_page = Detail(selenium, base_url).wait_for_page_to_load()
assert(
variables["page_not_available_in_your_region"]
in detail_page.page_not_available_in_region.text
)
assert (
variables["page_not_accessible_in_your_region"]
in detail_page.not_available_in_your_region_message.text
)
assert (
variables["paragraph_with_links"]
in detail_page.paragraphs_with_links_message.text
)
@pytest.mark.coverage
@pytest.mark.create_session("developer")
def test_blocked_frontend_page_tc_id_c1771696(selenium, base_url, wait, variables):
# Test Case: C1771696 AMO Coverage > Require admin tools
selenium.get(f"{base_url}/firefox/blocked-addon/alextest@mail.ro/")
detail_page = Detail(selenium, base_url).wait_for_page_to_load()
assert (
variables["card_header_text"]
in detail_page.card_header_text.text
)
assert (
variables["why_was_it_blocked"]
in detail_page.why_was_it_blocked.text
)
assert (
variables["block_metadata"]
in detail_page.block_metadata.text
)