daydream

A small matrix web client written in rust
git clone git://archive.git.mtrnord.blog/daydream-mx/daydream.git
Log | Files | Refs | README | LICENSE

roomlist_spec.js (1592B)


      1 import {fake_matrix_api_handler} from "./matrix-fake-api";
      2 import {login} from "./utils";
      3 
      4 describe('RoomList', () => {
      5     const name_of_user = "Alice Margatroid";
      6     beforeEach(function () {
      7         // We use cy.visit({onBeforeLoad: ...}) to stub
      8         // window.fetch before any app code runs
      9         cy.visit('/', {
     10             onBeforeLoad(win) {
     11                 let fetch = win.fetch;
     12                 cy.stub(win, 'fetch')
     13                     .callsFake(args => fake_matrix_api_handler(args, fetch, win));
     14             },
     15         })
     16     });
     17 
     18     it("does allow clicking a room", () => {
     19         login();
     20         cy.get('ul.scrollable').contains(name_of_user).click();
     21 
     22         cy.log('check if the room title is shown after click');
     23         cy.get('h1').contains(name_of_user).should('be.visible');
     24     });
     25 
     26     it("should allow searching", () => {
     27         login();
     28 
     29         cy.log('check if the room is not shown if anything else is in the search');
     30         cy.get('input.uk-search-input').clear().type("blub");
     31         cy.get("ul.scrollable").contains(name_of_user).should("not.exist");
     32 
     33         cy.log('check if the room is shown if a part of the name is in the search');
     34         cy.get('input.uk-search-input').clear().type("Alice");
     35         cy.get("ul.scrollable").contains(name_of_user).should("exist").should("be.visible");
     36 
     37         cy.log('check if the room is shown if the full name is in the search');
     38         cy.get('input.uk-search-input').clear().type(name_of_user);
     39         cy.get("ul.scrollable").contains(name_of_user).should("exist").should("be.visible");
     40     });
     41 })