How to generate allure report for cucumber js on playwright? - playwright

I can not generate allure report for executed features
My package json looks next:
{
"author": "Lorem ipsum",
"description": "Playwright end-to-end test automation with Cucumber",
"devDependencies": {
"#cucumber/cucumber": "^8.5.1",
"#playwright/test": "^1.30.0",
"allure-playwright": "^2.0.0-beta.25",
"cucumber-junit": "^1.5.0",
"cucumberjs-junitxml": "^1.0.0",
"playwright": "^1.24.0",
"jasmine-allure-reporter": "^1.0.2",
"jest-allure": "^0.1.3",
"jasmine":"^3.7.0",
"allure-commandline": "^2.17.2"
},
"keywords": [
"cucumber"
],
"license": "",
"name": "automation",
"repository": {
"type": "git",
"url": ""
},
"scripts": {
"test": "cucumber-js --parallel 1 --tags '#smoke' -f json:report/report.json && node report.js && cat report/report.json | npx cucumber-junit > report/junitreport.xml --publish",
"allure:generate": "npx allure generate ./allure-results --clean",
"allure:open": "npx allure open ./allure-report",
"allure:serve": "npx allure serve"
},
"version": "1.0.0",
"dependencies": {
"cucumber-html-reporter": "^5.3.0",
}
}
I mixed it from all resources what could find.
Have also playwright.config.js in root of folder. It looks next:
const { PlaywrightConfig } = require('#playwright/test');
module.exports = PlaywrightConfig({
reporter: "allure-playwright"
});
But when try to generate report I see NaN. I guess that my test script is not configured properly. Help please with refactor it to run features by tags in couple of threads and with output results for allure.
And dependencies I guess also specified incorrectly (extra or less)

Related

AWS CDK Code Pipeline Development - Typescript Error TS2307

Problem:
Whilst developing my Code Pipeline, I am experiencing a new error I did not receive with cdk deploy --all in the CLI. All stacks deploy successfully.
Code Build Error Message:
src/lambda-handlers/queue-consumers/intoMagentoQueueConsumer/index.ts(3,75): error TS2307: Cannot find module '#aws-sdk/client-sfn' or its corresponding type declarations.
Lambda Function Import Statements:
import { SFNClient, SendTaskSuccessCommand, SendTaskFailureCommand } from "#aws-sdk/client-sfn";
Lambda Function Package.json:
{
"name": "intomagentoqueueconsumer",
"module": "commonjs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#aws-sdk/client-sfn": "^3.226.0",
"axios": "^1.2.1",
"axios-retry": "^3.3.1"
}
}
Lambda Function CDK Definition:
this.intoMagentoQueueConsumer = new NodejsFunction(this, `intoMagentoQueueConsumer`, {
runtime: Runtime.NODEJS_16_X,
handler: "handler",
depsLockFilePath: join(__dirname, "../../src/lambda-handlers/queue-consumers/intoMagentoQueueConsumer/package-lock.json"),
entry: join(__dirname, "../../src/lambda-handlers/queue-consumers/intoMagentoQueueConsumer/index.ts"),
bundling: { minify: false, nodeModules: ["#aws-sdk/client-sfn", "axios", "axios-retry"], externalModules: ["aws-sdk", "crypto-js"] },
});
Porting the solution from the comments for posterity:
Do you have mismatched npm CLI versions? AWS CodeBuild tsc error TS2307: Cannot find module.
I understand your project has multiple package.json. In your pipeline ShellStep commands, make sure you are running npm ci for each one to install the dependencies.

Huge difference in build size of Electron Forge and Electron builder

I have just started learning Electron from the official Quick Start guide. At the end of the guide, they've recommended to use Electron Forge as the tool to create the distributable package. Another tool for the same purpose is Electron Builder.
I've used the latter before and out of curiosity I created the quick start app build with both the tools. To my surprise, there is a huge difference between the dmg builds that were created for the same app on MacOS:
Electron Forge - 180.9 MB
Electron Builder - 315.1 MB (628.3 MB after installation)
I understand the Electron builds are fairly large in size due to the shipment of Chromium and Node along with the package but this significant difference (~134.2 MB) between the builds of a quick start app is quite not clear to me.
package.json:
{
"name": "my-electron-app",
"version": "1.0.0",
"description": "Hello World",
"main": "main.js",
"scripts": {
"test": "test",
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
},
"license": "MIT",
"devDependencies": {
"#electron-forge/cli": "^6.0.0-beta.57",
"#electron-forge/maker-deb": "^6.0.0-beta.57",
"#electron-forge/maker-rpm": "^6.0.0-beta.57",
"#electron-forge/maker-squirrel": "^6.0.0-beta.57",
"#electron-forge/maker-zip": "^6.0.0-beta.57",
"electron": "^13.1.6",
"electron-builder": "^22.11.7",
"electron-log": "^4.3.5",
"electron-reloader": "^1.2.1"
},
"dependencies": {
"electron-squirrel-startup": "^1.0.0"
},
"config": {
"forge": {
"packagerConfig": {},
"makers": [
{
"name": "#electron-forge/maker-squirrel",
"config": {
"name": "my_electron_app"
}
},
{
"name": "#electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "#electron-forge/maker-deb",
"config": {}
},
{
"name": "#electron-forge/maker-rpm",
"config": {}
}
]
}
}
}
I need help with the following questions:
Why there is a huge difference for a simple quick starter app?
Is there any way or standard practice with which we could reduce the final build size in Electron (besides npm prune, deleting node_modules and then creation of build as it had no effect)?

Where can I see output of echo in electron-builder custom NSIS include script?

I have created simplest electron app from official Quick Start Guide.
I am able to create installer also using electron-builder
Now I want to try customUnInstall macro of NSIS option given at https://www.electron.build/configuration/nsis
My installer.nsh file is
!macro customUnInstall
!echo "test output"
!macroend
My package.json file is
{
"name": "my-electron-app",
"version": "0.1.0",
"author": "your name",
"description": "My Electron app",
"main": "main.js",
"scripts": {
"start": "electron .",
"pack": "electron-builder --dir",
"dist": "electron-builder"
},
"devDependencies": {
"electron": "^12.0.1",
"electron-builder": "^22.10.5"
},
"build": {
"nsis": {
"include": "installer.nsh"
}
}
}
Where can I see output of line !echo "test output" in installer.nsh?
Currently I am not seeing any output message or dialogue in case of running uninstaller.
!echo prints a message in the compiler, use DetailPrint or MessageBox to display something in the installer/uninstaller.
e.g.
!macro customUnInstall
MessageBox MB_OK "Test output"
!macroend

How to Publish to a Private GitHub with Electron-builder NSIS and AppImage?

Electron-builder Version: 20.38.5
Target: Windows ia32 and x64
I'm trying to push the project to GitHub releases in a private repository.
The main target is Win ia32 and x64.
I set the token in the console by:
set GH_TOKEN=<blabla>
And at the package.json file:
"publish": {
"provider": "github",
"repo": "electron-todo-tasks",
"owner": "AndreD23",
"host": "github.com",
"protocol": "https",
"releaseType": "draft",
"token": "<blablabla>",
"private": true
}
I'm the only one who will have access to the project, so updating the token in the file apparently not a problem.
But, when I run:
electron-builder --x64 --ia32 --publish always
It shows me the error:
Error: Cannot cleanup:
Error #1 --------------------------------------------------------------------------------
HttpError: 404 Not Found
"method: undefined url: https://github.com/repos/AndreD23/electron-todo-tasks/releases\n\nPlease double check that your authentication token is correct. Due to security reasons actual status maybe not reported, but 404.\n"
I'll attach the whole error.
2019-03-22T13_04_27_992Z-debug.log
electron publish error.txt
I tried to change the option always to onTag or onTagOrDraft and change releaseType to release.
I tried to manually create a draft on GitHub first, doesn't work.
I tried to make the repository public for tests, not working too.
I tried to regenerate the token twice and updated the envs, console and package.json, doesn't work.
Is there any configuration that I've missed? What I have to do for Electron to publish to GitHub?
At the error, it says that cannot find https://github.com/repos/AndreD23/electron-todo-tasks/releases. Opening it on the web browser, it returns 404. I find the link a bit strange because it adds the word repos after github.com, and removing it in the browser it loads fine. This word is setting automatically?
Thanks #edelCustodio
Reference: https://github.com/electron-userland/electron-builder/issues/3776#issuecomment-486888574
This worked for me, on PowerShell type this
[Environment]::SetEnvironmentVariable("GH_TOKEN","my-personal-token","User")
and be sure that you package.json will be like this:
"build": {
"appId": "com.friasoftit.electron-auto-update",
"productName": "Electron Auto Update",
"publish": [
{
"provider": "github",
"owner": "edelCustodio",
"repo": "electron-auto-update"
}
],
"win": {
"publish": [
"github"
],
"target": [
{
"target": "nsis",
"arch": [
"x64",
"ia32"
]
}
]
}
},
And then I run this command yarn run publish and this is how my publish is on my package.json
"publish": "build --win -p always"
Don't forget to close and open a new PowerShell terminal.
Run windows powerShell from Administrator
Execute [Environment]::SetEnvironmentVariable("GH_TOKEN","<git_hub_token>","User")
Launch or full restart your IDE
Run bozon package windows --publish
Config:
{
"name": "",
"version": "",
"description": "",
"author": "",
"repository": "<repo_url>",
"dependencies": {
"cross-fetch": "^3.0.6",
"electron-builder": "^22.10.5",
"file-loader": "^6.2.0",
"luxon": "^1.26.0",
"node-fetch": "^2.6.1"
},
"license": "ISC",
"devDependencies": {
"bozon": "1.1.3",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"jest": "26.6.3",
"spectron": "13.0.0"
},
"build": {
"appId": "",
"publish": [
{
"provider": "github"
}
],
"win": {}
},
"main": ".eslintrc.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}

Electron-packager does not package node modules which names are started from "#"

I create desktop application by using electron, and tried electron-packager.
But electron-packager doesn't package node modules which names are started from "#" (Example: #turf, #mapbox)
In node_modules folder of developing folder, I can find "#turf" and "#mapbox".
But after running
>electron-packager . MaplatEditor --platform=darwin --arch=x64 --electron-version=1.7.9
Created package never includes "#turf" and "#mapbox".
And also, it's depending modules are also not included.
My package.json includes "#turf", so it is not setting error.
{
"name": "MaplatEditor",
"version": "1.0.0",
"description": "",
"main": "lib/main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#turf/turf": "^4.6.1",
"argv": "0.0.2",
"async": "^2.5.0",
"child_process": "^1.0.2",
"electron-json-storage": "^3.2.0",
"file-url": "^2.0.2",
"fs-extra": "^3.0.1",
"imagemagick": "^0.1.3",
"mapshaper": "^0.4.31",
"path": "^0.12.7",
"wellknown": "^0.5.0"
}
}
How can I package such #-started modules into application package?
In my case, I updated #Turf module for latest version, then electron-packager worked well.
I don't know why, but it looks not the issue of electron-packager...

Resources