1.2.5 • Published 2 months ago

cypress-pipedream-plugin v1.2.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

Retrieve SMS history from Pipedream

This npm library enhances Cypress testing capabilities by providing convenient commands for retrieving received SMS history from Pipedream.
Simplify your end-to-end testing workflow by effortlessly integrating SMS history verification into your Cypress tests.

Install

$ npm install cypress-pipedream-plugin --save-dev

Alternatively, you can install it as a global module:

$ npm install -g cypress-pipedream-plugin

Prerequisites

A Pipedream source: https://pipedream.com/sources/new.
Pay attention to set the Body Only option to true when creating the source, if you haven't and you have already created the Pipedream-Source enables it here: https://pipedream.com/sources/{your-source}/configuration

npm.io

Added commands

CommandsNotes
cy.getNewestMessage()Attempts to retrieve last (NEWEST) SMS for a specific Pipedream Source History within a specified time limit.
cy.getOldestMessage()Attempts to retrieve first (OLDEST) SMS for a specific Pipedream Source History within a specified time limit.
cy.clearMessagesHistory()Clears the SMS history for a specific Pipedream Source.
cy.clearHistorySendSmsAndGetSMS()This command simplifies the usage by executing the following commands in sequence:
cy.clearMessagesHistory() //
cy.get('[data-cy="send-sms"]', { timeout: 120000 }).click() // Command to send the SMS from the frontend
cy.getNewestMessage()

According to cypress documentation adding the data-cy tag to your frontend, is the best way to keep your test updated and maintainable.

Configuration

Inside cypress/support/e2e.js

At the top of your support file (usually cypress/support/e2e.js for e2e testing type):

import 'cypress-pipedream-plugin'

Inside your environment file

You MUST set these environment variables to make this plugin working

ParameterMandatoryNotesDefault
pipedreamBearerTRUEBearer used for Pipedream Auth\
pipedreamSourceIDTRUEYour Pipedream Source ID\
pipedreamMaxRetriesFALSEMax retires value for the commands cy.getOldestMessage() or cy.getNewestMessage()120 (seconds)
pipedreamFolderPathFALSEFolder where the SMS body will be saved'cypress/fixtures/sms-response'
pipedreamFileNameFALSEFile name in which the message will be written'message.json'

To set these variables dynamically in a multi environment cypress-test, you can use the following plugin: cypress-env

Considerations

To check the file contents, you can use the following command:

cy.readFile('cypress/fixtures/sms_response/message.json', {
	timeout: 60000,
	retries: 3,
}).then((message) {
  ... // do something with the saved message
})

Missing configuration error:

────────────────────────────────────────────────────────────────────────────────────────────────────

  Running:  myFirstTest.cy.js                                                               (1 of 1)

    An uncaught error was detected outside of a test (Attempt 1 of 2)
    Error: The following error originated from your test code, not from Cypress.
  1) An uncaught error was detected outside of a test

  0 passing (1s)
  1 failing

  1) An uncaught error was detected outside of a test:
     Error: The following error originated from your test code, not from Cypress.

  > CYPRESS-PIPEDREAM-PLUGIN | Missing environment variables: env('pipedreamBearer') & env('pipedreamSourceID') needed

────────────────────────────────────────────────────────────────────────────────────────────────────

THE JOB IS DONE!

Happy testing to everyone!

ALEC-JS

1.2.5

2 months ago

1.2.4

2 months ago

1.2.3

5 months ago

1.2.2

5 months ago

1.2.1

6 months ago

1.2.0

6 months ago

1.1.4

6 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago

0.9.6

6 months ago

0.9.5

6 months ago

0.9.4

6 months ago

0.9.3

6 months ago

0.9.2

6 months ago

0.9.1

6 months ago

0.9.0

6 months ago