Giter Site home page Giter Site logo

martinsedm / sw-cypress Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leichteckig/sw-cypress

0.0 0.0 0.0 1.07 MB

This is a blueprint project dealing with the implementation of E2E tests for the Shopware 6 platform project using Cypress framework. So .. If you're searching for a starting point, here you go. ๐Ÿ’™

License: MIT License

JavaScript 100.00%

sw-cypress's Introduction

sw-cypress

This is a project dealing with the implementation of E2E tests for the Shopware 6 platform project using Cypress framework.

photo5386507048319036166

Setup

Shopware 6 itself is not shipped with this project. This way, you need a running environment with a shopware platform repository. For more details about the setup steps, please refer to Shopware 6's getting started guide.

At first, clone this project in a folder you like. After that, you can just run the tests in a Docker container (see below).

One thing to keep in mind

Please notice that these Cypress tests don't rely on a specific dataset, but do need at least one entity of a kind to be available! E.g. one product, one customer, etc.

One possibility to fulfill these requirements is the following

shell helper description
./psh.phar install Full install with demo data
./psh.phar demo-data Command to add demo data, even at a later point

Install Cypress

The easiest way to install Cypress and all npm dependencies into your project folder is this docker helper:

docker run -ti --rm -v "$(pwd)":/cypress -v npm-root-cache:/root/.cache --workdir /cypress cypress/browsers:node11.13.0-chrome73 npm ci

You can also follow the Cypress installation guide for a manual installation.

Configure Cypress

Environment

Some environment variable are needed to run Cypress with Shopware 6 properly. Those environment variables have to be available thorough a cypress.env.json file.

We provide an example you can use out of the box. Therefore, just copy cypress.env.json.example in the same folder and remove the .example of the file name in the process. Afterwards, feel free to configure the environment variables according to your needs.

Appearance

By default, we use the shopware theme for Cypress test runner. IF you don't want to use it, please set the following to false:

"useShopwareTheme": true

In this test suite, we integrated cypress-dark plugin to provide a dark mode for the test runner as well. You can activate it through setting the following variable in cypress.json:

"useDarkTheme": false

Run Cypress

Run tests in Docker

Now you can run your tests in a Docker container:

docker run -ti --rm -v "$(pwd)":/cypress -v npm-root-cache:/root/.cache --workdir /cypress cypress/browsers:node11.13.0-chrome73 ./node_modules/cypress/bin/cypress run

Run tests on your machine (and watch them)

You can also run the tests on your machine and watch them running with cypress run.

Run only Storefront-Tests

If you only want to run the Storefront-Tests simply add --spec "cypress/integration/storefront/**/*" to the cypress open command.

Run tests against a remote URL

You can override the baseUrl to test a remote Shopware Installation by passing the --config baseUrl=https://<remote-hostname>/ param.

Further information

sw-cypress's People

Contributors

leichteckig avatar sironheart avatar thomaslohner avatar adriankirchner avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.