Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"args": [
"task"
],
"name": "Gulp task",
"program": "${workspaceFolder}/node_modules/gulp/bin/gulp.js",
"request": "launch",
"skipFiles": [
"<node_internals>/**"
],
"type": "node"
}

]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Cypress plugin for effective API testing.

### Installation

### Usage
### Usage
68 changes: 68 additions & 0 deletions cypress/e2e/.ipynb_checkpoints/api.cy-checkpoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const methods = ['HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE']

it(`works with different methods`, () => {

methods.forEach(method => {
cy.api({
method,
url: '/'
})

});

})

it('works with query string', () => {

cy.api({
method: 'GET',
url: '/',
qs: {
listId: 1
}
}).its('status')
.should('eq', 200)

cy.get('[data-cy=query]')
.should('be.visible')

});

it('works with headers', () => {

cy.api({
method: 'GET',
url: '/',
headers: {
'accept': 'application/json'
}
})

cy.get('[data-cy=requestHeaders]')
.should('be.visible')

});

it('shows failed status code', () => {

cy.api({
url: '/404',
failOnStatusCode: false
})

cy.get('[data-cy=status]')
.eq(0)
.should('be.visible')
.and('contain', '404')

cy.api({
url: '/400',
failOnStatusCode: false
})

cy.get('[data-cy=status]')
.eq(1)
.should('be.visible')
.and('contain', '400')

});
23 changes: 23 additions & 0 deletions cypress/e2e/.ipynb_checkpoints/formats.cy-checkpoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
it('works with xml', () => {

cy.api({
url: '/xml'
})

});

it('works with html', () => {

cy.api({
url: '/html'
})

});

it('works with json', () => {

cy.api({
url: '/json'
})

});