fix login by API (#1700)
This commit is contained in:
parent
4880093f63
commit
4b05f67b2c
1 changed files with 6 additions and 0 deletions
|
@ -21,6 +21,8 @@ Cypress.Commands.add(
|
||||||
const mutation = `mutation TokenAuth{
|
const mutation = `mutation TokenAuth{
|
||||||
tokenCreate(email: "${user.email}", password: "${user.password}") {
|
tokenCreate(email: "${user.email}", password: "${user.password}") {
|
||||||
token
|
token
|
||||||
|
csrfToken
|
||||||
|
refreshToken
|
||||||
errors: accountErrors {
|
errors: accountErrors {
|
||||||
code
|
code
|
||||||
field
|
field
|
||||||
|
@ -32,6 +34,10 @@ Cypress.Commands.add(
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
return cy.sendRequestWithQuery(mutation, authorization).then(resp => {
|
return cy.sendRequestWithQuery(mutation, authorization).then(resp => {
|
||||||
|
window.localStorage.setItem(
|
||||||
|
"_saleorCSRFToken",
|
||||||
|
resp.body.data.tokenCreate.csrfToken
|
||||||
|
);
|
||||||
window.sessionStorage.setItem(
|
window.sessionStorage.setItem(
|
||||||
authorization,
|
authorization,
|
||||||
resp.body.data.tokenCreate.token
|
resp.body.data.tokenCreate.token
|
||||||
|
|
Loading…
Reference in a new issue