diff --git a/playwright.config.ts b/playwright.config.ts index d13d97e..6bf78ff 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -46,14 +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. */ + // Mobile Chrome (Pixel 5) // { - // name: 'Mobile Chrome', - // use: { ...devices['Pixel 5'] }, + // 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', diff --git a/playwright/PageObjects/AuthNewAccount.ts b/playwright/PageObjects/AuthNewAccount.ts index 12e42c3..3b4c20c 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 36e281e..fc3920e 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 b2c33e9..4933d92 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 5bea6c2..1256742 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 f52fcf1..bf64f51 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 7ac4eb2..384bc07 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 1074758..042d0e8 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 3fd4996..33df0fb 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 5b63c1f..7fbd01c 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 54b02cf..0b37af7 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 2684c0c..ddcef40 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 71ad1ba..ef3e754 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; @@ -41,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"); @@ -52,6 +59,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 +197,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/PageObjects/LoginPin.ts b/playwright/PageObjects/LoginPin.ts index ffb2c50..802724d 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 3c9eb8a..f22a8ff 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 inputSidebarSearchContainer: Locator; readonly navigationBar: Locator; @@ -34,15 +36,22 @@ 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") + .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("slimbar") + .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"); @@ -67,6 +76,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") .locator("input"); @@ -119,6 +129,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( @@ -143,25 +158,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/PreLoadingScreen.ts b/playwright/PageObjects/PreLoadingScreen.ts index 55fdbc9..b259ed1 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 1c2cfbe..ba34818 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 176121d..e60a608 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 aaa6792..c3336df 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 f747ab1..fd9eee8 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 c0f21fe..5dad390 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 995b44f..dbceefe 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 0742798..388aebf 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 d0b3ec5..35d9dcc 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 c35c330..c81fb30 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 e604367..4ba3646 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 e07d1fb..8b2583c 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 31149e8..484d826 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 7fd0c23..57e78c0 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 a9b75f9..09b23fe 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 0371a3a..7e77e3e 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 778b346..98f7fa5 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 411a1a3..9661881 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", ); @@ -396,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/PageObjects/Settings/SettingsRealms.ts b/playwright/PageObjects/Settings/SettingsRealms.ts index 327bd39..f3a2472 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 4fbeed1..659e155 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 e95cafd..1d639b5 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 a08618c..d741050 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 1e3b483..536333e 100644 --- a/playwright/specs/02-friends-one-instance.spec.ts +++ b/playwright/specs/02-friends-one-instance.spec.ts @@ -5,9 +5,11 @@ 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(); await chatsMainPage.goToFriends(); }); @@ -15,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(); @@ -111,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 @@ -173,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 11e03ab..768ac0b 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 6e54110..96dbba2 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 ab9abdb..7b4ecd6 100644 --- a/playwright/specs/05-chats-sidebar.spec.ts +++ b/playwright/specs/05-chats-sidebar.spec.ts @@ -2,14 +2,21 @@ 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 viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); + 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); + const viewport = singleUserContext.viewport; + const chatsMainPage = new ChatsMainPage(page, viewport); await chatsMainPage.buttonCreateGroupChat.click(); - await expect(chatsMainPage.createGroupLabelGroupName).toBeVisible(); await expect(chatsMainPage.createGroupLabelGroupName).toHaveText( "Group name:", @@ -28,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( @@ -41,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(); @@ -79,7 +88,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.buttonHideSidebar.click(); @@ -89,6 +99,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" }); @@ -99,34 +114,41 @@ 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); - // 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 ({ 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 400019c..bf5b5de 100644 --- a/playwright/specs/07-settings-profile.spec.ts +++ b/playwright/specs/07-settings-profile.spec.ts @@ -8,16 +8,24 @@ test.describe("Settings Profile 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"); + + // Hide sidebar if viewport is Mobile Chrome + if (viewport === "mobile-chrome") { + await chatsMainPage.buttonHideSidebar.click(); + } }); test("I1 - Banner Picture - Tooltip displayed", async ({ 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(); @@ -31,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"); @@ -41,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 @@ -59,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(); @@ -78,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( @@ -91,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"]); @@ -121,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"]); @@ -165,8 +179,9 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); - const chatsMainPage = new ChatsMainPage(page); + 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"; @@ -195,15 +210,30 @@ 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") { + 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") { + await settingsProfile.buttonHideSidebar.click(); + } await expect(settingsProfile.inputSettingsProfileUsername).toHaveValue( newUsername, ); @@ -213,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( @@ -225,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(); @@ -242,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(); @@ -278,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(); @@ -295,8 +329,9 @@ test.describe("Settings Profile Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsProfile = new SettingsProfile(page); - const chatsMainPage = new ChatsMainPage(page); + 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"; @@ -325,15 +360,30 @@ 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") { + 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") { + await settingsProfile.buttonHideSidebar.click(); + } await expect(settingsProfile.inputSettingsProfileStatus).toHaveValue( newStatus, ); @@ -343,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( @@ -355,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(); @@ -372,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"); @@ -395,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"); @@ -418,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( @@ -445,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"]); @@ -468,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( @@ -502,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 ca85134..0fd4d29 100644 --- a/playwright/specs/08-settings-inventory.spec.ts +++ b/playwright/specs/08-settings-inventory.spec.ts @@ -6,11 +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"); }); @@ -20,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" }, @@ -50,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"); @@ -80,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 47b2136..5cd56f4 100644 --- a/playwright/specs/09-settings-customizations.spec.ts +++ b/playwright/specs/09-settings-customizations.spec.ts @@ -6,11 +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"); }); @@ -19,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", @@ -38,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", @@ -76,7 +80,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 selectedFont = "JosefinSans"; await settingsCustomizations.selectFont(selectedFont); @@ -84,6 +89,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); @@ -96,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", @@ -124,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", @@ -145,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( @@ -173,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"]; @@ -227,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", @@ -263,12 +278,20 @@ 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); + 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\)|color\(srgb 0.371765 0.371765 1\)/, ); + + if (viewport === "mobile-chrome") { + await settingsCustomizations.buttonHideSidebar.click(); + } await settingsCustomizations.primaryColorSectionPopUpButton.click(); const customColorInput = @@ -283,10 +306,17 @@ 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\)|color\(srgb 1 0.604706 0.749412\)/, ); }); @@ -294,14 +324,26 @@ test.describe("Settings Customization Tests", () => { singleUserContext, }) => { const page = singleUserContext.page; - const settingsCustomizations = new SettingsCustomizations(page); - const chatsMainPage = new ChatsMainPage(page); + 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", - "color(srgb 0.371765 0.371765 1)", + /rgb\(77, 77, 255\)|color\(srgb 0.371765 0.371765 1\)/, ); + + 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)", @@ -317,13 +359,20 @@ 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); + 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", ); @@ -335,12 +384,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", @@ -353,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", @@ -382,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); @@ -400,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", @@ -438,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 7dc291d..ca52b9d 100644 --- a/playwright/specs/10-settings-messages.spec.ts +++ b/playwright/specs/10-settings-messages.spec.ts @@ -6,11 +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"); }); @@ -19,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( @@ -47,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( @@ -75,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 22e5732..684c268 100644 --- a/playwright/specs/11-settings-audio-video.spec.ts +++ b/playwright/specs/11-settings-audio-video.spec.ts @@ -6,11 +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"); }); @@ -19,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( @@ -36,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", @@ -52,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", @@ -79,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", @@ -108,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", @@ -133,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", @@ -158,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( @@ -181,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 780d376..f4137a5 100644 --- a/playwright/specs/12-settings-extensions.spec.ts +++ b/playwright/specs/12-settings-extensions.spec.ts @@ -6,11 +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"); }); @@ -19,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 5bcf78a..c127fa4 100644 --- a/playwright/specs/13-settings-keybinds.spec.ts +++ b/playwright/specs/13-settings-keybinds.spec.ts @@ -6,21 +6,27 @@ 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"); + const viewport = singleUserContext.viewport; + if (viewport === "desktop-chrome") { + const page = singleUserContext.page; + const chatsMainPage = new ChatsMainPage(page, viewport); + await chatsMainPage.goToSettings(); + await page.waitForURL("/settings/profile"); + + const settingsProfile = new SettingsProfile(page, viewport); + 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 ({ 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( @@ -81,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( @@ -128,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.", @@ -154,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( @@ -186,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( @@ -208,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 = @@ -235,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( @@ -257,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 afd8c32..53b35e6 100644 --- a/playwright/specs/14-settings-gamepad.spec.ts +++ b/playwright/specs/14-settings-gamepad.spec.ts @@ -5,11 +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"); }); @@ -19,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 84df60b..0b49086 100644 --- a/playwright/specs/15-settings-accessibility.spec.ts +++ b/playwright/specs/15-settings-accessibility.spec.ts @@ -6,11 +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"); }); @@ -19,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 1d12c65..df93fec 100644 --- a/playwright/specs/16-settings-notifications.spec.ts +++ b/playwright/specs/16-settings-notifications.spec.ts @@ -6,11 +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"); }); @@ -19,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( @@ -47,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( @@ -75,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( @@ -103,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 9ce6d8d..a454801 100644 --- a/playwright/specs/17-settings-network.spec.ts +++ b/playwright/specs/17-settings-network.spec.ts @@ -5,11 +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 f24aac0..de48ba2 100644 --- a/playwright/specs/18-settings-about.spec.ts +++ b/playwright/specs/18-settings-about.spec.ts @@ -10,11 +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"); }); @@ -23,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"); @@ -34,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"); @@ -46,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(); // }); @@ -55,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"); @@ -75,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( @@ -97,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"); @@ -113,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 9533c8a..08422fc 100644 --- a/playwright/specs/19-settings-licenses.spec.ts +++ b/playwright/specs/19-settings-licenses.spec.ts @@ -6,11 +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"); }); @@ -19,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 2165619..5ce833a 100644 --- a/playwright/specs/20-settings-developer.spec.ts +++ b/playwright/specs/20-settings-developer.spec.ts @@ -7,11 +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"); }); @@ -20,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(); @@ -43,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(); @@ -74,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(); @@ -96,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(); @@ -116,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(); @@ -136,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(); @@ -156,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 b909b88..5906b12 100644 --- a/playwright/specs/23-files-sidebar.spec.ts +++ b/playwright/specs/23-files-sidebar.spec.ts @@ -4,7 +4,9 @@ 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 c890cfe..42c85e4 100644 --- a/playwright/specs/24-files.spec.ts +++ b/playwright/specs/24-files.spec.ts @@ -7,7 +7,9 @@ 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"); }); @@ -16,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"); @@ -55,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( @@ -73,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"); @@ -86,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"); @@ -97,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(); @@ -110,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"); @@ -132,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"); @@ -153,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"); @@ -174,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"); @@ -217,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 f65f0a7..0df9d9b 100644 --- a/playwright/specs/25-wallet.spec.ts +++ b/playwright/specs/25-wallet.spec.ts @@ -4,7 +4,9 @@ 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"); });