From 876b0bac51e5084d32589349687906b5003ff722 Mon Sep 17 00:00:00 2001 From: James Tsay Date: Wed, 12 Feb 2025 14:27:03 -0800 Subject: [PATCH] Add test cases for type1 paid user --- ...e1.feature => compress-pdf-type1-free.feature} | 10 +++++----- .../regression/compress-pdf-type1-paid.feature | 15 +++++++++++++++ .../unity/regression/compress-pdf.feature | 2 +- test/e2e/page-objects/unity.page.js | 1 + test/e2e/step-definitions/dc.steps.js | 9 +++++++-- 5 files changed, 29 insertions(+), 8 deletions(-) rename test/e2e/features/unity/regression/{compress-pdf-type1.feature => compress-pdf-type1-free.feature} (79%) create mode 100644 test/e2e/features/unity/regression/compress-pdf-type1-paid.feature diff --git a/test/e2e/features/unity/regression/compress-pdf-type1.feature b/test/e2e/features/unity/regression/compress-pdf-type1-free.feature similarity index 79% rename from test/e2e/features/unity/regression/compress-pdf-type1.feature rename to test/e2e/features/unity/regression/compress-pdf-type1-free.feature index 453bb746..6175474a 100644 --- a/test/e2e/features/unity/regression/compress-pdf-type1.feature +++ b/test/e2e/features/unity/regression/compress-pdf-type1-free.feature @@ -2,9 +2,9 @@ Feature: Compress PDF Background: Given I have a new browser context - And I sign in as a type1 user + And I sign in as a type1free user - @regression @unity @compress-pdf @signed-in-type1 + @regression @unity @compress-pdf @signed-in-type1free Scenario: Type1 user upload of single file Given I go to the compress-pdf page Then I wait for 5 seconds @@ -22,12 +22,12 @@ Feature: Compress PDF Then I wait for 5 seconds Then I choose the file "test-files/test.pdf" to upload Then I wait for 5 seconds - Then I should see the address bar contains "acrobat.adobe.com" + Then I should see the address bar contains "acrobat.adobe.com" - @regression @unity @compress-pdf @multi-files-type1 + @regression @unity @compress-pdf @multi-files-type1free Scenario: Type1 user upload of multiple files Given I go to the compress-pdf page When I choose the file "test-files/test.pdf,test-files/test2.pdf" to upload Then I wait for 5 seconds Then I should see the address bar contains "acrobat.adobe.com" - Then I should see "To compress this many files at once, you need to select your files again in Acrobat.adobe.com" in the widget error toast + Then I should see the paywall diff --git a/test/e2e/features/unity/regression/compress-pdf-type1-paid.feature b/test/e2e/features/unity/regression/compress-pdf-type1-paid.feature new file mode 100644 index 00000000..ac02dbe9 --- /dev/null +++ b/test/e2e/features/unity/regression/compress-pdf-type1-paid.feature @@ -0,0 +1,15 @@ +Feature: Compress PDF + + Background: + Given I have a new browser context + And I sign in as a type1paid user + + @regression @unity @compress-pdf @multi-files-type1paid + Scenario: Type1paid user upload of multiple files + Given I go to the compress-pdf page + When I choose the file "test-files/test.pdf,test-files/test2.pdf" to upload + Then I wait for 5 seconds + Then I should see the address bar contains "acrobat.adobe.com" + Then I click the "Compress" button on the feedback + Then I should see "test-compressed.pdf" in the page content + Then I should see "test2-compressed.pdf" in the page content diff --git a/test/e2e/features/unity/regression/compress-pdf.feature b/test/e2e/features/unity/regression/compress-pdf.feature index 2a9a465c..6c9b4816 100644 --- a/test/e2e/features/unity/regression/compress-pdf.feature +++ b/test/e2e/features/unity/regression/compress-pdf.feature @@ -24,7 +24,7 @@ Feature: Compress PDF Scenario: Sign in at 3rd attempt Given I go to the compress-pdf page And I have tried "compress-pdf" twice - When I sign in as a type1 user using SUSI Light + When I sign in as a type1free user using SUSI Light Then I should see "Compress PDF" in the dropzone @regression @unity @compress-pdf @susi-sign-in-type2 diff --git a/test/e2e/page-objects/unity.page.js b/test/e2e/page-objects/unity.page.js index b4c97f8a..0d4bda5b 100644 --- a/test/e2e/page-objects/unity.page.js +++ b/test/e2e/page-objects/unity.page.js @@ -29,6 +29,7 @@ export class UnityPage extends classes(DcGnavPage, VerbWidgetSection, CaaSSectio widgetCompressButton: '*[data-testid="ls-footer-primary-compress-button"]', widgetToast: '*[class$="-Toast-content"]', widgetUpsellHeading: 'h1[data-testid$="-upsell-heading"]', + paywall: 'h2[data-testid="paywall-header-subtitle"]', }); } diff --git a/test/e2e/step-definitions/dc.steps.js b/test/e2e/step-definitions/dc.steps.js index 6861086f..d5597bfd 100644 --- a/test/e2e/step-definitions/dc.steps.js +++ b/test/e2e/step-definitions/dc.steps.js @@ -699,7 +699,7 @@ Then(/^I drag-and-drop the (?:PDF|file|files) "([^\"]*)" to upload$/, async func } }); -Then(/^I sign in as a (type1|type2) user$/, async function (type) { +Then(/^I sign in as a (type1free|type2|type1paid) user$/, async function (type) { const accounts = JSON.parse(fs.readFileSync(".auth/accounts.json", "utf8")); const account = accounts[type]; this.page = new DCPage("https://www.stage.adobe.com"); @@ -728,7 +728,7 @@ Then(/^I have tried "compress-pdf" twice$/, async function () { await this.page.native.reload({waitUntil: 'load'}); }); -Then(/^I sign in as a (type1|type2) user using SUSI Light$/, async function (type) { +Then(/^I sign in as a (type1free|type2|type1paid) user using SUSI Light$/, async function (type) { const accounts = JSON.parse(fs.readFileSync(".auth/accounts.json", "utf8")); const account = accounts[type]; await this.page.native.locator('susi-sentry-light #sentry-email-field').click(); @@ -760,4 +760,9 @@ Then(/^I should see "([^"]*)" in the widget error toast$/, async function (text) Then(/^I should see "([^"]*)" in the widget upsell heading$/, async function (text) { this.context(UnityPage); await expect(this.page.widgetUpsellHeading).toHaveText(text); +}); + +Then(/^I should see the paywall$/, async function () { + this.context(UnityPage); + await expect(this.page.paywall).toBeVisible({timeout: 30000}); }); \ No newline at end of file