|
| 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 { SynapseInstance } from "../../plugins/synapsedocker"; |
| 20 | + |
| 21 | +describe("Login", () => { |
| 22 | + let synapse: SynapseInstance; |
| 23 | + |
| 24 | + beforeEach(() => { |
| 25 | + cy.visit("/#/login"); |
| 26 | + cy.startSynapse("consent").then(data => { |
| 27 | + synapse = data; |
| 28 | + }); |
| 29 | + }); |
| 30 | + |
| 31 | + afterEach(() => { |
| 32 | + cy.stopSynapse(synapse); |
| 33 | + }); |
| 34 | + |
| 35 | + describe("m.login.password", () => { |
| 36 | + const username = "user1234"; |
| 37 | + const password = "p4s5W0rD"; |
| 38 | + |
| 39 | + beforeEach(() => { |
| 40 | + cy.registerUser(synapse, username, password); |
| 41 | + }); |
| 42 | + |
| 43 | + it("logs in with an existing account and lands on the home screen", () => { |
| 44 | + cy.get(".mx_ServerPicker_change", { timeout: 15000 }).click(); |
| 45 | + cy.get(".mx_ServerPickerDialog_otherHomeserver").type(synapse.baseUrl); |
| 46 | + cy.get(".mx_ServerPickerDialog_continue").click(); |
| 47 | + // wait for the dialog to go away |
| 48 | + cy.get('.mx_ServerPickerDialog').should('not.exist'); |
| 49 | + |
| 50 | + cy.get("#mx_LoginForm_username").type(username); |
| 51 | + cy.get("#mx_LoginForm_password").type(password); |
| 52 | + cy.get(".mx_Login_submit").click(); |
| 53 | + |
| 54 | + cy.url().should('contain', '/#/home'); |
| 55 | + }); |
| 56 | + }); |
| 57 | +}); |
0 commit comments