diff options
author | Luka Trovic <luka@nextcloud.com> | 2022-05-11 12:39:53 +0300 |
---|---|---|
committer | Luka Trovic <luka@nextcloud.com> | 2022-05-11 13:20:01 +0300 |
commit | d938a528c3a94ee1342f94269b3325960476ca55 (patch) | |
tree | 68501c531a77105a550256d0753d8e64ef29c426 /cypress | |
parent | 2309749d15bdcceb3879e945e206bd952f6c0a5d (diff) |
fix: integrate feedback
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Diffstat (limited to 'cypress')
-rw-r--r-- | cypress/integration/boardFeatures.js | 2 | ||||
-rw-r--r-- | cypress/integration/cardFeatures.js | 2 | ||||
-rw-r--r-- | cypress/integration/deckDashboard.js | 3 | ||||
-rw-r--r-- | cypress/integration/stackFeatures.js | 48 | ||||
-rw-r--r-- | cypress/support/commands.js | 147 |
5 files changed, 99 insertions, 103 deletions
diff --git a/cypress/integration/boardFeatures.js b/cypress/integration/boardFeatures.js index 6f6de322..058da5e8 100644 --- a/cypress/integration/boardFeatures.js +++ b/cypress/integration/boardFeatures.js @@ -21,7 +21,7 @@ describe('Board', function () { }).as('createBoardRequest') // Click "Add board" - cy.get('.app-navigation button.app-navigation-toggle').click() + cy.openLeftSidebar() cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry') .eq(3).find('a').first().click({force: true}) diff --git a/cypress/integration/cardFeatures.js b/cypress/integration/cardFeatures.js index 18ddd3e9..5a413e20 100644 --- a/cypress/integration/cardFeatures.js +++ b/cypress/integration/cardFeatures.js @@ -19,7 +19,7 @@ describe('Card', function () { it('Can add a card', function () { let card = 'Card 1' - cy.get('.app-navigation button.app-navigation-toggle').click() + cy.openLeftSidebar() cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry') .eq(3).find('a.app-navigation-entry-link') .first().click({force: true}) diff --git a/cypress/integration/deckDashboard.js b/cypress/integration/deckDashboard.js index c5155ae6..ce85d43c 100644 --- a/cypress/integration/deckDashboard.js +++ b/cypress/integration/deckDashboard.js @@ -21,8 +21,7 @@ describe('Deck dashboard', function() { it('Can see the default "Personal Board" created for user by default', function () { const defaultBoard = 'Personal' - cy.get('.app-navigation button.app-navigation-toggle').click() - + cy.openLeftSidebar() cy.get('.app-navigation__list .app-navigation-entry') .eq(1) .find('ul.app-navigation-entry__children li.app-navigation-entry') diff --git a/cypress/integration/stackFeatures.js b/cypress/integration/stackFeatures.js index 48bac465..3ce09fa2 100644 --- a/cypress/integration/stackFeatures.js +++ b/cypress/integration/stackFeatures.js @@ -1,35 +1,33 @@ -import { randHash } from '../utils' -const randUser = randHash() +import { randHash } from "../utils"; +const randUser = randHash(); -describe('Stack', function () { - const board = 'TestBoard' - const password = 'pass123' - const stack = 'List 1' +describe("Stack", function () { + const board = "TestBoard"; + const password = "pass123"; + const stack = "List 1"; - before(function () { + before(function () { cy.nextcloudCreateUser(randUser, password) - cy.deckCreateBoard({ user: randUser, password }, board) + cy.deckCreateBoard({ user: randUser, password }, board) }) - beforeEach(function() { - cy.logout() + 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(3) - .find('a.app-navigation-entry-link') - .first().click({force: true}) + it("Can create a stack", function () { + cy.openLeftSidebar() + cy.get("#app-navigation-vue .app-navigation__list .app-navigation-entry") + .eq(3) + .find("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("#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 + cy.get(".board .stack").eq(0).contains(stack).should("be.visible") + }) +}); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index a1653a63..b74d726b 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -20,95 +20,94 @@ * */ - const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '') - Cypress.env('baseUrl', url) +const url = Cypress.config("baseUrl").replace(/\/index.php\/?$/g, ""); +Cypress.env("baseUrl", url); - Cypress.Commands.add('login', (user, password, route = '/apps/deck/') => { - let session = `${user}-${Date.now()}` +Cypress.Commands.add("login", (user, password, route = "/apps/deck/") => { + 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) - cy.get('.submit-wrapper input[type=submit]').click() - cy.url().should('include', route) - }) + cy.visit(route); + cy.get("input[name=user]").type(user); + cy.get("input[name=password]").type(password); + cy.get(".submit-wrapper input[type=submit]").click(); + cy.url().should("include", route); + }); // in case the session already existed but we are on a different route... - cy.visit(route) -}) + cy.visit(route); +}); - Cypress.Commands.add('logout', (route = '/') => { - cy.session('_guest', function () { - }) - }) +Cypress.Commands.add("logout", (route = "/") => { + cy.session("_guest", function () {}); +}); - Cypress.Commands.add('nextcloudCreateUser', (user, password) => { - cy.clearCookies() - cy.request({ - method: 'POST', - url: `${Cypress.env('baseUrl')}/ocs/v1.php/cloud/users?format=json`, - form: true, - body: { - userid: user, - password: password - }, - auth: { user: 'admin', pass: 'admin' }, - headers: { - 'OCS-ApiRequest': 'true', - 'Content-Type': 'application/x-www-form-urlencoded', - } - }).then(response => { - cy.log(`Created user ${user}`, response.status) - }) - }) +Cypress.Commands.add("nextcloudCreateUser", (user, password) => { + cy.clearCookies(); + cy.request({ + method: "POST", + url: `${Cypress.env("baseUrl")}/ocs/v1.php/cloud/users?format=json`, + form: true, + body: { + userid: user, + password: password, + }, + auth: { user: "admin", pass: "admin" }, + headers: { + "OCS-ApiRequest": "true", + "Content-Type": "application/x-www-form-urlencoded", + }, + }).then((response) => { + cy.log(`Created user ${user}`, response.status); + }); +}); - Cypress.Commands.add('nextcloudUpdateUser', (user, password, key, value) => { - cy.request({ - method: 'PUT', - url: `${Cypress.env('baseUrl')}/ocs/v2.php/cloud/users/${user}`, - form: true, - body: { key, value }, - auth: { user, pass: password }, - headers: { - 'OCS-ApiRequest': 'true', - 'Content-Type': 'application/x-www-form-urlencoded', - } - }).then(response => { - cy.log(`Updated user ${user} ${key} to ${value}`, response.status) - }) - }) +Cypress.Commands.add("nextcloudUpdateUser", (user, password, key, value) => { + cy.request({ + method: "PUT", + url: `${Cypress.env("baseUrl")}/ocs/v2.php/cloud/users/${user}`, + form: true, + body: { key, value }, + auth: { user, pass: password }, + headers: { + "OCS-ApiRequest": "true", + "Content-Type": "application/x-www-form-urlencoded", + }, + }).then((response) => { + cy.log(`Updated user ${user} ${key} to ${value}`, response.status); + }); +}); - Cypress.Commands.add('deckCreateBoard', ({ user, password }, title) => { - cy.login(user, password) +Cypress.Commands.add("openLeftSidebar", () => { + cy.get(".app-navigation button.app-navigation-toggle").click(); +}); - cy.get('.app-navigation button.app-navigation-toggle').click() - cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry') +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(3) - .find('a') + .find("a") .first() - .click({force: true}) + .click({ force: true }); - cy.get('.board-create form input[type=text]') - .type(title, {force: true}) + cy.get(".board-create form input[type=text]").type(title, { force: true }); - cy.get('.board-create form input[type=submit]') + cy.get(".board-create form input[type=submit]") .first() - .click({force: true}) - }) + .click({ force: true }); +}); - Cypress.Commands.add('deckCreateList', ({ user, password }, title) => { - cy.login(user, password) +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') + cy.get(".app-navigation button.app-navigation-toggle").click(); + cy.get("#app-navigation-vue .app-navigation__list .app-navigation-entry") .eq(3) - .find('a.app-navigation-entry-link') + .find("a.app-navigation-entry-link") .first() - .click({force: true}) + .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() - })
\ No newline at end of file + 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(); +}); |