Launching Multiple Browser and running the URL's - browser

Protractor Version: 5.1.1
NPM : 3.10.10`
Browsers:Microsoft Edge(Ver 14), Safari(Ver 5.1.7), IE Ver11.0, firefox(ver 46.0) and Opera(Ver 43.0) Ver11.0, firefox(ver 46.0) and O: Win 10 43.0)
Operating System and Version : Win 10
Conf.js
//Code changes for multiCapabilities
multiCapabilities: [
{
browserName: 'chrome',
},
{
browserName: 'firefox',
},
{
browserName: 'MicrosoftEdge',
},
{
browserName: 'Opera',
},
{
browserName: 'Internet Explorer',
},
{
browserName: 'safari',
}, ],
Protractor.js
'webDriverUpdate': {
'browsers': ['chrome']
},
'webDriverUpdate': {
'browsers': ['Microsoft Edge']
},
'webDriverUpdate': {
'browsers': ['safari']
},
'webDriverUpdate': {
'browsers': ['Internet Explorer']
},
'webDriverUpdate': {
'browsers': ['firefox']
},
'webDriverUpdate': {
'browsers': ['Opera']
},
'webDriverStart': {
'args': ['--chrome']
},
'webDriverStart': {
'args': ['--Microsoft Edge']
},
'webDriverStart': {
'args': ['--Opera']
},
'webDriverStart': {
'args': ['--safari']
},
'webDriverStart': {
'args': ['--Internet Explorer']
},
'webDriverStart': {
'args': ['--firefox']
},
Issue: It is unable to launch Firefox,Safari,Microsoft Edge and Internet explorer though the drivers are downloaded in specific path
based on the browser versions.
The following is the error message which is throwing in the console for all the browser
Error message
\node_modules\gulp-angular-protractor\node_modules\gulp-protractor\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108
var template = new Error(this.message);
^
UnknownError: The best matching driver provider org.openqa.selenium.edge.EdgeDriver can't create a new driver instance
for Capabilities [{count=1, browserName=Microsoft Edge
When I run the scripts using single browsers the same error message is getting displayed.

Related

How to use iohook with electron js and node js

I am using electron js(version 13.1.9) and node js (version 14.12.0). Used this code but still not working.
`const nodeAbi = require('node-abi')
console.log("node:"+nodeAbi.getAbi('14.12.0', 'node'));
console.log("electron:"+nodeAbi.getAbi('13.1.9', 'electron'));
"iohook": {
"targets": [
"node-83",
"electron-89"
],
"platforms": [
"win32",
"darwin",
"linux"
],
"arches": [
"x64",
"ia32"
]
},
const ioHook = require('iohook');
ioHook.on('mousemove', (event) => {
console.log(event); // { type: 'mousemove', x: 700, y: 400 }
});`

Babel config to SWC

Now I have such babel config on the project and I really want to rewrite this case under swc. Would anyone be able to help with this
module.exports = {
sourceMaps: true,
presets: [
[
'#babel/preset-env',
{
exclude: ['transform-async-to-generator', 'transform-regenerator'],
},
],
'#babel/preset-react',
[
'#babel/preset-typescript',
{
isTSX: true,
allExtensions: true,
},
],
],
plugins: [
'#babel/plugin-syntax-dynamic-import',
['#babel/plugin-proposal-decorators', { legacy: true }],
['#babel/plugin-proposal-class-properties', { loose: true }],
['module:fast-async', { spec: true }],
[
'#babel/plugin-transform-regenerator',
{
asyncGenerators: true,
generators: true,
async: false,
},
],
],
};
Now I have written such a config, but part of the application has stopped working with similar errors: [MobX] Cannot decorate undefined property: 'description'
test: /\.(tsx|ts|jsx|js)$/,
loader: 'swc-loader',
options: {
jsc: {
keepClassNames: true,
parser: {
syntax: 'typescript',
decorators: true,
tsx: true,
dynamicImport: true,
preserveAllComments: false
},
transform: {
legacyDecorator: true,
decoratorMetadata: true
},
loose: false
},
},

How to disable removeViewBox plugin in Next.Js and svgr?

I would like to disable the removeViewBox plugin in Next.js/svgr/svgo. The following next.config.js should work but it does not.
Anybody can help ?
I'm using it with:
"#svgr/webpack": "^6.2.0", "react": "17.0.2", "next": "^12.0.7",
module.exports = {
reactStrictMode: true,
i18n,
webpack(config) {
config.module.rules.push(
{
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: [
{
loader: '#svgr/webpack',
options: {
prettier: false,
svgo: true,
icon: true,
svgoConfig: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
},
},
},
],
},
titleProp: true,
},
},
],
})
return config
},
}
For #svgr/webpack#5.5.0 it worked when I added { removeViewBox: false } right to plugins array:
{
loader: '#svgr/webpack',
options: {
svgoConfig: {
plugins: [
{ removeViewBox: false },
],
},
},
},
This is what's worked for my with next#13.0.5 and #svgr/webpack#6.5.1
config.module.rules.push({
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: [{ loader: '#svgr/webpack', options: { icon: true } }]
});

Problem with app update yml files is not generated in electron?

I have a problem with the auto-update of electron app,
After I finished all the app parts and I am trying to push it to my custom update server , I found this error message in my logger :
Error unknown ENOENT: no such file or directory, open
'C:\{appPath}\{appName}\resources\app-update.yml'
and here is my package.json build configuration
"build": {
"appId": "com.server.app",
"copyright": "Copyright company name",
"generateUpdatesFilesForAllChannels": true,
"win": {
"target": "nsis",
"icon": "build/icon.ico"
},
"mac": {
"target": "dmg",
"artifactName": "appName.dmg",
"icon": "build/icon.icns"
},
"dmg": {
"background": "build/i-bg.tif",
"icon": "build/setup.icns",
"iconSize": 80,
"title": "${productName}-${version}",
"window": {
"width": 540,
"height": 380
}
},
"nsis": {
"artifactName": "${productName}-Setup-${version}.${ext}",
"oneClick": false,
"perMachine": false,
"allowToChangeInstallationDirectory": true,
"installerIcon": "build/setup.ico",
"uninstallerIcon": "build/setup.ico",
"installerHeader": "build/installerHeader.bmp",
"installerSidebar": "build/installerSidebar.bmp",
"runAfterFinish": true,
"deleteAppDataOnUninstall": true,
"createDesktopShortcut": "always",
"createStartMenuShortcut": true,
"shortcutName": "AppName",
"publish": [{
"provider": "generic",
"url": "https://my-update-server/path"
}]
},
"extraFiles": [
"data",
"templates"
]
},
"publish": [{
"provider": "generic",
"url": "https://my-update-server/path"
}],
and here is the code for triggering the auto-update
//-----------------------------------------------
// Auto-Update event listening
//-----------------------------------------------
autoUpdater.on('checking-for-update', () => {
splashLoadingStatus(`Checking for ${appName} update ...`);
})
autoUpdater.on('update-available',(info) => {
splashLoadingStatus(`${appName} new update available.`);
})
autoUpdater.on('update-progress',(progInfo) => {
splashLoadingStatus(`Download speed: ${progInfo.bytesPerSecond} - Download ${progInfo.percent}% (${progInfo.transferred}/${progInfo.total})`);
})
autoUpdater.on('error' , (error) => {
dialog.showErrorBox('Error', error.message);
})
autoUpdater.on('update-downloaded', (info) => {
const message = {
type: 'info',
buttons: ['Restart', 'Update'],
title: `${appName} Update`,
detail: `A new version has been downloaded. Restart ${appName} to apply the updates.`
}
dialog.showMessageBox(message, (res) => {
if(res === 0) {
autoUpdater.quitAndInstall();
}
})
})
.....
autoUpdater.setFeedURL('https://my-update-server/path');
autoUpdater.checkForUpdatesAndNotify();
.....
then when I am pushing the build it will do everything correct with the latest.yml file generating but after installing I found the app-update.yml is not there ...
If you have a problem with missing app-update.yml and dev-app-update.yml then paste the following code into index.js:
import path from "path"
import fs from "fs"
const feed = 'your_site/update/windows_64'
let yaml = '';
yaml += "provider: generic\n"
yaml += "url: your_site/update/windows_64\n"
yaml += "useMultipleRangeRequest: false\n"
yaml += "channel: latest\n"
yaml += "updaterCacheDirName: " + app.getName()
let update_file = [path.join(process.resourcesPath, 'app-update.yml'), yaml]
let dev_update_file = [path.join(process.resourcesPath, 'dev-app-update.yml'), yaml]
let chechFiles = [update_file, dev_update_file]
for (let file of chechFiles) {
if (!fs.existsSync(file[0])) {
fs.writeFileSync(file[0], file[1], () => { })
}
}
I fixed it by using autoUpdater.setFeedURL() before autoUpdater.checkForUpdates(). Below is the code snippet that works for github releases. Also, please make sure there is existing release in Github before running this code.
import { autoUpdater } from "electron-updater";
// ...
autoUpdater.setFeedURL({
provider: "github",
owner: "org",
repo: "repo",
});

Parallel run in Chrome

I am trying to implement parallel test execution in Chrome to reduce the test execution time. The framework being used is protractor-cucumber framework with Node JS. The webdriver instances open up in two tabs rather than two separate windows of Chrome.
Used the multicapabilities in the config file to set testsharding as true and maxinstances as 2:
multiCapabilities: [
{
shardTestFiles: true,
maxInstances: 4,
browserName: chrome,
specs: ['*.spec.js']
},
Chrome is opening 2 tabs instead of windows and the tests are not getting distributed across the tabs.
Full config as requested
const path = require("path");
const jsonReports = process.cwd() + "/reports/json";
exports.config = {
seleniumAddress: "http://localhost:4444/wd/hub",
baseUrl: "https://www.google.co.uk",
multiCapabilities: [
{
browserName: "chrome",
shardTestFiles: true,
maxInstances: 2
}
],
framework: "custom",
frameworkPath: require.resolve("protractor-cucumber-framework"),
specs: ["../features/*.feature"],
onPrepare: function() {
browser.ignoreSynchronization = true;
browser.manage().window().maximize();
Reporter.createDirectory(jsonReports);
},
cucumberOpts: {
strict: true,
format: 'json:./reports/json/cucumber_report.json',
require: ["../stepDefinitions/*.js"],
tags: "(#AllureScenario or #CucumberScenario or #ProtractorScenario) and (not #DatabaseTest)" //
},
onComplete: function () {
}
};

Resources