From 1e4e1b1166d1409962c94842354ddd29fa01075f Mon Sep 17 00:00:00 2001 From: Vidya Ramakrishnan Date: Mon, 20 Nov 2023 22:54:58 +0530 Subject: [PATCH 01/14] Playwright tests (wip) --- .github/workflows/playwright.yml | 27 +++++++ .gitignore | 1 + funnel/templates/account.html.jinja2 | 14 ++-- .../templates/account_formlayout.html.jinja2 | 2 +- funnel/templates/account_menu.html.jinja2 | 10 +-- .../account_organizations.html.jinja2 | 2 +- .../templates/collaborator_list.html.jinja2 | 6 +- funnel/templates/forms.html.jinja2 | 4 +- .../img_upload_formlayout.html.jinja2 | 2 +- funnel/templates/js/comments.js.jinja2 | 34 ++++---- funnel/templates/js/event_checkin.js.jinja2 | 12 +-- funnel/templates/js/membership.js.jinja2 | 18 ++--- funnel/templates/js/schedule.js.jinja2 | 4 +- funnel/templates/js/update.js.jinja2 | 4 +- funnel/templates/labels.html.jinja2 | 4 +- funnel/templates/labels_form.html.jinja2 | 2 +- funnel/templates/layout.html.jinja2 | 12 +-- funnel/templates/login.html.jinja2 | 2 +- funnel/templates/macros.html.jinja2 | 32 ++++---- .../notifications/layout_web.html.jinja2 | 2 +- funnel/templates/otpform.html.jinja2 | 4 +- .../templates/password_login_form.html.jinja2 | 8 +- funnel/templates/profile.html.jinja2 | 4 +- funnel/templates/profile_layout.html.jinja2 | 34 ++++---- funnel/templates/project_admin.html.jinja2 | 14 ++-- funnel/templates/project_cfp.html.jinja2 | 2 +- funnel/templates/project_layout.html.jinja2 | 70 ++++++++-------- .../templates/project_rsvp_list.html.jinja2 | 4 +- funnel/templates/project_settings.html.jinja2 | 24 +++--- .../project_sponsor_popup.html.jinja2 | 4 +- .../templates/project_submissions.html.jinja2 | 2 +- funnel/templates/project_updates.html.jinja2 | 2 +- funnel/templates/rsvp_modal.html.jinja2 | 4 +- funnel/templates/schedule_edit.html.jinja2 | 8 +- .../templates/schedule_subscribe.html.jinja2 | 4 +- .../templates/session_view_popup.html.jinja2 | 18 ++--- funnel/templates/submission.html.jinja2 | 40 +++++----- .../submission_admin_panel.html.jinja2 | 6 +- funnel/templates/submission_form.html.jinja2 | 24 +++--- funnel/templates/ticket_event.html.jinja2 | 8 +- funnel/templates/unread_comments.html.jinja2 | 6 +- funnel/templates/venues.html.jinja2 | 12 +-- funnel/views/login.py | 2 +- playwright.config.js | 80 +++++++++++++++++++ tests/cypress/cypress_initdb_test.py | 1 + tests/cypress/e2e/00_addProfile.cy.js | 10 +-- tests/cypress/e2e/01_addCrewtoProfile.cy.js | 24 +++--- tests/cypress/e2e/02_verifyAdminRoles.cy.js | 22 ++--- tests/cypress/e2e/03_createProject.cy.js | 12 +-- tests/cypress/e2e/04_addCrewtoProject.cy.js | 8 +- tests/cypress/e2e/05_publishProject.cy.js | 30 +++---- tests/cypress/e2e/06_manageVenue.cy.js | 26 +++--- tests/cypress/e2e/07_addCFP.cy.js | 22 ++--- tests/cypress/e2e/08_addSubmission.cy.js | 46 +++++------ tests/cypress/e2e/09_confirmSubmission.cy.js | 62 +++++++------- tests/cypress/e2e/10_updateSchedule.cy.js | 34 ++++---- tests/cypress/e2e/11_respondToAttend.cy.js | 20 ++--- tests/cypress/e2e/12_verifyPromotorRole.cy.js | 22 ++--- tests/cypress/e2e/13_verifyattendeeList.cy.js | 8 +- tests/cypress/e2e/14_viewSchedule.cy.js | 38 ++++----- tests/cypress/e2e/15_addSessionVideo.cy.js | 22 ++--- tests/cypress/e2e/16_viewVideos.cy.js | 6 +- tests/cypress/e2e/17_removeSessionVideo.cy.js | 12 +-- tests/cypress/e2e/18_viewCrew.cy.js | 18 ++--- tests/cypress/e2e/20_postComment.cy.js | 38 ++++----- tests/cypress/e2e/21_postUpdate.cy.js | 22 ++--- .../cypress/e2e/22_commentSubscription.cy.js | 58 +++++++------- tests/cypress/e2e/23_addSponsor.cy.js | 18 ++--- .../e2e/eventsetup-tests/1_setupEvent.cy.js | 12 +-- .../e2e/eventsetup-tests/2_synctickets.cy.js | 26 +++--- .../e2e/eventsetup-tests/3_checkin.cy.js | 28 +++---- .../eventsetup-tests/4_verifyUsherRoles.cy.js | 22 ++--- .../e2e/eventsetup-tests/5_badge.cy.js | 14 ++-- .../e2e/eventsetup-tests/6_printbadge.cy.js | 12 +-- .../7_updatebadgeprintstatus.cy.js | 12 +-- tests/cypress/support.js | 26 +++--- tests/playwright/fixtures/boxoffice.js | 8 ++ tests/playwright/fixtures/cfp.json | 3 + tests/playwright/fixtures/labels.json | 22 +++++ tests/playwright/fixtures/profile.json | 6 ++ tests/playwright/fixtures/project.json | 18 +++++ tests/playwright/fixtures/proposal.json | 14 ++++ tests/playwright/fixtures/session.json | 10 +++ tests/playwright/fixtures/sponsor.json | 7 ++ tests/playwright/fixtures/ticket_events.json | 10 +++ .../fixtures/ticket_participants.json | 26 ++++++ tests/playwright/fixtures/user.json | 42 ++++++++++ tests/playwright/fixtures/venues.json | 24 ++++++ tests/playwright/page/create-project.js | 27 +++++++ tests/playwright/page/login.js | 29 +++++++ tests/playwright/page/profile-crew-form.js | 53 ++++++++++++ tests/playwright/page/project-crew-form.js | 49 ++++++++++++ .../playwright/tests/add-crew-project.spec.js | 32 ++++++++ .../tests/add-venue-project.spec.js | 72 +++++++++++++++++ tests/playwright/tests/create-profile.spec.js | 60 ++++++++++++++ tests/playwright/tests/create-project.spec.js | 42 ++++++++++ 96 files changed, 1263 insertions(+), 600 deletions(-) create mode 100644 .github/workflows/playwright.yml create mode 100644 playwright.config.js create mode 100644 tests/playwright/fixtures/boxoffice.js create mode 100644 tests/playwright/fixtures/cfp.json create mode 100644 tests/playwright/fixtures/labels.json create mode 100644 tests/playwright/fixtures/profile.json create mode 100644 tests/playwright/fixtures/project.json create mode 100644 tests/playwright/fixtures/proposal.json create mode 100644 tests/playwright/fixtures/session.json create mode 100644 tests/playwright/fixtures/sponsor.json create mode 100644 tests/playwright/fixtures/ticket_events.json create mode 100644 tests/playwright/fixtures/ticket_participants.json create mode 100644 tests/playwright/fixtures/user.json create mode 100644 tests/playwright/fixtures/venues.json create mode 100644 tests/playwright/page/create-project.js create mode 100644 tests/playwright/page/login.js create mode 100644 tests/playwright/page/profile-crew-form.js create mode 100644 tests/playwright/page/project-crew-form.js create mode 100644 tests/playwright/tests/add-crew-project.spec.js create mode 100644 tests/playwright/tests/add-venue-project.spec.js create mode 100644 tests/playwright/tests/create-profile.spec.js create mode 100644 tests/playwright/tests/create-project.spec.js diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 000000000..90b6b700d --- /dev/null +++ b/.github/workflows/playwright.yml @@ -0,0 +1,27 @@ +name: Playwright Tests +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] +jobs: + test: + timeout-minutes: 60 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install dependencies + run: npm ci + - name: Install Playwright Browsers + run: npx playwright install --with-deps + - name: Run Playwright tests + run: npx playwright test + - uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/.gitignore b/.gitignore index ca291c340..2d48b9b7a 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,7 @@ tests/cypress/videos tests/screenshots tests/unit/utils/markdown/data/output.html coverage/ +tests/playwright/test-results # Instance files that should not be checked-in instance/development.py diff --git a/funnel/templates/account.html.jinja2 b/funnel/templates/account.html.jinja2 index d7cf48be3..6fb90efed 100644 --- a/funnel/templates/account.html.jinja2 +++ b/funnel/templates/account.html.jinja2 @@ -33,11 +33,11 @@

@{{ current_auth.user.username }}

{% else %}

- {{ faicon(icon='info-circle', icon_size='body2', baseline=true) }} {% trans %}Add username{% endtrans %} {{ faicon(icon='plus', icon_size='caption', baseline=false) }} + {{ faicon(icon='info-circle', icon_size='body2', baseline=true) }} {% trans %}Add username{% endtrans %} {{ faicon(icon='plus', icon_size='caption', baseline=false) }}

{%- endif %} {%- trans %}Go to account{% endtrans %} {{ faicon(icon='arrow-right', icon_size='caption', baseline=false) }} @@ -91,7 +91,7 @@ href="{{ url_for('account_edit') }}">{% trans %}Edit{% endtrans %} + data-testid="change-password"> {% if user_has_password %} {% trans %}Change password{% endtrans %} {% else %} @@ -100,7 +100,7 @@ @@ -202,7 +202,7 @@ {% endif %} {% trans %}Add an email address{% endtrans %} + href="{{ url_for('add_email') }}" data-testid="add-new-email">{% trans %}Add an email address{% endtrans %} @@ -253,7 +253,7 @@ {% endif %} {% trans %}Add a mobile number{% endtrans %} + href="{{ url_for('add_phone') }}" data-testid="add-new-phone">{% trans %}Add a mobile number{% endtrans %} @@ -388,7 +388,7 @@
diff --git a/funnel/templates/account_formlayout.html.jinja2 b/funnel/templates/account_formlayout.html.jinja2 index 29cca39ee..2a8167981 100644 --- a/funnel/templates/account_formlayout.html.jinja2 +++ b/funnel/templates/account_formlayout.html.jinja2 @@ -23,7 +23,7 @@

{% trans %}Cookies are required to login. Please enable cookies in your browser’s settings and reload this page{% endtrans %}

-
+