playwright, cucumber in nx - nrwl-nx

Is there any way to setup e2e test with Playwright and Cucumber instead of cypress? I need to use from playwright and cucumber as it's test runner in my nx project.

I would suggest to use https://github.com/marksandspencer/nx-plugins/tree/main/packages/nx-playwright
You will need to install the plugin using
yarn add --dev #mands/nx-playwright
yarn playwright install --with-deps
Remove existing e2e app nx generate remove <APP-NAME>-e2e before generating a new one
Generate new e2e app
yarn nx generate #mands/nx-playwright:project <APP-NAME>-e2e --project <APP-NAME>
PS: I am also author of the plugin

Related

Nx.dev doesn't show my newly created plugin

I'm trying to understand and use nx.dev dev tools
Basically what I'd like to do now is to create a custom plugin.
So I first installed the #nrwl/nx-plugin plugin which allows to build custom plugins.
Then I created a test plugin using the command:
nx g #nrwl/nx-plugin:plugin my-plugin
Done that, I built the plugin:
nx run my-plugin:build
Then I published to npm (my local npm repository of course, hosted via Verdaccio)
npm publish ./dist/libs/my-plugin --registry http://localhost:4873
Done that I installed my brand new plugin as you would do with any other nx plugin:
npm install -D #webtest/my-plugin --registry http://localhost:4873
Please note that #webtest is the name of my nx.dev workspace
The command is successful, but when I do:
nx list
I don't see it in the installed plugin list. All I get is:
NX Installed plugins:
#nrwl/cypress (builders,schematics)
#nrwl/jest (builders,schematics)
#nrwl/linter (builders)
#nrwl/node (builders,schematics)
#nrwl/nx-plugin (builders,schematics)
#nrwl/web (builders,schematics)
#nrwl/workspace (builders,schematics)
I would expect a #webtest/my-plugin on there. What am I missing here? Should the custom plugin appear in the installed plugin list?
It looks like there's a regression where only core and community plugins are listed when running nx list. This will be patched in 9.4.

VSTS Build is failing with Polymer build

I am running npm,lerna,yarn and bootstrap in my VSTS build definitions via Command line task after running all the above commands I am running npm run build command but while running npm run build command its failing with 'polymer' is not recognized as an internal or external command.Please help me on this.I tried running polymer in a command line passing polymer as a tool and arguments as build even though its failing.Please help me.
Make sure that the polymer-cli npm package is listed in your dev dependencies (at least it sounds like a dev dependency to me) in your package.json. Also make sure you run npm install before you run npm run build. You might have to point your NPM build script to the Polymer package in your node_modules folder because it is not installed globale on the build server

Setup ng e2e in protractor

I have protractor 5.1.2 on my machine. When I do ng e2e, it download webdriver 2.37. I want to change it to webdriver 2.26. What config should I update to achieve it.
Because ng e2e will execute webdriver-manager update as default, and np e2e can't pass down the --versions.chrom=2.26 to webdriver-manager update.
So we can disable the webdriver-manager update of ng e2e by execute command: ng e2e --webdriver-update=false or ng e2e --wu=false, and before execute this command, you have to execute node_modules/.bin/webdriver-manager update --versions.chrome=2.26 manually to update webdriver to certain version.

code ship fails with error - You have to be inside an angular-cli project in order to use the serve command

For my angular CLI/Bitbucket project I am running following script in Codeship but it gives error You have to be inside an angular-cli project in order to use the serve command.
#install node version, 4.x is required for the angular-cli
nvm install 4.1
#install angular-cli
npm install angular-cli
#run npm install for your project dependencies
npm install
Under that script is the "Test Pipelines", where the script is setup to run the tests.
#serve the application adding '&' to run command in background
ng serve &
#start end to end tests using protractor
ng test
#if all of the tests pass, then build the production assets
ng build -prod
According to https://github.com/angular/angular-cli/issues/4379 this error message is usually triggered if you're using the (now deprecated) angular-cli package.
Either update the package.json file for the project to reference the #angular/cli package, or make sure to install this package instead of the deprecated one.

How do I run protractor from source code

I cloned the protractor code from github (https://github.com/angular/protractor)
Is there a way to run the code from the source code? The documentation is always mentions to install protractor with "npm install", but I want to run the latest code.
Is there an easy way to do this ?
npm install in this context is meant to install the local dependencies for protractor.
You need to just run the protractor script in the bin folder.
git clone https://github.com/angular/protractor.git
cd protractor
npm install
cd bin/
./protractor /path/to/e2e/e2e-conf.js