Skip to content

Commit f3a5aa4

Browse files
authored
Merge pull request #5364 from raft-tech/fix/develop-e2e-admin-api-auth-failure
Add referer to cypress admin api requests
2 parents 31a62c9 + ce2c99e commit f3a5aa4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tdrs-frontend/cypress/support/commands.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Cypress.Commands.add('login', (username) => {
4040
.invoke('dispatch', {
4141
type: 'SET_AUTH',
4242
payload: {
43-
user: response?.body?.user
43+
user: response?.body?.user,
4444
},
4545
})
4646

@@ -85,6 +85,7 @@ Cypress.Commands.add(
8585
cy.get('@adminSessionId').then((sessionId) =>
8686
cy.setCookie('sessionid', sessionId)
8787
)
88+
cy.clearCookie('csrftoken')
8889
cy.get('@adminCsrfToken').then((csrfToken) => {
8990
cy.setCookie('csrftoken', csrfToken)
9091
options.headers['X-CSRFToken'] = csrfToken
@@ -118,8 +119,11 @@ Cypress.Commands.add(
118119
options = {
119120
method,
120121
body,
121-
headers,
122122
url: `${Cypress.env('apiUrl')}${path}`,
123+
headers: {
124+
...headers,
125+
Referer: `${Cypress.env('apiUrl')}`,
126+
},
123127
}
124128

125129
cy.get('@adminSessionId').then((sessionId) =>

0 commit comments

Comments
 (0)