|
| 1 | +/* |
| 2 | +Copyright 2022 The Matrix.org Foundation C.I.C. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +/// <reference types="cypress" /> |
| 18 | + |
| 19 | +import { MatrixClient } from "../../global"; |
| 20 | +import { SynapseInstance } from "../../plugins/synapsedocker"; |
| 21 | + |
| 22 | +describe("User Onboarding (new user)", () => { |
| 23 | + let synapse: SynapseInstance; |
| 24 | + |
| 25 | + const bot1Name = "BotBob"; |
| 26 | + let bot1: MatrixClient; |
| 27 | + |
| 28 | + beforeEach(() => { |
| 29 | + cy.startSynapse("default").then(data => { |
| 30 | + synapse = data; |
| 31 | + cy.initTestUser(synapse, "Jane Doe"); |
| 32 | + cy.window({ log: false }).then(win => { |
| 33 | + win.localStorage.setItem("mx_registration_time", "1656633601"); |
| 34 | + }); |
| 35 | + cy.reload().then(() => { |
| 36 | + // wait for the app to load |
| 37 | + return cy.get(".mx_MatrixChat", { timeout: 15000 }); |
| 38 | + }); |
| 39 | + cy.getBot(synapse, { displayName: bot1Name }).then(_bot1 => { |
| 40 | + bot1 = _bot1; |
| 41 | + }); |
| 42 | + cy.get('.mx_UserOnboardingPage').should('exist'); |
| 43 | + }); |
| 44 | + }); |
| 45 | + |
| 46 | + afterEach(() => { |
| 47 | + cy.stopSynapse(synapse); |
| 48 | + }); |
| 49 | + |
| 50 | + it("page is shown", () => { |
| 51 | + cy.get('.mx_UserOnboardingPage').should('exist'); |
| 52 | + cy.percySnapshot("User onboarding page"); |
| 53 | + }); |
| 54 | + |
| 55 | + it("using find friends action should increase progress", () => { |
| 56 | + cy.get(".mx_ProgressBar").invoke("val").then((oldProgress) => { |
| 57 | + const findPeopleAction = cy.contains(".mx_UserOnboardingTask_action", "Find friends"); |
| 58 | + expect(findPeopleAction).to.exist; |
| 59 | + findPeopleAction.click(); |
| 60 | + cy.get(".mx_InviteDialog_editor input").type(bot1.getUserId()); |
| 61 | + cy.get(".mx_InviteDialog_buttonAndSpinner").click(); |
| 62 | + cy.get(".mx_InviteDialog_buttonAndSpinner").should("not.exist"); |
| 63 | + cy.visit("/#/home"); |
| 64 | + |
| 65 | + cy.get(".mx_ProgressBar").invoke("val").should("be.greaterThan", oldProgress); |
| 66 | + }); |
| 67 | + }); |
| 68 | +}); |
0 commit comments