Created
July 1, 2021 08:07
-
-
Save slawekradzyminski/0d5e86f1fa84abeb26c9569868ccc390 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference types="cypress" /> | |
import { getRandomString } from "../util/random" | |
describe('home page', () => { | |
const firstName = getRandomString() | |
const lastName = getRandomString() | |
const username = getRandomString() | |
const password = getRandomString() | |
let id | |
let token | |
before(() => { | |
cy.request({ | |
method: 'POST', | |
url: 'http://localhost:4000/users/register', | |
body: { | |
firstName: firstName, | |
lastName: lastName, | |
username: username, | |
password: password | |
} | |
}).then((response) => { | |
expect(response.status).to.eq(201) | |
id = response.body.id | |
}) | |
cy.request({ | |
method: 'POST', | |
url: 'http://localhost:4000/users/authenticate', | |
body: { | |
username: username, | |
password: password | |
} | |
}).then((response) => { | |
expect(response.status).to.eq(200) | |
token = response.body.token | |
}) | |
}) | |
beforeEach(() => { | |
const user = { token: token } | |
window.localStorage.setItem('user', JSON.stringify(user)) | |
cy.visit('/') | |
}) | |
it('should delete user', () => { | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment