Skip to content
Encode a fixture with Protocol Buffers
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
public test: 💍 Test the whole plugin Mar 24, 2019
src feat: 🎸 Complete the plugin Mar 23, 2019
.all-contributorsrc docs: create .all-contributorsrc Mar 24, 2019
.travis.yml docs: ✏️ Improve the logo Mar 24, 2019
package-lock.json 1.0.4 Mar 24, 2019

Cypress Protocol Buffers

Encode a fixture with Protocol Buffers

Commitizen friendly Build Status Open Source Love

Cypress Protobuf

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"),

How to use it

To encode with Protocol Buffers a fixture

  .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
      headers: {
        "content-type": "application/octet-stream"
      response: encodedJson,
      url: 'API_URL'

and in your test you will wait for the request as usual


Take a look at the example test source code.


  • the plugin saves the last protoFilePath so you can avoid to pass it every time. You can even set it at the beginning of your test suite
before(() => {
  cy.task("protobufEncode", {
    protoFilePath: "./public/escrow/ui.proto"


Thanks goes to these wonderful people (emoji key):

Stefano Magni
Stefano Magni

💻 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!

You can’t perform that action at this time.