diff --git a/cypress/integration/boardFeatures.js b/cypress/integration/boardFeatures.js new file mode 100644 index 000000000..44a70a181 --- /dev/null +++ b/cypress/integration/boardFeatures.js @@ -0,0 +1,40 @@ +import { randHash } from "../utils" +const randUser = randHash() + +describe('Board', function () { + const password = 'pass123' + + before(function () { + cy.nextcloudCreateUser(randUser, password) + }) + + beforeEach(function() { + cy.login(randUser, password) + }) + + it('Can create a board', function () { + let board = 'Test' + + // Click "Add board" + cy.get('.app-navigation button.app-navigation-toggle').click() + cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry') + .eq(1) + .find('a') + .first() + .click({force: true}) + + // Type the board title + cy.get('.board-create form input[type=text]') + .type(board, {force: true}) + + // Submit + cy.get('.board-create form input[type=submit]') + .first() + .click({force: true}) + + cy.get('.app-navigation__list .app-navigation-entry__children .app-navigation-entry') + .first() + .contains(board) + .should('be.visible') + }) +}) \ No newline at end of file diff --git a/cypress/integration/cardFeatures.js b/cypress/integration/cardFeatures.js new file mode 100644 index 000000000..3d04bf6d3 --- /dev/null +++ b/cypress/integration/cardFeatures.js @@ -0,0 +1,40 @@ +import { randHash } from '../utils' +const randUser = randHash() + +describe('Card', function () { + const board = 'TestBoard' + const list = 'TestList' + const password = 'pass123' + + before(function () { + cy.nextcloudCreateUser(randUser, password) + cy.deckCreateBoard({ user: randUser, password }, board) + cy.deckCreateList({ user: randUser, password }, list) + }) + + beforeEach(function () { + cy.login(randUser, password) + }) + + it('Can add a card', function () { + let card = 'Card 1' + + cy.get('.app-navigation button.app-navigation-toggle').click() + cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry') + .eq(1) + .find('.app-navigation-entry__children .app-navigation-entry a.app-navigation-entry-link') + .first() + .click({force: true}) + + cy.get('.board .stack').eq(0).within(() => { + cy.get('button.action-item.action-item--single.icon-add') + .first().click() + + cy.get('.stack__card-add form input#new-stack-input-main') + .type(card) + cy.get('.stack__card-add form input[type=submit]') + .first().click() + cy.get('.card').first().contains(card).should('be.visible') + }) + }) +}) \ No newline at end of file diff --git a/cypress/integration/deckDashboard.js b/cypress/integration/deckDashboard.js index 134e0b757..b024778f4 100644 --- a/cypress/integration/deckDashboard.js +++ b/cypress/integration/deckDashboard.js @@ -2,13 +2,14 @@ import { randHash } from '../utils' const randUser = randHash() describe('Deck dashboard', function() { + const password = 'pass123' + before(function () { - // Create a user - cy.nextcloudCreateUser(randUser, 'pass123') + cy.nextcloudCreateUser(randUser, password) }) beforeEach(function() { - cy.login(randUser, 'pass123') + cy.login(randUser, password) }) it('Can show the right title on the dashboard', function() { @@ -26,20 +27,4 @@ describe('Deck dashboard', function() { .first() .contains('Personal') }) */ - - it('Can create a board', function () { - cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry') - .eq(1) - .find('a') - .first() - .click({force: true}) - - cy.get('.board-create form input[type=text]') - .type('Test', {force: true}) - - cy.get('.board-create form input[type=submit]') - .first() - .click({force: true}) - - }) }) diff --git a/cypress/integration/stackFeatures.js b/cypress/integration/stackFeatures.js new file mode 100644 index 000000000..b46a024af --- /dev/null +++ b/cypress/integration/stackFeatures.js @@ -0,0 +1,35 @@ +import { randHash } from '../utils' +const randUser = randHash() + +describe('Stack', function () { + const board = 'TestBoard' + const password = 'pass123' + const stack = 'List 1' + + before(function () { + cy.nextcloudCreateUser(randUser, password) + cy.deckCreateBoard({ user: randUser, password }, board) + }) + + beforeEach(function() { + cy.logout() + cy.login(randUser, password) + }) + + it('Can create a stack', function () { + + cy.get('.app-navigation button.app-navigation-toggle').click() + cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry') + .eq(1) + .find('.app-navigation-entry__children .app-navigation-entry a.app-navigation-entry-link') + .first().click({force: true}) + + cy.get('#stack-add button').first().click() + cy.get('#stack-add form input#new-stack-input-main') + .type(stack) + cy.get('#stack-add form input[type=submit]') + .first().click() + + cy.get('.board .stack').eq(0).contains(stack).should('be.visible') + }) +}) \ No newline at end of file diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 59af756db..7335dcb0f 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -24,7 +24,8 @@ Cypress.env('baseUrl', url) Cypress.Commands.add('login', (user, password, route = '/apps/deck/') => { - cy.session(user, function () { + let session = `${user}-${Date.now()}` + cy.session(session, function () { cy.visit(route) cy.get('input[name=user]').type(user) cy.get('input[name=password]').type(password) @@ -75,4 +76,40 @@ cy.log(`Updated user ${user} ${key} to ${value}`, response.status) }) }) + + Cypress.Commands.add('deckCreateBoard', ({ user, password }, title) => { + cy.login(user, password) + + cy.get('.app-navigation button.app-navigation-toggle').click() + cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry') + .eq(1) + .find('a') + .first() + .click({force: true}) + + cy.get('.board-create form input[type=text]') + .type(title, {force: true}) + + cy.get('.board-create form input[type=submit]') + .first() + .click({force: true}) + }) + + Cypress.Commands.add('deckCreateList', ({ user, password }, title) => { + cy.login(user, password) + + cy.get('.app-navigation button.app-navigation-toggle').click() + cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry') + .eq(1) + .find('.app-navigation-entry__children .app-navigation-entry a.app-navigation-entry-link') + .first() + .click({force: true}) + + cy.get('#stack-add button').first().click() + cy.get('#stack-add form input#new-stack-input-main') + .type(title) + cy.get('#stack-add form input[type=submit]') + .first() + .click() + })