JSPM

cypress-magento-rest-client

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q21773F
  • License MIT

Magento 2 REST API Client

Package Exports

  • cypress-magento-rest-client
  • cypress-magento-rest-client/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cypress-magento-rest-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

This repository contains the cypress-magento-rest-client package, which is a Magento 2 REST API client designed for Cypress integration tests.

Installation

To install the cypress-magento-rest-client package, follow these steps:

  1. Ensure you have Node.js installed on your machine.
  2. Create a new Cypress project or navigate to your existing project.
  3. Run the following command in your project directory to install the package:
$ npm install cypress-magento-rest-client --save-dev`

Usage

To use the cypress-magento-rest-client package in your Cypress spec, follow the example below:

const { Magento2Client } = require('cypress-magento-rest-client');
describe('categories tests', () => {
let client;

    before(() => {
        client = Magento2Client({
            url: Cypress.config('baseUrl'),
            consumerKey: Cypress.config('consumerKey'),
            consumerSecret: Cypress.config('consumerSecret'),
            accessToken: Cypress.config('accessToken'),
            accessTokenSecret: Cypress.config('accessTokenSecret')
        });
    });

    it('can get category collection', () => {
        cy.wrap(client.categories.list())
            .then((categories) => {
                expect(categories.parent_id).to.equal(1);
            });
        cy.log('after list categories test');
    });

});