diff --git a/tests/helpers/commandsNewUser.ts b/tests/helpers/commandsNewUser.ts index d5ad250637..7876b5215f 100644 --- a/tests/helpers/commandsNewUser.ts +++ b/tests/helpers/commandsNewUser.ts @@ -36,8 +36,4 @@ export async function createNewUser( // Ensure Main Screen is displayed await WelcomeScreen.welcomeLayout.waitForExist({ timeout: 60000 }); - - // Workaround to ensure that user clicks on Add Someone - await WelcomeScreen.clickAddSomeone(); - await FriendsScreen.friendsBody.waitForExist(); } diff --git a/tests/helpers/debugging.ts b/tests/helpers/debugging.ts index bb4413f776..fb6e7e2732 100644 --- a/tests/helpers/debugging.ts +++ b/tests/helpers/debugging.ts @@ -147,6 +147,6 @@ export async function setupBeforeCreateGroupTests() { export async function setupBeforeSettingsTests() { await createNewUser("Test123"); - await FriendsScreen.goToSettings(); + await WelcomeScreen.goToSettings(); await SettingsProfileScreen.waitForIsShown(true); } diff --git a/tests/specs/reusable-accounts/00-create-three-instances.spec.ts b/tests/specs/reusable-accounts/00-create-three-instances.spec.ts new file mode 100644 index 0000000000..232bfbd219 --- /dev/null +++ b/tests/specs/reusable-accounts/00-create-three-instances.spec.ts @@ -0,0 +1,46 @@ +require("module-alias/register"); +import { createNewUser } from "@helpers/commandsNewUser"; +import { + closeFirstApplication, + closeSecondApplication, + closeThirdApplication, + launchSecondApplication, + launchThirdApplication, +} from "@helpers/commands"; +import CreatePinScreen from "@screenobjects/account-creation/CreatePinScreen"; +import WelcomeScreen from "@screenobjects/welcome-screen/WelcomeScreen"; + +export default async function createChatAccountsTests() { + it("Chats Tests - Create account for first instance", async () => { + // Launch first application and Create a new account to show Welcome Screen + await CreatePinScreen.waitForIsShown(true); + const username = "ChatUserA"; + await createNewUser(username); + await WelcomeScreen.waitForIsShown(true); + + // Close first application + await closeFirstApplication(); + }); + + it("Chats Tests - Create account for second instance", async () => { + // Launch second application and Create a new account to show Welcome Screen + await launchSecondApplication(); + await CreatePinScreen.waitForIsShown(true); + await createNewUser("ChatUserB"); + await WelcomeScreen.waitForIsShown(true); + + // Close second application + await closeSecondApplication(); + }); + + it("Chats Tests - Create account for third instance", async () => { + // Launch third application and Create a new account to show Welcome Screen + await launchThirdApplication(); + await CreatePinScreen.waitForIsShown(true); + await createNewUser("ChatUserC"); + await WelcomeScreen.waitForIsShown(true); + + // Close third application + await closeThirdApplication(); + }); +} diff --git a/tests/specs/reusable-accounts/01-create-accounts-and-friends.spec.ts b/tests/specs/reusable-accounts/01-create-accounts-and-friends.spec.ts index 54e5912cae..6f8ba2a0ce 100644 --- a/tests/specs/reusable-accounts/01-create-accounts-and-friends.spec.ts +++ b/tests/specs/reusable-accounts/01-create-accounts-and-friends.spec.ts @@ -1,11 +1,11 @@ require("module-alias/register"); -import { createNewUser } from "@helpers/commandsNewUser"; import { activateFirstApplication, activateSecondApplication, closeFirstApplication, closeSecondApplication, getUserKey, + launchFirstApplication, launchSecondApplication, saveTestKeys, scrollDown, @@ -28,12 +28,17 @@ import SettingsNotificationsScreen from "@screenobjects/settings/SettingsNotific import SettingsProfileScreen from "@screenobjects/settings/SettingsProfileScreen"; import WelcomeScreen from "@screenobjects/welcome-screen/WelcomeScreen"; -export default async function createChatAccountsTests() { +export default async function chatsFriendsRequests() { + before(async () => { + await launchSecondApplication(); + await CreatePinScreen.loginWithTestUser(); + await launchFirstApplication(); + await CreatePinScreen.loginWithTestUser(); + }); + it("Chat User A - Create Account", async () => { - // Create a new account and go to Settings Profile - await CreatePinScreen.waitForIsShown(true); + // Continue setting up first account created const username = "ChatUserA"; - await createNewUser(username); await WelcomeScreen.goToSettings(); await SettingsProfileScreen.validateSettingsProfileIsShown(); @@ -99,16 +104,9 @@ export default async function createChatAccountsTests() { await FriendsScreen.validateFriendsScreenIsShown(); }); - it("Chat User B - Create Account", async () => { - // Launch second application - await launchSecondApplication(); - - // Create a new account and go to Settings Profile - await CreatePinScreen.waitForIsShown(true); - await createNewUser("ChatUserB"); - }); - it("Chat User B - Save Did Key from User", async () => { + // Activate second application and continue setting up second account + await activateSecondApplication(); await WelcomeScreen.goToSettings(); await SettingsProfileScreen.validateSettingsProfileIsShown(); diff --git a/tests/specs/reusable-accounts/12-group-chats-multiple-users.spec.ts b/tests/specs/reusable-accounts/12-group-chats-multiple-users.spec.ts index ee63c6cf89..43f3d5e5a0 100644 --- a/tests/specs/reusable-accounts/12-group-chats-multiple-users.spec.ts +++ b/tests/specs/reusable-accounts/12-group-chats-multiple-users.spec.ts @@ -8,7 +8,6 @@ import SettingsGeneralScreen from "@screenobjects/settings/SettingsGeneralScreen import SettingsNotificationsScreen from "@screenobjects/settings/SettingsNotificationsScreen"; import SettingsProfileScreen from "@screenobjects/settings/SettingsProfileScreen"; import WelcomeScreen from "@screenobjects/welcome-screen/WelcomeScreen"; -import { createNewUser } from "@helpers/commandsNewUser"; import { activateFirstApplication, activateThirdApplication, @@ -25,16 +24,12 @@ export default async function groupChatMultipleUsersTests() { before(async () => { await launchFirstApplication(); await CreatePinScreen.loginWithTestUser(); + await launchThirdApplication(); + await CreatePinScreen.loginWithTestUser(); }); it("Chat User C - Create Account", async () => { - // Launch third application - await launchThirdApplication(); - - // Create a new account and go to Settings Profile - await CreatePinScreen.waitForIsShown(true); - const username = "ChatUserC"; - await createNewUser(username); + // Continue setting up third account await WelcomeScreen.goToSettings(); await SettingsProfileScreen.validateSettingsProfileIsShown(); diff --git a/tests/suites/Chats/01-Chats.suite.ts b/tests/suites/Chats/01-Chats.suite.ts index 405d665b9c..331bb0cdb6 100644 --- a/tests/suites/Chats/01-Chats.suite.ts +++ b/tests/suites/Chats/01-Chats.suite.ts @@ -1,18 +1,20 @@ require("module-alias/register"); -import chatTopbarTests from "@specs/reusable-accounts/06-chat-topbar.spec"; -import createChatAccountsTests from "@specs/reusable-accounts/01-create-accounts-and-friends.spec"; -import groupChatTests from "@specs/reusable-accounts/09-group-chats.spec"; -import groupChatEditTests from "@specs/reusable-accounts/10-group-chats-edit.spec"; -import groupChatSidebarTests from "@specs/reusable-accounts/11-group-chats-sidebar.spec"; -import messageAttachmentsTests from "@specs/reusable-accounts/05-message-attachments.spec"; +import createChatAccountsTests from "@specs/reusable-accounts/00-create-three-instances.spec"; +import chatsFriendsRequests from "@specs/reusable-accounts/01-create-accounts-and-friends.spec"; +import repliesTests from "@specs/reusable-accounts/02-chat-replies.spec"; import messageContextMenuTests from "@specs/reusable-accounts/03-message-context-menu.spec"; import messageInputTests from "@specs/reusable-accounts/04-message-input.spec"; -import repliesTests from "@specs/reusable-accounts/02-chat-replies.spec"; +import messageAttachmentsTests from "@specs/reusable-accounts/05-message-attachments.spec"; +import chatTopbarTests from "@specs/reusable-accounts/06-chat-topbar.spec"; import quickProfileTests from "@specs/reusable-accounts/07-quick-profile.spec"; import sidebarChatsTests from "@specs/reusable-accounts/08-sidebar-chats.spec"; +import groupChatTests from "@specs/reusable-accounts/09-group-chats.spec"; +import groupChatEditTests from "@specs/reusable-accounts/10-group-chats-edit.spec"; +import groupChatSidebarTests from "@specs/reusable-accounts/11-group-chats-sidebar.spec"; import groupChatMultipleUsersTests from "@specs/reusable-accounts/12-group-chats-multiple-users.spec"; -describe("Create Accounts and Chat Tests", createChatAccountsTests.bind(this)); +describe("Create Accounts for Chats Tests", createChatAccountsTests.bind(this)); +describe("Friend Requests and Messages Tests", chatsFriendsRequests.bind(this)); describe("Chat Replies Tests", repliesTests.bind(this)); describe("Message Context Menu Tests", messageContextMenuTests.bind(this)); describe("Message Input Tests", messageInputTests.bind(this));