ERROR #wdio/cli:utils: A service failed in the 'onPrepare' hook Error: Appium exited before timeout (exit code: 1) - Appium using emulator in VSCode - android-emulator

When trying to run I'm having the log below as ERROR #wdio/cli:utils: A service failed in the 'onPrepare' hook Error: Appium exited before timeout (exit code: 1)
package.json :
{
"name": "test2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/wdio wdio.conf.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#wdio/cli": "^7.3.1"
},
"devDependencies": {
"#wdio/appium-service": "^7.3.1",
"#wdio/local-runner": "^7.3.1",
"#wdio/mocha-framework": "^7.3.1",
"#wdio/spec-reporter": "^7.3.1",
"#wdio/sync": "^7.3.1",
"chromedriver": "^89.0.0",
"wdio-chromedriver-service": "^7.0.0"
}
}

Related

Importing jQuery with Parcel JS

I am trying to create a library using parceljs and after npm run watch, i am getting
Uncaught ReferenceError: require is not defined
package.json
{
"name": "social-tagger",
"version": "1.0.0",
"description": "",
"source": "src/index.ts",
"main": "dist/main.js",
"module": "dist/module.js",
"scripts": {
"watch": "parcel watch",
"build": "parcel build"
},
"author": "",
"license": "ISC",
"dependencies": {
"#yaireo/tagify": "^4.12.0",
"jquery": "^3.6.0"
},
"devDependencies": {
"#parcel/packager-ts": "^2.6.2",
"#parcel/transformer-typescript-types": "^2.6.2",
"#types/jquery": "^3.5.14",
"parcel": "^2.6.2",
"typescript": "^4.7.4"
}
}
src/social.ts
import * as jQuery from 'jquery';
How to properly import jQuery
Output From Inspect Element
Added Targets to package.json
package.json
{
"name": "social-tagger",
"version": "1.0.0",
"description": "",
"source": "src/index.ts",
"main": "dist/main.js",
"module": "dist/module.js",
"scripts": {
"watch": "parcel watch",
"build": "parcel build"
},
"author": "",
"license": "ISC",
"dependencies": {
"#yaireo/tagify": "^4.12.0",
"jquery": "^3.6.0"
},
"devDependencies": {
"#parcel/packager-ts": "^2.6.2",
"#parcel/transformer-typescript-types": "^2.6.2",
"#types/jquery": "^3.5.14",
"parcel": "^2.6.2",
"typescript": "^4.7.4"
},
"targets":{
"main": {
"includeNodeModules": true
}
}
}
Create a file named jquery.ts
jquery.ts
import jquery from "jquery";
export default ((window as any).jQuery = jquery);
Dont import jquery instead import from jquery.ts
social.ts
import './jquery';

Error: Jest: Got error running globalSetup ../#shelf/jest-mongodb/setup.js, reason: Instance Exited before being ready and without throwing an error

I'm following the documentation on jestjs.io. When I try to run a test I get this error:
Error: Jest: Got error running globalSetup - /home/.../node_modules/#shelf/jest-mongodb/setup.js, reason: Instance Exited before being ready and without throwing an error!
This happened both when I've used typescript and also when I created a simple app using javascript instead:
package.json:
{
"name": "mongojest",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"#shelf/jest-mongodb": "^3.0.1"
},
"scripts": {
"test": "jest"
},
"dependencies": {
"jest": "^28.1.0"
}
}
jest.config.js:
module.exports = {
coverageProvider: "v8",
"preset": "#shelf/jest-mongodb"
};
I haven't made any changes other than the minimum installs to get it running.
I got around this issue by installing Ubuntu 20.04. I was using the newer Ubuntu 22.04 and it seem to have caused some issues.
I installed typescript in my project. That was enough to run. Follow my configuration files
//package.json
{
"name": "research-with-programmers-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "jest --passWithNoTests --silent --noStackTrace --runInBand",
"test:verbose": "jest --passWithNoTests --runInBand",
"test:unit": "yarn test -- --watch -c jest-unit-config.ts",
"test:integration": "yarn test -- --watch -c jest-integration-config.ts",
"test:staged": "yarn test -- --findRelatedTest",
"test:ci": "yarn test -- --coverage"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#shelf/jest-mongodb": "^4.1.0",
"#types/bcrypt": "^5.0.0",
"#types/jest": "^28.1.8",
"#types/mongodb": "^4.0.7",
"#types/node": "^18.7.13",
"#types/validator": "^13.7.6",
"#typescript-eslint/eslint-plugin": "^5.0.0",
"eslint": "^8.0.1",
"eslint-config-standard-with-typescript": "^22.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-promise": "^6.0.0",
"git-commit-msg-linter": "^4.1.3",
"husky": "^8.0.1",
"jest": "^29.0.1",
"lint-staged": "^13.0.3",
"ts-jest": "^28.0.8",
"ts-node": "^10.9.1",
"typescript": "^4.8.2"
},
"dependencies": {
"bcrypt": "^5.0.1",
"mongodb": "^4.10.0",
"validator": "^13.7.0"
}
}
//jest-config.ts
export default {
roots: ['<rootDir>/src'],
collectCoverageFrom: [
'<rootDir>/src/**/*.ts',
'!<rootDir>/src/**/protocols/*.ts',
'!<rootDir>/src/**/*protocols.ts',
'!<rootDir>/src/**/models/*.ts',
'!<rootDir>/src/**/usecases/*.ts',
'!<rootDir>/src/**/index.ts'
],
collectCoverage: true,
coverageDirectory: 'coverage',
coverageProvider: 'v8',
testEnvironment: 'node',
preset: '#shelf/jest-mongodb',
transform: {
'.+\\.ts$': 'ts-jest'
}
}
// jest-mongodb-config.ts
export default {
mongodbMemoryServerOptions: {
instance: {
dbName: 'jest'
},
binary: {
version: '4.0.3',
skipMD5: true
},
autoStart: false
}
}

how to solve mongoParseError in nodeModule?

this is output after run yarn start having this is the error:
`yarn run v1.22.17
warning ../../../package.json: No license field
$ ts-node index.ts
MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"
at new ConnectionString (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongodb-connection-string-url/src/index.ts:133:13)
at parseOptions (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/node_modules/mongodb/src/connection_string.ts:253:15)
at new MongoClient (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/node_modules/mongodb/src/mongo_client.ts:337:34)
at /Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/lib/connection.js:783:16
at new Promise (<anonymous>)
at NativeConnection.Connection.openUri (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/lib/connection.js:780:19)
at Mongoose.createConnection (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/lib/index.js:285:10)
at Object.<anonymous> (/Users/youmnasalloum/Desktop/ts/user/db/index.ts:9:28)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Module.m._compile (/Users/youmnasalloum/Desktop/ts/user/node_modules/ts-node/src/index.ts:1455:23)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make: *** [start] Error 1`
this is package.json:
{ "name": "user", "version": "1.0.0", "main": "index.ts", "repository": "https://github.com/ArtistCrowdfundExchange/user", "author": "Oghogho Odemwingie", "license": "MIT", "devDependencies": { "#types/bcrypt": "^3.0.0", "#types/node": "^17.0.13", "typescript": "4.5.5" }, "scripts": { "start": "ts-node index.ts", "test": "echo no tests yet" }, "dependencies": { "#aws-sdk/client-s3": "^3.41.0", "#grpc/grpc-js": "^1.3.7", "amqp": "^0.2.7", "aws4": "^1.11.0", "bcrypt": "^5.0.0", "cuid": "^2.1.8", "encrypter": "^1.0.0", "erax.db": "^3.3.1", "jose": "3", "mongodb": "^4.5.0", "mongodb-uri": "^0.9.7", "mongoose": "6.1.8", "nanoid": "^3.1.29", "proto": "git+https://github.com/ArtistCrowdfundExchange/proto#playground", "ts-node": "^10.4.0", "winston": "^3.3.3", "yael-autoencrypt": "^1.1.0" } }
I tried to add packages mongo-Uri,mongo-connection-string-URI using yarn but still the same error when I do yarn start

Getting "connect ECONNREFUSED" error when I "npm run seed" in feathers api with mongodb

I'm learning react and feathers. For my recipes app that I've made in react I use feathers api and mongodb. I have some seeds as examples in /src/seeds.js and just began to set up everything in feathers but when I want to run my seeds(npm run seed) and check if it works on feathers localhost:3030/recipes I got this error:
Error creating user! { Error: connect ECONNREFUSED 127.0.0.1:3030
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1087:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 3030,
response: undefined }
I don't know the error is because of connection or creating user!
I checked my mondo db, it runs.
this is package.json, just in case:
{
"name": "recipes-api(par)",
"description": "api for recipes app",
"version": "0.0.0",
"homepage": "",
"main": "src/",
"keywords": [
"feathers"
],
"license": "MIT",
"repository": {},
"author": {},
"contributors": [],
"bugs": {},
"engines": {
"node": ">= 0.12.0"
},
"scripts": {
"test": "npm run jshint && npm run mocha",
"jshint": "jshint src/. test/. --config",
"start": "node src/",
"mocha": "mocha test/ --recursive",
"seed": "node src/seeds.js"
},
"dependencies": {
"body-parser": "^1.17.1",
"compression": "^1.6.2",
"cors": "^2.8.3",
"feathers": "^2.1.1",
"feathers-authentication": "^0.7.12",
"feathers-client": "^2.2.0",
"feathers-configuration": "^0.3.3",
"feathers-errors": "^2.6.3",
"feathers-hooks": "^1.8.1",
"feathers-mongoose": "^3.6.2",
"feathers-rest": "^1.7.2",
"feathers-socketio": "^1.6.0",
"mongoose": "^4.9.6",
"passport": "^0.3.2",
"serve-favicon": "^2.4.2",
"superagent": "^3.5.2",
"winston": "^2.3.1"
},
"devDependencies": {
"jshint": "^2.9.4",
"mocha": "^3.3.0",
"request": "^2.81.0"
}
}
Before adding seeds I should have seen {"total":0,"limit":5,"skip":0,"data":[]} in http://localhost:3030/recipes that I'm still having it but after running seeds I should see the list of my recipes.
Anythings else that I need to copy here from my code? any idea?

Serentiy Report with protracor and cucumber

I have protractor cucumber example works fine, now I'm trying to create report by serenity.js
protractor.conf.js file
exports.config = {
getPageTimeout: 600000,
allScriptsTimeout: 700000,
framework: 'custom',
frameworkPath: require.resolve('serenity-js'),
capabilities: {
'browserName': 'chrome'
},
specs: [
'/home/git/adap_gateway/src/test/features/*.feature'
],
baseURL: 'http://localhost:8099/',
cucumberOpts: {
require: '/home/git/adap_gateway/src/test/javascript/stepDefinitions.js',
format: ['pretty'],
}
};
The feature file
Feature: Running Cucumber with Protractor
Scenario: Protractor and Cucumber Test
Given I go to "http://localhost:8099/#/"
When I add login credential
Then I go to scenario home page
Then I go to scenario details page
Then I go to edit attack tree page
Then build attack tree
ANd package.json file is
{
"name": "c",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"gulp": "^3.9.1",
"protractor-cucumber": "^0.1.8",
"protractor-cucumber-framework": "^3.1.0"
},
"devDependencies": {
"protractor-cucumber": "^0.1.8",
"serenity-cli": "^0.2.4",
"serenity-js": "^1.4.1",
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prereport": "serenity update",
"report": "serenity run"
},
"author": "",
"license": "ISC"
}
But I get
I get E/launcher - Error: Error: EACCES: permission denied, scandir '/etc/cups/ssl' at Error (native) at Object.fs.readdirSync (fs.js:952:18) at GlobSync._readdir (/home/ali/node_modules/cucumber/node_modules/glob/sync.js:2‌​88:41) [18:15:41] E/launcher - Process exited with error code 100,Do you have any instructions?
Can any one help me please to fix this problem?