From 4afc5b94fd28ab5d09f1a5b4ef682cbef257fea4 Mon Sep 17 00:00:00 2001 From: aschek <139126091+alexandruschek@users.noreply.github.com> Date: Mon, 30 Oct 2023 10:34:49 +0200 Subject: [PATCH] update submissions tests (#877) --- pages/desktop/developers/addons_manage.py | 1 - pages/desktop/developers/submit_addon.py | 28 ++-- sample-addons/make-addon.zip | Bin 194 -> 306 bytes sample-addons/manifest.json | 2 +- submissions-dev-test-results.html | 146 +++++++++--------- submissions_user.txt | 2 +- tests/conftest.py | 2 +- tests/coverage/test_coverage_devhub.py | 4 +- .../test_addon_submissions.py | 12 +- 9 files changed, 103 insertions(+), 94 deletions(-) diff --git a/pages/desktop/developers/addons_manage.py b/pages/desktop/developers/addons_manage.py index 3892684..f1c4eb5 100644 --- a/pages/desktop/developers/addons_manage.py +++ b/pages/desktop/developers/addons_manage.py @@ -61,6 +61,5 @@ class ManageAddons(Base): return self.find_element(*self._addon_name_locator).text def click_addon_name(self): - self.wait.until(EC.element_to_be_clickable(self._addon_edit_link_locator)) self.find_element(*self._addon_edit_link_locator).click() return EditAddon(self.driver, self.page.base_url).wait_for_page_to_load() diff --git a/pages/desktop/developers/submit_addon.py b/pages/desktop/developers/submit_addon.py index f3af144..5545113 100644 --- a/pages/desktop/developers/submit_addon.py +++ b/pages/desktop/developers/submit_addon.py @@ -82,7 +82,7 @@ class SubmitAddon(Page): ) _create_theme_button_locator = (By.ID, "wizardlink") _submit_file_button_locator = (By.ID, "submit-upload-file-finish") - _addon_validation_success_locator = (By.CLASS_NAME, "bar-success") + _addon_validation_success_locator = (By.CSS_SELECTOR, "#upload-status-bar.bar-success") _validation_fail_bar_locator = (By.CLASS_NAME, "bar-fail") _validation_support_link_locator = (By.CSS_SELECTOR, "#upload-status-results a") _validation_failed_message_locator = ( @@ -611,14 +611,14 @@ class ListedAddonSubmissionForm(Page): _is_experimental_checkbox_locator = (By.ID, "id_is_experimental") _requires_payment_checkbox_locator = (By.ID, "id_requires_payment") _categories_section_locator = (By.ID, "addon-categories-edit") - _firefox_categories_locator = ( + _categories_locator = ( By.CSS_SELECTOR, ".addon-app-cats:nth-of-type(1) > ul input", ) - _android_categories_locator = ( - By.CSS_SELECTOR, - ".addon-app-cats:nth-of-type(2) > ul input", - ) + # _android_categories_locator = ( + # By.CSS_SELECTOR, + # ".addon-app-cats:nth-of-type(2) > ul input", + # ) _email_input_field_locator = (By.ID, "id_support_email_0") _support_site_input_field_locator = (By.ID, "id_support_url_0") _license_options_locator = (By.CLASS_NAME, "license") @@ -637,7 +637,8 @@ class ListedAddonSubmissionForm(Page): ".submission-buttons button:nth-child(2)", ) # _theme_categories_locator = (By.CSS_SELECTOR, '#addon-categories-edit > ul input') - temporary not available - _theme_categories_locator = (By.CSS_SELECTOR, "#id_category input") + _theme_categories_locator = (By.CSS_SELECTOR, ".addon-app-cats") + _theme_category_abstract_locator = (By.CSS_SELECTOR, "#id_categories > div:nth-child(1) > label") _theme_licence_sharing_rights_locator = ( By.CSS_SELECTOR, "#cc-chooser ul:nth-of-type(1) input", @@ -666,6 +667,10 @@ class ListedAddonSubmissionForm(Page): def clear_addon_name(self): self.find_element(*self._addon_name_field_locator).clear() + @property + def theme_category_abstract(self): + return self.find_element(*self._theme_category_abstract_locator) + @property def addon_name_field(self): self.wait.until( @@ -717,11 +722,11 @@ class ListedAddonSubmissionForm(Page): ) return self.find_element(*self._categories_section_locator) - def select_firefox_categories(self, count): - self.find_elements(*self._firefox_categories_locator)[count].click() + def select_categories(self, count): + self.find_elements(*self._categories_locator)[count].click() - def select_android_categories(self, count): - self.find_elements(*self._android_categories_locator)[count].click() + # def select_android_categories(self, count): + # self.find_elements(*self._android_categories_locator)[count].click() def select_theme_categories(self, count): self.find_elements(*self._theme_categories_locator)[count].click() @@ -929,5 +934,4 @@ class SubmissionConfirmationPage(Page): @property def generated_theme_preview(self): - self.wait.until(EC.visibility_of_element_located(self._theme_preview_locator)) return self.find_element(*self._theme_preview_locator) diff --git a/sample-addons/make-addon.zip b/sample-addons/make-addon.zip index f68a18567b9eb34dcbf6ea77ed138ca590c43481..9efa3756c1183674f4d2504a0defdac12daf21ec 100644 GIT binary patch literal 306 zcmWIWW@Zs#0D;Q^ap4sAr%A6v<1>O$ACS#grNtStNr3bVGv` f{D3@#)RfGU)D)%K0B=Sn5oT=Ke;KhAf=vYgOC1$j diff --git a/sample-addons/manifest.json b/sample-addons/manifest.json index a7bb564..9d18889 100644 --- a/sample-addons/manifest.json +++ b/sample-addons/manifest.json @@ -1 +1 @@ -{"manifest_version": 2, "version": "3.0", "name": "EN-US Name edited"} \ No newline at end of file +{"manifest_version": 2, "version": "1.0", "name": "\u028c\u0251:\u00e6\u010d\u03b2\u3041\u0147", "description": "\u263a\ufe0f\u028c\u0251:\u00e6\u010d\u03b2\u3041\u0147\u263a\ufe0f"} \ No newline at end of file diff --git a/submissions-dev-test-results.html b/submissions-dev-test-results.html index 36d2338..d780595 100644 --- a/submissions-dev-test-results.html +++ b/submissions-dev-test-results.html @@ -429,9 +429,9 @@ function filterTable(elem) { // eslint-disable-line no-unused-vars }

submissions-dev-test-results.html

-

Report generated on 10-Oct-2023 at 10:03:13 by pytest-html v3.1.1

+

Report generated on 30-Oct-2023 at 10:07:34 by pytest-html v3.1.1

Summary

-

22 tests ran in 818.26 seconds.

+

22 tests ran in 835.33 seconds.

21 passed, 0 skipped, 1 failed, 0 errors, 0 expected failures, 0 unexpected passes, 0 rerun

Results

@@ -447,72 +447,78 @@ function filterTable(elem) { // eslint-disable-line no-unused-vars - - + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - +
Failed tests/devhub_submissions/test_addon_submissions.py::test_addon_last_modified_date[Desktop]4.73
5.03
-
-
selenium = <selenium.webdriver.firefox.webdriver.WebDriver (session="44bccf9c-4204-4836-9683-d4f088dac778")>, base_url = 'https://addons-dev.allizom.org'

@pytest.mark.serial
@pytest.mark.create_session("submissions_user")
def test_addon_last_modified_date(selenium, base_url):
page = DevHubHome(selenium, base_url).open().wait_for_page_to_load()
# check the last modified date in the latest submitted addon on Devhub homepage (should be current date)
print(page.my_addons_list[0].my_addon_modified_date_text)
> assert (
reusables.current_date() == page.my_addons_list[0].my_addon_modified_date_text
)
E AssertionError: assert 'Oct #d, 2023' == 'Oct 10, 2023'
E - Oct 10, 2023
E ? ^^
E + Oct #d, 2023
E ? ^^

tests/devhub_submissions/test_addon_submissions.py:333: AssertionError
------------------------------Captured stdout call------------------------------
Oct 10, 2023 +
+
selenium = <selenium.webdriver.firefox.webdriver.WebDriver (session="86badbd4-d6a7-4b1b-9704-76c6150ca7fa")>, base_url = 'https://addons-dev.allizom.org'

@pytest.mark.serial
@pytest.mark.create_session("submissions_user")
def test_addon_last_modified_date(selenium, base_url):
page = DevHubHome(selenium, base_url).open().wait_for_page_to_load()
# check the last modified date in the latest submitted addon on Devhub homepage (should be current date)
print(page.my_addons_list[0].my_addon_modified_date_text)
> assert (
reusables.current_date() == page.my_addons_list[0].my_addon_modified_date_text
)
E AssertionError: assert 'Oct #d, 2023' == 'Oct 30, 2023'
E - Oct 30, 2023
E ? ^^
E + Oct #d, 2023
E ? ^^

tests/devhub_submissions/test_addon_submissions.py:334: AssertionError
------------------------------Captured stdout call------------------------------
Oct 30, 2023
Passed tests/devhub_submissions/test_addon_submissions.py::test_devhub_developer_agreement_page_contents[Desktop]15.72
-
-----------------------------Captured stdout setup------------------------------
The "click continue button" event occurred. -The script should be on the password input screen here. We should see "Sign in" in the header. The card header title is "Enter your password -for your Firefox account" -
Passedtests/devhub_submissions/test_addon_submissions.py::test_devhub_developer_agreement_page_links[Desktop]8.52
-
No log output captured.
Passedtests/devhub_submissions/test_addon_submissions.py::test_devhub_developer_agreement_checkboxes[Desktop]7.10
-
No log output captured.
Passedtests/devhub_submissions/test_addon_submissions.py::test_submit_listed_wizard_theme[Desktop]61.6116.19
------------------------------Captured stdout call------------------------------
The "click continue button" event occurred. The script should be on the password input screen here. We should see "Sign in" in the header. The card header title is "Enter your password -for your Firefox account" +for your Mozilla account"
Passedtests/devhub_submissions/test_addon_submissions.py::test_submit_unlisted_addon[Desktop]56.98tests/devhub_submissions/test_addon_submissions.py::test_devhub_developer_agreement_page_links[Desktop]16.41
+
------------------------------Captured stdout call------------------------------
The "click continue button" event occurred. +The script should be on the password input screen here. We should see "Sign in" in the header. The card header title is "Enter your password +for your Mozilla account" +
Passedtests/devhub_submissions/test_addon_submissions.py::test_devhub_developer_agreement_checkboxes[Desktop]13.32
+
------------------------------Captured stdout call------------------------------
The "click continue button" event occurred. +The script should be on the password input screen here. We should see "Sign in" in the header. The card header title is "Enter your password +for your Mozilla account" +
Passedtests/devhub_submissions/test_addon_submissions.py::test_submit_listed_wizard_theme_tc_id_c97500[Desktop]64.15
+
------------------------------Captured stdout call------------------------------
The "click continue button" event occurred. +The script should be on the password input screen here. We should see "Sign in" in the header. The card header title is "Enter your password +for your Mozilla account" +
Passedtests/devhub_submissions/test_addon_submissions.py::test_submit_unlisted_addon_tc_id_c14886[Desktop]61.31
-----------------------------Captured stdout setup------------------------------
The "click continue button" event occurred. The script should be on the password input screen here. We should see "Sign in" in the header. The card header title is "Enter your password -for your Firefox account" +for your Mozilla account"
Passedtests/devhub_submissions/test_addon_submissions.py::test_addon_distribution_page_contents[Desktop]8.15tests/devhub_submissions/test_addon_submissions.py::test_addon_distribution_page_contents_tc_id_c14882[Desktop]10.79
@@ -521,7 +527,7 @@ for your Firefox account"
Passed tests/devhub_submissions/test_addon_submissions.py::test_devhub_upload_extension_page_contents[Desktop]5.085.47
@@ -530,7 +536,7 @@ for your Firefox account"
Passed tests/devhub_submissions/test_addon_submissions.py::test_upload_unsupported_file_validation_error[Desktop]6.417.07
@@ -539,7 +545,7 @@ for your Firefox account"
Passed tests/devhub_submissions/test_addon_submissions.py::test_verify_first_version_autoapproval[Desktop]253.72223.76
@@ -547,8 +553,8 @@ for your Firefox account"
Passedtests/devhub_submissions/test_addon_submissions.py::test_submit_listed_addon[Desktop]23.07tests/devhub_submissions/test_addon_submissions.py::test_submit_listed_addon_tc_id_c4369[Desktop]19.46
@@ -556,8 +562,8 @@ for your Firefox account"
Passedtests/devhub_submissions/test_addon_submissions.py::test_submit_addon_3mb_size[Desktop]22.52tests/devhub_submissions/test_addon_submissions.py::test_submit_addon_3mb_size_tc_id_c2274214[Desktop]22.91
@@ -565,8 +571,8 @@ for your Firefox account"
Passedtests/devhub_submissions/test_addon_submissions.py::test_submit_mixed_addon_versions[Desktop]18.16tests/devhub_submissions/test_addon_submissions.py::test_submit_mixed_addon_versions_tc_id_c14981[Desktop]16.95
@@ -574,21 +580,21 @@ for your Firefox account"
Passedtests/devhub_submissions/test_addon_submissions.py::test_verify_new_unlisted_version_autoapproval[Desktop]210.42tests/devhub_submissions/test_addon_submissions.py::test_verify_new_unlisted_version_autoapproval_tc_id_C4372[Desktop]238.51
------------------------------Captured stdout call------------------------------
The "click continue button" event occurred. The script should be on the password input screen here. We should see "Sign in" in the header. The card header title is "Enter your password -for your Firefox account" -Manifest content: {'manifest_version': 2, 'theme': {'frame': '#083af0', 'tab_background_text': '#ffffff'}, 'version': '48.0', 'name': 'New version auto-approval'} +for your Mozilla account" +Manifest content: {'manifest_version': 2, 'theme': {'frame': '#083af0', 'tab_background_text': '#ffffff'}, 'version': '75.0', 'name': 'New version auto-approval'}
Passedtests/devhub_submissions/test_addon_submissions.py::test_submit_unicode_addon[Desktop-Chinese characters]14.27tests/devhub_submissions/test_addon_submissions.py::test_submit_unicode_addon_tc_id_c4590[Desktop-Chinese characters]13.79
@@ -597,8 +603,8 @@ Manifest content: {'manifest_version': 2, 'theme': {'fr
Passedtests/devhub_submissions/test_addon_submissions.py::test_submit_unicode_addon[Desktop-Arabic characters]14.00tests/devhub_submissions/test_addon_submissions.py::test_submit_unicode_addon_tc_id_c4590[Desktop-Arabic characters]13.22
@@ -607,8 +613,8 @@ Manifest content: {'manifest_version': 2, 'theme': {'fr
Passedtests/devhub_submissions/test_addon_submissions.py::test_submit_unicode_addon[Desktop-Korean characters]13.69tests/devhub_submissions/test_addon_submissions.py::test_submit_unicode_addon_tc_id_c4590[Desktop-Korean characters]13.23
@@ -617,8 +623,8 @@ Manifest content: {'manifest_version': 2, 'theme': {'fr
Passedtests/devhub_submissions/test_addon_submissions.py::test_submit_unicode_addon[Desktop-Burmese characters]14.48tests/devhub_submissions/test_addon_submissions.py::test_submit_unicode_addon_tc_id_c4590[Desktop-Burmese characters]13.36
@@ -627,8 +633,8 @@ Manifest content: {'manifest_version': 2, 'theme': {'fr
Passedtests/devhub_submissions/test_addon_submissions.py::test_submit_unicode_addon[Desktop-Random non-ascii characters]13.88tests/devhub_submissions/test_addon_submissions.py::test_submit_unicode_addon_tc_id_c4590[Desktop-Random non-ascii characters]14.02
@@ -637,8 +643,8 @@ Manifest content: {'manifest_version': 2, 'theme': {'fr
Passedtests/devhub_submissions/test_addon_submissions.py::test_addon_validation_warning[Desktop]9.31tests/devhub_submissions/test_addon_submissions.py::test_addon_validation_warning_tc_id_c2283005[Desktop]8.72
@@ -647,7 +653,7 @@ Manifest content: {'manifest_version': 2, 'theme': {'fr
Passed tests/devhub_submissions/test_addon_submissions.py::test_cancel_and_disable_version_during_upload[Desktop]12.3713.51
@@ -656,7 +662,7 @@ Manifest content: {'manifest_version': 2, 'theme': {'fr
Passed tests/devhub_submissions/test_addon_submissions.py::test_delete_all_extensions[Desktop]23.8223.70
diff --git a/submissions_user.txt b/submissions_user.txt index 2a37e01..82feeac 100644 --- a/submissions_user.txt +++ b/submissions_user.txt @@ -1 +1 @@ -1oxn6s79cpl2jb4s575nr0mps0u0nna8 \ No newline at end of file +ktforx1gytxlcbxneb64clczzp8x0a9t \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index b5ff0dc..6ce2697 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -71,7 +71,7 @@ def firefox_options(firefox_options, base_url, variables): firefox_options.set_preference( "extensions.update.url", variables["extensions_update_url"] ) - firefox_options.add_argument("-headless") + firefox_options.add_argument("-foreground") firefox_options.log.level = "trace" return firefox_options diff --git a/tests/coverage/test_coverage_devhub.py b/tests/coverage/test_coverage_devhub.py index 646bef3..58ddcd7 100644 --- a/tests/coverage/test_coverage_devhub.py +++ b/tests/coverage/test_coverage_devhub.py @@ -24,7 +24,7 @@ def submit_addon_method(selenium, base_url): summary = reusables.get_random_string(10) confirmation_page.set_addon_name(random_string) confirmation_page.set_addon_summary(summary) - confirmation_page.select_firefox_categories(1) + confirmation_page.select_categories(1) confirmation_page.select_license_options[0].click() confirmation_page.submit_addon() return f"listed-addon{random_string}" @@ -138,7 +138,7 @@ def test_disable_an_addon_at_submission_tc_id_c1898098(selenium, base_url, wait, listed_addon_submission_form.clear_addon_name() listed_addon_submission_form.set_addon_name(random_string) listed_addon_submission_form.set_addon_summary(summary) - listed_addon_submission_form.select_firefox_categories(1) + listed_addon_submission_form.select_categories(1) listed_addon_submission_form.select_license_options[0].click() """Complete the form and "Submit Version""" listed_addon_submission_form.submit_addon() diff --git a/tests/devhub_submissions/test_addon_submissions.py b/tests/devhub_submissions/test_addon_submissions.py index 84b0d4f..27d3055 100644 --- a/tests/devhub_submissions/test_addon_submissions.py +++ b/tests/devhub_submissions/test_addon_submissions.py @@ -91,7 +91,7 @@ def test_submit_listed_wizard_theme_tc_id_c97500(selenium, base_url, variables, assert theme_name in theme_details.addon_name_field.get_attribute("value") theme_details.set_addon_summary("Theme summary") # select a category for the theme - theme_details.select_theme_categories(0) + theme_details.theme_category_abstract.click() # set up a license for the theme based on 'Yes'[0]/'No'[1] options theme_details.select_theme_licence_sharing_rights(1) theme_details.select_theme_license_commercial_use(1) @@ -251,8 +251,8 @@ def test_submit_listed_addon_tc_id_c4369(selenium, base_url, variables, wait): details_form.requires_payment.click() # reusables.scroll_into_view(selenium, details_form.categories_section) # set Firefox and Android categories for the addon - details_form.select_firefox_categories(0) - details_form.select_android_categories(0) + details_form.select_categories(0) + # details_form.select_android_categories(0) details_form.email_input_field("some-mail@mail.com") details_form.support_site_input_field("https://example.com") # set an addon license from the available list @@ -306,8 +306,8 @@ def test_submit_addon_3mb_size_tc_id_c2274214(selenium, base_url, wait, variable details_form.requires_payment.click() # reusables.scroll_into_view(selenium, details_form.categories_section) # set Firefox and Android categories for the addon - details_form.select_firefox_categories(0) - details_form.select_android_categories(0) + details_form.select_categories(0) + # details_form.select_android_categories(0) details_form.email_input_field("some-mail@mail.com") details_form.support_site_input_field("https://example.com") # set an addon license from the available list @@ -448,7 +448,7 @@ def test_submit_unicode_addon_tc_id_c4590( source = submit_addon.click_continue_upload_button() source.select_no_to_omit_source() details_form = source.continue_listed_submission() - details_form.select_firefox_categories(0) + details_form.select_categories(0) # set an addon license from the available list details_form.select_license_options[0].click() # submit the add-on details