|
|
@@ -40,6 +40,8 @@ context('Login', () => { |
|
|
|
}); |
|
|
|
|
|
|
|
it('check redirect after login', () => { |
|
|
|
|
|
|
|
// mock for OAuth 2.0 client_id, redirect_uri, scope and state |
|
|
|
const payload = new URLSearchParams({ |
|
|
|
uuid: '6fed1519-cfd8-4a2d-84a6-9a1799c7c741', |
|
|
|
encoded_string: 'hello all', |
|
|
@@ -48,11 +50,19 @@ context('Login', () => { |
|
|
|
}); |
|
|
|
|
|
|
|
cy.request('/api/method/logout'); |
|
|
|
cy.visit('/login?redirect-to=/me?' + encodeURIComponent(payload.toString())); |
|
|
|
|
|
|
|
// redirect-to /me page with params to mock OAuth 2.0 like request |
|
|
|
cy.visit( |
|
|
|
'/login?redirect-to=/me?' + |
|
|
|
encodeURIComponent(payload.toString().replace("+", " ")) |
|
|
|
); |
|
|
|
|
|
|
|
cy.get('#login_email').type('Administrator'); |
|
|
|
cy.get('#login_password').type(Cypress.config('adminPassword')); |
|
|
|
|
|
|
|
cy.get('.btn-login').click(); |
|
|
|
cy.url().should('include', '/me?' + payload.toString()); |
|
|
|
|
|
|
|
// verify redirected location and url params after login |
|
|
|
cy.url().should('include', '/me?' + payload.toString().replace('+', '%20')); |
|
|
|
}); |
|
|
|
}); |