Giter VIP home page Giter VIP logo

cypress-component-examples's Introduction

This repository is no longer maintained. Please visit the new Cypress Component Testing Examples repository for the latest examples.

This repository contains a number of projects configured with Cypress component testing.

You can use any of them by cloning the repository, going into the directory and running:

  • yarn install to install the dependencies
  • yarn cypress open-ct to open in interactive mode
  • yarn cypress run-ct to run all the tests headlessly

Learn more about component testing with Cypress in the official docs.

cypress-component-examples's People

Contributors

cowboy avatar lmiller1990 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cypress-component-examples's Issues

vite-vue template not working

I tried downloading and starting the vite-vue template because I want to use cypress in my own vite/vue project. However, cypress doesn't find the src/HelloWorld.spec.js files, apparently:

$ yarn run cypress run
yarn run v1.22.18
warning package.json: No license field
$ E:\Downloads\cypress-component-examples-main\vite-vue\node_modules\.bin\cypress run

Can't run because no spec files were found.

We searched for any files inside of this folder:

E:\Downloads\cypress-component-examples-main\vite-vue\cypress\integration
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproductible by just doing

  • yarn
  • yarn run cypress run

When using Github Actions CI/CD + Nuxt, runner cannot find webpack-dev-server

Im trying to run tests in my Github Actions, i have sample test there and all is good on my local enviroment, but when running into github, test runner fails.


Your 'pluginsFile' is set to '/home/runner/work/xxx/xxx/cypress/plugins/index.js, but either the file is missing, it contains a syntax error, or threw an error when required. The 'pluginsFile' must be a '.js', '.ts', or '.coffee' file.

Or you might have renamed the extension of your 'pluginsFile'. If that's the case, restart the test runner.

Please fix this, or set 'pluginsFile' to 'false' if a plugins file is not necessary for your project.

 Error: Cannot find module 'webpack-dev-server'

My /plugins/index.js

const { getWebpackConfig } = require('nuxt')

export default (on) => {
  on('dev-server:start', async (options) => {
    const webpackConfig = await getWebpackConfig()
    return startDevServer({
      options,
      webpackConfig
    })
  })
} 

My workflow yaml

on:
  push:
    branches: ['*']

jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Set up node
        uses: actions/setup-node@v2
        with:
          node-version: '14'

      - name: Install dependencies
        run: npm ci

      - name: Run Component tests ๐Ÿงช
        uses: cypress-io/github-action@v2
        with:
          # we have already installed everything
          install: false
          # to run component tests we need to use "cypress run-ct"
          command: yarn cypress run-ct

Vite vue can't find tests

What I do...

git clone https://github.com/cypress-io/cypress-component-examples
cd cypress-component-examples/vite-vue
npm i
npx cypress run

What I would expect...

The example to run

What I get

It looks like this is your first time using Cypress: 7.2.0

  โœ”  Verified Cypress! /.../Cypress/7.2.0/Cypress.app

Opening Cypress...
Can't run because no spec files were found.

We searched for any files inside of this folder:
/.../cypress-component-examples/vite-vue/cypress/integration

I confirmed the spec files are in source

Seems broken

repro steps:
1: download / clone repo
2: cd into the nuxt-vue-2-cypress folder
3: yarn install
4: yarn cypress ct-open

Error message:

Error the plugins file is mising or invalid
...
...

{
  isCypressErr: true,
  type: 'PLUGINS_FILE_ERROR',
  details: "Error: Cannot find module 'webpack-dev-server'\n" +

...
[rest omitted]

The webpack-dev-server module is correctly installed and is present in the node_modules directory

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.