Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
cypress-should
Advanced tools
Supercool assertion library for Cypress to verify API responses
npm install --save-dev cypress-should
In your cypress/support/index.js
file, add the following:
require('cypress-should');
or if you are using TypeScript:
import 'cypress-should';
Then in your tests, you can use the should
command with custom assertions to verify the response:
cy.request('/api/users')
.should('have.status', 200)
.and('have.statusMessage', 'OK')
.and('have.contentType', 'application/json')
.and('have.body', { name: 'John Doe' });
or
cy.request('/api/users').should((response) => {
expect(response).to.have.status(200);
expect(response).to.have.statusMessage('OK');
expect(response).to.haveContentType('application/json');
expect(response).to.have.body({ name: 'John Doe' });
});
have.status
- Asserts the response status code
cy.request('/api/users').should('have.status', 200)
have.statusMessage
- Asserts the response status message
cy.request('/api/users').should('have.statusMessage', 'OK')
have.contentType
- Asserts the response content type
cy.request('/api/users').should('have.contentType', 'application/json')
have.body
- Asserts the response body
cy.request('/api/users').should('have.body', { name: 'John Doe' })
have.header
- Asserts the response header
cy.request('/api/users').should('have.header', 'x-powered-by', 'Express')
have.cookie
- Asserts the response cookie
cy.request('/profile').should('have.cookie', 'session_id')
containBody
- Asserts the response body contains the given value
cy.request('/api/users').should('containBody', { name: 'John Doe' });
haveText
- Asserts the response body is equal to the given text
cy.request('/home').should('haveText', 'Hello World!');
containText
- Asserts the response body contains the given text
cy.request('/home').should('containText', 'World!');
be.json
- Asserts the response body is a valid JSON
cy.request('/api/users').should('be.json');
be.html
- Asserts the response body is a valid HTML
cy.request('/home').should('be.html');
be.text
- Asserts the response body is a valid text
cy.request('/home').should('be.text');
be.xml
- Asserts the response body is a valid XML
cy.request('/home').should('be.xml');
MIT
Yevhen Laichenkov elaichenkov@gmail.com
FAQs
Supercool assertion library for Cypress
The npm package cypress-should receives a total of 335 weekly downloads. As such, cypress-should popularity was classified as not popular.
We found that cypress-should demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.