diff options
author | Robin Appelman <robin@icewind.nl> | 2020-10-01 17:29:37 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-10-01 19:53:33 +0200 |
commit | d20d14cb42b53ea5322447da28618ec2d796ebc5 (patch) | |
tree | 3d43f257016378aeb92e24c10932d3d93f5de825 /cypress/integration | |
parent | f77cf749c0ba5094c88e207b7b660ece8dd44cbe (diff) |
add cypress testing
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'cypress/integration')
-rw-r--r-- | cypress/integration/0.setup.spec.js | 26 | ||||
-rw-r--r-- | cypress/integration/post.spec.js | 93 |
2 files changed, 119 insertions, 0 deletions
diff --git a/cypress/integration/0.setup.spec.js b/cypress/integration/0.setup.spec.js new file mode 100644 index 00000000..4c60f8bb --- /dev/null +++ b/cypress/integration/0.setup.spec.js @@ -0,0 +1,26 @@ +describe('Social app setup', function() { + + before(function() { + cy.login('admin', 'admin') + }) + + it('See the welcome message', function() { + cy.visit('/apps/social/') + cy.get('.social__welcome').should('contain', 'Nextcloud becomes part of the federated social networks!') + cy.get('.social__welcome').find('.icon-close').click() + cy.get('.social__welcome').should('not.exist') + }) + + it('See the home section in the sidebar', function() { + cy.get('.app-navigation').contains('Home').click() + cy.get('.emptycontent').should('be.visible') + }) + + it('See the empty content illustration', function() { + cy.get('.app-navigation').contains('Direct messages').click() + cy.get('.emptycontent').should('be.visible').contains('No direct messages found') + cy.get('.app-navigation').contains('Profile').click() + cy.get('.emptycontent').should('be.visible').contains('You haven\'t tooted yet') + }) + +}) diff --git a/cypress/integration/post.spec.js b/cypress/integration/post.spec.js new file mode 100644 index 00000000..1de7688f --- /dev/null +++ b/cypress/integration/post.spec.js @@ -0,0 +1,93 @@ +/* + * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net> + * + * @author Julius Härtl <jus@bitgrid.net> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +describe('Create posts', function() { + + before(function() { + cy.visit('/apps/social/') + cy.logout() + cy.login('admin', 'admin') + cy.nextcloudCreateUser('janedoe', 'p4ssw0rd') + cy.logout() + cy.login('janedoe', 'p4ssw0rd', '/apps/social/') + cy.get('.app-content').should('be.visible') + }) + + afterEach(function() { + cy.screenshot() + }) + + it('Write a post to followers', function() { + cy.server() + cy.route('POST', '/index.php/apps/social/api/v1/post').as('postMessage') + cy.get('.new-post input[type=submit]') + .should('be.disabled') + cy.get('.new-post').find('[contenteditable]').type('Hello world') + cy.get('.new-post input[type=submit]') + .should('not.be.disabled') + cy.get('.new-post input[type=submit]') + .click() + cy.wait('@postMessage') + cy.get('.social__timeline div.timeline-entry:first-child').should('contain', 'Hello world') + }) + + it('Write a post to followers with shift enter', function() { + cy.server() + cy.route('POST', '/index.php/apps/social/api/v1/post').as('postMessage') + cy.get('.new-post').find('[contenteditable]').type('Hello world 2{shift}{enter}') + cy.wait('@postMessage') + cy.get('.social__timeline div.timeline-entry:first-child').should('contain', 'Hello world 2') + }) + + it('Write a post to @admin', function() { + cy.server() + cy.route('POST', '/index.php/apps/social/api/v1/post').as('postMessage') + cy.get('.new-post').find('[contenteditable]').type('@adm', {delay: 500}) + cy.get('.tribute-container').should('be.visible') + cy.get('.tribute-container ul li:first').contains('admin') + cy.get('.new-post').find('[contenteditable]').type('{enter} Hello there', {delay: 100, force: true}) + cy.get('.new-post input[type=submit]') + .click() + cy.wait('@postMessage') + cy.get('.social__timeline div.timeline-entry:first-child').should('contain', 'admin@localhost') + }) + + it('Opens the menu and shows that followers is selected by default', function() { + cy.get('.new-post').find('[contenteditable]').click({force: true}).type('@adm{enter} Hello world', {delay: 500, force: true}) + cy.wait(500) + cy.get('.new-post input[type=submit]').should('not.be.disabled') + const visibilityButton = cy.get('.new-post .options > div > button') + visibilityButton.should('have.class', 'icon-contacts-dark') + + visibilityButton.click() + cy.get('.new-post-form .popovermenu').should('be.visible') + cy.get('.new-post-form .popovermenu .active').contains('Followers') + visibilityButton.click() + cy.get('.new-post-form .popovermenu').should('not.be.visible') + + cy.get('.new-post input[type=submit]') + .click() + cy.get('.social__timeline div.timeline-entry:first-child').should('contain', 'Hello there').should('contain', 'admin@localhost') + + }) + +}) |