From 0980f47d0de9e91e1bf32e5e89d08a1a57801610 Mon Sep 17 00:00:00 2001 From: joeltejeda <76879536+joeltejeda@users.noreply.github.com> Date: Tue, 16 May 2023 19:50:46 -0400 Subject: [PATCH] 1018 cad currency support (#1020) * adding playwright test termns and condition creation and checkout * Fix #1018 adding CAD support * separating CAD and GBP currency tests * changing concurrency group * restructuring CAD tests * changing email queue mounted folder --- ...demo-deploy.yml => pr-demo-deploy-CAD.yml} | 20 +-- .github/workflows/pr-demo-deploy-GBP.yml | 131 ++++++++++++++++ subscribie/utils.py | 1 + .../github.spec.js | 3 +- .../index.spec.js | 31 ++-- .../playwright.config.ts | 1 - ...4_shop_owner_magic_login_receives_email.js | 2 +- ..._plan_with_recurring_and_upfront_charge.js | 107 +++++++++++++ ...905-subscriber-search-by-email-and-name.js | 35 +++++ ...action_filter_by_name_and_by_plan_title.js | 36 +++++ .../tests/CAD-tests/stripe_connect.js | 128 ++++++++++++++++ ...hop_owner_terms_and_conditions_creation.js | 2 +- ...bscriber_terms_and_condition_check_test.js | 2 +- .../121_shop_owner_public_page_creation.js | 2 +- ..._subscriber_order_plan_with_cooling_off.js | 2 +- .../212_shop_owner_slogan_creation.js | 2 +- ...n_with_choice_options_and_required_note.js | 2 +- .../275_shop_owner_changing_plans_order.js | 2 +- ...r_order_plan_with_only_recurring_charge.js | 2 +- ...ber_order_plan_with_only_upfront_charge.js | 2 +- ..._plan_with_recurring_and_upfront_charge.js | 2 +- .../334_shop_owner_private_page_creation.js | 2 +- .../387_shop_owner_change_shop_colour.js | 2 +- .../452_shop_owner_categories_creation.js | 2 +- .../463_shop_owner_adding_vat.js | 2 +- .../463_subscriber_ordering_plan_with_VAT.js | 2 +- ...5_subscriber_order_plan_with_free_trial.js | 2 +- .../491_shop_owner_share_private_plan_url.js | 2 +- ...16_subscriber_order_plan_with_cancel_at.js | 2 +- .../623_subscriber_magic_login.js | 2 +- .../872_uploading_plan_picture.js | 2 +- ...905-subscriber-search-by-email-and-name.js | 2 +- ...der_free_plan_with_terms_and_conditions.js | 2 +- .../993_subscriber_change_card_details.js | 2 +- .../{ => GBP-tests}/checkSubscriberLogin.js | 0 ...r_pause_resume_and_cancel_subscriptions.js | 2 +- .../shop_owner_plan_creation.js | 2 +- ...action_filter_by_name_and_by_plan_title.js | 2 +- .../tests/GBP-tests/stripe_connect.js | 142 ++++++++++++++++++ .../tests/clear_db.js | 2 +- .../worker2.spec.js | 13 +- .../worker3.spec.js | 29 ++-- 42 files changed, 653 insertions(+), 80 deletions(-) rename .github/workflows/{pr-demo-deploy.yml => pr-demo-deploy-CAD.yml} (87%) create mode 100644 .github/workflows/pr-demo-deploy-GBP.yml create mode 100644 tests/browser-automated-tests-playwright/tests/CAD-tests/293_subscriber_order_plan_with_recurring_and_upfront_charge.js create mode 100644 tests/browser-automated-tests-playwright/tests/CAD-tests/905-subscriber-search-by-email-and-name.js create mode 100644 tests/browser-automated-tests-playwright/tests/CAD-tests/shop_owner_transaction_filter_by_name_and_by_plan_title.js create mode 100644 tests/browser-automated-tests-playwright/tests/CAD-tests/stripe_connect.js rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/1005_shop_owner_terms_and_conditions_creation.js (97%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/1005_subscriber_terms_and_condition_check_test.js (93%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/121_shop_owner_public_page_creation.js (94%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/133_subscriber_order_plan_with_cooling_off.js (99%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/212_shop_owner_slogan_creation.js (94%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/264_subscriber_order_plan_with_choice_options_and_required_note.js (99%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/275_shop_owner_changing_plans_order.js (96%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/293_subscriber_order_plan_with_only_recurring_charge.js (98%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/293_subscriber_order_plan_with_only_upfront_charge.js (97%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/293_subscriber_order_plan_with_recurring_and_upfront_charge.js (98%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/334_shop_owner_private_page_creation.js (97%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/387_shop_owner_change_shop_colour.js (93%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/452_shop_owner_categories_creation.js (96%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/463_shop_owner_adding_vat.js (90%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/463_subscriber_ordering_plan_with_VAT.js (98%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/475_subscriber_order_plan_with_free_trial.js (98%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/491_shop_owner_share_private_plan_url.js (92%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/516_subscriber_order_plan_with_cancel_at.js (98%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/623_subscriber_magic_login.js (94%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/872_uploading_plan_picture.js (94%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/905-subscriber-search-by-email-and-name.js (94%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/939_subscriber_order_free_plan_with_terms_and_conditions.js (97%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/993_subscriber_change_card_details.js (95%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/checkSubscriberLogin.js (100%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/shop_owner_pause_resume_and_cancel_subscriptions.js (97%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/shop_owner_plan_creation.js (99%) rename tests/browser-automated-tests-playwright/tests/{ => GBP-tests}/shop_owner_transaction_filter_by_name_and_by_plan_title.js (98%) create mode 100644 tests/browser-automated-tests-playwright/tests/GBP-tests/stripe_connect.js diff --git a/.github/workflows/pr-demo-deploy.yml b/.github/workflows/pr-demo-deploy-CAD.yml similarity index 87% rename from .github/workflows/pr-demo-deploy.yml rename to .github/workflows/pr-demo-deploy-CAD.yml index 87810e7b6..84746b2e4 100644 --- a/.github/workflows/pr-demo-deploy.yml +++ b/.github/workflows/pr-demo-deploy-CAD.yml @@ -3,7 +3,7 @@ # that branch. # The deployed url will be . -name: Deploy pr preview +name: CAD Deploy pr preview on: pull_request: # (pull_request_target get fired on external contributer pull requests) @@ -13,12 +13,12 @@ on: - '**/TESTING.md' - 'docs/**' jobs: - deploy-pr: + CAD-deploy-pr: runs-on: ubuntu-22.04 timeout-minutes: 60 environment: testing concurrency: - group: ${{ github.ref }} + group: 'CAD-${{ github.ref }}' cancel-in-progress: true steps: - name: Dump context @@ -43,7 +43,7 @@ jobs: - name: Set subdomain (ensure is lowercase for dokku) run: | set -x - echo SUBDOMAIN=`echo "${{ github.head_ref }}" | tr '[:upper:]' '[:lower:]' | cut -c -60` >> $GITHUB_ENV + echo SUBDOMAIN=`echo "CAD-${{ github.head_ref }}" | tr '[:upper:]' '[:lower:]' | cut -c -60` >> $GITHUB_ENV echo $GITHUB_ENV - name: Create dokku app for pr branch if dosent already exist using dokku apps:create env: @@ -66,7 +66,7 @@ jobs: ssh dokku@$DOKKU_HOST -C "dokku config:set --no-restart ${{ env.SUBDOMAIN }} FLASK_ENV=development" ssh dokku@$DOKKU_HOST -C "dokku config:set --no-restart ${{ env.SUBDOMAIN }} EMAIL_QUEUE_FOLDER=${{ secrets.DOKKU_EMAIL_QUEUE_FOLDER }}" # mount email-queue folder - ssh dokku@$DOKKU_HOST -C "dokku storage:mount ${{ github.head_ref }} ${{ secrets.HOST_EMAIL_QUEUE_PATH }}:${{ secrets.DOKKU_EMAIL_QUEUE_FOLDER }} && dokku ps:restart ${{ github.head_ref }} || true" + ssh dokku@$DOKKU_HOST -C "dokku storage:mount ${{ env.SUBDOMAIN }} ${{ secrets.HOST_EMAIL_QUEUE_PATH }}:${{ secrets.DOKKU_EMAIL_QUEUE_FOLDER }} && dokku ps:restart ${{ env.SUBDOMAIN }} || true" - name: Deploy branch ${{ github.head_ref }} to dokku uses: idoberko2/dokku-deploy-github-action@v1 @@ -81,7 +81,7 @@ jobs: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} DOKKU_HOST: ${{ secrets.DOKKU_HOST }} run: | - echo Visit your pr here: http://${{ github.head_ref }}.pcpink.co.uk + echo Visit your pr here: http://CAD-${{ github.head_ref }}.pcpink.co.uk - name: 'Comment PR with web address of application live preview' uses: actions/github-script@v3 if: github.event_name == 'pull_request' @@ -91,7 +91,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: "🙌 Live preview is here: http://${{ github.head_ref }}.pcpink.co.uk" + body: "🙌 Live preview is here: http://CAD-${{ github.head_ref }}.pcpink.co.uk" }) - uses: actions/setup-node@v3 @@ -106,7 +106,7 @@ jobs: - name: Run & Record browser automated tests (Playwright) env: - PLAYWRIGHT_HOST: http://${{ github.head_ref }}.pcpink.co.uk/ + PLAYWRIGHT_HOST: http://CAD-${{ github.head_ref }}.pcpink.co.uk/ PLAYWRIGHT_SLOWMO: 1000 PLAYWRIGHT_HEADLESS: true SUBSCRIBER_EMAIL_HOST: ${{ secrets.SUBSCRIBER_EMAIL_HOST }} @@ -115,12 +115,12 @@ jobs: EMAIL_SEARCH_API_HOST: ${{ secrets.EMAIL_SEARCH_API_HOST }} RESET_PASSWORD_IMAP_SEARCH_SUBJECT: ${{ secrets.RESET_PASSWORD_IMAP_SEARCH_SUBJECT }} IMAP_SEARCH_UNSEEN: "1" - IMAP_SEARCH_SINCE_DATE: "01-Sep-2021" + IMAP_SEARCH_SINCE_DATE: "01-Sep-2022" run: | set -x cp tests/browser-automated-tests-playwright/.env.example tests/browser-automated-tests-playwright/.env cp .env.example .env - cd tests/browser-automated-tests-playwright; npx playwright test --grep-invert @704 --update-snapshots + cd tests/browser-automated-tests-playwright; npx playwright test --grep @CAD --update-snapshots - uses: actions/upload-artifact@v2 if: ${{ always() }} diff --git a/.github/workflows/pr-demo-deploy-GBP.yml b/.github/workflows/pr-demo-deploy-GBP.yml new file mode 100644 index 000000000..9f9df8b8b --- /dev/null +++ b/.github/workflows/pr-demo-deploy-GBP.yml @@ -0,0 +1,131 @@ +--- +# When a push is made to a branch, deploy an instance of the app using +# that branch. +# The deployed url will be . + +name: GBP Deploy pr preview +on: + pull_request: + # (pull_request_target get fired on external contributer pull requests) + #pull_request_target + paths-ignore: + - '**/README.md' + - '**/TESTING.md' + - 'docs/**' +jobs: + GBP-deploy-pr: + runs-on: ubuntu-20.04 + timeout-minutes: 60 + environment: testing + concurrency: + group: 'GBP-${{ github.ref }}' + cancel-in-progress: true + steps: + - name: Dump context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: | + echo $GITHUB_CONTEXT + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: psf/black@stable # Fail early if fails Black code style + - name: Prepare runner with ssh keys + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + DOKKU_HOST: ${{ secrets.DOKKU_HOST }} + run: | + set -x + mkdir -p ~/.ssh + eval `ssh-agent -s` + ssh-add - <<< "$SSH_PRIVATE_KEY" + ssh-keyscan $DOKKU_HOST >> ~/.ssh/known_hosts + - name: Set subdomain (ensure is lowercase for dokku) + run: | + set -x + echo SUBDOMAIN=`echo "GBP-${{ github.head_ref }}" | tr '[:upper:]' '[:lower:]' | cut -c -60` >> $GITHUB_ENV + echo $GITHUB_ENV + - name: Create dokku app for pr branch if dosent already exist using dokku apps:create + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + DOKKU_HOST: ${{ secrets.DOKKU_HOST }} + run: | + set -x + echo The PR was raised by: ${{ github.event.pull_request.user.login }} + eval `ssh-agent -s` + ssh-add - <<< "$SSH_PRIVATE_KEY" + echo Creating dokku app ${{ github.head_ref }} + ssh dokku@$DOKKU_HOST -C "dokku apps:create ${{ env.SUBDOMAIN }}" | true + echo The url will be ${{ github.head_ref }}.pcpink.co.uk + ssh dokku@$DOKKU_HOST -C "dokku git:initialize ${{ env.SUBDOMAIN }}" + ssh dokku@$DOKKU_HOST -C "dokku git:set ${{ env.SUBDOMAIN }} deploy-branch ${{ github.head_ref }}" + # set Stripe test keys as env vars dor dokku/docker + ssh dokku@$DOKKU_HOST -C "dokku config:set --no-restart ${{ env.SUBDOMAIN }} STRIPE_TEST_SECRET_KEY=${{ secrets.STRIPE_TEST_SECRET_KEY }}" + ssh dokku@$DOKKU_HOST -C "dokku config:set --no-restart ${{ env.SUBDOMAIN }} STRIPE_TEST_PUBLISHABLE_KEY=${{ secrets.STRIPE_TEST_PUBLISHABLE_KEY }}" + ssh dokku@$DOKKU_HOST -C "dokku config:set --no-restart ${{ env.SUBDOMAIN }} STRIPE_CONNECT_ACCOUNT_ANNOUNCER_HOST=${{ secrets.STRIPE_CONNECT_ACCOUNT_ANNOUNCER_HOST }}" + ssh dokku@$DOKKU_HOST -C "dokku config:set --no-restart ${{ env.SUBDOMAIN }} FLASK_ENV=development" + ssh dokku@$DOKKU_HOST -C "dokku config:set --no-restart ${{ env.SUBDOMAIN }} EMAIL_QUEUE_FOLDER=${{ secrets.DOKKU_EMAIL_QUEUE_FOLDER }}" + # mount email-queue folder + ssh dokku@$DOKKU_HOST -C "dokku storage:mount ${{ env.SUBDOMAIN }} ${{ secrets.HOST_EMAIL_QUEUE_PATH }}:${{ secrets.DOKKU_EMAIL_QUEUE_FOLDER }} && dokku ps:restart ${{ env.SUBDOMAIN }} || true" + + - name: Deploy branch ${{ github.head_ref }} to dokku + uses: idoberko2/dokku-deploy-github-action@v1 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + dokku-host: ${{ secrets.DOKKU_HOST }} + app-name: ${{ env.SUBDOMAIN }} + git-push-flags: '--force' + remote-branch: ${{ github.head_ref }} + - name: Click to see your PR web address + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + DOKKU_HOST: ${{ secrets.DOKKU_HOST }} + run: | + echo Visit your pr here: http://GBP-${{ github.head_ref }}.pcpink.co.uk + - name: 'Comment PR with web address of application live preview' + uses: actions/github-script@v3 + if: github.event_name == 'pull_request' + with: + script: | + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "🙌 Live preview is here: http://GBP-${{ github.head_ref }}.pcpink.co.uk" + }) + + - uses: actions/setup-node@v3 + + - uses: microsoft/playwright-github-action@v1 + + - name: Install node dependencies needed for Playwright browser tests + run: | + npm i -D @playwright/test@1.27.1 + npx playwright install + sudo npx playwright install-deps + + - name: Run & Record browser automated tests (Playwright) + env: + PLAYWRIGHT_HOST: http://GBP-${{ github.head_ref }}.pcpink.co.uk/ + PLAYWRIGHT_SLOWMO: 1000 + PLAYWRIGHT_HEADLESS: true + SUBSCRIBER_EMAIL_HOST: ${{ secrets.SUBSCRIBER_EMAIL_HOST }} + SUBSCRIBER_EMAIL_USER: ${{ secrets.SUBSCRIBER_EMAIL_USER }} + SUBSCRIBER_EMAIL_PASSWORD: ${{ secrets.SUBSCRIBER_EMAIL_PASSWORD }} + EMAIL_SEARCH_API_HOST: ${{ secrets.EMAIL_SEARCH_API_HOST }} + RESET_PASSWORD_IMAP_SEARCH_SUBJECT: ${{ secrets.RESET_PASSWORD_IMAP_SEARCH_SUBJECT }} + IMAP_SEARCH_UNSEEN: "1" + IMAP_SEARCH_SINCE_DATE: "01-Sep-2022" + run: | + set -x + cp tests/browser-automated-tests-playwright/.env.example tests/browser-automated-tests-playwright/.env + cp .env.example .env + cd tests/browser-automated-tests-playwright; npx playwright test --grep @GBP --update-snapshots + + - uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: Screenshots-and-video-artifacts + path: | + ./index.spec.js-snapshots/* + ./tests/browser-automated-tests-playwright/test-results/* diff --git a/subscribie/utils.py b/subscribie/utils.py index 303a61f3b..daa1cd24e 100644 --- a/subscribie/utils.py +++ b/subscribie/utils.py @@ -29,6 +29,7 @@ "SK": "EUR", "SI": "EUR", "ES": "EUR", + "CA": "CAD", "AU": "AUD", } diff --git a/tests/browser-automated-tests-playwright/github.spec.js b/tests/browser-automated-tests-playwright/github.spec.js index 46c6d77b5..40e26facc 100644 --- a/tests/browser-automated-tests-playwright/github.spec.js +++ b/tests/browser-automated-tests-playwright/github.spec.js @@ -1,6 +1,5 @@ const { test, expect } = require('@playwright/test'); - test.describe("Github actions test:", () => { -const magic_login_receives_email = require('./tests/704_shop_owner_magic_login_receives_email'); +const magic_login_receives_email = require(`./tests/704_shop_owner_magic_login_receives_email`); }); diff --git a/tests/browser-automated-tests-playwright/index.spec.js b/tests/browser-automated-tests-playwright/index.spec.js index 74be8a137..f85675184 100644 --- a/tests/browser-automated-tests-playwright/index.spec.js +++ b/tests/browser-automated-tests-playwright/index.spec.js @@ -1,5 +1,5 @@ const { test, expect } = require('@playwright/test'); - +const TEST = process.env.TEST; //Subscribie tests test.describe("Subscribie tests:", () => { test.beforeEach(async ({ page }) => { @@ -13,7 +13,7 @@ test.describe("Subscribie tests:", () => { expect(content === 'Checklist'); // If we see "Checklist", we're logged in to admin }); //Stripe Test - test("@293@connect-to-stripe@shop-owner@Stripe Test", async ({ page }) => { + test("@293@connect-to-stripe@shop-owner@Stripe Test @GBP @CAD", async ({ page }) => { // Go to Stripe Connect payment gateways page await page.goto('admin/connect/stripe-connect'); // Check onboarding not already completed @@ -29,6 +29,9 @@ test.describe("Subscribie tests:", () => { console.log("Continuing with Stripe Connect onboarding"); } }); + const stripe_connect = require('./tests/GBP-tests/stripe_connect.js'); + + const order_plan_with_only_recurring_charge = require(`./tests/GBP-tests/293_subscriber_order_plan_with_only_recurring_charge`); test("@293@connect-to-stripe@shop-owner@detect stripe onboarding page", async ({ page }) => { // Go to Stripe Connect payment gateways page @@ -155,25 +158,19 @@ test.describe("Subscribie tests:", () => { await page.click('[data-test="requirements-index-done-button"]') - console.log("Announce stripe account automatically visiting announce url. In prod this is called via uwsgi cron"); - await new Promise(x => setTimeout(x, 5000)); - const stripe_connected = await page.textContent("text=Your currently running in test mode."); - expect(stripe_connected === "Your currently running in test mode."); - console.log("Stripe Connected"); - await page.goto('/admin/announce-stripe-connect'); - await page.textContent(':has-text("Announced Stripe connect account")') === "Announced Stripe connect account"; - console.log("Announced to Stripe connect account"); - - }); - const order_plan_with_only_recurring_charge = require('./tests/293_subscriber_order_plan_with_only_recurring_charge'); - - const order_plan_with_only_upfront_charge = require('./tests/293_subscriber_order_plan_with_only_upfront_charge'); + const order_plan_with_only_upfront_charge = require(`./tests/GBP-tests/293_subscriber_order_plan_with_only_upfront_charge`); - const order_plan_with_free_trial = require('./tests/475_subscriber_order_plan_with_free_trial'); + const order_plan_with_free_trial = require(`./tests/GBP-tests/475_subscriber_order_plan_with_free_trial`); // When you run order subscription and upfront charge, it will run 2 more tests that are inside: // 1. Transacion filter by name and plan title // 2. 2.A pause, resume and 2.B cancel subscription test. - const order_plan_with_subscription_and_upfront_charge = require('./tests/293_subscriber_order_plan_with_recurring_and_upfront_charge'); + const order_plan_with_subscription_and_upfront_charge = require(`./tests/GBP-tests/293_subscriber_order_plan_with_recurring_and_upfront_charge`); + + // Tests for CAD currency + const stripe_connect_CAD = require('./tests/CAD-tests/stripe_connect.js'); + + const order_plan_with_subscription_and_upfront_charge_CAD = require(`./tests/CAD-tests/293_subscriber_order_plan_with_recurring_and_upfront_charge`); + }); diff --git a/tests/browser-automated-tests-playwright/playwright.config.ts b/tests/browser-automated-tests-playwright/playwright.config.ts index 1b495753b..156a089c7 100644 --- a/tests/browser-automated-tests-playwright/playwright.config.ts +++ b/tests/browser-automated-tests-playwright/playwright.config.ts @@ -8,7 +8,6 @@ const PLAYWRIGHT_SLOWMO = parseInt(process.env.PLAYWRIGHT_SLOWMO); const { devices } = require('@playwright/test'); /** @type {import('@playwright/test').PlaywrightTestConfig} */ const config: PlaywrightTestConfig = { - testDir: 'tests', testDir: '../browser-automated-tests-playwright', timeout: 180000, retries: 2, diff --git a/tests/browser-automated-tests-playwright/tests/704_shop_owner_magic_login_receives_email.js b/tests/browser-automated-tests-playwright/tests/704_shop_owner_magic_login_receives_email.js index f6cc99e8c..fb21129d3 100644 --- a/tests/browser-automated-tests-playwright/tests/704_shop_owner_magic_login_receives_email.js +++ b/tests/browser-automated-tests-playwright/tests/704_shop_owner_magic_login_receives_email.js @@ -4,7 +4,7 @@ const checkShopOwnerLogin = require('./checkShopOwnerLogin.js'); const SHOP_OWNER_LOGIN_URL = process.env.SHOP_OWNER_LOGIN_URL const SHOP_OWNER_EMAIL = process.env.SHOP_OWNER_EMAIL_USER -test('@704@shop_owner@magic login receives email', async ({ page }) => { +test('@704@shop_owner@magic login receives email @GBP', async ({ page }) => { await page.goto(SHOP_OWNER_LOGIN_URL); await page.fill('#email', SHOP_OWNER_EMAIL); await page.click('#login'); diff --git a/tests/browser-automated-tests-playwright/tests/CAD-tests/293_subscriber_order_plan_with_recurring_and_upfront_charge.js b/tests/browser-automated-tests-playwright/tests/CAD-tests/293_subscriber_order_plan_with_recurring_and_upfront_charge.js new file mode 100644 index 000000000..16bec690f --- /dev/null +++ b/tests/browser-automated-tests-playwright/tests/CAD-tests/293_subscriber_order_plan_with_recurring_and_upfront_charge.js @@ -0,0 +1,107 @@ +const { test, expect } = require('@playwright/test'); +const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; +test.describe("order plan with recurring and upfront charge test:", () => { + test("@293@subscriber@Ordering recurring and upfront plan @CAD", async ({ page }) => { + console.log("Ordering Plan with subscription and upfront charge"); + // Buy item with subscription & upfront fee + await page.goto('/'); // Go to home before selecting product + await page.click('[name="Hair Gel"]'); + + // Fill in order form + await page.fill('#given_name', 'John'); + await page.fill('#family_name', 'Smith'); + await page.fill('#email', SUBSCRIBER_EMAIL_USER); + await page.fill('#mobile', '07123456789'); + await page.fill('#address_line_one', '123 Short Road'); + await page.fill('#city', 'London'); + await page.fill('#postcode', 'L01 T3U'); + expect(await page.screenshot()).toMatchSnapshot('recurring-and-upfront-new-customer-form.png'); + await page.click('.btn-primary-lg'); + // Begin stripe checkout + const order_summary_content = await page.textContent(".title-1"); + expect(order_summary_content === "Order Summary"); + expect(await page.screenshot()).toMatchSnapshot('recurring-and-upfront-pre-stripe-checkout.png'); + await page.click('#checkout-button'); + + //Verify first payment is correct (upfront charge + first recuring charge) + const first_payment_content = await page.textContent('#ProductSummary-totalAmount'); + expect(first_payment_content === "$5.99"); + const recuring_charge_content = await page.textContent('.ProductSummaryDescription'); + expect(recuring_charge_content === "Then $5.99 per week"); + + // Pay with test card + await page.fill('#cardNumber', '4242 4242 4242 4242'); + await page.fill('#cardExpiry', '04 / 24'); + await page.fill('#cardCvc', '123'); + await page.fill('#billingName', 'John Smith'); + await page.selectOption('select#billingCountry', 'CA'); + + await page.fill('#billingPostalCode', 'LN1 7FH'); + expect(await page.screenshot()).toMatchSnapshot('recurring-and-upfront-stripe-checkout-filled.png'); + await page.click('.SubmitButton'); + + // Verify get to the thank you page order complete + const order_complete_content = await page.textContent('.title-1'); + expect(order_complete_content === "Order Complete!"); + expect(await page.screenshot()).toMatchSnapshot('recurring-and-upfront-order-complete.png'); + + // Go to My Subscribers page + // Crude wait before we check subscribers to allow webhooks time + await new Promise(x => setTimeout(x, 5000)); //5 secconds + await page.goto('admin/subscribers') + expect(await page.screenshot()).toMatchSnapshot('recurring-and-upfront-view-subscribers.png'); + + // Click Refresh Subscription + await page.click('#refresh_subscriptions'); // this is the refresh subscription + await page.textContent('.alert-heading') === "Notification"; + // screeshot to the active subscriber + await page.goto('admin/dashboard'); + expect(await page.screenshot()).toMatchSnapshot('recurring-and-upfront-active-subscribers.png'); + //go back to subscriptions + await page.goto('admin/subscribers') + + // Verify that subscriber is present in the list + const subscriber_email_content = await page.textContent('.subscriber-email'); + expect(subscriber_email_content === SUBSCRIBER_EMAIL_USER); + + // Verify that plan is attached to subscriber + const subscriber_subscription_title_content = await page.textContent('.subscription-title'); + expect(subscriber_subscription_title_content === 'Hair Gel'); + + // Verify transaction is present in 'All transactions page' + await page.goto('admin/transactions') + expect(await page.screenshot()).toMatchSnapshot('view-transactions.png'); + const transaction_content = await page.textContent('.transaction-amount'); + expect (transaction_content == '$5.99'); + + // Verify subscriber is linked to the transaction: + const transaction_subscriber_content = await page.textContent('.transaction-subscriber'); + expect (transaction_subscriber_content === 'John smith'); + + // Verify paid invoice has been generated & marked "paid": + await page.goto('admin/invoices') + expect(await page.screenshot()).toMatchSnapshot('recurring-and-upfront-view-paid-invoices.png'); + const content_paid_invoice_status = await page.textContent('.invoice-status'); + expect(content_paid_invoice_status === 'paid') + + const content_paid_invoice_amount = await page.textContent('.invoice-amount-paid'); + expect(content_paid_invoice_amount === '$5.99') + + // Verify upcoming invoice has been generated for the subscription: + await page.goto('admin/upcoming-invoices') + // Fetch Upcoming Invoices + await page.click('#fetch_upcoming_invoices'); + await new Promise(x => setTimeout(x, 10000)); //10 secconds + expect(await page.screenshot()).toMatchSnapshot('recurring-and-upfront-view-upcoming-invoices.png'); + const content_upcoming_invoice_amount = await page.textContent('.upcoming-invoice-amount'); + expect(content_upcoming_invoice_amount === '$5.99') + + // Verify Plan is attached to upcoming invoice, and recuring price & upfront price are correct + const content_upcoming_invoice_plan_recuring_amount = await page.textContent('.plan-price-interval'); + expect(content_upcoming_invoice_plan_recuring_amount === '$5.99') + const content_upcoming_invoice_plan_upfront_amount = await page.textContent('.plan-sell-price'); + expect(content_upcoming_invoice_plan_upfront_amount === '$1.00') + }); + const transaction_filter_by_name_and_by_plan_title = require('./shop_owner_transaction_filter_by_name_and_by_plan_title.js'); + const subscriber_filter_by_name_and_by_plan_title = require('./905-subscriber-search-by-email-and-name.js'); +}); diff --git a/tests/browser-automated-tests-playwright/tests/CAD-tests/905-subscriber-search-by-email-and-name.js b/tests/browser-automated-tests-playwright/tests/CAD-tests/905-subscriber-search-by-email-and-name.js new file mode 100644 index 000000000..00a577046 --- /dev/null +++ b/tests/browser-automated-tests-playwright/tests/CAD-tests/905-subscriber-search-by-email-and-name.js @@ -0,0 +1,35 @@ +const { test, expect } = require('@playwright/test'); +const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; +test("@905@shop-owner@subscriber filter by name and by email @CAD", async ({ page }) => { + console.log("subscriber filter by name and by email"); + + await page.goto('admin/subscribers') + // Verify that subscriber is present in the list + const mysubscriber_email_content = await page.textContent('.subscriber-email'); + expect(mysubscriber_email_content === SUBSCRIBER_EMAIL_USER); + + // Verify subscriber is linked to the subscribers page: + const mysubscriber_subscriber_content = await page.textContent('text=John Smith'); + expect (mysubscriber_subscriber_content === 'John smith'); + + // Verify search by Name + await page.fill('input[name=subscriber_name]',"John"); + await page.click('input[type=submit]'); + expect (mysubscriber_subscriber_content === 'John smith'); + expect(await page.screenshot()).toMatchSnapshot('filter-by-name.png'); + + // Verify search by email + await page.fill('input[name=subscriber_name]',""); + await page.fill('input[name=subscriber_email]',SUBSCRIBER_EMAIL_USER); + await page.click('input[type=submit]'); + expect (mysubscriber_subscriber_content === SUBSCRIBER_EMAIL_USER); + expect(await page.screenshot()).toMatchSnapshot('filter-by-email.png'); + + // Verify search by Name & Email + await page.fill('input[name=subscriber_name]',"John"); + await page.fill('input[name=subscriber_email]',SUBSCRIBER_EMAIL_USER); + await page.click('input[type=submit]'); + expect (mysubscriber_subscriber_content === 'John smith'); + expect(await page.screenshot()).toMatchSnapshot('filter-by-name-and-plan.png'); +}); + diff --git a/tests/browser-automated-tests-playwright/tests/CAD-tests/shop_owner_transaction_filter_by_name_and_by_plan_title.js b/tests/browser-automated-tests-playwright/tests/CAD-tests/shop_owner_transaction_filter_by_name_and_by_plan_title.js new file mode 100644 index 000000000..cdc453079 --- /dev/null +++ b/tests/browser-automated-tests-playwright/tests/CAD-tests/shop_owner_transaction_filter_by_name_and_by_plan_title.js @@ -0,0 +1,36 @@ +const { test, expect } = require('@playwright/test'); +test("@619@shop-owner@transaction filter by name and by plan title @CAD", async ({ page }) => { + console.log("transaction filter by name and by plan title"); + + await page.goto("admin/dashboard") + const content = await page.textContent('.card-title') + expect(content === 'Checklist'); // If we see "Checklist", we're logged in to admin + // Verify transaction is present in 'All transactions page' + + await page.goto('admin/transactions') + const transaction_content = await page.textContent('.transaction-amount'); + expect (transaction_content == '$6.99'); + + // Verify subscriber is linked to the transaction: + const transaction_subscriber_content = await page.textContent('.transaction-subscriber'); + expect (transaction_subscriber_content === 'John smith'); + // Verify search by Name - Transaccions + await page.fill('input[name=subscriber_name]',"John"); + await page.click('.btn-primary'); + expect (transaction_subscriber_content === 'John smith'); + expect(await page.screenshot()).toMatchSnapshot('filter-by-name.png'); + + // Verify search by plan title + await page.fill('input[name=plan_title]',"Hair"); + await page.click('.btn-primary'); + expect (transaction_subscriber_content === 'John smith'); + expect(await page.screenshot()).toMatchSnapshot('filter-by-plan.png'); + + // Verify search by Name & plan title + await page.fill('input[name=subscriber_name]',"John"); + await page.fill('input[name=plan_title]',"Hair"); + await page.click('.btn-primary'); + expect (transaction_subscriber_content === 'John smith'); + expect(await page.screenshot()).toMatchSnapshot('filter-by-name-and-plan.png'); +}); + diff --git a/tests/browser-automated-tests-playwright/tests/CAD-tests/stripe_connect.js b/tests/browser-automated-tests-playwright/tests/CAD-tests/stripe_connect.js new file mode 100644 index 000000000..bf29c8aa5 --- /dev/null +++ b/tests/browser-automated-tests-playwright/tests/CAD-tests/stripe_connect.js @@ -0,0 +1,128 @@ +const { test, expect } = require('@playwright/test'); +const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; +test.describe("order plan with recurring and upfront charge test:", () => { + test("@293@connect-to-stripe@shop-owner@detect stripe onboarding page @CAD", async ({ page }) => { + + // Go to Stripe Connect payment gateways page + await page.goto('admin/connect/stripe-connect'); + //page.setDefaultTimeout(3000); + let contentStripeConnect = await page.evaluate(() => document.body.textContent); + test.skip(contentStripeConnect.indexOf("Your currently running in test mode.") > -1); + expect(await page.screenshot()).toMatchSnapshot('stripe_status.png'); + + // deleting connect account id, if stripe was not succesfully connected + await page.goto('/admin/delete-connect-account'); + await page.goto('/admin/dashboard'); + console.log('deleting connect account id'); + + // Start Stripe connect onboarding + await page.goto('/admin/connect/stripe-connect'); + // Selecting countring to connect to stripe + await page.locator('select').selectOption('CA') + await page.click('.btn-success'); + + console.log("Start Stripe connect onboarding") + + const phone_email_content = await page.textContent('.db-ConsumerUITitle'); + // Stripe onboarding login + if (expect(phone_email_content === "Get paid by Subscribie")) { + console.log("Detected stripe onboarding") + // Use the text phone number for SMS verification + await page.click('text="the test phone number"'); + await page.click('text="Continue"'); + await new Promise(x => setTimeout(x, 2000)); + } else { + console.log("Could not detect stripe onboarding page") + } + + // Use SME verify with test code + const phone_content = await page.textContent('text="Enter the verification code we sent to your phone"'); + if (expect(phone_content === "Enter the verification code we sent to your phone")) { + console.log("Clicking Use test code") + await page.click('button:has-text("Use test code")'); //Use Test code for SMS + } + + // Stripe onboarding Business type + //const business_type_content = await page.textContent('.db-ConsumerUITitle'); + const business_type_content = await page.textContent('text="Tell us about your business"'); + if (expect(business_type_content === "Tell us about your business")) { + await new Promise(x => setTimeout(x, 4000)); + await page.click('text=Individual or sole proprietorship'); + await page.click('text="Continue"'); + } + + // Stripe onboarding personal details step + //const personal_details_content = await page.textContent('.db-ConsumerUITitle'); + const personal_details_content = await page.textContent('text="Verify your personal details"'); + if (expect(personal_details_content === 'Verify your personal details')) { + await new Promise(x => setTimeout(x, 1000)); + try { + await page.fill('#first_name', "Sam"); + await page.fill('#last_name', "Smith"); + try { + await page.fill('input[name=dob-day]', "28", { timeout: 10000 }); + await page.fill('input[name=dob-month]', "12", { timeout: 10000 }); + await page.fill('input[name=dob-year]', "1990", { timeout: 10000 }); + console.log("input selector being used"); + } catch (e) { + await page.selectOption('select >> nth=0', '12'); + await page.selectOption('select >> nth=1', '28'); + await page.selectOption('select >> nth=2', '1990'); + console.log("select selector being used"); + } + } catch (e) { + console.log("Exception in setting personal details, perhaps already completed"); + console.log(e); + console.log("Continuing regardless"); + } + await page.fill('input[name=address]', "123 Tree Lane"); + await page.fill('input[name=locality]', "123 Tree Lane"); + await page.fill('input[name=zip]', "123456"); + await page.selectOption('[aria-label="Province"]', 'AB'); + //await page.locator('select.subregion').selectOption('Alberta'); + await page.click('text="Continue"'); + } + // Stripe onboarding payouts bank details + //const account_payouts_content = await page.textContent('.db-ConsumerUITitle'); + const account_payouts_content = await page.textContent('text="Select an account for payouts"'); + if (expect(account_payouts_content === "Select an account for payouts")) { + await new Promise(x => setTimeout(x, 1000)); + await page.click('text="Use test account"'); + } + // Stripe onboarding verification summary + //const notice_title_content = await page.textContent('.Notice-title'); + const notice_title_content = await page.textContent('text="Information required soon"'); + if (expect(notice_title_content === "Information required soon")) { + console.log("On the Let's review your details page"); + await new Promise(x => setTimeout(x, 2000)); + //await page.click('button:has-text("Update")'); + await page.locator('text="Information required soon"').click(); + } + // Stripe onboarding identify verification step + //const additional_information_content = await page.textContent('.db-ConsumerUITitle'); + const additional_information_content = await page.textContent('text=For additional security, please have this person finish verifying their identity'); + if (expect(additional_information_content === "For additional security, please have this person finish verifying their identity")) { + await new Promise(x => setTimeout(x, 3000)); + await page.click('text="Use test document"'); + await new Promise(x => setTimeout(x, 3000)); + } + // Stripe onboarding verification complete + const stripe_completion_content = await page.textContent('text="Other information provided"'); + if (expect(stripe_completion_content === "Other information provided")) { + await new Promise(x => setTimeout(x, 1000)); + + // Dont wait too long to click either Submit or Done + await page.click('button:has-text("Agree & Submit")'); + console.log("Clicking Submit"); + } + + console.log("Announce stripe account automatically visiting announce url. In prod this is called via uwsgi cron"); + await new Promise(x => setTimeout(x, 5000)); + const stripe_connected = await page.textContent("text=Your currently running in test mode."); + expect(stripe_connected === "Your currently running in test mode."); + console.log("Stripe Connected"); + await page.goto('/admin/announce-stripe-connect'); + await page.textContent(':has-text("Announced Stripe connect account")') === "Announced Stripe connect account"; + console.log("Announced to Stripe connect account"); + }); +}); diff --git a/tests/browser-automated-tests-playwright/tests/1005_shop_owner_terms_and_conditions_creation.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/1005_shop_owner_terms_and_conditions_creation.js similarity index 97% rename from tests/browser-automated-tests-playwright/tests/1005_shop_owner_terms_and_conditions_creation.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/1005_shop_owner_terms_and_conditions_creation.js index 29bb6437d..d6e6ef9bc 100644 --- a/tests/browser-automated-tests-playwright/tests/1005_shop_owner_terms_and_conditions_creation.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/1005_shop_owner_terms_and_conditions_creation.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); //Subscribie tests -test("@1005@shop-owner@terms and condition creation", async ({ page }) => { +test("@1005@shop-owner@terms and condition creation @GBP", async ({ page }) => { try{ console.log("checking if terms and conditions is already attached to the free plan..."); await page.goto('/'); diff --git a/tests/browser-automated-tests-playwright/tests/1005_subscriber_terms_and_condition_check_test.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/1005_subscriber_terms_and_condition_check_test.js similarity index 93% rename from tests/browser-automated-tests-playwright/tests/1005_subscriber_terms_and_condition_check_test.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/1005_subscriber_terms_and_condition_check_test.js index a2aa3acd7..2bd02be52 100644 --- a/tests/browser-automated-tests-playwright/tests/1005_subscriber_terms_and_condition_check_test.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/1005_subscriber_terms_and_condition_check_test.js @@ -2,7 +2,7 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; -test('@1005@subscriber@check terms and conditions', async ({ page }) => { +test('@1005@subscriber@check terms and conditions @GBP', async ({ page }) => { await page.goto("/auth/logout"); diff --git a/tests/browser-automated-tests-playwright/tests/121_shop_owner_public_page_creation.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/121_shop_owner_public_page_creation.js similarity index 94% rename from tests/browser-automated-tests-playwright/tests/121_shop_owner_public_page_creation.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/121_shop_owner_public_page_creation.js index 372c7dca9..dd06b5449 100644 --- a/tests/browser-automated-tests-playwright/tests/121_shop_owner_public_page_creation.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/121_shop_owner_public_page_creation.js @@ -1,6 +1,6 @@ const { test, expect } = require('@playwright/test'); -test("@121@shop-owner@Creating Public Page", async ({ page }) => { +test("@121@shop-owner@Creating Public Page @GBP", async ({ page }) => { page.setDefaultTimeout(5000); await page.goto('/page/contactus'); await new Promise(x => setTimeout(x, 5000)); diff --git a/tests/browser-automated-tests-playwright/tests/133_subscriber_order_plan_with_cooling_off.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/133_subscriber_order_plan_with_cooling_off.js similarity index 99% rename from tests/browser-automated-tests-playwright/tests/133_subscriber_order_plan_with_cooling_off.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/133_subscriber_order_plan_with_cooling_off.js index 570a5f178..a202ac707 100644 --- a/tests/browser-automated-tests-playwright/tests/133_subscriber_order_plan_with_cooling_off.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/133_subscriber_order_plan_with_cooling_off.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; test.describe("order plan with cooling off:", () => { - test("@133@subscriber@Ordering plan with cooling off feature", async ({ page }) => { + test("@133@subscriber@Ordering plan with cooling off feature @GBP", async ({ page }) => { console.log("Ordering plan with cooling off"); // Buy item with subscription & upfront fee await page.goto('/'); // Go to home before selecting product diff --git a/tests/browser-automated-tests-playwright/tests/212_shop_owner_slogan_creation.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/212_shop_owner_slogan_creation.js similarity index 94% rename from tests/browser-automated-tests-playwright/tests/212_shop_owner_slogan_creation.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/212_shop_owner_slogan_creation.js index 7b132ab0b..69b7e9068 100644 --- a/tests/browser-automated-tests-playwright/tests/212_shop_owner_slogan_creation.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/212_shop_owner_slogan_creation.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); //Subscribie tests -test("@212@shop-owner@slogan creation", async ({ page }) => { +test("@212@shop-owner@slogan creation @GBP", async ({ page }) => { console.log("checking if slogan is already created..."); await page.goto('/'); page.setDefaultTimeout(3000); diff --git a/tests/browser-automated-tests-playwright/tests/264_subscriber_order_plan_with_choice_options_and_required_note.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/264_subscriber_order_plan_with_choice_options_and_required_note.js similarity index 99% rename from tests/browser-automated-tests-playwright/tests/264_subscriber_order_plan_with_choice_options_and_required_note.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/264_subscriber_order_plan_with_choice_options_and_required_note.js index aec31e03c..b3806c69e 100644 --- a/tests/browser-automated-tests-playwright/tests/264_subscriber_order_plan_with_choice_options_and_required_note.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/264_subscriber_order_plan_with_choice_options_and_required_note.js @@ -1,6 +1,6 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; -test("@264@subscriber@order plan with choice, option and required note", async ({ page }) => { +test("@264@subscriber@order plan with choice, option and required note @GBP", async ({ page }) => { console.log("order plan with choice, option and required note"); // Buy item with subscription & upfront fee await page.goto('/'); // Go to home before selecting product diff --git a/tests/browser-automated-tests-playwright/tests/275_shop_owner_changing_plans_order.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/275_shop_owner_changing_plans_order.js similarity index 96% rename from tests/browser-automated-tests-playwright/tests/275_shop_owner_changing_plans_order.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/275_shop_owner_changing_plans_order.js index 2463c1c73..687ccbbbe 100644 --- a/tests/browser-automated-tests-playwright/tests/275_shop_owner_changing_plans_order.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/275_shop_owner_changing_plans_order.js @@ -1,6 +1,6 @@ const { test, expect } = require('@playwright/test'); -test("@275@shop-owner@Changing Plans order", async ({ page }) => { +test("@275@shop-owner@Changing Plans order @GBP", async ({ page }) => { console.log("Changing plans order..."); await page.goto("/admin/edit") const check_plan_with_choice_and_options = await page.textContent('text="Edit Plans"'); diff --git a/tests/browser-automated-tests-playwright/tests/293_subscriber_order_plan_with_only_recurring_charge.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/293_subscriber_order_plan_with_only_recurring_charge.js similarity index 98% rename from tests/browser-automated-tests-playwright/tests/293_subscriber_order_plan_with_only_recurring_charge.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/293_subscriber_order_plan_with_only_recurring_charge.js index 80536dcd0..983971bf2 100644 --- a/tests/browser-automated-tests-playwright/tests/293_subscriber_order_plan_with_only_recurring_charge.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/293_subscriber_order_plan_with_only_recurring_charge.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; test.describe("order plan with only recurring charge test:", () => { - test("@293@subscriber@Ordering recurring plan", async ({ page }) => { + test("@293@subscriber@Ordering recurring plan @GBP", async ({ page }) => { console.log("Ordering plan with only recurring charge..."); // Buy item with subscription & upfront fee await page.goto("/"); // Go to home before selecting product diff --git a/tests/browser-automated-tests-playwright/tests/293_subscriber_order_plan_with_only_upfront_charge.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/293_subscriber_order_plan_with_only_upfront_charge.js similarity index 97% rename from tests/browser-automated-tests-playwright/tests/293_subscriber_order_plan_with_only_upfront_charge.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/293_subscriber_order_plan_with_only_upfront_charge.js index efceb8a1e..444ab0c10 100644 --- a/tests/browser-automated-tests-playwright/tests/293_subscriber_order_plan_with_only_upfront_charge.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/293_subscriber_order_plan_with_only_upfront_charge.js @@ -2,7 +2,7 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; test.describe("order plan with only upfront charge tests:", () => { - test("@293@subscriber@Ordering upfront plan", async ({ page }) => { + test("@293@subscriber@Ordering upfront plan @GBP", async ({ page }) => { console.log("Ordering plan with only upfront charge..."); // Buy item with subscription & upfront fee await page.goto('/'); // Go to home before selecting product diff --git a/tests/browser-automated-tests-playwright/tests/293_subscriber_order_plan_with_recurring_and_upfront_charge.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/293_subscriber_order_plan_with_recurring_and_upfront_charge.js similarity index 98% rename from tests/browser-automated-tests-playwright/tests/293_subscriber_order_plan_with_recurring_and_upfront_charge.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/293_subscriber_order_plan_with_recurring_and_upfront_charge.js index b9a16335a..1c501bf14 100644 --- a/tests/browser-automated-tests-playwright/tests/293_subscriber_order_plan_with_recurring_and_upfront_charge.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/293_subscriber_order_plan_with_recurring_and_upfront_charge.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; test.describe("order plan with recurring and upfront charge test:", () => { - test("@293@subscriber@Ordering recurring and upfront plan", async ({ page }) => { + test("@293@subscriber@Ordering recurring and upfront plan @GBP", async ({ page }) => { console.log("Ordering Plan with subscription and upfront charge"); // Buy item with subscription & upfront fee await page.goto('/'); // Go to home before selecting product diff --git a/tests/browser-automated-tests-playwright/tests/334_shop_owner_private_page_creation.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/334_shop_owner_private_page_creation.js similarity index 97% rename from tests/browser-automated-tests-playwright/tests/334_shop_owner_private_page_creation.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/334_shop_owner_private_page_creation.js index 1d5c949e1..f1524ea75 100644 --- a/tests/browser-automated-tests-playwright/tests/334_shop_owner_private_page_creation.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/334_shop_owner_private_page_creation.js @@ -1,6 +1,6 @@ const { test, expect } = require('@playwright/test'); -test("@334@shop-owner@Creating Private Page", async ({ page }) => { +test("@334@shop-owner@Creating Private Page @GBP", async ({ page }) => { page.setDefaultTimeout(5000); await page.goto('/page/privatetestpage'); await new Promise(x => setTimeout(x, 5000)); diff --git a/tests/browser-automated-tests-playwright/tests/387_shop_owner_change_shop_colour.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/387_shop_owner_change_shop_colour.js similarity index 93% rename from tests/browser-automated-tests-playwright/tests/387_shop_owner_change_shop_colour.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/387_shop_owner_change_shop_colour.js index ab4962ff3..6cec99dac 100644 --- a/tests/browser-automated-tests-playwright/tests/387_shop_owner_change_shop_colour.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/387_shop_owner_change_shop_colour.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); //Subscribie tests -test("@387@shop-owner@change_shop_colour", async ({ page }) => { +test("@387@shop-owner@change_shop_colour @GBP", async ({ page }) => { console.log("changing shop colour..."); // Go to style your shop await page.goto('/style/style-shop'); diff --git a/tests/browser-automated-tests-playwright/tests/452_shop_owner_categories_creation.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/452_shop_owner_categories_creation.js similarity index 96% rename from tests/browser-automated-tests-playwright/tests/452_shop_owner_categories_creation.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/452_shop_owner_categories_creation.js index 8c0c309ac..d99f2b767 100644 --- a/tests/browser-automated-tests-playwright/tests/452_shop_owner_categories_creation.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/452_shop_owner_categories_creation.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); //Subscribie tests -test("@452@shop-owner@category creation", async ({ page }) => { +test("@452@shop-owner@category creation @GBP", async ({ page }) => { try{ console.log("checking if category is already created..."); await page.goto('/'); diff --git a/tests/browser-automated-tests-playwright/tests/463_shop_owner_adding_vat.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/463_shop_owner_adding_vat.js similarity index 90% rename from tests/browser-automated-tests-playwright/tests/463_shop_owner_adding_vat.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/463_shop_owner_adding_vat.js index 3d4ca31fb..6ea4c9852 100644 --- a/tests/browser-automated-tests-playwright/tests/463_shop_owner_adding_vat.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/463_shop_owner_adding_vat.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); //Subscribie tests -test("@463@shop-owner@adding VAT", async ({ page }) => { +test("@463@shop-owner@adding VAT @GBP", async ({ page }) => { console.log("enabling VAT..."); // Go to style your shop await page.goto('/admin/vat-settings'); diff --git a/tests/browser-automated-tests-playwright/tests/463_subscriber_ordering_plan_with_VAT.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/463_subscriber_ordering_plan_with_VAT.js similarity index 98% rename from tests/browser-automated-tests-playwright/tests/463_subscriber_ordering_plan_with_VAT.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/463_subscriber_ordering_plan_with_VAT.js index 13469b99f..8fbce01aa 100644 --- a/tests/browser-automated-tests-playwright/tests/463_subscriber_ordering_plan_with_VAT.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/463_subscriber_ordering_plan_with_VAT.js @@ -1,6 +1,6 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; -test("@463@subscriber@Ordering plan with VAT", async ({ page }) => { +test("@463@subscriber@Ordering plan with VAT @GBP", async ({ page }) => { console.log("Ordering plan with only recurring charge + VAT..."); // Buy item with subscription & upfront fee await page.goto("/"); // Go to home before selecting product diff --git a/tests/browser-automated-tests-playwright/tests/475_subscriber_order_plan_with_free_trial.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/475_subscriber_order_plan_with_free_trial.js similarity index 98% rename from tests/browser-automated-tests-playwright/tests/475_subscriber_order_plan_with_free_trial.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/475_subscriber_order_plan_with_free_trial.js index 33beb68ca..7efefdfb3 100644 --- a/tests/browser-automated-tests-playwright/tests/475_subscriber_order_plan_with_free_trial.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/475_subscriber_order_plan_with_free_trial.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; test.describe("order plan with free-trial:", () => { - test("@475@subscriber@Ordering plan with free-trial feature", async ({ page }) => { + test("@475@subscriber@Ordering plan with free-trial feature @GBP", async ({ page }) => { console.log("Ordering Plan with free trial"); // Buy item with subscription & upfront fee await page.goto('/'); // Go to home before selecting product diff --git a/tests/browser-automated-tests-playwright/tests/491_shop_owner_share_private_plan_url.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/491_shop_owner_share_private_plan_url.js similarity index 92% rename from tests/browser-automated-tests-playwright/tests/491_shop_owner_share_private_plan_url.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/491_shop_owner_share_private_plan_url.js index 1d498f83a..8e1bafa28 100644 --- a/tests/browser-automated-tests-playwright/tests/491_shop_owner_share_private_plan_url.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/491_shop_owner_share_private_plan_url.js @@ -2,7 +2,7 @@ const { test, expect } = require('@playwright/test'); //Subscribie tests test.describe("Looking for Private plan share URL:", () => { - test("@491@shop-owner@Create Private Plan", async ({ page }) => { + test("@491@shop-owner@Create Private Plan @GBP", async ({ page }) => { await page.goto('/admin/edit'); page.setDefaultTimeout(3000); const private_plan__already_exist = await page.textContent('text="First Private plan"'); diff --git a/tests/browser-automated-tests-playwright/tests/516_subscriber_order_plan_with_cancel_at.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/516_subscriber_order_plan_with_cancel_at.js similarity index 98% rename from tests/browser-automated-tests-playwright/tests/516_subscriber_order_plan_with_cancel_at.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/516_subscriber_order_plan_with_cancel_at.js index 911cbbae4..29a63c359 100644 --- a/tests/browser-automated-tests-playwright/tests/516_subscriber_order_plan_with_cancel_at.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/516_subscriber_order_plan_with_cancel_at.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; test.describe("order plan with cancel at:", () => { - test("@516@subscriber@Ordering plan with cancel at feature", async ({ page }) => { + test("@516@subscriber@Ordering plan with cancel at feature @GBP", async ({ page }) => { console.log("Ordering plan with cancel_at"); // Go to home before selecting product await page.goto('/'); diff --git a/tests/browser-automated-tests-playwright/tests/623_subscriber_magic_login.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/623_subscriber_magic_login.js similarity index 94% rename from tests/browser-automated-tests-playwright/tests/623_subscriber_magic_login.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/623_subscriber_magic_login.js index f44a49cc1..f1debd660 100644 --- a/tests/browser-automated-tests-playwright/tests/623_subscriber_magic_login.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/623_subscriber_magic_login.js @@ -3,7 +3,7 @@ const checkSubscriberLogin= require('./checkSubscriberLogin.js'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; -test('@623@subscriber@reset password receives email', async ({ page }) => { +test('@623@subscriber@reset password receives email @GBP', async ({ page }) => { await page.goto("/auth/logout"); diff --git a/tests/browser-automated-tests-playwright/tests/872_uploading_plan_picture.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/872_uploading_plan_picture.js similarity index 94% rename from tests/browser-automated-tests-playwright/tests/872_uploading_plan_picture.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/872_uploading_plan_picture.js index 1f6baf8f0..3309ca1cc 100644 --- a/tests/browser-automated-tests-playwright/tests/872_uploading_plan_picture.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/872_uploading_plan_picture.js @@ -1,6 +1,6 @@ const { test, expect } = require('@playwright/test'); -test("@872@shop-owner@uploading a plan picture", async ({ page }) => { +test("@872@shop-owner@uploading a plan picture @GBP", async ({ page }) => { //uploading an image in a plan console.log("Uploading a plan picture"); await page.goto("/admin/edit") diff --git a/tests/browser-automated-tests-playwright/tests/905-subscriber-search-by-email-and-name.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/905-subscriber-search-by-email-and-name.js similarity index 94% rename from tests/browser-automated-tests-playwright/tests/905-subscriber-search-by-email-and-name.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/905-subscriber-search-by-email-and-name.js index fbd5c49cf..0a80d6e80 100644 --- a/tests/browser-automated-tests-playwright/tests/905-subscriber-search-by-email-and-name.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/905-subscriber-search-by-email-and-name.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; -test("@905@shop-owner@subscriber filter by name and by email", async ({ page }) => { +test("@905@shop-owner@subscriber filter by name and by email @GBP", async ({ page }) => { console.log("subscriber filter by name and by email"); await page.goto('admin/subscribers') diff --git a/tests/browser-automated-tests-playwright/tests/939_subscriber_order_free_plan_with_terms_and_conditions.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/939_subscriber_order_free_plan_with_terms_and_conditions.js similarity index 97% rename from tests/browser-automated-tests-playwright/tests/939_subscriber_order_free_plan_with_terms_and_conditions.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/939_subscriber_order_free_plan_with_terms_and_conditions.js index 8db185a8a..0bb059915 100644 --- a/tests/browser-automated-tests-playwright/tests/939_subscriber_order_free_plan_with_terms_and_conditions.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/939_subscriber_order_free_plan_with_terms_and_conditions.js @@ -2,7 +2,7 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; test.describe("order free plan tests:", () => { - test("@939 @subscriber @Ordering free plan", async ({ page }) => { + test("@939 @subscriber @Ordering free plan @GBP", async ({ page }) => { console.log("Ordering free plan..."); // Buy item with subscription & upfront fee await page.goto('/'); // Go to home before selecting product diff --git a/tests/browser-automated-tests-playwright/tests/993_subscriber_change_card_details.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/993_subscriber_change_card_details.js similarity index 95% rename from tests/browser-automated-tests-playwright/tests/993_subscriber_change_card_details.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/993_subscriber_change_card_details.js index 6a9c05b36..81c7e1c64 100644 --- a/tests/browser-automated-tests-playwright/tests/993_subscriber_change_card_details.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/993_subscriber_change_card_details.js @@ -2,7 +2,7 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; -test('@993@subscriber@change card details', async ({ page }) => { +test('@993@subscriber@change card details @GBP', async ({ page }) => { await page.goto("/auth/logout"); diff --git a/tests/browser-automated-tests-playwright/tests/checkSubscriberLogin.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/checkSubscriberLogin.js similarity index 100% rename from tests/browser-automated-tests-playwright/tests/checkSubscriberLogin.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/checkSubscriberLogin.js diff --git a/tests/browser-automated-tests-playwright/tests/shop_owner_pause_resume_and_cancel_subscriptions.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/shop_owner_pause_resume_and_cancel_subscriptions.js similarity index 97% rename from tests/browser-automated-tests-playwright/tests/shop_owner_pause_resume_and_cancel_subscriptions.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/shop_owner_pause_resume_and_cancel_subscriptions.js index b3a1f355b..07ddf1a4f 100644 --- a/tests/browser-automated-tests-playwright/tests/shop_owner_pause_resume_and_cancel_subscriptions.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/shop_owner_pause_resume_and_cancel_subscriptions.js @@ -2,7 +2,7 @@ const { test, expect } = require('@playwright/test'); const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; //Subscribie tests test.describe("Pause, Resume and Cancel Subscription:", () => { - test("@147@shop-owner@Pause and Resume transaction", async ({ page }) => { + test("@147@shop-owner@Pause and Resume transaction @GBP", async ({ page }) => { console.log("Pause and Resume transaction"); // Go to My Subscribers page // Crude wait before we check subscribers to allow webhooks time diff --git a/tests/browser-automated-tests-playwright/tests/shop_owner_plan_creation.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/shop_owner_plan_creation.js similarity index 99% rename from tests/browser-automated-tests-playwright/tests/shop_owner_plan_creation.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/shop_owner_plan_creation.js index 439c63014..9c1564cd0 100644 --- a/tests/browser-automated-tests-playwright/tests/shop_owner_plan_creation.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/shop_owner_plan_creation.js @@ -4,7 +4,7 @@ const TIMEOUT = 5000; //Subscribie tests test.describe("Plan Creation tests:", () => { // Create cooling off plan - test("@133@show-owner@Create cooling off plan", async ({ page }) => { + test("@133@show-owner@Create cooling off plan @GBP", async ({ page }) => { console.log("Starting plan creations..."); await page.goto('/'); try { diff --git a/tests/browser-automated-tests-playwright/tests/shop_owner_transaction_filter_by_name_and_by_plan_title.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/shop_owner_transaction_filter_by_name_and_by_plan_title.js similarity index 98% rename from tests/browser-automated-tests-playwright/tests/shop_owner_transaction_filter_by_name_and_by_plan_title.js rename to tests/browser-automated-tests-playwright/tests/GBP-tests/shop_owner_transaction_filter_by_name_and_by_plan_title.js index 78ae15033..34c34eb10 100644 --- a/tests/browser-automated-tests-playwright/tests/shop_owner_transaction_filter_by_name_and_by_plan_title.js +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/shop_owner_transaction_filter_by_name_and_by_plan_title.js @@ -1,5 +1,5 @@ const { test, expect } = require('@playwright/test'); -test("@619@shop-owner@transaction filter by name and by plan title", async ({ page }) => { +test("@619@shop-owner@transaction filter by name and by plan title @GBP", async ({ page }) => { console.log("transaction filter by name and by plan title"); await page.goto("admin/dashboard") diff --git a/tests/browser-automated-tests-playwright/tests/GBP-tests/stripe_connect.js b/tests/browser-automated-tests-playwright/tests/GBP-tests/stripe_connect.js new file mode 100644 index 000000000..e3e413b57 --- /dev/null +++ b/tests/browser-automated-tests-playwright/tests/GBP-tests/stripe_connect.js @@ -0,0 +1,142 @@ +const { test, expect } = require('@playwright/test'); +const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER; +test.describe("@ gbp order plan with recurring and upfront charge test:", () => { + test("@293@connect-to-stripe@shop-owner@detect stripe onboarding page @GBP", async ({ page }) => { + + // Go to Stripe Connect payment gateways page + await page.goto('admin/connect/stripe-connect'); + //page.setDefaultTimeout(3000); + let contentStripeConnect = await page.evaluate(() => document.body.textContent); + test.skip(contentStripeConnect.indexOf("Your currently running in test mode.") > -1); + expect(await page.screenshot()).toMatchSnapshot('stripe_status.png'); + + // deleting connect account id, if stripe was not succesfully connected + await page.goto('/admin/delete-connect-account'); + await page.goto('/admin/dashboard'); + console.log('deleting connect account id'); + + // Start Stripe connect onboarding + await page.goto('/admin/connect/stripe-connect'); + // Selecting countring to connect to stripe + await page.locator('select').selectOption('GB') + await page.click('.btn-success'); + + console.log("Start Stripe connect onboarding") + + const phone_email_content = await page.textContent('.db-ConsumerUITitle'); + // Stripe onboarding login + if (expect(phone_email_content === "Get paid by Subscribie")) { + console.log("Detected stripe onboarding") + // Use the text phone number for SMS verification + await page.click('text="the test phone number"'); + await page.click('text="Continue"'); + await new Promise(x => setTimeout(x, 2000)); + } else { + console.log("Could not detect stripe onboarding page") + } + + // Use SME verify with test code + const phone_content = await page.textContent('text="Enter the verification code we sent to your phone"'); + if (expect(phone_content === "Enter the verification code we sent to your phone")) { + console.log("Clicking Use test code") + await page.click('button:has-text("Use test code")'); //Use Test code for SMS + } + + // Stripe onboarding Business type + //const business_type_content = await page.textContent('.db-ConsumerUITitle'); + const business_type_content = await page.textContent('text="Tell us about your business"'); + if (expect(business_type_content === "Tell us about your business")) { + await new Promise(x => setTimeout(x, 4000)); + await page.selectOption('select', 'individual'); + await page.click('text="Continue"'); + } + + // Stripe onboarding personal details step + //const personal_details_content = await page.textContent('.db-ConsumerUITitle'); + const personal_details_content = await page.textContent('text="Verify your personal details"'); + if (expect(personal_details_content === 'Verify your personal details')) { + await new Promise(x => setTimeout(x, 1000)); + try { + await page.fill('#first_name', "Sam"); + await page.fill('#last_name', "Smith"); + try { + await page.fill('input[name=dob-day]', "28", { timeout: 10000 }); + await page.fill('input[name=dob-month]', "12", { timeout: 10000 }); + await page.fill('input[name=dob-year]', "1990", { timeout: 10000 }); + console.log("input selector being used"); + } catch (e) { + await page.selectOption('select >> nth=0', '12'); + await page.selectOption('select >> nth=1', '28'); + await page.selectOption('select >> nth=2', '1990'); + console.log("select selector being used"); + } + } catch (e) { + console.log("Exception in setting personal details, perhaps already completed"); + console.log(e); + console.log("Continuing regardless"); + } + await page.fill('input[name=address]', "123 Tree Lane"); + await page.fill('input[name=locality]', "123 Tree Lane"); + await page.fill('input[name=zip]', "SW1A 1AA"); + await page.fill('input[name=phone]', "0000000000"); + await page.click('text="Continue"'); + } + // Stripe onboarding industry selection + //const business_details_content = await page.textContent('.db-ConsumerUITitle'); + const business_details_content = await page.textContent('text="Tell us a few details about how you earn money with Subscribie."'); + if (expect(business_details_content === "Tell us a few details about how you earn money with Subscribie.")) { + await new Promise(x => setTimeout(x, 1000)); + await page.click('text="Please select your industry…"'); + await page.click('text="Software"'); + await page.click('text="Continue"'); + } + + // Stripe onboarding payouts bank details + //const account_payouts_content = await page.textContent('.db-ConsumerUITitle'); + const account_payouts_content = await page.textContent('text="Select an account for payouts"'); + if (expect(account_payouts_content === "Select an account for payouts")) { + await new Promise(x => setTimeout(x, 1000)); + await page.click('text="Use test account"'); + } + // Stripe onboarding verification summary + //const notice_title_content = await page.textContent('.Notice-title'); + const notice_title_content = await page.textContent('text="Information required soon"'); + if (expect(notice_title_content === "Information required soon")) { + console.log("On the Let's review your details page"); + await new Promise(x => setTimeout(x, 2000)); + //await page.click('button:has-text("Update")'); + await page.locator('text="Information required soon"').click(); + } + // Stripe onboarding identify verification step + //const additional_information_content = await page.textContent('.db-ConsumerUITitle'); + const additional_information_content = await page.textContent('text=For additional security, please have this person finish verifying their identity'); + if (expect(additional_information_content === "For additional security, please have this person finish verifying their identity")) { + await new Promise(x => setTimeout(x, 3000)); + await page.click('text="Use test document"'); + await new Promise(x => setTimeout(x, 3000)); + } + // Stripe onboarding verification complete + const stripe_completion_content = await page.textContent('text="Other information provided"'); + if (expect(stripe_completion_content === "Other information provided")) { + await new Promise(x => setTimeout(x, 1000)); + + // Dont wait too long to click either Submit or Done + try { + await page.click('button:has-text("Submit")', { timeout: 10000 }) + console.log("Clicking Submit"); + } catch (e) { + await page.click('button:has-text("Done")'); + console.log("Clicking Done"); + } + } + + console.log("Announce stripe account automatically visiting announce url. In prod this is called via uwsgi cron"); + await new Promise(x => setTimeout(x, 5000)); + const stripe_connected = await page.textContent("text=Your currently running in test mode."); + expect(stripe_connected === "Your currently running in test mode."); + console.log("Stripe Connected"); + await page.goto('/admin/announce-stripe-connect'); + await page.textContent(':has-text("Announced Stripe connect account")') === "Announced Stripe connect account"; + console.log("Announced to Stripe connect account"); + }); +}); diff --git a/tests/browser-automated-tests-playwright/tests/clear_db.js b/tests/browser-automated-tests-playwright/tests/clear_db.js index af932b741..ddb899f46 100644 --- a/tests/browser-automated-tests-playwright/tests/clear_db.js +++ b/tests/browser-automated-tests-playwright/tests/clear_db.js @@ -1,6 +1,6 @@ const { test, expect } = require('@playwright/test'); // Clear DB before each test. -test("@Clearing the DB", async ({ page }) => { +test("@Clearing the DB @GBP", async ({ page }) => { await page.goto('/admin/remove-subscriptions'); const contentSubscriptions = await page.evaluate(() => document.body.textContent.indexOf("all subscriptions deleted")); diff --git a/tests/browser-automated-tests-playwright/worker2.spec.js b/tests/browser-automated-tests-playwright/worker2.spec.js index 8455476f6..20b502c99 100644 --- a/tests/browser-automated-tests-playwright/worker2.spec.js +++ b/tests/browser-automated-tests-playwright/worker2.spec.js @@ -1,5 +1,4 @@ const { test, expect } = require('@playwright/test'); - test.beforeEach(async ({ page }) => { //Login await page.goto('/auth/login'); @@ -13,17 +12,17 @@ test.beforeEach(async ({ page }) => { await new Promise(x => setTimeout(x, 5000)); }); - const plan_creation = require('./tests/shop_owner_plan_creation'); + const plan_creation = require(`./tests/GBP-tests/shop_owner_plan_creation`); - const changing_plans_order = require('./tests/275_shop_owner_changing_plans_order'); + const changing_plans_order = require(`./tests/GBP-tests/275_shop_owner_changing_plans_order`); - const share_private_plan_url = require('./tests/491_shop_owner_share_private_plan_url'); + const share_private_plan_url = require(`./tests/GBP-tests/491_shop_owner_share_private_plan_url`); - const order_plan_with_choice_options_and_required_note = require('./tests/264_subscriber_order_plan_with_choice_options_and_required_note'); + const order_plan_with_choice_options_and_required_note = require(`./tests/GBP-tests/264_subscriber_order_plan_with_choice_options_and_required_note`); - const order_plan_with_cancel_at = require('./tests/516_subscriber_order_plan_with_cancel_at'); + const order_plan_with_cancel_at = require(`./tests/GBP-tests/516_subscriber_order_plan_with_cancel_at`); - const order_plan_cooling_off = require('./tests/133_subscriber_order_plan_with_cooling_off'); + const order_plan_cooling_off = require(`./tests/GBP-tests/133_subscriber_order_plan_with_cooling_off`); const enabling_donations = require('./tests/1065_shop_owner_enabling_donations'); diff --git a/tests/browser-automated-tests-playwright/worker3.spec.js b/tests/browser-automated-tests-playwright/worker3.spec.js index 767f2aacf..0b600a336 100644 --- a/tests/browser-automated-tests-playwright/worker3.spec.js +++ b/tests/browser-automated-tests-playwright/worker3.spec.js @@ -1,5 +1,4 @@ const { test, expect } = require('@playwright/test'); - test.beforeEach(async ({ page }) => { //Login await page.goto('/auth/login'); @@ -10,30 +9,30 @@ test.beforeEach(async ({ page }) => { const content = await page.textContent('.card-title') expect(content === 'Checklist'); // If we see "Checklist", we're logged in to admin }); - const clear_DB = require('./tests/clear_db'); + const clear_DB = require(`./tests/clear_db`); - const categories_creation = require('./tests/452_shop_owner_categories_creation'); + const categories_creation = require(`./tests/GBP-tests/452_shop_owner_categories_creation`); - const private_page_creation = require('./tests/334_shop_owner_private_page_creation'); + const private_page_creation = require(`./tests/GBP-tests/334_shop_owner_private_page_creation`); - const public_page_creation = require('./tests/121_shop_owner_public_page_creation'); + const public_page_creation = require(`./tests/GBP-tests/121_shop_owner_public_page_creation`); - const slogan_creation = require('./tests/212_shop_owner_slogan_creation'); + const slogan_creation = require(`./tests/GBP-tests/212_shop_owner_slogan_creation`); - const change_shop_colour = require('./tests/387_shop_owner_change_shop_colour'); + const change_shop_colour = require(`./tests/GBP-tests/387_shop_owner_change_shop_colour`); - const uploading_plan_picture = require('./tests/872_uploading_plan_picture.js'); + const uploading_plan_picture = require(`./tests/GBP-tests/872_uploading_plan_picture.js`); - const adding_vat = require('./tests/463_shop_owner_adding_vat'); + const adding_vat = require(`./tests/GBP-tests/463_shop_owner_adding_vat`); - const ordering_plan_with_VAT = require('./tests/463_subscriber_ordering_plan_with_VAT'); + const ordering_plan_with_VAT = require(`./tests/GBP-tests/463_subscriber_ordering_plan_with_VAT`); - const subscriber_magic_login = require('./tests/623_subscriber_magic_login'); + const subscriber_magic_login = require(`./tests/GBP-tests/623_subscriber_magic_login`); - const shop_owner_terms_and_conditions_creation = require('./tests/1005_shop_owner_terms_and_conditions_creation.js'); + const shop_owner_terms_and_conditions_creation = require(`./tests/GBP-tests/1005_shop_owner_terms_and_conditions_creation.js`); - const subscriber_order_free_plan = require('./tests/939_subscriber_order_free_plan_with_terms_and_conditions.js'); + const subscriber_order_free_plan = require(`./tests/GBP-tests/939_subscriber_order_free_plan_with_terms_and_conditions.js`); - const subscriber_terms_and_condition_check_test = require('./tests/1005_subscriber_terms_and_condition_check_test.js'); + const subscriber_terms_and_condition_check_test = require(`./tests/GBP-tests/1005_subscriber_terms_and_condition_check_test.js`); - const subscriber_change_card_details = require('./tests/993_subscriber_change_card_details.js'); + const subscriber_change_card_details = require(`./tests/GBP-tests/993_subscriber_change_card_details.js`);