Skip to content

Commit e4ad21e

Browse files
committed
fix(e2e): use scope in e2e tests
1 parent f9ef86b commit e4ad21e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

high-level-tests/e2e/cypress/support/commands.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ const jsonwebtoken = require('jsonwebtoken');
22
const { addCompareSnapshotCommand } = require('cypress-visual-regression/dist/command');
33
require('@testing-library/cypress/add-commands');
44

5-
function getLoginBody(username, password) {
5+
function getLoginBody(username, password, scope) {
66
return {
77
username,
88
password,
99
grant_type: 'password',
10+
scope,
1011
};
1112
}
1213

@@ -20,7 +21,8 @@ function setEmberSimpleAuthSession(response) {
2021
access_token: response.body.access_token,
2122
user_id: response.body.user_id,
2223
refresh_token: response.body.refresh_token,
23-
expires_in: 1000,
24+
scope: response.body.scope,
25+
expires_in: 10000000,
2426
},
2527
})
2628
);
@@ -32,7 +34,7 @@ Cypress.Commands.add('login', (username, password) => {
3234
url: `${Cypress.env('API_URL')}/api/token`,
3335
method: 'POST',
3436
form: true,
35-
body: getLoginBody(username, password),
37+
body: getLoginBody(username, password, 'mon-pix'),
3638
}).then(setEmberSimpleAuthSession);
3739
cy.wait(['@getCurrentUser']);
3840
});
@@ -43,7 +45,7 @@ Cypress.Commands.add('loginOrga', (username, password) => {
4345
url: `${Cypress.env('API_URL')}/api/token`,
4446
method: 'POST',
4547
form: true,
46-
body: getLoginBody(username, password),
48+
body: getLoginBody(username, password, 'pix-orga'),
4749
}).then(setEmberSimpleAuthSession);
4850
cy.wait(['@getCurrentUser']);
4951
});
@@ -54,7 +56,7 @@ Cypress.Commands.add('loginAdmin', (username, password) => {
5456
url: `${Cypress.env('API_URL')}/api/token`,
5557
method: 'POST',
5658
form: true,
57-
body: getLoginBody(username, password),
59+
body: getLoginBody(username, password, 'pix-admin'),
5860
}).then((response) => {
5961
window.localStorage.setItem(
6062
'ember_simple_auth-session',
@@ -63,6 +65,7 @@ Cypress.Commands.add('loginAdmin', (username, password) => {
6365
authenticator: 'authenticator:oauth2',
6466
token_type: 'bearer',
6567
access_token: response.body.access_token,
68+
scope: response.body.scope,
6669
user_id: 2,
6770
},
6871
})

0 commit comments

Comments
 (0)