We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Common use case: need to login, then perform authorized API calls
it('user cannot follow themselves', () => { const user = Cypress.env('user') cy.getLoginToken(user).then(token => { const apiUrl = Cypress.env('apiUrl') cy.api({ method: 'POST', url: `${apiUrl}/api/profiles/${user.username}/follow`, headers: { authorization: `Token ${token}` }, failOnStatusCode: false // we expect failure })
It would be nice if we could create the API client once (using before) and then could make the calls. Something like
before
let apiClient before(() => { const user = Cypress.env('user') cy.getLoginToken(user).then(token => { const apiUrl = Cypress.env('apiUrl') apiClient = cy.apiClient({ baseUrl: `${apiUrl}/api`, headers: { authorization: `Token ${token}` } }) }) }) it('user cannot follow themselves', () => { apiClient({ method: 'POST', url: `/profiles/${user.username}/follow`, failOnStatusCode: false // we expect failure }) })
The text was updated successfully, but these errors were encountered:
LeJeanbono
No branches or pull requests
Common use case: need to login, then perform authorized API calls
It would be nice if we could create the API client once (using
before
) and then could make the calls. Something likeThe text was updated successfully, but these errors were encountered: