Security News
Supply Chain Attack Detected in @solana/web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
cypress-protobuf
Advanced tools
Encode a fixture with Protocol Buffers
Use this plugin to encode a Cypress fixture with Protocol Buffers.
npm i -D cypress-protobuf
# or
yarn add -D cypress-protobuf
then open your cypress/plugins/index.js
file and register a new task
module.exports = on => {
on("task", {
protobufEncode: require("cypress-protobuf"),
});
};
To encode with Protocol Buffers a fixture
cy.fixture("FIXTURE_NAME.json+")
.then(json => {
cy.task("protobufEncode", {
fixtureBody: json, // the fixture body
message: "MESSAGE_NAME", // the protobuf message to use
protoFilePath: "./public/example.proto", // the path (starting from your project directory) to the .profo file
})
.then(encodedJson => {
// 🎉 `encodedJson` contains the encoded fixture
cy.route({
headers: {
"content-type": "application/octet-stream"
},
response: encodedJson,
url: 'API_URL'
}).as("FIXTURE_NAME");
});
});
and in your test you will wait for the request as usual
cy.wait("@YOUR_FIXTURE_NAME");
Take a look at the example test source code.
protoFilePath
so you can avoid to pass it every time. You can even set it at the beginning of your test suitebefore(() => {
cy.task("protobufEncode", {
protoFilePath: "./public/escrow/ui.proto"
});
});
Thanks goes to these wonderful people (emoji key):
Stefano Magni 💻 ⚠️ |
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
Encode a Cypress fixture with Protocol Buffers
The npm package cypress-protobuf receives a total of 4 weekly downloads. As such, cypress-protobuf popularity was classified as not popular.
We found that cypress-protobuf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.