fix: integrate feedback

Signed-off-by: Luka Trovic <luka@nextcloud.com>
This commit is contained in:
Luka Trovic
2022-05-11 10:39:53 +01:00
parent 2309749d15
commit d938a528c3
6 changed files with 100 additions and 106 deletions

View File

@@ -76,14 +76,12 @@ jobs:
php occ user:add --password-from-env user2 php occ user:add --password-from-env user2
php occ app:enable deck php occ app:enable deck
php occ app:list php occ app:list
composer install
cd apps/deck cd apps/deck
composer install composer install
npm install npm ci
npm run build npm run build
cd ../../ cd ../../
curl -v http://localhost:8081/index.php/login curl -v http://localhost:8081/index.php/login
cat data/nextcloud.log
- name: Cypress run - name: Cypress run
uses: cypress-io/github-action@v2 uses: cypress-io/github-action@v2

View File

@@ -21,7 +21,7 @@ describe('Board', function () {
}).as('createBoardRequest') }).as('createBoardRequest')
// Click "Add board" // 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') cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry')
.eq(3).find('a').first().click({force: true}) .eq(3).find('a').first().click({force: true})

View File

@@ -19,7 +19,7 @@ describe('Card', function () {
it('Can add a card', function () { it('Can add a card', function () {
let card = 'Card 1' 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') cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry')
.eq(3).find('a.app-navigation-entry-link') .eq(3).find('a.app-navigation-entry-link')
.first().click({force: true}) .first().click({force: true})

View File

@@ -21,8 +21,7 @@ describe('Deck dashboard', function() {
it('Can see the default "Personal Board" created for user by default', function () { it('Can see the default "Personal Board" created for user by default', function () {
const defaultBoard = 'Personal' const defaultBoard = 'Personal'
cy.get('.app-navigation button.app-navigation-toggle').click() cy.openLeftSidebar()
cy.get('.app-navigation__list .app-navigation-entry') cy.get('.app-navigation__list .app-navigation-entry')
.eq(1) .eq(1)
.find('ul.app-navigation-entry__children li.app-navigation-entry') .find('ul.app-navigation-entry__children li.app-navigation-entry')

View File

@@ -1,35 +1,33 @@
import { randHash } from '../utils' import { randHash } from "../utils";
const randUser = randHash() const randUser = randHash();
describe('Stack', function () { describe("Stack", function () {
const board = 'TestBoard' const board = "TestBoard";
const password = 'pass123' const password = "pass123";
const stack = 'List 1' const stack = "List 1";
before(function () { before(function () {
cy.nextcloudCreateUser(randUser, password) cy.nextcloudCreateUser(randUser, password)
cy.deckCreateBoard({ user: randUser, password }, board) cy.deckCreateBoard({ user: randUser, password }, board)
}) })
beforeEach(function() { beforeEach(function () {
cy.logout() cy.logout()
cy.login(randUser, password) cy.login(randUser, password)
}) })
it('Can create a stack', function () { it("Can create a stack", function () {
cy.openLeftSidebar()
cy.get('.app-navigation button.app-navigation-toggle').click() cy.get("#app-navigation-vue .app-navigation__list .app-navigation-entry")
cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry') .eq(3)
.eq(3) .find("a.app-navigation-entry-link")
.find('a.app-navigation-entry-link') .first()
.first().click({force: true}) .click({ force: true })
cy.get('#stack-add button').first().click() cy.get("#stack-add button").first().click()
cy.get('#stack-add form input#new-stack-input-main') cy.get("#stack-add form input#new-stack-input-main").type(stack)
.type(stack) cy.get("#stack-add form input[type=submit]").first().click()
cy.get('#stack-add form input[type=submit]')
.first().click()
cy.get('.board .stack').eq(0).contains(stack).should('be.visible') cy.get(".board .stack").eq(0).contains(stack).should("be.visible")
}) })
}) });

View File

@@ -20,95 +20,94 @@
* *
*/ */
const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '') const url = Cypress.config("baseUrl").replace(/\/index.php\/?$/g, "");
Cypress.env('baseUrl', url) Cypress.env("baseUrl", url);
Cypress.Commands.add('login', (user, password, route = '/apps/deck/') => { Cypress.Commands.add("login", (user, password, route = "/apps/deck/") => {
let session = `${user}-${Date.now()}` let session = `${user}-${Date.now()}`;
cy.session(session, function () { cy.session(session, function () {
cy.visit(route) cy.visit(route);
cy.get('input[name=user]').type(user) cy.get("input[name=user]").type(user);
cy.get('input[name=password]').type(password) cy.get("input[name=password]").type(password);
cy.get('.submit-wrapper input[type=submit]').click() cy.get(".submit-wrapper input[type=submit]").click();
cy.url().should('include', route) cy.url().should("include", route);
}) });
// in case the session already existed but we are on a different 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 = '/') => { Cypress.Commands.add("logout", (route = "/") => {
cy.session('_guest', function () { cy.session("_guest", function () {});
}) });
})
Cypress.Commands.add('nextcloudCreateUser', (user, password) => { Cypress.Commands.add("nextcloudCreateUser", (user, password) => {
cy.clearCookies() cy.clearCookies();
cy.request({ cy.request({
method: 'POST', method: "POST",
url: `${Cypress.env('baseUrl')}/ocs/v1.php/cloud/users?format=json`, url: `${Cypress.env("baseUrl")}/ocs/v1.php/cloud/users?format=json`,
form: true, form: true,
body: { body: {
userid: user, userid: user,
password: password password: password,
}, },
auth: { user: 'admin', pass: 'admin' }, auth: { user: "admin", pass: "admin" },
headers: { headers: {
'OCS-ApiRequest': 'true', "OCS-ApiRequest": "true",
'Content-Type': 'application/x-www-form-urlencoded', "Content-Type": "application/x-www-form-urlencoded",
} },
}).then(response => { }).then((response) => {
cy.log(`Created user ${user}`, response.status) cy.log(`Created user ${user}`, response.status);
}) });
}) });
Cypress.Commands.add('nextcloudUpdateUser', (user, password, key, value) => { Cypress.Commands.add("nextcloudUpdateUser", (user, password, key, value) => {
cy.request({ cy.request({
method: 'PUT', method: "PUT",
url: `${Cypress.env('baseUrl')}/ocs/v2.php/cloud/users/${user}`, url: `${Cypress.env("baseUrl")}/ocs/v2.php/cloud/users/${user}`,
form: true, form: true,
body: { key, value }, body: { key, value },
auth: { user, pass: password }, auth: { user, pass: password },
headers: { headers: {
'OCS-ApiRequest': 'true', "OCS-ApiRequest": "true",
'Content-Type': 'application/x-www-form-urlencoded', "Content-Type": "application/x-www-form-urlencoded",
} },
}).then(response => { }).then((response) => {
cy.log(`Updated user ${user} ${key} to ${value}`, response.status) cy.log(`Updated user ${user} ${key} to ${value}`, response.status);
}) });
}) });
Cypress.Commands.add('deckCreateBoard', ({ user, password }, title) => { Cypress.Commands.add("openLeftSidebar", () => {
cy.login(user, password) cy.get(".app-navigation button.app-navigation-toggle").click();
});
cy.get('.app-navigation button.app-navigation-toggle').click() Cypress.Commands.add("deckCreateBoard", ({ user, password }, title) => {
cy.get('#app-navigation-vue .app-navigation__list .app-navigation-entry') 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) .eq(3)
.find('a') .find("a")
.first() .first()
.click({force: true}) .click({ force: true });
cy.get('.board-create form input[type=text]') cy.get(".board-create form input[type=text]").type(title, { force: true });
.type(title, {force: true})
cy.get('.board-create form input[type=submit]') cy.get(".board-create form input[type=submit]")
.first() .first()
.click({force: true}) .click({ force: true });
}) });
Cypress.Commands.add('deckCreateList', ({ user, password }, title) => { Cypress.Commands.add("deckCreateList", ({ user, password }, title) => {
cy.login(user, password) cy.login(user, password);
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') cy.get("#app-navigation-vue .app-navigation__list .app-navigation-entry")
.eq(3) .eq(3)
.find('a.app-navigation-entry-link') .find("a.app-navigation-entry-link")
.first() .first()
.click({force: true}) .click({ force: true });
cy.get('#stack-add button').first().click() cy.get("#stack-add button").first().click();
cy.get('#stack-add form input#new-stack-input-main') cy.get("#stack-add form input#new-stack-input-main").type(title);
.type(title) cy.get("#stack-add form input[type=submit]").first().click();
cy.get('#stack-add form input[type=submit]') });
.first()
.click()
})