login_spec.js (817B)
1 import {fake_matrix_api_handler} from './matrix-fake-api'; 2 import {login} from "./utils"; 3 describe('LoginPage', () => { 4 5 beforeEach(function () { 6 // We use cy.visit({onBeforeLoad: ...}) to stub 7 // window.fetch before any app code runs 8 cy.visit('/', { 9 onBeforeLoad(win) { 10 let fetch = win.fetch; 11 cy.stub(win, 'fetch') 12 .callsFake(args => fake_matrix_api_handler(args, fetch, win)); 13 }, 14 }) 15 }) 16 17 it('Does login', () => { 18 login() 19 // First show spinner 20 cy.get('svg#loading').should('be.visible'); 21 // Now it should be gone and instead we see the roomlist 22 cy.get('svg#loading').should('not.be.visible'); 23 cy.get('ul.scrollable').should('be.visible'); 24 }) 25 })