Giter Club home page Giter Club logo

vue-cli-plugin-e2e-playwright's People

Contributors

dependabot[bot] avatar marcol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ttanakatt

vue-cli-plugin-e2e-playwright's Issues

Getting base_url inside test?

The cli plugin launches the server and works perfectly with a hard-coded base url. Is there any way to get the server url from within the test so that the base url will always be correct?

const base_url='http:/192.168.1.10:8100/'; // <= want to get this from the cli plugin/mocha somehow?
page = await browser.newPage();
await page.goto(base_url);

conflicting versions for project dependency "@vue/test-utils"

image

 WARN  conflicting versions for project dependency "@vue/test-utils":

       - ^2.0.0-0 injected by generator "@vue/cli-plugin-unit-mocha"
       - ^1.0.4 injected by generator "vue-cli-plugin-e2e-playwright"

       Using newer version (^2.0.0-0), but this may cause build errors.

How to reproduce

I create preset https://cli.vuejs.org/guide/plugins-and-presets.html:

Step 1: Create file

./my-preset/preset.json

{
  "useConfigFiles": true,
  "plugins": {
    "@vue/cli-plugin-babel": {},
    "@vue/cli-plugin-typescript": {
      "classComponent": false,
      "useTsWithBabel": true
    },
    "@vue/cli-plugin-router": {
      "historyMode": true
    },
    "@vue/cli-plugin-eslint": {
      "config": "airbnb",
      "lintOn": [
        "save",
        "commit"
      ]
    },
    "@vue/cli-plugin-unit-mocha": {},
    "vue-cli-plugin-e2e-playwright": {}
  },
  "vueVersion": "3",
  "cssPreprocessor": "dart-sass"
}

Step 2: run command

vue create --preset ./my-preset test --packageManager=npm

Running Tests written in Typescript

I have an application written in Typescript. I'd like to also write tests in Typescript. Playwright, Mocha and Chai all support Typescript, but I cannot figure out how to structure the code. I keep getting errors such as SyntaxError: Cannot use import statement outside a module.

I've come up with something like this, but I suspect the Typescript compiler does not like having method invocations outside of a class:

import { expect } from "chai";
import { describe } from "mocha";


describe("My example E2E test with Playwright", () => {
  let browser!: Browser;
  let page!: Page;

  before(async () => {
    browser = await chromium.launch();
    page = await browser.newPage();
    await page.goto("https://www.example.com/");
  });

  after(async () => {
    await page.close();
    await browser.close();
  });

  it("has header", async () => {
    const h1 = await page.$("h1");
    const text = await h1?.innerText();
    expect(text).to.equal("Example Domain");
  });
});

If this is something you know how to structure, would you please be able to add a snippet in the doco for this project. That would be most appreciated.

If not, no problems.

Thanks

using ES2020

Hi, we are having issue using es2020 operator chaining with your plugin -
we are getting this error:
You may need an additional loader to handle the result of these loaders.

`You may need an additional loader to handle the result of these loaders.
|
| isParamLocked() {

  return this.getUpdatedLocks?.lockCollisions?.get(this.paramName);

| }`

Is there any setting we can change to make it work?

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.