From 63c503c9f7f7f7ae5c3a5bc6e68dfa94ee40fb92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Tue, 24 Sep 2024 17:26:32 -0600 Subject: [PATCH 1/5] chore(ci): attempt to run parallel tests for mobile and desktop viewports --- .github/workflows/playwright-matrix.yml | 137 +++++++++++++++++++ playwright.config.ts | 29 +++- playwright/PageObjects/MainPage.ts | 16 ++- playwright/specs/07-settings-profile.spec.ts | 35 ++++- 4 files changed, 205 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/playwright-matrix.yml diff --git a/.github/workflows/playwright-matrix.yml b/.github/workflows/playwright-matrix.yml new file mode 100644 index 00000000..328f7f47 --- /dev/null +++ b/.github/workflows/playwright-matrix.yml @@ -0,0 +1,137 @@ +name: Playwright Tests + +on: + pull_request: + paths-ignore: + - ".github/workflows/**" + workflow_dispatch: + +jobs: + test: + runs-on: macos-14 + strategy: + matrix: + project: [desktop-chrome, mobile-chrome, mobile-safari] + steps: + - name: Checkout Uplink Web directory + uses: actions/checkout@v4 + with: + repository: Satellite-im/UplinkWeb + + - name: Checkout Automated Tests directory + uses: actions/checkout@v4 + with: + path: automated-tests + + - name: Setup Node.js for Uplink Web + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies for Uplink Web + run: npm install + + - name: Install dependencies for Testing Repo + working-directory: automated-tests + run: npm install + + - name: Install Playwright Browsers + working-directory: automated-tests + run: npx playwright install --with-deps + + - name: Run server for Uplink Web + run: npm run dev & + + - name: Run Playwright tests for Desktop + if: matrix.project == 'desktop-chrome' + working-directory: automated-tests + run: | + PLAYWRIGHT_JSON_OUTPUT_NAME=report.json npx playwright test --project=${{ matrix.project }} + + - name: Run Playwright tests for Mobile Chrome and Safari (Single Test File) + if: matrix.project == 'mobile-chrome' || matrix.project == 'mobile-safari' + working-directory: automated-tests + run: | + PLAYWRIGHT_JSON_OUTPUT_NAME=report.json npx playwright test ./automated-tests/playwright/specs/07-settings-profile.spec.ts --project=${{ matrix.project }} + + - name: Upload Playwright report + uses: actions/upload-artifact@v4 + with: + name: playwright-report-${{ matrix.project }} + path: automated-tests/playwright-report/ + + - name: Upload Allure results + uses: actions/upload-artifact@v4 + with: + name: allure-results-${{ matrix.project }} + path: automated-tests/allure-results/ + + - name: Add label if any of build jobs failed + if: failure() + uses: buildsville/add-remove-label@v2.0.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + labels: | + Failed Automated Test + type: add + + merge-reports: + runs-on: ubuntu-latest + needs: test + steps: + - name: Download Playwright reports + uses: actions/download-artifact@v4 + with: + name: playwright-report-* + path: ./playwright-reports/ + + - name: Download Allure results + uses: actions/download-artifact@v4 + with: + name: allure-results-* + path: ./allure-results/ + + - name: Generate Allure report + run: | + npx allure generate ./allure-results --clean -o allure-report + + - name: Generate Playwright HTML report + run: | + npx playwright show-report ./playwright-reports + + - name: Upload Allure report to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} + publish_branch: gh-pages + publish_dir: allure-report + + - name: Comment PR with Test Results Summary + if: github.event_name == 'pull_request' + uses: mshick/add-pr-comment@v2 + with: + message: | + Playwright test execution is complete! + - Playwright report: [here](https://github.io/playwright-report) + - Allure report: [here](https://your-gh-pages-url) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + finalize-label: + needs: [test, merge-reports] + runs-on: ubuntu-latest + permissions: + checks: write + pull-requests: write + contents: write + issues: read + + steps: + - name: Remove label if all tests succeeded + if: success() + uses: buildsville/add-remove-label@v2.0.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + labels: | + Failed Automated Test + type: remove diff --git a/playwright.config.ts b/playwright.config.ts index d13d97e9..5a3ee9dd 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -46,15 +46,30 @@ export default defineConfig({ /* Configure projects for major browsers */ projects: [ { - name: "Automated Tests on Chrome Desktop", - use: { ...devices["Desktop Chrome"] }, + name: "desktop-chrome", + use: { + browserName: "chromium", + viewport: { width: 1280, height: 720 }, // Desktop viewport + }, }, - /* Test against mobile viewports. */ - // { - // name: 'Mobile Chrome', - // use: { ...devices['Pixel 5'] }, - // }, + // Mobile Chrome (Pixel 5) + { + name: "mobile-chrome", + use: { + browserName: "chromium", + ...devices["Pixel 5"], // Use predefined mobile device + }, + }, + + // iPhone 12 (Safari) + { + name: "mobile-safari", + use: { + browserName: "webkit", + ...devices["iPhone 12"], // Use predefined iPhone 12 device + }, + }, // { // name: 'Mobile Safari', // use: { ...devices['iPhone 12'] }, diff --git a/playwright/PageObjects/MainPage.ts b/playwright/PageObjects/MainPage.ts index cdbf23d5..0bfc171c 100644 --- a/playwright/PageObjects/MainPage.ts +++ b/playwright/PageObjects/MainPage.ts @@ -2,6 +2,7 @@ import { expect, type Locator, type Page } from "@playwright/test"; export default class MainPage { readonly buttonChat: Locator; + readonly buttonDismissInstallAlert: Locator; readonly buttonFiles: Locator; readonly buttonFriends: Locator; readonly buttonHideSidebar: Locator; @@ -23,6 +24,7 @@ export default class MainPage { readonly favoriteProfilePicture: Locator; readonly favoriteProfileStatusIndicator: Locator; readonly favoritesLabel: Locator; + readonly installAlert: Locator; readonly inputSidebarSearch: Locator; readonly navigationBar: Locator; readonly sidebar: Locator; @@ -35,13 +37,17 @@ export default class MainPage { constructor(public readonly page: Page) { this.buttonChat = this.page.getByTestId("button-Chat"); + this.buttonDismissInstallAlert = this.page + .locator("#install-banner") + .getByRole("button") + .first(); this.buttonFiles = this.page.getByTestId("button-Files"); this.buttonFriends = this.page.getByTestId("button-Friends"); this.buttonHideSidebar = this.page.getByTestId("button-hide-sidebar"); this.buttonSettings = this.page.getByTestId("button-Settings"); this.buttonShowSidebar = this.page - .getByTestId("button-show-sidebar") - .first(); + .getByTestId("topbar") + .getByTestId("button-show-sidebar"); this.buttonSidebarChats = this.page.getByTestId("button-sidebar-chats"); this.buttonSidebarFiles = this.page.getByTestId("button-sidebar-files"); this.buttonWallet = this.page.getByTestId("button-Wallet"); @@ -66,6 +72,7 @@ export default class MainPage { this.favoriteProfileStatusIndicator = this.favoriteProfilePicture.getByTestId("status-indicator"); this.favoritesLabel = this.page.getByTestId("label-favorites"); + this.installAlert = this.page.locator("#install-banner"); this.inputSidebarSearch = this.page.getByTestId("input-sidebar-search"); this.navigationBar = this.page.getByTestId(".navigation"); this.sidebar = this.page.getByTestId("sidebar"); @@ -113,6 +120,11 @@ export default class MainPage { await this.toastNotificationButton.click(); } + async dismissDownloadAlert() { + await this.buttonDismissInstallAlert.click(); + await this.installAlert.waitFor({ state: "detached" }); + } + async expectElementToHaveClass(selector: string, className: string) { const element = this.page.locator(selector); const hasClass = await element.evaluate( diff --git a/playwright/specs/07-settings-profile.spec.ts b/playwright/specs/07-settings-profile.spec.ts index eb952df7..a4abc19e 100644 --- a/playwright/specs/07-settings-profile.spec.ts +++ b/playwright/specs/07-settings-profile.spec.ts @@ -6,11 +6,18 @@ test.describe("Settings Profile Tests", () => { const username = "test123"; const status = "fixed status"; - test.beforeEach(async ({ singleUserContext }) => { + test.beforeEach(async ({ singleUserContext }, testoptions) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); + const viewport = testoptions.project.name; + + // Hide sidebar if viewport is Mobile Chrome + if (viewport === "Mobile Chrome") { + await chatsMainPage.buttonHideSidebar.click(); + } }); test("I1 - Banner Picture - Tooltip displayed", async ({ @@ -163,10 +170,11 @@ test.describe("Settings Profile Tests", () => { test("I9, I10 - User should be able to change username and see toast notification of change", async ({ singleUserContext, - }) => { + }, testoptions) => { const page = singleUserContext.page; const settingsProfile = new SettingsProfile(page); const chatsMainPage = new ChatsMainPage(page); + const viewport = testoptions.project.name; // User types into username and change value const newUsername = "newUsername"; @@ -200,10 +208,20 @@ test.describe("Settings Profile Tests", () => { newUsername, ); + // Show sidebar if viewport is Mobile Chrome + if (viewport === "Mobile Chrome") { + await settingsProfile.buttonShowSidebar.click(); + } + // User goes to another page and returns to settings profile, username is still changed await settingsProfile.goToFriends(); await page.waitForURL("/friends"); await chatsMainPage.goToSettings(); + + // Hide sidebar if viewport is Mobile Chrome + if (viewport === "Mobile Chrome") { + await settingsProfile.buttonHideSidebar.click(); + } await expect(settingsProfile.inputSettingsProfileUsername).toHaveValue( newUsername, ); @@ -293,10 +311,11 @@ test.describe("Settings Profile Tests", () => { test("I15, I16 - User should be able to change Status Message and see toast notification for update", async ({ singleUserContext, - }) => { + }, testoptions) => { const page = singleUserContext.page; const settingsProfile = new SettingsProfile(page); const chatsMainPage = new ChatsMainPage(page); + const viewport = testoptions.project.name; // User types into username and change value const newStatus = "this is my new status"; @@ -330,10 +349,20 @@ test.describe("Settings Profile Tests", () => { newStatus, ); + // Show sidebar if viewport is Mobile Chrome + if (viewport === "Mobile Chrome") { + await settingsProfile.buttonShowSidebar.click(); + } + // User goes to another page and returns to settings profile, username is still changed await settingsProfile.goToFriends(); await page.waitForURL("/friends"); await chatsMainPage.goToSettings(); + + // Hide sidebar if viewport is Mobile Chrome + if (viewport === "Mobile Chrome") { + await settingsProfile.buttonHideSidebar.click(); + } await expect(settingsProfile.inputSettingsProfileStatus).toHaveValue( newStatus, ); From 6ea4bd6a38251b2a7ce5c2a0841279aeeaef8e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Thu, 26 Sep 2024 12:34:27 -0600 Subject: [PATCH 2/5] update(mobile): updates for mobile builds --- .github/workflows/playwright-matrix.yml | 137 ------------------ playwright.config.ts | 1 + playwright/PageObjects/MainPage.ts | 10 +- .../PageObjects/Settings/SettingsProfile.ts | 2 +- .../specs/02-friends-one-instance.spec.ts | 1 + playwright/specs/05-chats-sidebar.spec.ts | 1 + playwright/specs/07-settings-profile.spec.ts | 24 ++- .../specs/08-settings-inventory.spec.ts | 1 + .../specs/09-settings-customizations.spec.ts | 62 +++++++- playwright/specs/10-settings-messages.spec.ts | 1 + .../specs/11-settings-audio-video.spec.ts | 1 + .../specs/12-settings-extensions.spec.ts | 1 + playwright/specs/13-settings-keybinds.spec.ts | 23 +-- playwright/specs/14-settings-gamepad.spec.ts | 1 + .../specs/15-settings-accessibility.spec.ts | 1 + .../specs/16-settings-notifications.spec.ts | 1 + playwright/specs/17-settings-network.spec.ts | 1 + playwright/specs/18-settings-about.spec.ts | 1 + playwright/specs/19-settings-licenses.spec.ts | 1 + .../specs/20-settings-developer.spec.ts | 1 + playwright/specs/23-files-sidebar.spec.ts | 1 + playwright/specs/24-files.spec.ts | 1 + playwright/specs/25-wallet.spec.ts | 1 + 23 files changed, 108 insertions(+), 167 deletions(-) delete mode 100644 .github/workflows/playwright-matrix.yml diff --git a/.github/workflows/playwright-matrix.yml b/.github/workflows/playwright-matrix.yml deleted file mode 100644 index 328f7f47..00000000 --- a/.github/workflows/playwright-matrix.yml +++ /dev/null @@ -1,137 +0,0 @@ -name: Playwright Tests - -on: - pull_request: - paths-ignore: - - ".github/workflows/**" - workflow_dispatch: - -jobs: - test: - runs-on: macos-14 - strategy: - matrix: - project: [desktop-chrome, mobile-chrome, mobile-safari] - steps: - - name: Checkout Uplink Web directory - uses: actions/checkout@v4 - with: - repository: Satellite-im/UplinkWeb - - - name: Checkout Automated Tests directory - uses: actions/checkout@v4 - with: - path: automated-tests - - - name: Setup Node.js for Uplink Web - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Install dependencies for Uplink Web - run: npm install - - - name: Install dependencies for Testing Repo - working-directory: automated-tests - run: npm install - - - name: Install Playwright Browsers - working-directory: automated-tests - run: npx playwright install --with-deps - - - name: Run server for Uplink Web - run: npm run dev & - - - name: Run Playwright tests for Desktop - if: matrix.project == 'desktop-chrome' - working-directory: automated-tests - run: | - PLAYWRIGHT_JSON_OUTPUT_NAME=report.json npx playwright test --project=${{ matrix.project }} - - - name: Run Playwright tests for Mobile Chrome and Safari (Single Test File) - if: matrix.project == 'mobile-chrome' || matrix.project == 'mobile-safari' - working-directory: automated-tests - run: | - PLAYWRIGHT_JSON_OUTPUT_NAME=report.json npx playwright test ./automated-tests/playwright/specs/07-settings-profile.spec.ts --project=${{ matrix.project }} - - - name: Upload Playwright report - uses: actions/upload-artifact@v4 - with: - name: playwright-report-${{ matrix.project }} - path: automated-tests/playwright-report/ - - - name: Upload Allure results - uses: actions/upload-artifact@v4 - with: - name: allure-results-${{ matrix.project }} - path: automated-tests/allure-results/ - - - name: Add label if any of build jobs failed - if: failure() - uses: buildsville/add-remove-label@v2.0.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - labels: | - Failed Automated Test - type: add - - merge-reports: - runs-on: ubuntu-latest - needs: test - steps: - - name: Download Playwright reports - uses: actions/download-artifact@v4 - with: - name: playwright-report-* - path: ./playwright-reports/ - - - name: Download Allure results - uses: actions/download-artifact@v4 - with: - name: allure-results-* - path: ./allure-results/ - - - name: Generate Allure report - run: | - npx allure generate ./allure-results --clean -o allure-report - - - name: Generate Playwright HTML report - run: | - npx playwright show-report ./playwright-reports - - - name: Upload Allure report to GitHub Pages - uses: peaceiris/actions-gh-pages@v4 - with: - deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} - publish_branch: gh-pages - publish_dir: allure-report - - - name: Comment PR with Test Results Summary - if: github.event_name == 'pull_request' - uses: mshick/add-pr-comment@v2 - with: - message: | - Playwright test execution is complete! - - Playwright report: [here](https://github.io/playwright-report) - - Allure report: [here](https://your-gh-pages-url) - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - finalize-label: - needs: [test, merge-reports] - runs-on: ubuntu-latest - permissions: - checks: write - pull-requests: write - contents: write - issues: read - - steps: - - name: Remove label if all tests succeeded - if: success() - uses: buildsville/add-remove-label@v2.0.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - labels: | - Failed Automated Test - type: remove diff --git a/playwright.config.ts b/playwright.config.ts index 5a3ee9dd..042e8d8d 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -60,6 +60,7 @@ export default defineConfig({ browserName: "chromium", ...devices["Pixel 5"], // Use predefined mobile device }, + testIgnore: "./playwright/specs/13-settings-keybinds.spec.ts", }, // iPhone 12 (Safari) diff --git a/playwright/PageObjects/MainPage.ts b/playwright/PageObjects/MainPage.ts index 0bfc171c..587eec5b 100644 --- a/playwright/PageObjects/MainPage.ts +++ b/playwright/PageObjects/MainPage.ts @@ -149,25 +149,25 @@ export default class MainPage { } async goToChat() { - await this.buttonChat.click(); + await this.buttonChat.first().click(); } async goToFiles() { - await this.buttonFiles.click(); + await this.buttonFiles.first().click(); await this.page.waitForURL("/files"); } async goToFriends() { - await this.buttonFriends.click(); + await this.buttonFriends.first().click(); await this.page.waitForURL("/friends"); } async goToSettings() { - await this.buttonSettings.click(); + await this.buttonSettings.first().click(); } async goToWallet() { - await this.buttonWallet.click(); + await this.buttonWallet.first().click(); } async normalizeSvg(svgString: string) { diff --git a/playwright/PageObjects/Settings/SettingsProfile.ts b/playwright/PageObjects/Settings/SettingsProfile.ts index f86306c7..56edc964 100644 --- a/playwright/PageObjects/Settings/SettingsProfile.ts +++ b/playwright/PageObjects/Settings/SettingsProfile.ts @@ -399,7 +399,7 @@ export class SettingsProfile extends SettingsBase { break; } await this.validateToastProfileUpdated(); - await this.waitForToastNotificationToDisappear(); + await this.closeToastNotification(); } async updateStatus(newStatus: string) { diff --git a/playwright/specs/02-friends-one-instance.spec.ts b/playwright/specs/02-friends-one-instance.spec.ts index 07416ce5..f432d499 100644 --- a/playwright/specs/02-friends-one-instance.spec.ts +++ b/playwright/specs/02-friends-one-instance.spec.ts @@ -8,6 +8,7 @@ test.describe("Friends tests", () => { const chatsMainPage = new ChatsMainPage(page); // Go to Friends + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToFriends(); }); diff --git a/playwright/specs/05-chats-sidebar.spec.ts b/playwright/specs/05-chats-sidebar.spec.ts index f6b4cca0..fb65c7f8 100644 --- a/playwright/specs/05-chats-sidebar.spec.ts +++ b/playwright/specs/05-chats-sidebar.spec.ts @@ -7,6 +7,7 @@ test.describe("Chats Sidebar Tests", () => { }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.buttonCreateGroupChat.click(); diff --git a/playwright/specs/07-settings-profile.spec.ts b/playwright/specs/07-settings-profile.spec.ts index a4abc19e..edac28ba 100644 --- a/playwright/specs/07-settings-profile.spec.ts +++ b/playwright/specs/07-settings-profile.spec.ts @@ -15,7 +15,7 @@ test.describe("Settings Profile Tests", () => { const viewport = testoptions.project.name; // Hide sidebar if viewport is Mobile Chrome - if (viewport === "Mobile Chrome") { + if (viewport === "mobile-chrome") { await chatsMainPage.buttonHideSidebar.click(); } }); @@ -203,23 +203,28 @@ test.describe("Settings Profile Tests", () => { await expect(settingsProfile.toastNotificationText).toHaveText( "Profile Updated!", ); - await settingsProfile.toastNotification.waitFor({ state: "detached" }); + await settingsProfile.closeToastNotification(); await expect(settingsProfile.inputSettingsProfileUsername).toHaveValue( newUsername, ); // Show sidebar if viewport is Mobile Chrome - if (viewport === "Mobile Chrome") { + if (viewport === "mobile-chrome") { await settingsProfile.buttonShowSidebar.click(); } // User goes to another page and returns to settings profile, username is still changed await settingsProfile.goToFriends(); await page.waitForURL("/friends"); + + // Show sidebar if viewport is Mobile Chrome + if (viewport === "mobile-chrome") { + await settingsProfile.buttonShowSidebar.click(); + } await chatsMainPage.goToSettings(); // Hide sidebar if viewport is Mobile Chrome - if (viewport === "Mobile Chrome") { + if (viewport === "mobile-chrome") { await settingsProfile.buttonHideSidebar.click(); } await expect(settingsProfile.inputSettingsProfileUsername).toHaveValue( @@ -344,23 +349,28 @@ test.describe("Settings Profile Tests", () => { await expect(settingsProfile.toastNotificationText).toHaveText( "Profile Updated!", ); - await settingsProfile.toastNotification.waitFor({ state: "detached" }); + await settingsProfile.closeToastNotification(); await expect(settingsProfile.inputSettingsProfileStatus).toHaveValue( newStatus, ); // Show sidebar if viewport is Mobile Chrome - if (viewport === "Mobile Chrome") { + if (viewport === "mobile-chrome") { await settingsProfile.buttonShowSidebar.click(); } // User goes to another page and returns to settings profile, username is still changed await settingsProfile.goToFriends(); await page.waitForURL("/friends"); + + // Show sidebar if viewport is Mobile Chrome + if (viewport === "mobile-chrome") { + await settingsProfile.buttonShowSidebar.click(); + } await chatsMainPage.goToSettings(); // Hide sidebar if viewport is Mobile Chrome - if (viewport === "Mobile Chrome") { + if (viewport === "mobile-chrome") { await settingsProfile.buttonHideSidebar.click(); } await expect(settingsProfile.inputSettingsProfileStatus).toHaveValue( diff --git a/playwright/specs/08-settings-inventory.spec.ts b/playwright/specs/08-settings-inventory.spec.ts index ca85134a..7aea9024 100644 --- a/playwright/specs/08-settings-inventory.spec.ts +++ b/playwright/specs/08-settings-inventory.spec.ts @@ -7,6 +7,7 @@ test.describe("Settings Inventory Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); diff --git a/playwright/specs/09-settings-customizations.spec.ts b/playwright/specs/09-settings-customizations.spec.ts index 8534c5cb..0acbea7b 100644 --- a/playwright/specs/09-settings-customizations.spec.ts +++ b/playwright/specs/09-settings-customizations.spec.ts @@ -7,6 +7,7 @@ test.describe("Settings Customization Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); @@ -71,9 +72,10 @@ test.describe("Settings Customization Tests", () => { test("K3 - Selected Fonts should be applied everywhere throughout the app", async ({ singleUserContext, - }) => { + }, testoptions) => { const page = singleUserContext.page; const settingsCustomizations = new SettingsCustomizations(page); + const viewport = testoptions.project.name; const selectedFont = "JosefinSans"; await settingsCustomizations.selectFont(selectedFont); @@ -81,6 +83,11 @@ test.describe("Settings Customization Tests", () => { "font-family", selectedFont, ); + + // Show sidebar if viewport is Mobile Chrome + if (viewport === "mobile-chrome") { + await settingsCustomizations.buttonShowSidebar.click(); + } await settingsCustomizations.goToChat(); const welcomeText = await page.getByText("Let's get something started!"); await expect(welcomeText).toHaveCSS("font-family", selectedFont); @@ -252,14 +259,22 @@ test.describe("Settings Customization Tests", () => { test("K12 - Clicking Pick should open up the finetune color selector", async ({ singleUserContext, - }) => { + }, testoptions) => { const page = singleUserContext.page; const settingsCustomizations = new SettingsCustomizations(page); + const viewport = testoptions.project.name; + if (viewport === "mobile-chrome") { + await settingsCustomizations.buttonShowSidebar.click(); + } await expect(settingsCustomizations.buttonCustomization).toHaveCSS( "background-color", - "color(srgb 0.371765 0.371765 1)", + "rgb(77, 77, 255)", ); + + if (viewport === "mobile-chrome") { + await settingsCustomizations.buttonHideSidebar.click(); + } await settingsCustomizations.primaryColorSectionPopUpButton.click(); const customColorInput = @@ -274,25 +289,43 @@ test.describe("Settings Customization Tests", () => { await expect(customColorPicker).toBeVisible(); await customColorInput.clear(); await customColorInput.fill("#ff8fb8"); - await settingsCustomizations.buttonCustomization.click({ force: true }); + + if (viewport === "mobile-chrome") { + await settingsCustomizations.buttonShowSidebar.click({ force: true }); + await settingsCustomizations.buttonShowSidebar.click(); + } else { + await settingsCustomizations.buttonCustomization.click({ force: true }); + } await expect(settingsCustomizations.buttonCustomization).toHaveCSS( "background-color", - "color(srgb 1 0.604706 0.749412)", + "rgb(255, 143, 184)", ); }); test("K13 - Selected primary color should be applied throughout the entire app", async ({ singleUserContext, - }) => { + }, testoptions) => { const page = singleUserContext.page; const settingsCustomizations = new SettingsCustomizations(page); const chatsMainPage = new ChatsMainPage(page); + const viewport = testoptions.project.name; + if (viewport === "mobile-chrome") { + await settingsCustomizations.buttonShowSidebar.click(); + } await expect(settingsCustomizations.buttonCustomization).toHaveCSS( "background-color", - "color(srgb 0.371765 0.371765 1)", + "rgb(77, 77, 255)", ); + + if (viewport === "mobile-chrome") { + await settingsCustomizations.buttonHideSidebar.click(); + } await settingsCustomizations.selectColorSwatch("Traffic Cone"); + + if (viewport === "mobile-chrome") { + await settingsCustomizations.buttonShowSidebar.click(); + } await expect(settingsCustomizations.buttonCustomization).toHaveCSS( "background-color", "rgb(255, 60, 0)", @@ -306,15 +339,22 @@ test.describe("Settings Customization Tests", () => { test("K14 - User should be able to add additional custom CSS to the application", async ({ singleUserContext, - }) => { + }, testoptions) => { const page = singleUserContext.page; const settingsCustomizations = new SettingsCustomizations(page); + const viewport = testoptions.project.name; + if (viewport === "mobile-chrome") { + await settingsCustomizations.buttonShowSidebar.click(); + } await expect(settingsCustomizations.slimbar).toHaveCSS( "background-color", "rgba(0, 0, 0, 0)", ); + if (viewport === "mobile-chrome") { + await settingsCustomizations.buttonHideSidebar.click(); + } await expect(settingsCustomizations.customCSSSectionLabel).toHaveText( "Custom CSS", ); @@ -326,12 +366,18 @@ test.describe("Settings Customization Tests", () => { ".slimbar {background-color: rgb(255, 0, 141)}", ); + if (viewport === "mobile-chrome") { + await settingsCustomizations.buttonShowSidebar.click(); + } await settingsCustomizations.buttonCustomization.click(); await expect(settingsCustomizations.slimbar).toHaveCSS( "background-color", "rgb(255, 0, 141)", ); + if (viewport === "mobile-chrome") { + await settingsCustomizations.buttonShowSidebar.click(); + } await settingsCustomizations.goToChat(); await expect(settingsCustomizations.slimbar).toHaveCSS( "background-color", diff --git a/playwright/specs/10-settings-messages.spec.ts b/playwright/specs/10-settings-messages.spec.ts index 7dc291d6..975ef53f 100644 --- a/playwright/specs/10-settings-messages.spec.ts +++ b/playwright/specs/10-settings-messages.spec.ts @@ -7,6 +7,7 @@ test.describe("Settings Messages Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); diff --git a/playwright/specs/11-settings-audio-video.spec.ts b/playwright/specs/11-settings-audio-video.spec.ts index 22e57325..29f10ef0 100644 --- a/playwright/specs/11-settings-audio-video.spec.ts +++ b/playwright/specs/11-settings-audio-video.spec.ts @@ -7,6 +7,7 @@ test.describe("Settings Audio and Video Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); diff --git a/playwright/specs/12-settings-extensions.spec.ts b/playwright/specs/12-settings-extensions.spec.ts index 780d376c..042d739f 100644 --- a/playwright/specs/12-settings-extensions.spec.ts +++ b/playwright/specs/12-settings-extensions.spec.ts @@ -7,6 +7,7 @@ test.describe("Settings Extensions Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); diff --git a/playwright/specs/13-settings-keybinds.spec.ts b/playwright/specs/13-settings-keybinds.spec.ts index 5bcf78a7..022ea1f9 100644 --- a/playwright/specs/13-settings-keybinds.spec.ts +++ b/playwright/specs/13-settings-keybinds.spec.ts @@ -5,15 +5,20 @@ import { SettingsKeybinds } from "playwright/PageObjects/Settings/SettingsKeybin import { FriendsScreen } from "playwright/PageObjects/FriendsScreen"; test.describe("Settings Keybinds Tests", () => { - test.beforeEach(async ({ singleUserContext }) => { - const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); - await chatsMainPage.goToSettings(); - await page.waitForURL("/settings/profile"); - - const settingsProfile = new SettingsProfile(page); - await settingsProfile.buttonKeybinds.click(); - await page.waitForURL("/settings/keybinds"); + test.beforeEach(async ({ singleUserContext }, testoptions) => { + const viewport = testoptions.project.name; + if (viewport === "desktop-chrome") { + const page = singleUserContext.page; + const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.goToSettings(); + await page.waitForURL("/settings/profile"); + + const settingsProfile = new SettingsProfile(page); + await settingsProfile.buttonKeybinds.click(); + await page.waitForURL("/settings/keybinds"); + } else { + test.skip(); + } }); test("O1, 06 - Message at top of page and custom keybinds listed correctly", async ({ diff --git a/playwright/specs/14-settings-gamepad.spec.ts b/playwright/specs/14-settings-gamepad.spec.ts index afd8c322..0eed4155 100644 --- a/playwright/specs/14-settings-gamepad.spec.ts +++ b/playwright/specs/14-settings-gamepad.spec.ts @@ -6,6 +6,7 @@ test.describe("Settings Extensions Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); diff --git a/playwright/specs/15-settings-accessibility.spec.ts b/playwright/specs/15-settings-accessibility.spec.ts index 84df60b9..cc8c8ed6 100644 --- a/playwright/specs/15-settings-accessibility.spec.ts +++ b/playwright/specs/15-settings-accessibility.spec.ts @@ -7,6 +7,7 @@ test.describe("Settings Accessibility Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); diff --git a/playwright/specs/16-settings-notifications.spec.ts b/playwright/specs/16-settings-notifications.spec.ts index 1d12c65d..3614c068 100644 --- a/playwright/specs/16-settings-notifications.spec.ts +++ b/playwright/specs/16-settings-notifications.spec.ts @@ -7,6 +7,7 @@ test.describe("Settings Notifications Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); diff --git a/playwright/specs/17-settings-network.spec.ts b/playwright/specs/17-settings-network.spec.ts index 9ce6d8d6..2b821d30 100644 --- a/playwright/specs/17-settings-network.spec.ts +++ b/playwright/specs/17-settings-network.spec.ts @@ -6,6 +6,7 @@ test.describe("Settings Network Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); diff --git a/playwright/specs/18-settings-about.spec.ts b/playwright/specs/18-settings-about.spec.ts index f24aac0b..dec6d72f 100644 --- a/playwright/specs/18-settings-about.spec.ts +++ b/playwright/specs/18-settings-about.spec.ts @@ -11,6 +11,7 @@ test.describe("Settings About Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); diff --git a/playwright/specs/19-settings-licenses.spec.ts b/playwright/specs/19-settings-licenses.spec.ts index 9533c8a7..8014ba0f 100644 --- a/playwright/specs/19-settings-licenses.spec.ts +++ b/playwright/specs/19-settings-licenses.spec.ts @@ -7,6 +7,7 @@ test.describe("Settings Licenses Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); diff --git a/playwright/specs/20-settings-developer.spec.ts b/playwright/specs/20-settings-developer.spec.ts index c4ce6c2f..e230088e 100644 --- a/playwright/specs/20-settings-developer.spec.ts +++ b/playwright/specs/20-settings-developer.spec.ts @@ -8,6 +8,7 @@ test.describe("Settings Developer Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); diff --git a/playwright/specs/23-files-sidebar.spec.ts b/playwright/specs/23-files-sidebar.spec.ts index b909b88a..b26b6193 100644 --- a/playwright/specs/23-files-sidebar.spec.ts +++ b/playwright/specs/23-files-sidebar.spec.ts @@ -5,6 +5,7 @@ test.describe("Files Sidebar Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToFiles(); await page.waitForURL("/files"); }); diff --git a/playwright/specs/24-files.spec.ts b/playwright/specs/24-files.spec.ts index f4b4add8..3b30c3c4 100644 --- a/playwright/specs/24-files.spec.ts +++ b/playwright/specs/24-files.spec.ts @@ -8,6 +8,7 @@ test.describe("Files Page Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToFiles(); await page.waitForURL("/files"); }); diff --git a/playwright/specs/25-wallet.spec.ts b/playwright/specs/25-wallet.spec.ts index f65f0a7c..babe62d2 100644 --- a/playwright/specs/25-wallet.spec.ts +++ b/playwright/specs/25-wallet.spec.ts @@ -5,6 +5,7 @@ test.describe("Wallet Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToWallet(); await page.waitForURL("/wallet"); }); From dc6cd0cec4c99e13d5ced9af54211ece4d067f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:21:03 -0600 Subject: [PATCH 3/5] update(mobile): fix changes for mobile --- playwright/PageObjects/MainPage.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/playwright/PageObjects/MainPage.ts b/playwright/PageObjects/MainPage.ts index 1eccf211..455d9588 100644 --- a/playwright/PageObjects/MainPage.ts +++ b/playwright/PageObjects/MainPage.ts @@ -74,7 +74,6 @@ export default class MainPage { this.favoriteProfilePicture.getByTestId("status-indicator"); this.favoritesLabel = this.page.getByTestId("label-favorites"); this.installAlert = this.page.locator("#install-banner"); - this.inputSidebarSearch = this.page.getByTestId("input-sidebar-search"); this.inputSidebarSearch = this.page .getByTestId("input-sidebar-search") .locator("input"); From c27385f3795e6fe87ffb25efcfbbfc3881852b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Thu, 3 Oct 2024 18:05:39 -0600 Subject: [PATCH 4/5] update(mobile): fix chats sidebar test --- playwright/PageObjects/FriendsScreen.ts | 31 +++++++++++++++ playwright/specs/05-chats-sidebar.spec.ts | 46 +++++++++++++++-------- 2 files changed, 62 insertions(+), 15 deletions(-) diff --git a/playwright/PageObjects/FriendsScreen.ts b/playwright/PageObjects/FriendsScreen.ts index 71ad1ba3..dea49e37 100644 --- a/playwright/PageObjects/FriendsScreen.ts +++ b/playwright/PageObjects/FriendsScreen.ts @@ -11,6 +11,10 @@ export class FriendsScreen extends MainPage { readonly buttonFriendsActive: Locator; readonly buttonFriendsAll: Locator; readonly buttonFriendsBlocked: Locator; + readonly buttonFriendsHamburger: Locator; + readonly contextFriendListOptionAll: Locator; + readonly contextFriendListOptionBlocked: Locator; + readonly contextFriendListOptionRequests: Locator; readonly contextMenuCopyID: Locator; readonly contextOptionCopyDid: Locator; readonly contextOptionCopyID: Locator; @@ -52,6 +56,18 @@ export class FriendsScreen extends MainPage { this.buttonFriendsActive = this.page.getByTestId("button-friends-active"); this.buttonFriendsAll = this.page.getByTestId("button-friends-all"); this.buttonFriendsBlocked = this.page.getByTestId("button-friends-blocked"); + this.buttonFriendsHamburger = this.page + .getByTestId("topbar") + .getByRole("button") + .nth(1); + this.contextFriendListOptionAll = + this.page.getByTestId("button-friends-all"); + this.contextFriendListOptionBlocked = this.page.getByTestId( + "button-friends-blocked", + ); + this.contextFriendListOptionRequests = this.page.getByTestId( + "button-friends-active", + ); this.contextMenuCopyID = this.page.getByTestId("context-menu-copy-id"); this.contextOptionCopyDid = this.contextMenuCopyID.getByTestId( "context-menu-option-Copy DID", @@ -178,6 +194,21 @@ export class FriendsScreen extends MainPage { await this.buttonFriendsActive.click(); } + async goToMobleAllFriendsList() { + await this.buttonFriendsHamburger.click(); + await this.contextFriendListOptionAll.click(); + } + + async goToMobileBlockedList() { + await this.buttonFriendsHamburger.click(); + await this.contextFriendListOptionBlocked.click(); + } + + async goToMobileRequestList() { + await this.buttonFriendsHamburger.click(); + await this.contextFriendListOptionRequests.click(); + } + async removeFriend(username: string) { const friendUser = await this.getFriendFromList(username); await friendUser.getByTestId("button-friend-remove").click(); diff --git a/playwright/specs/05-chats-sidebar.spec.ts b/playwright/specs/05-chats-sidebar.spec.ts index 0a97f5fe..ac82202e 100644 --- a/playwright/specs/05-chats-sidebar.spec.ts +++ b/playwright/specs/05-chats-sidebar.spec.ts @@ -2,15 +2,19 @@ import { ChatsMainPage } from "playwright/PageObjects/ChatsMain"; import { test, expect } from "../fixtures/setup"; test.describe("Chats Sidebar Tests", () => { + test.beforeEach(async ({ singleUserContext }) => { + const page = singleUserContext.page; + const chatsMainPage = new ChatsMainPage(page); + await chatsMainPage.dismissDownloadAlert(); + }); + test("C1 - Clicking Create Chat should open modal with option for Group Name and Group Members", async ({ singleUserContext, }) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); - await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.buttonCreateGroupChat.click(); - await expect(chatsMainPage.createGroupLabelGroupName).toBeVisible(); await expect(chatsMainPage.createGroupLabelGroupName).toHaveText( "Group name:", @@ -78,9 +82,10 @@ test.describe("Chats Sidebar Tests", () => { test("C4 - Clicking hamburger button should collapse sidebar", async ({ singleUserContext, - }) => { + }, testoptions) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + const viewport = testoptions.project.name; await chatsMainPage.buttonHideSidebar.click(); @@ -90,6 +95,11 @@ test.describe("Chats Sidebar Tests", () => { '[data-cy="sidebar"]', "closed", ); + + if (viewport === "mobile-chrome") { + await chatsMainPage.buttonAddFriends.click(); + } + await chatsMainPage.buttonShowSidebar.waitFor({ state: "attached" }); await chatsMainPage.buttonShowSidebar.click(); await chatsMainPage.buttonShowSidebar.waitFor({ state: "detached" }); @@ -98,29 +108,35 @@ test.describe("Chats Sidebar Tests", () => { test("C5, C6, C7, C8, C9 - Nav bar buttons should redirect to correct page", async ({ singleUserContext, - }) => { + }, testoptions) => { const page = singleUserContext.page; const chatsMainPage = new ChatsMainPage(page); + const viewport = testoptions.project.name; - // Navigate to Wallet Page - // await chatsMainPage.buttonWallet.click(); - // await page.waitForURL("/wallet"); - - // Navigate to Files Page - await chatsMainPage.buttonFiles.click(); + await chatsMainPage.goToFiles(); await page.waitForURL("/files"); // Navigate to Chat Page - await chatsMainPage.buttonChat.click(); + if (viewport === "mobile-chrome") { + await chatsMainPage.buttonShowSidebar.click(); + } + await chatsMainPage.goToChat(); await page.waitForURL("/chat"); - // Navigate to Friends Page - await chatsMainPage.buttonFriends.click(); - await page.waitForURL("/friends"); + if (viewport === "mobile-chrome") { + await chatsMainPage.buttonAddFriends.click(); + } // Navigate to Settings Page - await chatsMainPage.buttonSettings.click(); + if (viewport === "mobile-chrome") { + await chatsMainPage.buttonShowSidebar.click(); + } + await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); + + // Navigate to Friends Page + await chatsMainPage.goToFriends(); + await page.waitForURL("/friends"); }); test("C10 - Textbox should have highlighted border when clicking into Chat Search", async ({ From 473a2d8e78abf2d710717a6b1b7e2d5136878625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Fri, 4 Oct 2024 11:25:07 -0600 Subject: [PATCH 5/5] update(mobile): prepare page objects to work wiht mob --- playwright.config.ts | 30 +-- playwright/PageObjects/AuthNewAccount.ts | 7 +- playwright/PageObjects/CallControls.ts | 7 +- playwright/PageObjects/CallScreen.ts | 7 +- playwright/PageObjects/CallSettings.ts | 7 +- .../ChatsElements/CombinedSelector.ts | 7 +- .../PageObjects/ChatsElements/EmojiPicker.ts | 7 +- .../PageObjects/ChatsElements/GifPicker.ts | 7 +- .../ChatsElements/StickerPicker.ts | 7 +- playwright/PageObjects/ChatsMain.ts | 7 +- playwright/PageObjects/CreateOrImport.ts | 7 +- playwright/PageObjects/FilesScreen.ts | 7 +- playwright/PageObjects/FriendsScreen.ts | 7 +- playwright/PageObjects/LoginPin.ts | 7 +- playwright/PageObjects/MainPage.ts | 7 +- playwright/PageObjects/PreLoadingScreen.ts | 7 +- playwright/PageObjects/QuickProfile.ts | 7 +- playwright/PageObjects/SaveRecoverySeed.ts | 7 +- .../PageObjects/Settings/SettingsAbout.ts | 7 +- .../Settings/SettingsAccessibility.ts | 7 +- .../PageObjects/Settings/SettingsAudio.ts | 7 +- .../PageObjects/Settings/SettingsBase.ts | 7 +- .../Settings/SettingsCustomizations.ts | 7 +- .../PageObjects/Settings/SettingsDeveloper.ts | 7 +- .../Settings/SettingsExtensions.ts | 7 +- .../PageObjects/Settings/SettingsGamepad.ts | 8 +- .../PageObjects/Settings/SettingsInventory.ts | 7 +- .../PageObjects/Settings/SettingsKeybinds.ts | 7 +- .../PageObjects/Settings/SettingsLicenses.ts | 7 +- .../PageObjects/Settings/SettingsMessages.ts | 7 +- .../PageObjects/Settings/SettingsNetwork.ts | 7 +- .../Settings/SettingsNotifications.ts | 7 +- .../PageObjects/Settings/SettingsProfile.ts | 7 +- .../PageObjects/Settings/SettingsRealms.ts | 7 +- playwright/PageObjects/VolumeMixer.ts | 7 +- playwright/fixtures/setup.ts | 49 +++-- playwright/specs/01-pin-input.spec.ts | 114 +++++----- .../specs/02-friends-one-instance.spec.ts | 12 +- .../specs/03-friends-two-instances.spec.ts | 195 ++++++++++-------- .../specs/04-friends-three-instances.spec.ts | 1 - playwright/specs/05-chats-sidebar.spec.ts | 27 ++- playwright/specs/07-settings-profile.spec.ts | 79 ++++--- .../specs/08-settings-inventory.spec.ts | 16 +- .../specs/09-settings-customizations.spec.ts | 71 ++++--- playwright/specs/10-settings-messages.spec.ts | 14 +- .../specs/11-settings-audio-video.spec.ts | 29 ++- .../specs/12-settings-extensions.spec.ts | 8 +- playwright/specs/13-settings-keybinds.spec.ts | 36 ++-- playwright/specs/14-settings-gamepad.spec.ts | 6 +- .../specs/15-settings-accessibility.spec.ts | 12 +- .../specs/16-settings-notifications.spec.ts | 17 +- playwright/specs/17-settings-network.spec.ts | 5 +- playwright/specs/18-settings-about.spec.ts | 26 ++- playwright/specs/19-settings-licenses.spec.ts | 8 +- .../specs/20-settings-developer.spec.ts | 40 ++-- playwright/specs/23-files-sidebar.spec.ts | 3 +- playwright/specs/24-files.spec.ts | 39 ++-- playwright/specs/25-wallet.spec.ts | 3 +- 58 files changed, 667 insertions(+), 412 deletions(-) diff --git a/playwright.config.ts b/playwright.config.ts index 042e8d8d..6bf78ff9 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -54,23 +54,23 @@ export default defineConfig({ }, // Mobile Chrome (Pixel 5) - { - name: "mobile-chrome", - use: { - browserName: "chromium", - ...devices["Pixel 5"], // Use predefined mobile device - }, - testIgnore: "./playwright/specs/13-settings-keybinds.spec.ts", - }, + // { + // name: "mobile-chrome", + // use: { + // browserName: "chromium", + // ...devices["Pixel 5"], // Use predefined mobile device + // }, + // testIgnore: "./playwright/specs/13-settings-keybinds.spec.ts", + // }, // iPhone 12 (Safari) - { - name: "mobile-safari", - use: { - browserName: "webkit", - ...devices["iPhone 12"], // Use predefined iPhone 12 device - }, - }, + // { + // name: "mobile-safari", + // use: { + // browserName: "webkit", + // ...devices["iPhone 12"], // Use predefined iPhone 12 device + // }, + // }, // { // name: 'Mobile Safari', // use: { ...devices['iPhone 12'] }, diff --git a/playwright/PageObjects/AuthNewAccount.ts b/playwright/PageObjects/AuthNewAccount.ts index 12e42c35..3b4c20c5 100644 --- a/playwright/PageObjects/AuthNewAccount.ts +++ b/playwright/PageObjects/AuthNewAccount.ts @@ -16,8 +16,11 @@ export class AuthNewAccount extends MainPage { readonly textNewAccountSecondary: Locator; readonly titleNewAccount: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.buttonNewAccountCreate = this.page.getByTestId( "button-new-account-create", ); diff --git a/playwright/PageObjects/CallControls.ts b/playwright/PageObjects/CallControls.ts index 36e281ed..fc3920e3 100644 --- a/playwright/PageObjects/CallControls.ts +++ b/playwright/PageObjects/CallControls.ts @@ -13,8 +13,11 @@ export class CallControls extends MainPage { readonly inCallLabel: Locator; readonly incomingCallLabel: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.callAnswerButton = this.page.getByTestId("button-call-answer"); this.callControls = this.page.getByTestId("call-controls"); this.callDeafenButton = this.page.getByTestId("button-call-deafen"); diff --git a/playwright/PageObjects/CallScreen.ts b/playwright/PageObjects/CallScreen.ts index b2c33e9b..4933d927 100644 --- a/playwright/PageObjects/CallScreen.ts +++ b/playwright/PageObjects/CallScreen.ts @@ -27,8 +27,11 @@ export class CallScreen extends MainPage { readonly remoteUserVideo: Locator; readonly usersInCallText: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.callCollapseExpandButton = this.callScreen.getByTestId( "button-call-collapse-expand", ); diff --git a/playwright/PageObjects/CallSettings.ts b/playwright/PageObjects/CallSettings.ts index 5bea6c20..12567423 100644 --- a/playwright/PageObjects/CallSettings.ts +++ b/playwright/PageObjects/CallSettings.ts @@ -39,8 +39,11 @@ export class CallSettings extends MainPage { readonly videoDeviceSelectorOption: Locator; readonly videoDeviceText: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.callSettings = this.page.locator(".call-settings"); this.audioBitrate = this.page.getByTestId("section-audio-bitrate"); this.audioBitrateLabel = this.audioBitrate.getByTestId( diff --git a/playwright/PageObjects/ChatsElements/CombinedSelector.ts b/playwright/PageObjects/ChatsElements/CombinedSelector.ts index f52fcf1e..bf64f511 100644 --- a/playwright/PageObjects/ChatsElements/CombinedSelector.ts +++ b/playwright/PageObjects/ChatsElements/CombinedSelector.ts @@ -11,8 +11,11 @@ export class CombinedSelector extends MainPage { readonly giphySelector: Locator; readonly stickerSelector: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.combinedSelector = this.page.getByTestId("combined-selector"); this.emojiContainer = this.page.getByTestId("emoji-container"); this.footerTabs = this.page.getByTestId(".pill-tabs"); diff --git a/playwright/PageObjects/ChatsElements/EmojiPicker.ts b/playwright/PageObjects/ChatsElements/EmojiPicker.ts index 7ac4eb2c..384bc075 100644 --- a/playwright/PageObjects/ChatsElements/EmojiPicker.ts +++ b/playwright/PageObjects/ChatsElements/EmojiPicker.ts @@ -18,8 +18,11 @@ export class EmojiPicker extends CombinedSelector { readonly skinToneSelector: Locator; readonly skinToneSelectorButton: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.categoryNav = this.page.getByTestId("emoji-category-nav"); this.emojiContainerSearchInput = this.page .getByTestId("emoji-container-search-input") diff --git a/playwright/PageObjects/ChatsElements/GifPicker.ts b/playwright/PageObjects/ChatsElements/GifPicker.ts index 10747589..042d0e80 100644 --- a/playwright/PageObjects/ChatsElements/GifPicker.ts +++ b/playwright/PageObjects/ChatsElements/GifPicker.ts @@ -14,8 +14,11 @@ export class GifPicker extends CombinedSelector { readonly searchInput: Locator; readonly textNoFavoritesYet: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.allFavoritesButton = this.page.getByTestId( "giphy-selector-favorites-button", ); diff --git a/playwright/PageObjects/ChatsElements/StickerPicker.ts b/playwright/PageObjects/ChatsElements/StickerPicker.ts index 3fd49965..33df0fb6 100644 --- a/playwright/PageObjects/ChatsElements/StickerPicker.ts +++ b/playwright/PageObjects/ChatsElements/StickerPicker.ts @@ -13,8 +13,11 @@ export class StickerPicker extends CombinedSelector { readonly stickerSidebarCollection: Locator; readonly stickerSelectorSidebarLabel: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.allStickers = this.page.getByTestId("sticker-contents"); this.stickerCollection = this.page.getByTestId("sticker-collection"); this.stickerCollectionItem = this.page.getByTestId( diff --git a/playwright/PageObjects/ChatsMain.ts b/playwright/PageObjects/ChatsMain.ts index 5b63c1f3..7fbd01c6 100644 --- a/playwright/PageObjects/ChatsMain.ts +++ b/playwright/PageObjects/ChatsMain.ts @@ -115,8 +115,11 @@ export class ChatsMainPage extends MainPage { readonly uploadFilesSelectedSinglePreviewIcon: Locator; readonly uploadFilesSelectedSinglePreviewImage: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.addSomeone = this.page.locator(".add-someone"); this.buttonAddAttachment = this.page.getByTestId( "button-chat-add-attachment", diff --git a/playwright/PageObjects/CreateOrImport.ts b/playwright/PageObjects/CreateOrImport.ts index 54b02cf3..0b37af7a 100644 --- a/playwright/PageObjects/CreateOrImport.ts +++ b/playwright/PageObjects/CreateOrImport.ts @@ -6,8 +6,11 @@ export class CreateOrImportPage extends MainPage { readonly labelCreateTitle: Locator; readonly textCreateDescription: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.buttonCreateAccount = this.page.getByTestId("button-create-account"); this.labelCreateTitle = this.page.getByTestId("label-create-title"); this.textCreateDescription = this.page.getByTestId( diff --git a/playwright/PageObjects/FilesScreen.ts b/playwright/PageObjects/FilesScreen.ts index 2684c0cd..ddcef404 100644 --- a/playwright/PageObjects/FilesScreen.ts +++ b/playwright/PageObjects/FilesScreen.ts @@ -27,8 +27,11 @@ export class FilesPage extends MainPage { readonly uploadFileButton: Locator; readonly uploadFileInput: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.buttonFilesSync = this.page.getByTestId("button-files-sync"); this.buttonFilesGiftSpace = this.page.getByTestId( "button-files-gift-space", diff --git a/playwright/PageObjects/FriendsScreen.ts b/playwright/PageObjects/FriendsScreen.ts index dea49e37..ef3e7541 100644 --- a/playwright/PageObjects/FriendsScreen.ts +++ b/playwright/PageObjects/FriendsScreen.ts @@ -45,8 +45,11 @@ export class FriendsScreen extends MainPage { readonly textNoOutgoingRequests: Locator; readonly textSearchFriendNoResults: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.buttonAddFriend = this.page.getByTestId("button-add-friend"); this.buttonCopyID = this.page.getByTestId("button-copy-id"); this.buttonFriendCancel = this.page.getByTestId("button-friend-cancel"); diff --git a/playwright/PageObjects/LoginPin.ts b/playwright/PageObjects/LoginPin.ts index ffb2c50d..802724de 100644 --- a/playwright/PageObjects/LoginPin.ts +++ b/playwright/PageObjects/LoginPin.ts @@ -28,8 +28,11 @@ export class LoginPinPage extends MainPage { readonly stayUnlockedLabel: Locator; readonly stayUnlockedSwitch: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.buttonClearInput = this.page.getByTestId("button-clear-input"); this.buttonCreateNewProfile = this.page.getByTestId( "button-create-new-profile", diff --git a/playwright/PageObjects/MainPage.ts b/playwright/PageObjects/MainPage.ts index 455d9588..f22a8fff 100644 --- a/playwright/PageObjects/MainPage.ts +++ b/playwright/PageObjects/MainPage.ts @@ -36,7 +36,10 @@ export default class MainPage { readonly toastNotificationButton: Locator; readonly toastNotificationText: Locator; - constructor(public readonly page: Page) { + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { this.buttonChat = this.page.getByTestId("button-Chat"); this.buttonDismissInstallAlert = this.page .locator("#install-banner") @@ -47,7 +50,7 @@ export default class MainPage { this.buttonHideSidebar = this.page.getByTestId("button-hide-sidebar"); this.buttonSettings = this.page.getByTestId("button-Settings"); this.buttonShowSidebar = this.page - .getByTestId("topbar") + .getByTestId("slimbar") .getByTestId("button-show-sidebar"); this.buttonSidebarChats = this.page.getByTestId("button-sidebar-chats"); this.buttonSidebarFiles = this.page.getByTestId("button-sidebar-files"); diff --git a/playwright/PageObjects/PreLoadingScreen.ts b/playwright/PageObjects/PreLoadingScreen.ts index 55fdbc99..b259ed19 100644 --- a/playwright/PageObjects/PreLoadingScreen.ts +++ b/playwright/PageObjects/PreLoadingScreen.ts @@ -5,8 +5,11 @@ export class PreLoadingScreen extends MainPage { readonly loadingHeader: Locator; readonly loadingMessage: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.loadingHeader = this.page.locator(".small"); this.loadingMessage = this.page.locator(".text.medium"); } diff --git a/playwright/PageObjects/QuickProfile.ts b/playwright/PageObjects/QuickProfile.ts index 1c2cfbe7..ba348186 100644 --- a/playwright/PageObjects/QuickProfile.ts +++ b/playwright/PageObjects/QuickProfile.ts @@ -16,8 +16,11 @@ export class QuickProfile extends MainPage { readonly quickProfileUsernameLabel: Locator; readonly quickProfileUsernameText: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.quickProfile = this.page.getByTestId("quick-profile"); this.quickProfileBanner = this.quickProfile.getByTestId( "quick-profile-banner", diff --git a/playwright/PageObjects/SaveRecoverySeed.ts b/playwright/PageObjects/SaveRecoverySeed.ts index 176121dc..e60a608e 100644 --- a/playwright/PageObjects/SaveRecoverySeed.ts +++ b/playwright/PageObjects/SaveRecoverySeed.ts @@ -7,8 +7,11 @@ export class SaveRecoverySeedPage extends MainPage { readonly textRecoveryPageWarning: Locator; readonly titleRecoveryPage: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.buttonDownloadPhrase = this.page.getByTestId("button-download-phrase"); this.buttonSavedPhrase = this.page.getByTestId("button-save-phrase"); this.textRecoveryPageWarning = this.page.getByTestId( diff --git a/playwright/PageObjects/Settings/SettingsAbout.ts b/playwright/PageObjects/Settings/SettingsAbout.ts index aaa6792c..c3336df2 100644 --- a/playwright/PageObjects/Settings/SettingsAbout.ts +++ b/playwright/PageObjects/Settings/SettingsAbout.ts @@ -26,8 +26,11 @@ export class SettingsAbout extends SettingsBase { readonly websiteSectionLabel: Locator; readonly websiteSectionText: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.aboutSection = this.page.getByTestId("section-about-header"); this.aboutSectionLabel = this.aboutSection.getByTestId( "setting-section-label", diff --git a/playwright/PageObjects/Settings/SettingsAccessibility.ts b/playwright/PageObjects/Settings/SettingsAccessibility.ts index f747ab1e..fd9eee80 100644 --- a/playwright/PageObjects/Settings/SettingsAccessibility.ts +++ b/playwright/PageObjects/Settings/SettingsAccessibility.ts @@ -8,8 +8,11 @@ export class SettingsAccessibility extends SettingsBase { readonly openDyslexicSectionText: Locator; readonly openDyslexicSectionSlider: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.openDyslexicSection = this.page.getByTestId("section-accessibility"); this.openDyslexicSectionCheckbox = this.page.getByTestId( "switch-accessibility-open-dyslexic", diff --git a/playwright/PageObjects/Settings/SettingsAudio.ts b/playwright/PageObjects/Settings/SettingsAudio.ts index c0f21fe4..5dad3902 100644 --- a/playwright/PageObjects/Settings/SettingsAudio.ts +++ b/playwright/PageObjects/Settings/SettingsAudio.ts @@ -48,8 +48,11 @@ export class SettingsAudio extends SettingsBase { readonly videoDeviceSectionSelectorOption: Locator; readonly videoDeviceSectionText: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.callTimerSection = this.page.getByTestId("section-call-timer"); this.callTimerSectionCheckbox = this.page.getByTestId("switch-call-timer"); this.callTimerSectionSlider = this.page.locator( diff --git a/playwright/PageObjects/Settings/SettingsBase.ts b/playwright/PageObjects/Settings/SettingsBase.ts index 995b44f7..dbceefe1 100644 --- a/playwright/PageObjects/Settings/SettingsBase.ts +++ b/playwright/PageObjects/Settings/SettingsBase.ts @@ -18,8 +18,11 @@ export class SettingsBase extends MainPage { readonly buttonProfile: Locator; readonly buttonRealms: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.buttonAbout = this.page.getByTestId("button-About"); this.buttonAccessibility = this.page.getByTestId("button-Accessibility"); this.buttonAudioAndVideo = this.page.locator( diff --git a/playwright/PageObjects/Settings/SettingsCustomizations.ts b/playwright/PageObjects/Settings/SettingsCustomizations.ts index 07427981..388aebf6 100644 --- a/playwright/PageObjects/Settings/SettingsCustomizations.ts +++ b/playwright/PageObjects/Settings/SettingsCustomizations.ts @@ -60,8 +60,11 @@ export class SettingsCustomizations extends SettingsBase { readonly widgetPanelSectionSlider: Locator; readonly widgetPanelSectionText: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.appLanguageSection = this.page.getByTestId("section-app-language"); this.appLanguageSectionLabel = this.appLanguageSection.getByTestId( "setting-section-label", diff --git a/playwright/PageObjects/Settings/SettingsDeveloper.ts b/playwright/PageObjects/Settings/SettingsDeveloper.ts index d0b3ec51..35d9dccd 100644 --- a/playwright/PageObjects/Settings/SettingsDeveloper.ts +++ b/playwright/PageObjects/Settings/SettingsDeveloper.ts @@ -40,8 +40,11 @@ export class SettingsDeveloper extends SettingsBase { readonly testVoiceSectionText: Locator; readonly widgetBar: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.batteryIndicator = this.page.getByTestId("battery-indicator"); this.batteryIndicatorIcon = this.page.getByTestId("battery-indicator-icon"); this.batteryIndicatorNotSupportedError = this.page.getByTestId( diff --git a/playwright/PageObjects/Settings/SettingsExtensions.ts b/playwright/PageObjects/Settings/SettingsExtensions.ts index c35c3309..c81fb309 100644 --- a/playwright/PageObjects/Settings/SettingsExtensions.ts +++ b/playwright/PageObjects/Settings/SettingsExtensions.ts @@ -8,8 +8,11 @@ export class SettingsExtensions extends SettingsBase { readonly settingsButton: Locator; readonly underConstructionIndicator: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.exploreButton = this.page.getByTestId("button-explore"); this.installedButton = this.page.getByTestId("button-installed"); this.noExtensionsInstalledLabel = this.page.getByTestId( diff --git a/playwright/PageObjects/Settings/SettingsGamepad.ts b/playwright/PageObjects/Settings/SettingsGamepad.ts index e604367b..4ba3646a 100644 --- a/playwright/PageObjects/Settings/SettingsGamepad.ts +++ b/playwright/PageObjects/Settings/SettingsGamepad.ts @@ -1,3 +1,4 @@ +import { vi } from "@faker-js/faker"; import { SettingsBase } from "./SettingsBase"; import { type Locator, type Page } from "@playwright/test"; @@ -21,8 +22,11 @@ export class SettingsGamepad extends SettingsBase { readonly switchGamepadEnabled: Locator; readonly textGamepadTestItOut: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.labelGamepadControllerInfo = this.page.getByTestId( "label-gamepad-controller-info", ); diff --git a/playwright/PageObjects/Settings/SettingsInventory.ts b/playwright/PageObjects/Settings/SettingsInventory.ts index e07d1fb3..8b2583ce 100644 --- a/playwright/PageObjects/Settings/SettingsInventory.ts +++ b/playwright/PageObjects/Settings/SettingsInventory.ts @@ -20,8 +20,11 @@ export class SettingsInventory extends SettingsBase { readonly inventoryItemName: Locator; readonly inventoryItemType: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.buttonUnequipInventory = this.page.getByTestId( "button-unequip-inventory", ); diff --git a/playwright/PageObjects/Settings/SettingsKeybinds.ts b/playwright/PageObjects/Settings/SettingsKeybinds.ts index 31149e80..484d8262 100644 --- a/playwright/PageObjects/Settings/SettingsKeybinds.ts +++ b/playwright/PageObjects/Settings/SettingsKeybinds.ts @@ -24,8 +24,11 @@ export class SettingsKeybinds extends SettingsBase { readonly revertKeybindSectionText: Locator; readonly revertKeybindSectionAllButton: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.bannerText = this.page.getByTestId("banner-text"); this.existingKeybind = this.page.getByTestId("keybind"); this.existingKeybindDescription = this.page.getByTestId( diff --git a/playwright/PageObjects/Settings/SettingsLicenses.ts b/playwright/PageObjects/Settings/SettingsLicenses.ts index 7fd0c236..57e78c08 100644 --- a/playwright/PageObjects/Settings/SettingsLicenses.ts +++ b/playwright/PageObjects/Settings/SettingsLicenses.ts @@ -7,8 +7,11 @@ export class SettingsLicenses extends SettingsBase { readonly licensesSectionLabel: Locator; readonly licensesSectionText: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.licensesSection = this.page.getByTestId("section-licenses-uplink"); this.licensesSectionButton = this.page.getByTestId("button-view-license"); this.licensesSectionLabel = this.licensesSection.locator( diff --git a/playwright/PageObjects/Settings/SettingsMessages.ts b/playwright/PageObjects/Settings/SettingsMessages.ts index a9b75f96..09b23fe8 100644 --- a/playwright/PageObjects/Settings/SettingsMessages.ts +++ b/playwright/PageObjects/Settings/SettingsMessages.ts @@ -28,8 +28,11 @@ export class SettingsMessages extends SettingsBase { readonly spamBotDetectionSectionText: Locator; readonly spamBotDetectionSectionSlider: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.compactMessagingSection = this.page.getByTestId( "section-compact-messaging", ); diff --git a/playwright/PageObjects/Settings/SettingsNetwork.ts b/playwright/PageObjects/Settings/SettingsNetwork.ts index 0371a3a6..7e77e3ec 100644 --- a/playwright/PageObjects/Settings/SettingsNetwork.ts +++ b/playwright/PageObjects/Settings/SettingsNetwork.ts @@ -22,8 +22,11 @@ export class SettingsNetwork extends SettingsBase { readonly relaySaveButton: Locator; readonly underConstruction: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.buttonCdnSave = this.page.getByTestId("button-cdn-save"); this.inputCdnAddress = this.page.getByTestId("input-cdn-address"); this.inputCdnName = this.page.getByTestId("input-cdn-name"); diff --git a/playwright/PageObjects/Settings/SettingsNotifications.ts b/playwright/PageObjects/Settings/SettingsNotifications.ts index 778b346c..98f7fa54 100644 --- a/playwright/PageObjects/Settings/SettingsNotifications.ts +++ b/playwright/PageObjects/Settings/SettingsNotifications.ts @@ -23,8 +23,11 @@ export class SettingsNotifications extends SettingsBase { readonly settingsSectionText: Locator; readonly settingsSectionSlider: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.enabledSection = this.page.getByTestId( "section-notifications-enabled", ); diff --git a/playwright/PageObjects/Settings/SettingsProfile.ts b/playwright/PageObjects/Settings/SettingsProfile.ts index 8be94ac5..96618812 100644 --- a/playwright/PageObjects/Settings/SettingsProfile.ts +++ b/playwright/PageObjects/Settings/SettingsProfile.ts @@ -86,8 +86,11 @@ export class SettingsProfile extends SettingsBase { readonly warningMessageMaxLengthIs32: Locator; readonly warningMessageMinLengthIs4: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.accountIntegrations = this.page.getByTestId( "section-account-integrations", ); diff --git a/playwright/PageObjects/Settings/SettingsRealms.ts b/playwright/PageObjects/Settings/SettingsRealms.ts index 327bd395..f3a2472f 100644 --- a/playwright/PageObjects/Settings/SettingsRealms.ts +++ b/playwright/PageObjects/Settings/SettingsRealms.ts @@ -6,8 +6,11 @@ export class SettingsRealms extends SettingsBase { readonly textSettingsRealmsDescriptionOne: Locator; readonly textSettingsRealmsDescriptionTwo: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.labelSettingsRealms = this.page.getByTestId("label-settings-realms"); this.textSettingsRealmsDescriptionOne = this.page.getByTestId( "text-settings-realms-description-1", diff --git a/playwright/PageObjects/VolumeMixer.ts b/playwright/PageObjects/VolumeMixer.ts index 4fbeed1b..659e1554 100644 --- a/playwright/PageObjects/VolumeMixer.ts +++ b/playwright/PageObjects/VolumeMixer.ts @@ -15,8 +15,11 @@ export class VolumeMixer extends MainPage { readonly userVolumeText: Locator; readonly volumeMixer: Locator; - constructor(public readonly page: Page) { - super(page); + constructor( + public readonly page: Page, + public readonly viewport: string, + ) { + super(page, viewport); this.masterVolumeLabel = this.page.getByTestId("label-master-volume"); this.masterVolumeRangeSelector = this.page .getByTestId("range-selector") diff --git a/playwright/fixtures/setup.ts b/playwright/fixtures/setup.ts index e95cafde..1d639b51 100644 --- a/playwright/fixtures/setup.ts +++ b/playwright/fixtures/setup.ts @@ -15,36 +15,42 @@ type MyFixtures = { enterPinUserContext: { context: BrowserContext; page: Page; + viewport: string; }; singleUserContext: { context: BrowserContext; page: Page; + viewport: string; }; firstUserContext: { context: BrowserContext; page: Page; + viewport: string; }; secondUserContext: { context: BrowserContext; page: Page; + viewport: string; }; }; // Extend base test by providing page object classes as fixtures. // This new "test" can be used in multiple test files, and each of them will get the fixtures. export const test = base.extend({ - enterPinUserContext: async ({}, use) => { + enterPinUserContext: async ({}, use, testInfo) => { // Declare all constants required for the precondition steps const browser = await chromium.launch(); const context = await browser.newContext(); const page = await context.newPage(); - const createOrImport = new CreateOrImportPage(page); + const viewport = testInfo.project.name; + const createOrImport = new CreateOrImportPage(page, viewport); await createOrImport.navigateTo(); // Pass the context, browser, and page to the test await use({ context, page, + viewport, }); // Close the context and browser after the test is done @@ -53,16 +59,18 @@ export const test = base.extend({ await context.close(); }, - singleUserContext: async ({}, use) => { + singleUserContext: async ({}, use, testInfo) => { // Declare all constants required for the precondition steps const browser = await chromium.launch(); const context = await browser.newContext(); const page = await context.newPage(); - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); - const saveRecoverySeed = new SaveRecoverySeedPage(page); - const chatsMainPage = new ChatsMainPage(page); + const viewport = testInfo.project.name; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + const saveRecoverySeed = new SaveRecoverySeedPage(page, viewport); + const chatsMainPage = new ChatsMainPage(page, viewport); + const username = "test123"; const status = "fixed status"; @@ -92,6 +100,7 @@ export const test = base.extend({ await use({ context, page, + viewport, }); // Close the context and browser after the test is done @@ -100,15 +109,16 @@ export const test = base.extend({ await context.close(); }, - firstUserContext: async ({}, use) => { + firstUserContext: async ({}, use, testInfo) => { // Declare all constants required for the precondition steps const browser = await chromium.launch(); const context = await browser.newContext(); const page = await context.newPage(); - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); - const saveRecoverySeed = new SaveRecoverySeedPage(page); + const viewport = testInfo.project.name; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + const saveRecoverySeed = new SaveRecoverySeedPage(page, viewport); const username: string = "ChatUserA"; const status: string = "status from first user"; @@ -135,6 +145,7 @@ export const test = base.extend({ await use({ context, page, + viewport, }); // Close the context and browser after the test is done @@ -143,15 +154,16 @@ export const test = base.extend({ await context.close(); }, - secondUserContext: async ({}, use) => { + secondUserContext: async ({}, use, testInfo) => { // Declare all constants required for the precondition steps const browser = await chromium.launch(); const context = await browser.newContext(); const page = await context.newPage(); - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); - const saveRecoverySeed = new SaveRecoverySeedPage(page); + const viewport = testInfo.project.name; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + const saveRecoverySeed = new SaveRecoverySeedPage(page, viewport); const username: string = "ChatUserB"; const status: string = "status from second user"; @@ -178,6 +190,7 @@ export const test = base.extend({ await use({ context, page, + viewport, }); // Close the context and browser after the test is done diff --git a/playwright/specs/01-pin-input.spec.ts b/playwright/specs/01-pin-input.spec.ts index a08618cc..d7410505 100644 --- a/playwright/specs/01-pin-input.spec.ts +++ b/playwright/specs/01-pin-input.spec.ts @@ -17,10 +17,11 @@ test.describe("Create Account and Login Tests", () => { enterPinUserContext, }) => { const page = enterPinUserContext.page; - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); - const saveRecoverySeed = new SaveRecoverySeedPage(page); + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + const saveRecoverySeed = new SaveRecoverySeedPage(page, viewport); // Validate Create or Import Page and then click on Create New Account await createOrImport.labelCreateTitle.waitFor({ state: "attached" }); @@ -77,9 +78,10 @@ test.describe("Create Account and Login Tests", () => { enterPinUserContext, }) => { const page = enterPinUserContext.page; - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); // Click on Create New Account await createOrImport.clickCreateNewAccount(); @@ -100,9 +102,10 @@ test.describe("Create Account and Login Tests", () => { enterPinUserContext, }) => { const page = enterPinUserContext.page; - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); // Click on Create New Account await createOrImport.clickCreateNewAccount(); @@ -124,9 +127,10 @@ test.describe("Create Account and Login Tests", () => { enterPinUserContext, }) => { const page = enterPinUserContext.page; - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); // Click on Create New Account await createOrImport.clickCreateNewAccount(); @@ -149,9 +153,10 @@ test.describe("Create Account and Login Tests", () => { enterPinUserContext, }) => { const page = enterPinUserContext.page; - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); // Click on Create New Account await createOrImport.clickCreateNewAccount(); @@ -177,9 +182,10 @@ test.describe("Create Account and Login Tests", () => { enterPinUserContext, }) => { const page = enterPinUserContext.page; - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); // Click on Create New Account await createOrImport.clickCreateNewAccount(); @@ -217,11 +223,12 @@ test.describe("Create Account and Login Tests", () => { enterPinUserContext, }) => { const page = enterPinUserContext.page; - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); - const saveRecoverySeed = new SaveRecoverySeedPage(page); - const chatsMainPage = new ChatsMainPage(page); + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + const saveRecoverySeed = new SaveRecoverySeedPage(page, viewport); + const chatsMainPage = new ChatsMainPage(page, viewport); // Click on Create New Account await createOrImport.clickCreateNewAccount(); @@ -257,11 +264,12 @@ test.describe("Create Account and Login Tests", () => { enterPinUserContext, }) => { const page = enterPinUserContext.page; - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); - const saveRecoverySeed = new SaveRecoverySeedPage(page); - const chatsMainPage = new ChatsMainPage(page); + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + const saveRecoverySeed = new SaveRecoverySeedPage(page, viewport); + const chatsMainPage = new ChatsMainPage(page, viewport); // Click on Create New Account await createOrImport.clickCreateNewAccount(); @@ -295,11 +303,12 @@ test.describe("Create Account and Login Tests", () => { enterPinUserContext, }) => { const page = enterPinUserContext.page; - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); - const saveRecoverySeed = new SaveRecoverySeedPage(page); - const chatsMainPage = new ChatsMainPage(page); + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + const saveRecoverySeed = new SaveRecoverySeedPage(page, viewport); + const chatsMainPage = new ChatsMainPage(page, viewport); // Click on Create New Account await createOrImport.clickCreateNewAccount(); @@ -327,11 +336,12 @@ test.describe("Create Account and Login Tests", () => { enterPinUserContext, }) => { const page = enterPinUserContext.page; - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); - const saveRecoverySeed = new SaveRecoverySeedPage(page); - const chatsMainPage = new ChatsMainPage(page); + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + const saveRecoverySeed = new SaveRecoverySeedPage(page, viewport); + const chatsMainPage = new ChatsMainPage(page, viewport); // Click on Create New Account await createOrImport.clickCreateNewAccount(); @@ -362,12 +372,13 @@ test.describe("Create Account and Login Tests", () => { enterPinUserContext, }) => { const page = enterPinUserContext.page; - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); - const saveRecoverySeed = new SaveRecoverySeedPage(page); - const chatsMainPage = new ChatsMainPage(page); - const settingsProfile = new SettingsProfile(page); + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + const saveRecoverySeed = new SaveRecoverySeedPage(page, viewport); + const chatsMainPage = new ChatsMainPage(page, viewport); + const settingsProfile = new SettingsProfile(page, viewport); // Click on Create New Account await createOrImport.clickCreateNewAccount(); @@ -406,12 +417,13 @@ test.describe("Create Account and Login Tests", () => { enterPinUserContext, }) => { const page = enterPinUserContext.page; - const createOrImport = new CreateOrImportPage(page); - const authNewAccount = new AuthNewAccount(page); - const loginPinPage = new LoginPinPage(page); - const saveRecoverySeed = new SaveRecoverySeedPage(page); - const chatsMainPage = new ChatsMainPage(page); - const settingsProfile = new SettingsProfile(page); + const viewport = enterPinUserContext.viewport; + const createOrImport = new CreateOrImportPage(page, viewport); + const authNewAccount = new AuthNewAccount(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + const saveRecoverySeed = new SaveRecoverySeedPage(page, viewport); + const chatsMainPage = new ChatsMainPage(page, viewport); + const settingsProfile = new SettingsProfile(page, viewport); // Click on Create New Account await createOrImport.clickCreateNewAccount(); diff --git a/playwright/specs/02-friends-one-instance.spec.ts b/playwright/specs/02-friends-one-instance.spec.ts index b3b60844..536333e1 100644 --- a/playwright/specs/02-friends-one-instance.spec.ts +++ b/playwright/specs/02-friends-one-instance.spec.ts @@ -5,7 +5,8 @@ import { FriendsScreen } from "playwright/PageObjects/FriendsScreen"; test.describe("Friends tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); // Go to Friends await chatsMainPage.dismissDownloadAlert(); @@ -16,7 +17,8 @@ test.describe("Friends tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const friendsScreen = new FriendsScreen(page); + const viewport = singleUserContext.viewport; + const friendsScreen = new FriendsScreen(page, viewport); // H2 - Clicking Active should take you to Active page within Friends await friendsScreen.goToRequestList(); @@ -112,7 +114,8 @@ test.describe("Friends tests", () => { }) => { const context = singleUserContext.context; const page = singleUserContext.page; - const friendsScreen = new FriendsScreen(page); + const viewport = singleUserContext.viewport; + const friendsScreen = new FriendsScreen(page, viewport); // H10 - Clicking the Copy button should copy your personal did:key // Grant clipboard permissions @@ -174,7 +177,8 @@ test.describe("Friends tests", () => { }) => { const context = singleUserContext.context; const page = singleUserContext.page; - const friendsScreen = new FriendsScreen(page); + const viewport = singleUserContext.viewport; + const friendsScreen = new FriendsScreen(page, viewport); // H22 - User cannot add himself as a friend // Grant clipboard permissions diff --git a/playwright/specs/03-friends-two-instances.spec.ts b/playwright/specs/03-friends-two-instances.spec.ts index 11e03abb..768ac0b8 100644 --- a/playwright/specs/03-friends-two-instances.spec.ts +++ b/playwright/specs/03-friends-two-instances.spec.ts @@ -24,10 +24,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); // With both users go to Friends Screen await chatsMainPageFirst.goToFriends(); @@ -91,10 +92,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); // With both users go to Friends Screen await chatsMainPageFirst.goToFriends(); @@ -166,10 +168,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); // With both users go to Friends Screen await chatsMainPageFirst.goToFriends(); @@ -220,10 +223,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); // With both users go to Friends Screen await chatsMainPageFirst.goToFriends(); @@ -271,10 +275,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); // Setup accounts for testing await setupChats( @@ -389,11 +394,12 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const filesPageFirst = new FilesPage(page1); - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const filesPageFirst = new FilesPage(page1, viewport); + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); // Setup accounts for testing await setupChats( @@ -449,10 +455,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); // Setup accounts for testing await setupChats( @@ -546,10 +553,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); // Setup accounts for testing await setupChats( @@ -626,12 +634,13 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); - const quickProfileLocal = new QuickProfile(page1); - const quickProfileRemote = new QuickProfile(page1); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); + const quickProfileLocal = new QuickProfile(page1, viewport); + const quickProfileRemote = new QuickProfile(page1, viewport); // Setup accounts for testing await setupChats( @@ -725,12 +734,13 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); - const quickProfileLocal = new QuickProfile(page1); - const settingsProfileFirst = new SettingsProfile(page1); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); + const quickProfileLocal = new QuickProfile(page1, viewport); + const settingsProfileFirst = new SettingsProfile(page1, viewport); // Setup accounts for testing await setupChats( @@ -810,12 +820,13 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); - const quickProfileRemote = new QuickProfile(page1); - const settingsProfileSecond = new SettingsProfile(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); + const quickProfileRemote = new QuickProfile(page1, viewport); + const settingsProfileSecond = new SettingsProfile(page2, viewport); // Setup accounts for testing await setupChats( @@ -901,10 +912,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); let lastMessageSent: Locator; let lastMessageReceived: Locator; @@ -982,10 +994,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); let lastMessageSent: Locator; let lastMessageReceived: Locator; @@ -1166,10 +1179,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); let lastMessageSent: Locator; let lastMessageReceived: Locator; let localMessageReactions: reactionContainer; @@ -1297,12 +1311,13 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); - const settingsProfileSecond = new SettingsProfile(page2); - const settingsMessagesSecond = new SettingsMessages(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); + const settingsProfileSecond = new SettingsProfile(page2, viewport); + const settingsMessagesSecond = new SettingsMessages(page2, viewport); // Setup accounts for testing await setupChats( @@ -1455,10 +1470,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); // Setup accounts for testing await setupChats( @@ -1530,10 +1546,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); // Setup accounts for testing await setupChats( @@ -1546,7 +1563,7 @@ test.describe("Two instances tests - Friends and Chats", () => { ); await chatsMainPageSecond.openEmojiPicker(); - const emojiPickerSecond = new EmojiPicker(page2); + const emojiPickerSecond = new EmojiPicker(page2, viewport); await emojiPickerSecond.selectEmoji("😂"); await chatsMainPageSecond.buttonChatbarSendMessage.click(); @@ -1658,10 +1675,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); // Setup accounts for testing await setupChats( @@ -1675,7 +1693,7 @@ test.describe("Two instances tests - Friends and Chats", () => { // Change GIF size in gifs container view await chatsMainPageSecond.openGifPicker(); - const gifPickerSecond = new GifPicker(page2); + const gifPickerSecond = new GifPicker(page2, viewport); await gifPickerSecond.waitForGifsToLoad(); await gifPickerSecond.changeGifSizeView("100"); await gifPickerSecond.changeGifSizeView("200"); @@ -1722,10 +1740,11 @@ test.describe("Two instances tests - Friends and Chats", () => { const context1 = firstUserContext.context; const page1 = firstUserContext.page; const page2 = secondUserContext.page; - const friendsScreenFirst = new FriendsScreen(page1); - const friendsScreenSecond = new FriendsScreen(page2); - const chatsMainPageFirst = new ChatsMainPage(page1); - const chatsMainPageSecond = new ChatsMainPage(page2); + const viewport = firstUserContext.viewport; + const friendsScreenFirst = new FriendsScreen(page1, viewport); + const friendsScreenSecond = new FriendsScreen(page2, viewport); + const chatsMainPageFirst = new ChatsMainPage(page1, viewport); + const chatsMainPageSecond = new ChatsMainPage(page2, viewport); // Setup accounts for testing await setupChats( @@ -1738,7 +1757,7 @@ test.describe("Two instances tests - Friends and Chats", () => { ); await chatsMainPageSecond.openStickerPicker(); - const stickerPickerSecond = new StickerPicker(page2); + const stickerPickerSecond = new StickerPicker(page2, viewport); await stickerPickerSecond.waitForStickersToLoad(); // Send a Sticker to the other user diff --git a/playwright/specs/04-friends-three-instances.spec.ts b/playwright/specs/04-friends-three-instances.spec.ts index 6e541103..96dbba2d 100644 --- a/playwright/specs/04-friends-three-instances.spec.ts +++ b/playwright/specs/04-friends-three-instances.spec.ts @@ -1,5 +1,4 @@ import { test } from "../fixtures/setup"; -import { faker } from "@faker-js/faker"; test.describe("Friends tests", () => { /* diff --git a/playwright/specs/05-chats-sidebar.spec.ts b/playwright/specs/05-chats-sidebar.spec.ts index ac82202e..7b4ecd61 100644 --- a/playwright/specs/05-chats-sidebar.spec.ts +++ b/playwright/specs/05-chats-sidebar.spec.ts @@ -4,7 +4,8 @@ import { test, expect } from "../fixtures/setup"; test.describe("Chats Sidebar Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); }); @@ -12,7 +13,8 @@ test.describe("Chats Sidebar Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.buttonCreateGroupChat.click(); await expect(chatsMainPage.createGroupLabelGroupName).toBeVisible(); @@ -33,7 +35,8 @@ test.describe("Chats Sidebar Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.buttonCreateGroupChat.hover(); await chatsMainPage.validateTooltipAttribute( @@ -46,7 +49,8 @@ test.describe("Chats Sidebar Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); // Hover on each button and validate the tooltip // await chatsMainPage.buttonWallet.hover(); @@ -82,10 +86,10 @@ test.describe("Chats Sidebar Tests", () => { test("C4 - Clicking hamburger button should collapse sidebar", async ({ singleUserContext, - }, testoptions) => { + }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); - const viewport = testoptions.project.name; + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.buttonHideSidebar.click(); @@ -108,10 +112,10 @@ test.describe("Chats Sidebar Tests", () => { test("C5, C6, C7, C8, C9 - Nav bar buttons should redirect to correct page", async ({ singleUserContext, - }, testoptions) => { + }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); - const viewport = testoptions.project.name; + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.goToFiles(); await page.waitForURL("/files"); @@ -143,7 +147,8 @@ test.describe("Chats Sidebar Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.inputSidebarSearch.focus(); diff --git a/playwright/specs/07-settings-profile.spec.ts b/playwright/specs/07-settings-profile.spec.ts index 45b6b1c7..bf5b5de3 100644 --- a/playwright/specs/07-settings-profile.spec.ts +++ b/playwright/specs/07-settings-profile.spec.ts @@ -6,13 +6,13 @@ test.describe("Settings Profile Tests", () => { const username = "test123"; const status = "fixed status"; - test.beforeEach(async ({ singleUserContext }, testoptions) => { + test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const viewport = testoptions.project.name; // Hide sidebar if viewport is Mobile Chrome if (viewport === "mobile-chrome") { @@ -24,7 +24,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Shows tooltip when hovering await settingsProfile.profileBanner.hover(); @@ -38,7 +39,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // User can upload a banner picture await settingsProfile.uploadProfileBanner("playwright/assets/banner.jpg"); @@ -48,7 +50,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Profile Picture Upload Button tooltip shows "Change profile photo" // Validate user can upload profile pictures @@ -66,7 +69,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Identicon picture is setup by default await expect(settingsProfile.identiconSettingsProfile).toBeVisible(); @@ -85,7 +89,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Username displayed will be equal to the username assigned randomly when creating account await expect(settingsProfile.inputSettingsProfileUsername).toHaveValue( @@ -98,7 +103,8 @@ test.describe("Settings Profile Tests", () => { }) => { const context = singleUserContext.context; const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Validate hovering on Copy ID button shows "Copy" await context.grantPermissions(["clipboard-read", "clipboard-write"]); @@ -128,7 +134,8 @@ test.describe("Settings Profile Tests", () => { }) => { const context = singleUserContext.context; const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Copy ID by just right clicking on the Short ID button and selecting Copy ID await context.grantPermissions(["clipboard-read", "clipboard-write"]); @@ -170,11 +177,11 @@ test.describe("Settings Profile Tests", () => { test("I9, I10 - User should be able to change username and see toast notification of change", async ({ singleUserContext, - }, testoptions) => { + }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); - const chatsMainPage = new ChatsMainPage(page); - const viewport = testoptions.project.name; + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); + const chatsMainPage = new ChatsMainPage(page, viewport); // User types into username and change value const newUsername = "newUsername"; @@ -236,7 +243,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // User clicks on username textbox and all text is selected await settingsProfile.assertInputTextSelected( @@ -248,7 +256,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Click on Username textbox and validate border is highlighted await settingsProfile.inputSettingsProfileUsername.focus(); @@ -265,7 +274,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // User leaves empty username - Warning message is displayed await settingsProfile.inputSettingsProfileUsername.click(); @@ -301,7 +311,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Click on Status textbox and validate border is highlighted await settingsProfile.inputSettingsProfileStatus.focus(); @@ -316,11 +327,11 @@ test.describe("Settings Profile Tests", () => { test("I15, I16 - User should be able to change Status Message and see toast notification for update", async ({ singleUserContext, - }, testoptions) => { + }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); - const chatsMainPage = new ChatsMainPage(page); - const viewport = testoptions.project.name; + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); + const chatsMainPage = new ChatsMainPage(page, viewport); // User types into username and change value const newStatus = "this is my new status"; @@ -382,7 +393,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // User clicks on status textbox and all text is selected await settingsProfile.assertInputTextSelected( @@ -394,7 +406,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // User types more characters than expected into status - Warning message is displayed await settingsProfile.inputSettingsProfileStatus.click(); @@ -411,7 +424,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Validate Settings Section contents await expect(settingsProfile.onlineStatusSectionLabel).toHaveText("Status"); @@ -434,7 +448,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Change Status to Offline and validate is displayed correctly await settingsProfile.selectOnlineStatus("offline"); @@ -457,7 +472,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Validate Settings Section contents await expect(settingsProfile.revealPhraseSectionLabel).toHaveText( @@ -484,7 +500,8 @@ test.describe("Settings Profile Tests", () => { }) => { const context = singleUserContext.context; const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Grant clipboard permissions to browser await context.grantPermissions(["clipboard-read", "clipboard-write"]); @@ -507,7 +524,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Validate Store Recovery Seed checkbox is checked by default await expect(settingsProfile.storeRecoverySeedCheckbox).toHaveClass( @@ -541,7 +559,8 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsProfile = new SettingsProfile(page, viewport); // Validate Settings Section contents await expect(settingsProfile.logOutSectionLabel).toHaveText("Log Out"); diff --git a/playwright/specs/08-settings-inventory.spec.ts b/playwright/specs/08-settings-inventory.spec.ts index 7aea9024..0fd4d299 100644 --- a/playwright/specs/08-settings-inventory.spec.ts +++ b/playwright/specs/08-settings-inventory.spec.ts @@ -6,12 +6,13 @@ import { SettingsInventory } from "playwright/PageObjects/Settings/SettingsInven test.describe("Settings Inventory Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonInventory.click(); await page.waitForURL("/settings/inventory"); }); @@ -21,7 +22,8 @@ test.describe("Settings Inventory Tests", () => { // singleUserContext, // }) => { // const page = singleUserContext.page; - // const settingsInventory = new SettingsInventory(page); + // const viewport = singleUserContext.viewport; + // const settingsInventory = new SettingsInventory(page, viewport); // const expectedFrames = [ // { name: "Moon", type: "Profile Picture Frame" }, @@ -51,8 +53,9 @@ test.describe("Settings Inventory Tests", () => { // singleUserContext, // }) => { // const page = singleUserContext.page; - // const settingsInventory = new SettingsInventory(page); - // const settingsProfile = new SettingsProfile(page); + // const viewport = singleUserContext.viewport; + // const settingsInventory = new SettingsInventory(page, viewport); + // const settingsProfile = new SettingsProfile(page, viewport); // // Equip Quaint inventory frame // await settingsInventory.equipFrame("Quaint"); @@ -81,7 +84,8 @@ test.describe("Settings Inventory Tests", () => { // singleUserContext, // }) => { // const page = singleUserContext.page; - // const settingsInventory = new SettingsInventory(page); + // const viewport = singleUserContext.viewport; + // const settingsInventory = new SettingsInventory(page, viewport); // // Equip Quaint inventory frame // await settingsInventory.equipFrame("Quaint"); diff --git a/playwright/specs/09-settings-customizations.spec.ts b/playwright/specs/09-settings-customizations.spec.ts index 78cf0f06..5cd56f48 100644 --- a/playwright/specs/09-settings-customizations.spec.ts +++ b/playwright/specs/09-settings-customizations.spec.ts @@ -6,12 +6,13 @@ import { SettingsCustomizations } from "playwright/PageObjects/Settings/Settings test.describe("Settings Customization Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonCustomization.click(); await page.waitForURL("/settings/preferences"); }); @@ -20,7 +21,8 @@ test.describe("Settings Customization Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); await expect(settingsCustomizations.appLanguageSectionLabel).toHaveText( "App Language", @@ -39,7 +41,8 @@ test.describe("Settings Customization Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); const expectedFonts = [ "Poppins", @@ -75,10 +78,10 @@ test.describe("Settings Customization Tests", () => { test("K3 - Selected Fonts should be applied everywhere throughout the app", async ({ singleUserContext, - }, testoptions) => { + }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); - const viewport = testoptions.project.name; + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); const selectedFont = "JosefinSans"; await settingsCustomizations.selectFont(selectedFont); @@ -103,7 +106,8 @@ test.describe("Settings Customization Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); await expect(settingsCustomizations.fontScalingSectionLabel).toHaveText( "Font Scaling", @@ -131,7 +135,8 @@ test.describe("Settings Customization Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); await expect(settingsCustomizations.fontScalingSectionInput).toHaveValue( "1.00", @@ -152,7 +157,8 @@ test.describe("Settings Customization Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); // Validate default theme is applied await settingsCustomizations.validateCurrentTheme( @@ -180,7 +186,8 @@ test.describe("Settings Customization Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); const expectedThemes = ["Default", "Dracula", "Olivia", "Light"]; @@ -234,7 +241,8 @@ test.describe("Settings Customization Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); const expectedPrimaryColors = [ "Neo Orbit", @@ -268,17 +276,17 @@ test.describe("Settings Customization Tests", () => { test("K12 - Clicking Pick should open up the finetune color selector", async ({ singleUserContext, - }, testoptions) => { + }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); - const viewport = testoptions.project.name; + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); if (viewport === "mobile-chrome") { await settingsCustomizations.buttonShowSidebar.click(); } await expect(settingsCustomizations.buttonCustomization).toHaveCSS( "background-color", - "rgb(77, 77, 255)", + /rgb\(77, 77, 255\)|color\(srgb 0.371765 0.371765 1\)/, ); if (viewport === "mobile-chrome") { @@ -305,26 +313,27 @@ test.describe("Settings Customization Tests", () => { } else { await settingsCustomizations.buttonCustomization.click({ force: true }); } + await expect(settingsCustomizations.buttonCustomization).toHaveCSS( "background-color", - "rgb(255, 143, 184)", + /rgb\(255, 143, 184\)|color\(srgb 1 0.604706 0.749412\)/, ); }); test("K13 - Selected primary color should be applied throughout the entire app", async ({ singleUserContext, - }, testoptions) => { + }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); - const chatsMainPage = new ChatsMainPage(page); - const viewport = testoptions.project.name; + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); + const chatsMainPage = new ChatsMainPage(page, viewport); if (viewport === "mobile-chrome") { await settingsCustomizations.buttonShowSidebar.click(); } await expect(settingsCustomizations.buttonCustomization).toHaveCSS( "background-color", - "rgb(77, 77, 255)", + /rgb\(77, 77, 255\)|color\(srgb 0.371765 0.371765 1\)/, ); if (viewport === "mobile-chrome") { @@ -348,10 +357,10 @@ test.describe("Settings Customization Tests", () => { test("K14 - User should be able to add additional custom CSS to the application", async ({ singleUserContext, - }, testoptions) => { + }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); - const viewport = testoptions.project.name; + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); if (viewport === "mobile-chrome") { await settingsCustomizations.buttonShowSidebar.click(); @@ -399,7 +408,8 @@ test.describe("Settings Customization Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); const expectedEmojiFonts = [ "NotoEmoji", @@ -428,7 +438,8 @@ test.describe("Settings Customization Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); const selectedEmojiFont = "OpenMoji"; await settingsCustomizations.selectEmojiFont(selectedEmojiFont); @@ -446,7 +457,8 @@ test.describe("Settings Customization Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); const expectedDefaultProfileStyles = [ "avataaars", @@ -484,7 +496,8 @@ test.describe("Settings Customization Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); + const viewport = singleUserContext.viewport; + const settingsCustomizations = new SettingsCustomizations(page, viewport); // Change current default profile style to lorelei const selectedDefaultStyle = "lorelei"; diff --git a/playwright/specs/10-settings-messages.spec.ts b/playwright/specs/10-settings-messages.spec.ts index 975ef53f..ca52b9dd 100644 --- a/playwright/specs/10-settings-messages.spec.ts +++ b/playwright/specs/10-settings-messages.spec.ts @@ -6,12 +6,13 @@ import { SettingsMessages } from "playwright/PageObjects/Settings/SettingsMessag test.describe("Settings Messages Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonMessages.click(); await page.waitForURL("/settings/messages"); }); @@ -20,7 +21,8 @@ test.describe("Settings Messages Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsMessages = new SettingsMessages(page); + const viewport = singleUserContext.viewport; + const settingsMessages = new SettingsMessages(page, viewport); // Label and texts for settings section are correct await expect(settingsMessages.convertToEmojiSectionLabel).toHaveText( @@ -48,7 +50,8 @@ test.describe("Settings Messages Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsMessages = new SettingsMessages(page); + const viewport = singleUserContext.viewport; + const settingsMessages = new SettingsMessages(page, viewport); // Label and texts for settings section are correct await expect(settingsMessages.markdownSupportSectionLabel).toHaveText( @@ -76,7 +79,8 @@ test.describe("Settings Messages Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsMessages = new SettingsMessages(page); + const viewport = singleUserContext.viewport; + const settingsMessages = new SettingsMessages(page, viewport); // Label and texts for settings section are correct await expect(settingsMessages.spamBotDetectionSectionLabel).toHaveText( diff --git a/playwright/specs/11-settings-audio-video.spec.ts b/playwright/specs/11-settings-audio-video.spec.ts index 29f10ef0..684c268c 100644 --- a/playwright/specs/11-settings-audio-video.spec.ts +++ b/playwright/specs/11-settings-audio-video.spec.ts @@ -6,12 +6,13 @@ import { SettingsAudio } from "playwright/PageObjects/Settings/SettingsAudio"; test.describe("Settings Audio and Video Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonAudioAndVideo.click(); await page.waitForURL("/settings/audio_video"); }); @@ -20,7 +21,8 @@ test.describe("Settings Audio and Video Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAudio = new SettingsAudio(page); + const viewport = singleUserContext.viewport; + const settingsAudio = new SettingsAudio(page, viewport); const expectedInputDevices = ["Default"]; await expect(settingsAudio.inputDeviceSectionLabel).toHaveText( @@ -37,7 +39,8 @@ test.describe("Settings Audio and Video Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAudio = new SettingsAudio(page); + const viewport = singleUserContext.viewport; + const settingsAudio = new SettingsAudio(page, viewport); const expectedOutputDevices = ["Default"]; await expect(settingsAudio.outputDeviceSectionLabel).toHaveText( "Output Device", @@ -53,7 +56,8 @@ test.describe("Settings Audio and Video Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAudio = new SettingsAudio(page); + const viewport = singleUserContext.viewport; + const settingsAudio = new SettingsAudio(page, viewport); // Label and texts for settings section are correct await expect(settingsAudio.echoCancellationSectionLabel).toHaveText( "Echo Cancellation", @@ -80,7 +84,8 @@ test.describe("Settings Audio and Video Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAudio = new SettingsAudio(page); + const viewport = singleUserContext.viewport; + const settingsAudio = new SettingsAudio(page, viewport); // Label and texts for settings section are correct await expect(settingsAudio.interfaceSoundsSectionLabel).toHaveText( "Interface Sounds", @@ -109,7 +114,8 @@ test.describe("Settings Audio and Video Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAudio = new SettingsAudio(page); + const viewport = singleUserContext.viewport; + const settingsAudio = new SettingsAudio(page, viewport); // Label and texts for settings section are correct await expect(settingsAudio.controlSoundsSectionLabel).toHaveText( "Control Sounds", @@ -134,7 +140,8 @@ test.describe("Settings Audio and Video Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAudio = new SettingsAudio(page); + const viewport = singleUserContext.viewport; + const settingsAudio = new SettingsAudio(page, viewport); // Label and texts for settings section are correct await expect(settingsAudio.messageSoundsSectionLabel).toHaveText( "Message Sounds", @@ -159,7 +166,8 @@ test.describe("Settings Audio and Video Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAudio = new SettingsAudio(page); + const viewport = singleUserContext.viewport; + const settingsAudio = new SettingsAudio(page, viewport); // Label and texts for settings section are correct await expect(settingsAudio.callTimerSectionLabel).toHaveText("Call Timer"); await expect(settingsAudio.callTimerSectionText).toHaveText( @@ -182,7 +190,8 @@ test.describe("Settings Audio and Video Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAudio = new SettingsAudio(page); + const viewport = singleUserContext.viewport; + const settingsAudio = new SettingsAudio(page, viewport); await expect(settingsAudio.videoDeviceSectionLabel).toHaveText( "Video Device", ); diff --git a/playwright/specs/12-settings-extensions.spec.ts b/playwright/specs/12-settings-extensions.spec.ts index 042d739f..f4137a5d 100644 --- a/playwright/specs/12-settings-extensions.spec.ts +++ b/playwright/specs/12-settings-extensions.spec.ts @@ -6,12 +6,13 @@ import { SettingsExtensions } from "playwright/PageObjects/Settings/SettingsExte test.describe("Settings Extensions Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonExtensions.click(); await page.waitForURL("/settings/extensions"); }); @@ -20,7 +21,8 @@ test.describe("Settings Extensions Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsExtensions = new SettingsExtensions(page); + const viewport = singleUserContext.viewport; + const settingsExtensions = new SettingsExtensions(page, viewport); await expect(settingsExtensions.installedButton).toBeVisible(); await expect(settingsExtensions.exploreButton).toBeVisible(); diff --git a/playwright/specs/13-settings-keybinds.spec.ts b/playwright/specs/13-settings-keybinds.spec.ts index 022ea1f9..c127fa49 100644 --- a/playwright/specs/13-settings-keybinds.spec.ts +++ b/playwright/specs/13-settings-keybinds.spec.ts @@ -5,15 +5,15 @@ import { SettingsKeybinds } from "playwright/PageObjects/Settings/SettingsKeybin import { FriendsScreen } from "playwright/PageObjects/FriendsScreen"; test.describe("Settings Keybinds Tests", () => { - test.beforeEach(async ({ singleUserContext }, testoptions) => { - const viewport = testoptions.project.name; + test.beforeEach(async ({ singleUserContext }) => { + const viewport = singleUserContext.viewport; if (viewport === "desktop-chrome") { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonKeybinds.click(); await page.waitForURL("/settings/keybinds"); } else { @@ -25,7 +25,8 @@ test.describe("Settings Keybinds Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsKeybinds = new SettingsKeybinds(page); + const viewport = singleUserContext.viewport; + const settingsKeybinds = new SettingsKeybinds(page, viewport); // Validate banner text await expect(settingsKeybinds.bannerText).toHaveText( @@ -86,9 +87,10 @@ test.describe("Settings Keybinds Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsKeybinds = new SettingsKeybinds(page); - const friendsScreen = new FriendsScreen(page); - const settingsProfile = new SettingsProfile(page); + const viewport = singleUserContext.viewport; + const settingsKeybinds = new SettingsKeybinds(page, viewport); + const friendsScreen = new FriendsScreen(page, viewport); + const settingsProfile = new SettingsProfile(page, viewport); // Validate keybind instructions await expect(settingsKeybinds.recordKeybindLabel).toHaveText( @@ -133,7 +135,8 @@ test.describe("Settings Keybinds Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsKeybinds = new SettingsKeybinds(page); + const viewport = singleUserContext.viewport; + const settingsKeybinds = new SettingsKeybinds(page, viewport); const expectedKeybinds = [ "Increase font size within Uplink.", @@ -159,7 +162,8 @@ test.describe("Settings Keybinds Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsKeybinds = new SettingsKeybinds(page); + const viewport = singleUserContext.viewport; + const settingsKeybinds = new SettingsKeybinds(page, viewport); // Setup a keybind and cancel the changes await expect(settingsKeybinds.recordKeybindLabel).toHaveText( @@ -191,7 +195,8 @@ test.describe("Settings Keybinds Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsKeybinds = new SettingsKeybinds(page); + const viewport = singleUserContext.viewport; + const settingsKeybinds = new SettingsKeybinds(page, viewport); // Color before clicking button await expect(settingsKeybinds.newKeybindCancelButton).toHaveCSS( @@ -213,7 +218,8 @@ test.describe("Settings Keybinds Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsKeybinds = new SettingsKeybinds(page); + const viewport = singleUserContext.viewport; + const settingsKeybinds = new SettingsKeybinds(page, viewport); // Setup a keybind and revert the changes const pushToTalkKeybind = @@ -240,7 +246,8 @@ test.describe("Settings Keybinds Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsKeybinds = new SettingsKeybinds(page); + const viewport = singleUserContext.viewport; + const settingsKeybinds = new SettingsKeybinds(page, viewport); // Color before clicking on button await expect(settingsKeybinds.revertKeybindSectionAllButton).toHaveCSS( @@ -262,7 +269,8 @@ test.describe("Settings Keybinds Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsKeybinds = new SettingsKeybinds(page); + const viewport = singleUserContext.viewport; + const settingsKeybinds = new SettingsKeybinds(page, viewport); // Setup a keybind and revert the changes const pushToTalkKeybind = diff --git a/playwright/specs/14-settings-gamepad.spec.ts b/playwright/specs/14-settings-gamepad.spec.ts index 0eed4155..53b35e60 100644 --- a/playwright/specs/14-settings-gamepad.spec.ts +++ b/playwright/specs/14-settings-gamepad.spec.ts @@ -5,12 +5,13 @@ import { SettingsProfile } from "playwright/PageObjects/Settings/SettingsProfile test.describe("Settings Extensions Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonGamepad.click(); await page.waitForURL("/settings/gamepad"); }); @@ -20,6 +21,7 @@ test.describe("Settings Extensions Tests", () => { // singleUserContext, // }) => { // const page = singleUserContext.page; + // const viewport = singleUserContext.viewport; // // Inject JavaScript to simulate gamepad connection and input // await page.evaluate(() => { diff --git a/playwright/specs/15-settings-accessibility.spec.ts b/playwright/specs/15-settings-accessibility.spec.ts index cc8c8ed6..0b490862 100644 --- a/playwright/specs/15-settings-accessibility.spec.ts +++ b/playwright/specs/15-settings-accessibility.spec.ts @@ -6,12 +6,13 @@ import { SettingsAccessibility } from "playwright/PageObjects/Settings/SettingsA test.describe("Settings Accessibility Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonAccessibility.click(); await page.waitForURL("/settings/accessibility"); }); @@ -20,9 +21,10 @@ test.describe("Settings Accessibility Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAccessibility = new SettingsAccessibility(page); - const settingsProfile = new SettingsProfile(page); - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const settingsAccessibility = new SettingsAccessibility(page, viewport); + const settingsProfile = new SettingsProfile(page, viewport); + const chatsMainPage = new ChatsMainPage(page, viewport); // Label and texts for settings section are correct await expect(settingsAccessibility.openDyslexicSectionLabel).toHaveText( diff --git a/playwright/specs/16-settings-notifications.spec.ts b/playwright/specs/16-settings-notifications.spec.ts index 3614c068..df93fec3 100644 --- a/playwright/specs/16-settings-notifications.spec.ts +++ b/playwright/specs/16-settings-notifications.spec.ts @@ -6,12 +6,13 @@ import { SettingsNotifications } from "playwright/PageObjects/Settings/SettingsN test.describe("Settings Notifications Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonNotifications.click(); await page.waitForURL("/settings/notifications"); }); @@ -20,7 +21,8 @@ test.describe("Settings Notifications Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsNotifications = new SettingsNotifications(page); + const viewport = singleUserContext.viewport; + const settingsNotifications = new SettingsNotifications(page, viewport); // Label and texts for settings section are correct await expect(settingsNotifications.enabledSectionLabel).toHaveText( @@ -48,7 +50,8 @@ test.describe("Settings Notifications Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsNotifications = new SettingsNotifications(page); + const viewport = singleUserContext.viewport; + const settingsNotifications = new SettingsNotifications(page, viewport); // Label and texts for settings section are correct await expect(settingsNotifications.friendsSectionLabel).toHaveText( @@ -76,7 +79,8 @@ test.describe("Settings Notifications Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsNotifications = new SettingsNotifications(page); + const viewport = singleUserContext.viewport; + const settingsNotifications = new SettingsNotifications(page, viewport); // Label and texts for settings section are correct await expect(settingsNotifications.messagesSectionLabel).toHaveText( @@ -104,7 +108,8 @@ test.describe("Settings Notifications Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsNotifications = new SettingsNotifications(page); + const viewport = singleUserContext.viewport; + const settingsNotifications = new SettingsNotifications(page, viewport); // Label and texts for settings section are correct await expect(settingsNotifications.settingsSectionLabel).toHaveText( diff --git a/playwright/specs/17-settings-network.spec.ts b/playwright/specs/17-settings-network.spec.ts index 2b821d30..a4548018 100644 --- a/playwright/specs/17-settings-network.spec.ts +++ b/playwright/specs/17-settings-network.spec.ts @@ -5,12 +5,13 @@ import { SettingsProfile } from "playwright/PageObjects/Settings/SettingsProfile test.describe("Settings Network Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonNetwork.click(); }); diff --git a/playwright/specs/18-settings-about.spec.ts b/playwright/specs/18-settings-about.spec.ts index dec6d72f..de48ba21 100644 --- a/playwright/specs/18-settings-about.spec.ts +++ b/playwright/specs/18-settings-about.spec.ts @@ -10,12 +10,13 @@ test.describe("Settings About Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonAbout.click(); await page.waitForURL("/settings/about"); }); @@ -24,7 +25,8 @@ test.describe("Settings About Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); // Label and texts for settings section are correct await expect(settingsAbout.aboutSectionLabel).toHaveText("About"); @@ -35,7 +37,8 @@ test.describe("Settings About Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); // Label and texts for settings section are correct await expect(settingsAbout.versionSectionLabel).toHaveText("Version"); @@ -47,7 +50,8 @@ test.describe("Settings About Tests", () => { // singleUserContext, // }) => { // const page = singleUserContext.page; - // const settingsAbout = new SettingsAbout(page); + // const viewport = singleUserContext.viewport; + // const settingsAbout = new SettingsAbout(page, viewport); // await settingsAbout.versionSectionButton.click(); // }); @@ -56,7 +60,8 @@ test.describe("Settings About Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); // Label and texts for settings section are correct await expect(settingsAbout.websiteSectionLabel).toHaveText("Website"); @@ -76,7 +81,8 @@ test.describe("Settings About Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); // Label and texts for settings section are correct await expect(settingsAbout.openSourceCodeSectionLabel).toHaveText( @@ -98,7 +104,8 @@ test.describe("Settings About Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); // Label and texts for settings section are correct await expect(settingsAbout.madeInSectionLabel).toHaveText("Made In"); @@ -114,7 +121,8 @@ test.describe("Settings About Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); // Label and texts for settings section are correct await expect(settingsAbout.devModeSectionLabel).toHaveText("Dev Mode"); diff --git a/playwright/specs/19-settings-licenses.spec.ts b/playwright/specs/19-settings-licenses.spec.ts index 8014ba0f..08422fcf 100644 --- a/playwright/specs/19-settings-licenses.spec.ts +++ b/playwright/specs/19-settings-licenses.spec.ts @@ -6,12 +6,13 @@ import { SettingsLicenses } from "playwright/PageObjects/Settings/SettingsLicens test.describe("Settings Licenses Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonLicenses.click(); await page.waitForURL("/settings/licenses"); }); @@ -20,7 +21,8 @@ test.describe("Settings Licenses Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsLicenses = new SettingsLicenses(page); + const viewport = singleUserContext.viewport; + const settingsLicenses = new SettingsLicenses(page, viewport); // Declare the page object implementations and constants const LICENSE_URL = diff --git a/playwright/specs/20-settings-developer.spec.ts b/playwright/specs/20-settings-developer.spec.ts index dd89bddd..5ce833ac 100644 --- a/playwright/specs/20-settings-developer.spec.ts +++ b/playwright/specs/20-settings-developer.spec.ts @@ -7,12 +7,13 @@ import { SettingsDeveloper } from "playwright/PageObjects/Settings/SettingsDevel test.describe("Settings Developer Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToSettings(); await page.waitForURL("/settings/profile"); - const settingsProfile = new SettingsProfile(page); + const settingsProfile = new SettingsProfile(page, viewport); await settingsProfile.buttonAbout.click(); await page.waitForURL("/settings/about"); }); @@ -21,8 +22,9 @@ test.describe("Settings Developer Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); - const settingsDeveloper = new SettingsDeveloper(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); + const settingsDeveloper = new SettingsDeveloper(page, viewport); // Open DevMode await settingsAbout.openDevModeSection(); @@ -44,8 +46,9 @@ test.describe("Settings Developer Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); - const settingsDeveloper = new SettingsDeveloper(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); + const settingsDeveloper = new SettingsDeveloper(page, viewport); // Open DevMode await settingsAbout.openDevModeSection(); @@ -75,8 +78,9 @@ test.describe("Settings Developer Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); - const settingsDeveloper = new SettingsDeveloper(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); + const settingsDeveloper = new SettingsDeveloper(page, viewport); // Open DevMode await settingsAbout.openDevModeSection(); @@ -97,8 +101,9 @@ test.describe("Settings Developer Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); - const settingsDeveloper = new SettingsDeveloper(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); + const settingsDeveloper = new SettingsDeveloper(page, viewport); // Open DevMode await settingsAbout.openDevModeSection(); @@ -117,8 +122,9 @@ test.describe("Settings Developer Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); - const settingsDeveloper = new SettingsDeveloper(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); + const settingsDeveloper = new SettingsDeveloper(page, viewport); // Open DevMode await settingsAbout.openDevModeSection(); @@ -137,8 +143,9 @@ test.describe("Settings Developer Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); - const settingsDeveloper = new SettingsDeveloper(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); + const settingsDeveloper = new SettingsDeveloper(page, viewport); // Open DevMode await settingsAbout.openDevModeSection(); @@ -157,8 +164,9 @@ test.describe("Settings Developer Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsAbout = new SettingsAbout(page); - const settingsDeveloper = new SettingsDeveloper(page); + const viewport = singleUserContext.viewport; + const settingsAbout = new SettingsAbout(page, viewport); + const settingsDeveloper = new SettingsDeveloper(page, viewport); // Open DevMode await settingsAbout.openDevModeSection(); diff --git a/playwright/specs/23-files-sidebar.spec.ts b/playwright/specs/23-files-sidebar.spec.ts index b26b6193..5906b122 100644 --- a/playwright/specs/23-files-sidebar.spec.ts +++ b/playwright/specs/23-files-sidebar.spec.ts @@ -4,7 +4,8 @@ import { test } from "../fixtures/setup"; test.describe("Files Sidebar Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToFiles(); await page.waitForURL("/files"); diff --git a/playwright/specs/24-files.spec.ts b/playwright/specs/24-files.spec.ts index 4a073122..42c85e4a 100644 --- a/playwright/specs/24-files.spec.ts +++ b/playwright/specs/24-files.spec.ts @@ -7,7 +7,8 @@ import { LoginPinPage } from "playwright/PageObjects/LoginPin"; test.describe("Files Page Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToFiles(); await page.waitForURL("/files"); @@ -17,7 +18,8 @@ test.describe("Files Page Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const filesPage = new FilesPage(page); + const viewport = singleUserContext.viewport; + const filesPage = new FilesPage(page, viewport); // Validate Free and Total space data await filesPage.validateFreeSpaceInfo("2.15 GB"); @@ -56,7 +58,8 @@ test.describe("Files Page Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const filesPage = new FilesPage(page); + const viewport = singleUserContext.viewport; + const filesPage = new FilesPage(page, viewport); // Validate border color when user clicks on New Folder button await expect(filesPage.newFolderButton).toHaveCSS( @@ -74,7 +77,8 @@ test.describe("Files Page Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const filesPage = new FilesPage(page); + const viewport = singleUserContext.viewport; + const filesPage = new FilesPage(page, viewport); // User can upload an image file await filesPage.uploadFile("playwright/assets/banner.jpg"); @@ -87,7 +91,8 @@ test.describe("Files Page Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const filesPage = new FilesPage(page); + const viewport = singleUserContext.viewport; + const filesPage = new FilesPage(page, viewport); // User can create folders on root await filesPage.createNewFolder("NewFolder"); @@ -98,7 +103,8 @@ test.describe("Files Page Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const filesPage = new FilesPage(page); + const viewport = singleUserContext.viewport; + const filesPage = new FilesPage(page, viewport); // Empty folders are named as undefined await filesPage.newFolderButton.click(); @@ -111,7 +117,8 @@ test.describe("Files Page Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const filesPage = new FilesPage(page); + const viewport = singleUserContext.viewport; + const filesPage = new FilesPage(page, viewport); // Create a folder await filesPage.createNewFolder("NewFolder"); @@ -133,7 +140,8 @@ test.describe("Files Page Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const filesPage = new FilesPage(page); + const viewport = singleUserContext.viewport; + const filesPage = new FilesPage(page, viewport); // Create a folder await filesPage.createNewFolder("NewFolder"); @@ -154,7 +162,8 @@ test.describe("Files Page Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const filesPage = new FilesPage(page); + const viewport = singleUserContext.viewport; + const filesPage = new FilesPage(page, viewport); // Create a folder in root and enter on it await filesPage.createNewFolder("NewFolder"); @@ -175,10 +184,11 @@ test.describe("Files Page Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const filesPage = new FilesPage(page); - const settingsProfile = new SettingsProfile(page); - const loginPinPage = new LoginPinPage(page); - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const filesPage = new FilesPage(page, viewport); + const settingsProfile = new SettingsProfile(page, viewport); + const loginPinPage = new LoginPinPage(page, viewport); + const chatsMainPage = new ChatsMainPage(page, viewport); // User can upload an image file in root await filesPage.uploadFile("playwright/assets/banner.jpg"); @@ -218,7 +228,8 @@ test.describe("Files Page Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const filesPage = new FilesPage(page); + const viewport = singleUserContext.viewport; + const filesPage = new FilesPage(page, viewport); // Upload a file await filesPage.uploadFile("playwright/assets/banner.jpg"); diff --git a/playwright/specs/25-wallet.spec.ts b/playwright/specs/25-wallet.spec.ts index babe62d2..0df9d9b1 100644 --- a/playwright/specs/25-wallet.spec.ts +++ b/playwright/specs/25-wallet.spec.ts @@ -4,7 +4,8 @@ import { test } from "../fixtures/setup"; test.describe("Wallet Tests", () => { test.beforeEach(async ({ singleUserContext }) => { const page = singleUserContext.page; - const chatsMainPage = new ChatsMainPage(page); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.dismissDownloadAlert(); await chatsMainPage.goToWallet(); await page.waitForURL("/wallet");