2020-05-19 13:13:30 +00:00
|
|
|
/// <reference types="Cypress" />
|
2020-07-03 17:25:23 +00:00
|
|
|
/* globals cy, expect */
|
2020-05-19 13:13:30 +00:00
|
|
|
|
|
|
|
context('Browser testing', () => {
|
2020-07-03 17:25:23 +00:00
|
|
|
before(() => {
|
2020-07-08 13:41:05 +00:00
|
|
|
cy.clearLocalStorageSnapshot();
|
2020-07-03 17:25:23 +00:00
|
|
|
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();
|
2020-05-19 13:13:30 +00:00
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
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.');
|
2020-05-19 13:13:30 +00:00
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
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.', () => {
|
2020-05-19 13:13:30 +00:00
|
|
|
cy.location().should((loc) => {
|
2020-07-03 17:25:23 +00:00
|
|
|
expect(loc.pathname).to.eq('/authorize');
|
2020-05-19 13:13:30 +00:00
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
cy.get('.accept-button').click();
|
2020-05-19 13:13:30 +00:00
|
|
|
});
|
|
|
|
// 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', () => {
|
2020-06-18 18:02:54 +00:00
|
|
|
// // cy.get('solid-display-value').contains('Admin');
|
2020-05-19 13:13:30 +00:00
|
|
|
// // });
|
|
|
|
// it('should show my username on the left menu', () => {
|
2020-06-18 18:02:54 +00:00
|
|
|
// cy.get('[fields="username, badge"][data-src="http://localhost:8000/users/admin/"] > :nth-child(1) > solid-display-div > div').contains('admin');
|
2020-05-19 13:13:30 +00:00
|
|
|
// });
|
|
|
|
// it('should open a chat with myself', () => {
|
2020-06-18 18:02:54 +00:00
|
|
|
// cy.get('[fields="username, badge"][data-src="http://localhost:8000/users/admin/"] > :nth-child(1) > solid-display-div > div').click();
|
2020-05-19 13:13:30 +00:00
|
|
|
// cy.get('.name').contains('admin');
|
|
|
|
// });
|
|
|
|
// it('should not work, because I have no Prosody configured', () => {
|
2020-06-18 18:02:54 +00:00
|
|
|
// cy.get('.content-box > .chat-view > solid-xmpp-chat').should('be.empty');
|
2020-05-19 13:13:30 +00:00
|
|
|
// });
|
|
|
|
// describe('Circles', () => {
|
|
|
|
// it('should navigate the Administration from left menu', () => {
|
2020-06-18 18:02:54 +00:00
|
|
|
// cy.get('.create > solid-link').click();
|
2020-05-19 13:13:30 +00:00
|
|
|
// 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', () => {
|
2020-06-18 18:02:54 +00:00
|
|
|
// 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);
|
2020-05-19 13:13:30 +00:00
|
|
|
// });
|
|
|
|
// 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', () => {
|
2020-06-18 18:02:54 +00:00
|
|
|
// cy.get('.box-button > solid-ac-checker > .button').click();
|
2020-05-19 13:13:30 +00:00
|
|
|
// 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/');
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
});
|