mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
19 lines
541 B
JavaScript
19 lines
541 B
JavaScript
import { Given } from "@badeball/cypress-cucumber-preprocessor";
|
|
import encode from '../../../../backend/src/jwt/encode'
|
|
|
|
Given("I am logged in as {string}", slug => {
|
|
cy.neode()
|
|
.first("User", { slug })
|
|
.then(user => {
|
|
return new Cypress.Promise((resolve, reject) => {
|
|
if(!user) {
|
|
return reject(`User ${email} not found in database`)
|
|
}
|
|
return user.toJson().then((user) => resolve(user))
|
|
})
|
|
})
|
|
.then(user => {
|
|
cy.setCookie('ocelot-social-token', encode(user))
|
|
})
|
|
});
|