From aca9fd3994398613f014cadfdb0a7d821e0d6f77 Mon Sep 17 00:00:00 2001 From: Jeremy Swinarton Date: Mon, 23 Oct 2023 17:23:03 -0400 Subject: [PATCH] Remove unnecessary bedrock tests and fix broken redirect tests (#22) Get the tests passing again. Fixes VPN-5517. After discussion with @alexgibson and Rebecca B last week, we determined that Bedrock already has a robust suite of tests that assert against various content elements on the VPN landing page, and there is no need for us to maintain a separate set of tests that ultimately do the same thing. Therefore, these have been removed. There were a couple redirect tests that had also gone out of date due to FPN sunset related changes, so those have also been fixed. --- tests/fixtures/locales.js | 192 ------------------ tests/fixtures/scenarios.js | 2 +- tests/specs/guardian-basics-privacy.spec.js | 55 ----- tests/specs/guardian-basics-terms.spec.js | 50 ----- .../specs/guardian-localization-urls.spec.js | 91 --------- tests/specs/guardian-redirects.spec.js | 2 +- 6 files changed, 2 insertions(+), 390 deletions(-) delete mode 100644 tests/fixtures/locales.js delete mode 100644 tests/specs/guardian-basics-privacy.spec.js delete mode 100644 tests/specs/guardian-basics-terms.spec.js delete mode 100644 tests/specs/guardian-localization-urls.spec.js diff --git a/tests/fixtures/locales.js b/tests/fixtures/locales.js deleted file mode 100644 index 11056642b..000000000 --- a/tests/fixtures/locales.js +++ /dev/null @@ -1,192 +0,0 @@ -const supportedLocalesWithCurrency = [ - { - lang: 'de', - geo: 'at', - name: 'Austria', - expect: 'US$4.99/Monat zzgl. Steuern', - stageExpect: '4,99 €/Monat' - }, - { - lang: 'nl', - geo: 'be', - name: 'Belgium', - expect: 'US$4.99/maand + BTW', - stageExpect: '4,99 €/maand' - }, - { - lang: 'en-US', - geo: 'ca', - name: 'Canada', - expect: 'US$4.99/month + tax', - stageExpect: 'US$4.99/month + tax' - }, - { - lang: 'de', - geo: 'ch', - name: 'Switzerland', - expect: 'US$4.99/Monat zzgl. Steuern', - stageExpect: 'CHF 5.99/Monat' - }, - { - lang: 'de', - geo: 'de', - name: 'Germany', - expect: 'US$4.99/Monat zzgl. Steuern', - stageExpect: '4,99 €/Monat' - }, - { - lang: 'es-ES', - geo: 'es', - name: 'Spain', - expect: 'US$4.99/mes + impuestos', - stageExpect: '4,99 €/mes' - }, - { - lang: 'fr', - geo: 'fr', - name: 'France', - expect: 'US$4.99/mois + taxes', - stageExpect: '4,99 €/mois' - }, - { - lang: 'en-US', - geo: 'gb', - name: 'UK', - expect: 'US$4.99/month + tax', - stageExpect: 'US$4.99/month' - }, - { - lang: 'it', - geo: 'it', - name: 'Italy', - expect: 'US$4.99 al mese + tasse', - stageExpect: '4,99 € al mese' - }, - { - lang: 'en-US', - geo: 'my', - name: 'Malaysia', - expect: 'US$4.99/month + tax', - stageExpect: 'US$4.99/month' - }, - { - lang: 'en-US', - geo: 'nz', - name: 'New Zealand', - expect: 'US$4.99/month + tax', - stageExpect: 'US$4.99/month' - }, - { - lang: 'en-US', - geo: 'sg', - name: 'Singapore', - expect: 'US$4.99/month + tax', - stageExpect: 'US$4.99/month' - }, - { - lang: 'en-US', - geo: 'US', - name: 'United States', - expect: 'US$4.99/month + tax', - stageExpect: 'US$4.99/month + tax' - } -]; - -const supportedLocales = [ - { - lang: 'de', - geo: 'at', - name: 'Austria', - expectedTermsTitle: 'Mozilla Abonnementdienste | Servicebedingungen', - expectedPrivacyTitle: 'Mozilla Abonnementdienste' - }, // currently returns USD instead of EURO - { - lang: 'nl', - geo: 'be', - name: 'Belgium', - expectedTermsTitle: 'Mozilla Abonnementsservices | Servicevoorwaarden', - expectedPrivacyTitle: 'Mozilla Abonnementsservices | Privacyverklaring' - }, - { - lang: 'en-US', - geo: 'ca', - name: 'Canada', - expectedTermsTitle: 'Mozilla Subscription Services', - expectedPrivacyTitle: 'Mozilla Subscription Services' - }, - { - lang: 'de', - geo: 'ch', - name: 'Switzerland', - expectedTermsTitle: 'Mozilla Abonnementdienste | Servicebedingungen', - expectedPrivacyTitle: 'Mozilla Abonnementdienste' - }, - { - lang: 'de', - geo: 'de', - name: 'Germany', - expectedTermsTitle: 'Mozilla Abonnementdienste | Servicebedingungen', - expectedPrivacyTitle: 'Mozilla Abonnementdienste' - }, - { - lang: 'es-US', - geo: 'es', - name: 'Spain', - expectedTermsTitle: 'Servicios de suscripción de Mozilla', - expectedPrivacyTitle: 'Servicios de suscripción de Mozilla' - }, - { - lang: 'fr', - geo: 'fr', - name: 'France', - expectedTermsTitle: 'Services d’abonnements Mozilla - Conditions d’utilisation', - expectedPrivacyTitle: 'Services d’abonnement Mozilla' - }, - { - lang: 'en-US', - geo: 'gb', - name: 'UK', - expectedTermsTitle: 'Mozilla Subscription Services', - expectedPrivacyTitle: 'Mozilla Subscription Services' - }, // shouldn't this be in pounds? - { - lang: 'it', - geo: 'it', - name: 'Italy', - expectedTermsTitle: 'Servizi Mozilla in abbonamento | Termini di servizio', - expectedPrivacyTitle: 'Servizi Mozilla in abbonamento' - }, - { - lang: 'en-US', - geo: 'my', - name: 'Malaysia', - expectedTermsTitle: 'Mozilla Subscription Services', - expectedPrivacyTitle: 'Mozilla Subscription Services' - }, - { - lang: 'en-US', - geo: 'nz', - name: 'New Zealand', - expectedTermsTitle: 'Mozilla Subscription Services', - expectedPrivacyTitle: 'Mozilla Subscription Services' - }, - { - lang: 'en-US', - geo: 'sg', - name: 'Singapore', - expectedTermsTitle: 'Mozilla Subscription Services', - expectedPrivacyTitle: 'Mozilla Subscription Services' - }, - { - lang: 'en-US', - geo: 'US', - name: 'United States', - expectedTermsTitle: 'Mozilla Subscription Services', - expectedPrivacyTitle: 'Mozilla Subscription Services' - } -]; - -module.exports = { - supportedLocales, - supportedLocalesWithCurrency -}; diff --git a/tests/fixtures/scenarios.js b/tests/fixtures/scenarios.js index 40f9b881f..5b8764892 100644 --- a/tests/fixtures/scenarios.js +++ b/tests/fixtures/scenarios.js @@ -1,7 +1,7 @@ const testScenarios = [ { TEST_ENV: 'stage', - TEST_BASE_URL: 'https://stage-vpn.guardian.nonprod.cloudops.mozgcp.net', + TEST_BASE_URL: 'https://stage.guardian.nonprod.cloudops.mozgcp.net', TEST_EXPECT_URL: 'https://www-dev.allizom.org', PRODUCT_DETAILS_URL: 'https://mozilla.github.io/mozillavpn-product-details/mozillavpn.json', PACKAGE_ARCHIVE_URL_BASE: 'https://archive.mozilla.org/pub/vpn', diff --git a/tests/specs/guardian-basics-privacy.spec.js b/tests/specs/guardian-basics-privacy.spec.js deleted file mode 100644 index 413e0341a..000000000 --- a/tests/specs/guardian-basics-privacy.spec.js +++ /dev/null @@ -1,55 +0,0 @@ -const { test, expect } = require('@playwright/test'); -const { supportedLocales } = require('../fixtures/locales'); -const { allure } = require('allure-playwright'); -const { getRequest } = require('../utils/helpers'); -const { testScenarios } = require('../fixtures/scenarios'); - -test.describe.configure({ mode: 'parallel' }); - -testScenarios.forEach((scenario) => { - const baseUrl = scenario.TEST_EXPECT_URL; - - // C1538755 - Verify that PN and TOS are translated for each one of the new regions - test.describe(`${scenario.TEST_ENV} - guardian basics - privacy, C1538755`, () => { - let guardianSpecs; - - test.beforeAll(async () => { - const _res = await getRequest(`${scenario.TEST_BASE_URL}/__version__`); - guardianSpecs = _res; - }); - - test.use({ viewport: { width: 1980, height: 1080 } }); - for (const locale of supportedLocales) { - test.describe('Checking locales for different langs and geos', () => { - test.beforeEach(async ({ page }) => { - allure.suite( - `${scenario.TEST_ENV} - Version: ${guardianSpecs.version}, Commit: ${guardianSpecs.commit}` - ); - await page.goto( - `${baseUrl}/${locale.lang}/products/vpn/?geo=${locale.geo}`, - { - waitUntil: 'networkidle' - } - ); - }); - - test(`Verify locale handling in ${locale.name} for privacy notice`, async ({ - page - }) => { - const privacyLink = page.locator( - 'footer .vpn-footer-list > li:nth-child(1) > a:nth-child(1)' - ); - - await Promise.all([ - privacyLink.click(), - page.waitForNavigation({ waitUntil: 'networkidle' }) - ]); - const privacyTitle = await page - .locator('.privacy-title') - .textContent(); - expect(privacyTitle).toContain(locale.expectedPrivacyTitle); - }); - }); - } - }); -}); diff --git a/tests/specs/guardian-basics-terms.spec.js b/tests/specs/guardian-basics-terms.spec.js deleted file mode 100644 index 5d92ffdb2..000000000 --- a/tests/specs/guardian-basics-terms.spec.js +++ /dev/null @@ -1,50 +0,0 @@ -const { test, expect } = require('@playwright/test'); -const { supportedLocales } = require('../fixtures/locales'); -const { allure } = require('allure-playwright'); -const { getRequest } = require('../utils/helpers'); -const { testScenarios } = require('../fixtures/scenarios'); - -test.describe.configure({ mode: 'parallel' }); - -testScenarios.forEach((scenario) => { - const baseUrl = scenario.TEST_EXPECT_URL; - - test.describe(`guardian basics ${scenario.TEST_ENV} - terms, C1538755`, () => { - let guardianSpecs; - - test.beforeAll(async () => { - const _res = await getRequest(`${scenario.TEST_BASE_URL}/__version__`); - guardianSpecs = _res; - }); - - for (const locale of supportedLocales) { - test.describe(`terms locale check for ${locale.name}`, () => { - test.beforeEach(async ({ page }) => { - allure.suite( - `${scenario.TEST_ENV} - Version: ${guardianSpecs.version}, Commit: ${guardianSpecs.commit}` - ); - await page.goto( - `${baseUrl}/${locale.lang}/products/vpn/?geo=${locale.geo}`, - { - waitUntil: 'networkidle' - } - ); - }); - - test(`Verify locale handling in ${locale.name} for terms`, async ({ - page - }) => { - const termsLink = page.locator( - 'footer .vpn-footer-list > li:nth-child(2) > a:nth-child(1)' - ); - await Promise.all([ - termsLink.click(), - page.waitForNavigation({ waitUntil: 'networkidle' }) - ]); - const termsTitle = await page.locator('section h1').textContent(); - expect(termsTitle).toContain(locale.expectedTermsTitle); - }); - }); - } - }); -}); diff --git a/tests/specs/guardian-localization-urls.spec.js b/tests/specs/guardian-localization-urls.spec.js deleted file mode 100644 index 973e5c0b8..000000000 --- a/tests/specs/guardian-localization-urls.spec.js +++ /dev/null @@ -1,91 +0,0 @@ -const { test, expect } = require('@playwright/test'); -const { supportedLocalesWithCurrency } = require('../fixtures/locales'); -const { allure } = require('allure-playwright'); -const { getRequest } = require('../utils/helpers'); -const { testScenarios } = require('../fixtures/scenarios'); - -test.describe.configure({ mode: 'parallel' }); - -const urlForScenarioAndRegion = function(scenario, locale) { - let baseURL = scenario.TEST_EXPECT_URL; - let urlString = `${baseURL}/${locale.lang}/products/vpn/`; - if (scenario.TEST_ENV === "stage") { - urlString += `?geo=${locale.geo}`; - } - return urlString; -} - -testScenarios.forEach((scenario) => { - /** - * C1538754 - Verify that 3 subscriptions plans are displayed - * correctly in VPN homepage for each of the new regions - * C1601703 - Verify that pricing and currency are displayed - * correctly in VPN homepage for each of the new regions - * - * These tests make assertions about the values of localized strings in - * various regions and locales. It is important to note that on stage, it is - * possible to simulate the page a user will see in a different region by - * setting the `geo` URL query parameter. For the purpose of these tests, - * this affects the currency displayed to the user, while the locale (set in - * the URL itself) changes the displayed language. - * - * Setting the `geo` parameter has no effect on production (see - * https://github.com/mozilla/bedrock/issues/12967#issuecomment-1498694421) - * and therefore it is only possible to test the variation of locale in - * prod. The currency value that is rendered in prod is determined by the - * physical location in which the tests are carried out. Since these tests - * run on a US server in CI, this is what the production currency is set to. - * - */ - test.describe( - `${scenario.TEST_ENV} - guardian localization by urls, C1538754, C1601703`, - () => { - let guardianSpecs; - - test.beforeAll(async () => { - const _res = await getRequest(`${scenario.TEST_BASE_URL}/__version__`); - guardianSpecs = _res; - }); - - for (const locale of supportedLocalesWithCurrency) { - test.describe( - `${locale.name} - ${urlForScenarioAndRegion(scenario, locale)}`, - () => { - test.beforeEach(async ({ page }) => { - allure.suite( - `${scenario.TEST_ENV} - Version: ${guardianSpecs.version}, Commit: ${guardianSpecs.commit}` - ); - await page.goto( - urlForScenarioAndRegion(scenario, locale), - { - waitUntil: 'networkidle' - } - ); - }); - - test(`Verify locale handling in ${locale.name}`, async ({ - page - }) => { - const pricingTables = await page - .locator('#pricing .vpn-content-block') - .count(); - expect(pricingTables).toEqual(2); - - const monthPlanPrice = await page - .locator('#pricing .vpn-monthly-price-display') - .first() - .textContent(); - - const expectedMonthlyPrice = - scenario.TEST_ENV === 'stage' ? locale.stageExpect : locale.expect; - expect( - monthPlanPrice, - `${monthPlanPrice} for ${locale.name} did not match expected ${locale.expect}` - ).toEqual(expectedMonthlyPrice); - }); - } - ); - } - } - ); -}); diff --git a/tests/specs/guardian-redirects.spec.js b/tests/specs/guardian-redirects.spec.js index c05f1cc59..98e9f1ca8 100644 --- a/tests/specs/guardian-redirects.spec.js +++ b/tests/specs/guardian-redirects.spec.js @@ -198,7 +198,7 @@ testScenarios.forEach((scenario) => { test(`Verify redirect for ${baseUrl}/r/vpn/update/ios, C1539669`, async () => { await verifyRedirectUrl( `${baseUrl}/r/vpn/update/ios`, - 'https://apps.apple.com/us/app/firefox-private-network-vpn/id1489407738' + 'https://apps.apple.com/us/app/mozilla-vpn-secure-private/id1489407738' ); });