From a0d8b1a1b3e775b55d49c9b6d0429b75d8e1b781 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Thu, 14 May 2020 05:51:08 +0530 Subject: [PATCH] fix: add comments to login ui test --- cypress/integration/login.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cypress/integration/login.js b/cypress/integration/login.js index b3227fa3ba..861377444c 100644 --- a/cypress/integration/login.js +++ b/cypress/integration/login.js @@ -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')); }); });