Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'cypress/support/commands.js')
-rw-r--r--cypress/support/commands.js26
1 files changed, 9 insertions, 17 deletions
diff --git a/cypress/support/commands.js b/cypress/support/commands.js
index 3283a8ab5..dbe72c3d0 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.js
@@ -26,27 +26,19 @@ const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '')
Cypress.env('baseUrl', url)
Cypress.Commands.add('login', (user, password, route = '/apps/files') => {
- cy.clearCookies()
- Cypress.Cookies.defaults({
- preserve: /^(oc|nc)/
+ cy.session(user, 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)
})
+ // in case the session already existed but we are on a different 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)
})
-Cypress.Commands.add('logout', () => {
- Cypress.Cookies.defaults({
- preserve: []
- })
-
- cy.clearLocalStorage()
- cy.clearCookies()
-
- Cypress.Cookies.defaults({
- preserve: /^(oc|nc)/
+Cypress.Commands.add('logout', (route = '/') => {
+ cy.session('_guest', function () {
})
})