fix: integrate feedback
Signed-off-by: Luka Trovic <luka@nextcloud.com>
This commit is contained in:
@@ -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()
|
||||
})
|
||||
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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user