Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress 10 support #54

Closed
emargareten opened this issue Jun 1, 2022 · 5 comments
Closed

Cypress 10 support #54

emargareten opened this issue Jun 1, 2022 · 5 comments

Comments

@emargareten
Copy link

No description provided.

@troccoli
Copy link

troccoli commented Jun 4, 2022

Since the plugins directory is not supported anymore, I had to put the tasks in cypress.config.js

const {defineConfig} = require("cypress");
const fs = require("fs");

module.exports = defineConfig({
    e2e: {
        baseUrl: 'http://localhost',
        setupNodeEvents(on, config) {
            on('task', {
                activateCypressEnvFile() {
                    if (fs.existsSync('.env.cypress')) {
                        fs.renameSync('.env', '.env.backup');
                        fs.renameSync('.env.cypress', '.env');
                    }

                    return null;
                },

                activateLocalEnvFile() {
                    if (fs.existsSync('.env.backup')) {
                        fs.renameSync('.env', '.env.cypress');
                        fs.renameSync('.env.backup', '.env');
                    }

                    return null;
                },
            })
        },
    },
});

I'm sure there are other things to change, but this is a start.

@dillingham
Copy link
Contributor

Working so far by

  • adding the env swap plugin as mentioned above
  • moving package stub files into /cypress/support and importing them within /cypress/support/e2e.js

@ValCanBuild
Copy link

It worked for me without any changes by just running the auto migrate tool that comes with cypress 10

@curtisblackwell
Copy link

This may be more appropriate for the Mix repo, but is less compelling outside of a specific context like this one.

Cypress added support for component tests, which are integration tests that allow you to mount a component and interact with it as someone would in the browser without the need for a Laravel route.

I find component tests far easier to work with than Jest unit tests and would like to use the feature in Laravel apps I'm using Mix with. However, as far as I can tell, there's no simple way to feed the Mix-generated Webpack config into Cypress (as instructed in the Cypress docs and) shown below:

module.exports = {
  component: {
    devServer: {
      framework: 'vue',
      bundler: 'webpack',
      // optionally pass in webpack config — not so optional with a Mix setup
      webpackConfig: require('./webpack.config'),
    },
  },
}

It would be nice if this package, as part of adding support for Cypress 10, also played nicely with Cypress's component testing. I imagine that would mean adding a section in the docs that shows how to pass in the Webpack config from Mix. Or maybe even a stub?

I'm happy to contribute, I'd just want to know this is something maintainers (is it just @JeffreyWay?) would want to add support for and some help with/guidance in getting the Webpack config out of Mix.

@JeffreyWay
Copy link
Contributor

@curtisblackwell Yeah, this is probably a better question for the Mix repo.

@emargareten Cypress 10 support has now been added. Upgrade to v3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants