102 lines
4.8 KiB
JavaScript
102 lines
4.8 KiB
JavaScript
/// <reference types="Cypress" />
|
|
/* globals cy, expect */
|
|
|
|
context('Browser testing', () => {
|
|
before(() => {
|
|
cy.clearLocalStorageSnapshot();
|
|
cy.clearLocalStorage({ domain: null});
|
|
cy.clearCookies({ domain: null });
|
|
});
|
|
it('should visit user login screen', () => cy.userLogin());
|
|
describe('Login process', () => {
|
|
it('should write "admin" on username field and "password" on password field', () => {
|
|
cy.get('#id_username').type('admin');
|
|
cy.get('#id_username').should('have.value', 'admin');
|
|
cy.get('#id_password').type('password');
|
|
cy.get('#id_password').should('have.value', 'password');
|
|
});
|
|
it('should click on login button', () => {
|
|
cy.get(':nth-child(1) > .flex-column > [type="submit"]').click();
|
|
});
|
|
it('should provide an error, username and password mismatch.', () => {
|
|
cy.get('.error').should('contain.text', 'Ton nom d\'utilisateur et ton mot de passe ne correspondent pas. Réessaye.');
|
|
});
|
|
it('should write "admin" on password field then press the login button', () => {
|
|
cy.get('#id_password').type('admin');
|
|
cy.get('#id_password').should('have.value', 'admin');
|
|
cy.get(':nth-child(1) > .flex-column > [type="submit"]').click();
|
|
});
|
|
it('should ask for user permission to access their datas.', () => {
|
|
cy.location().should((loc) => {
|
|
expect(loc.pathname).to.eq('/authorize');
|
|
});
|
|
cy.get('.accept-button').click();
|
|
});
|
|
// it('should redirect the user to the app.', () => {
|
|
// cy.get('.accept-button').click();
|
|
// cy.location().should((loc) => {
|
|
// expect(loc.protocol + "//" + loc.host).to.eq(Cypress.config().baseUrl);
|
|
// expect(loc.pathname).to.eq('/');
|
|
// });
|
|
// });
|
|
// });
|
|
// describe('Main interface', () => {
|
|
// // it('should show my name on top right', () => {
|
|
// // cy.get('solid-display-value').contains('Admin');
|
|
// // });
|
|
// it('should show my username on the left menu', () => {
|
|
// cy.get('[fields="username, badge"][data-src="http://localhost:8000/users/admin/"] > :nth-child(1) > solid-display-div > div').contains('admin');
|
|
// });
|
|
// it('should open a chat with myself', () => {
|
|
// cy.get('[fields="username, badge"][data-src="http://localhost:8000/users/admin/"] > :nth-child(1) > solid-display-div > div').click();
|
|
// cy.get('.name').contains('admin');
|
|
// });
|
|
// it('should not work, because I have no Prosody configured', () => {
|
|
// cy.get('.content-box > .chat-view > solid-xmpp-chat').should('be.empty');
|
|
// });
|
|
// describe('Circles', () => {
|
|
// it('should navigate the Administration from left menu', () => {
|
|
// cy.get('.create > solid-link').click();
|
|
// cy.get('#admin-circles > .content-box > .content-box__header > .without-margin').contains('Administration');
|
|
// cy.get('#admin-circle-list > .content-box__info > .admin-header > .admin-header__title').contains('Circles');
|
|
// });
|
|
// it('should navigate to Circle creation', () => {
|
|
// cy.get('#admin-circle-list > .content-box__info > .admin-header > .button').click();
|
|
// cy.location().should((loc) => {
|
|
// expect(loc.pathname).to.contain('admin-circle-create');
|
|
// });
|
|
// });
|
|
// var name = new Uint32Array(1);
|
|
// crypto.getRandomValues(name);
|
|
// name = "Test Circle " + name;
|
|
// it('should allow Circle Creation', () => {
|
|
// cy.get('form > solid-form-label-text[name="name"] > label > input').type(name);
|
|
// cy.get('.content-box__info > solid-form > form > solid-form-label-text[name="description"] > label > input').type('With a great description!');
|
|
// cy.get('#admin-circle-create > .content-box__info > solid-form > form > [type="submit"]').click();
|
|
// cy.get('#admin-circle-list > div > div.table > solid-display').contains(name);
|
|
// });
|
|
// it('should open the circle information page', () => {
|
|
// cy.screenshot();
|
|
// cy.get('#navbar-router').contains(name).click();
|
|
// cy.get('[name="circle-information"] > li').click();
|
|
// });
|
|
// it('should delete the circle', () => {
|
|
// cy.get('.box-button > solid-ac-checker > .button').click();
|
|
// cy.get('#navbar-router').should('not.contain', name);
|
|
// });
|
|
// });
|
|
// });
|
|
// describe('Logout process', () => {
|
|
// it('should properly log out the user', () => {
|
|
// cy.get('#user-controls__profile > div').click();
|
|
// cy.get('#user-controls__panel > nav > button').click();
|
|
// // Dirty fix for logout, targeting logout button is not enough.
|
|
// cy.clearLocalStorage({ domain: null });
|
|
// cy.clearCookies({ domain: null });
|
|
// cy.location().should((loc) => {
|
|
// expect(loc.pathname).to.eq('/auth/login/');
|
|
// });
|
|
// });
|
|
});
|
|
});
|