I've been trying to have my Cypress tests uploaded to their matching TestRail testcases, but so far it's not working.
Here's my current setup:
I have installed:
cypress
cypress-testrail-reporter
In my cypress.json file I have:
{
"baseUrl": "my website URL",
"projectId": "my project ID",
"reporter": "cypress-testrail-reporter",
"reporterOptions": {
"domain": "https://customName.testrail.io",
"username": "myemail#address.com",
"password": "My API key",
"projectId": 2,
"suiteId": 12
}
}
In Cypress, I have a it() block named it.only("C170 Using wrong credentials", ...)
In TestRail I have the following settings:
API is enabled
I have a custom API key (used in config.json)
I am an admin user
There's a testcase with the number C170
Then, when I run cypress run --record --key my-record-key-from-cypress:
The tests appear in the Cypress Dashboard
The tests DO NOT appear in the TestRail Dashboard
Any idea what could be missing?
SOLVED
Do not include http(s):// within your reporterOptions in the cypress.json file
BAD: "domain": "https://customName.testrail.io"
GOOD: "domain": "customName.testrail.io"
In all fairness, it's called domain, not URL, so I removing https makes sense
You should also run the test from the CLI instead of the Cypress test runner.
Related
I've followed the Create a JAR with the scripts to deploy instruction to create a custom Javascript policy for checking user attributes and it seems to be deployed successfully, however, I can't see the policy name in the create policy dropdown. Is there any setting I need to enable for this feature?
After uploading the .jar file to /keycloak/standalone/deployments, it says WFLYSRV0010: Deployed "script.jar" (runtime-name : "script.jar") without any error. I can also see the {filename}.jar.deployed next to my script file.
Setup: I use docker-compose to launch a jboss/keycloak version 10.0.1 container. Here's my docker-compose file:
version: "3.1"
services:
keycloak:
image: jboss/keycloak
restart: always
ports:
- 8080:8080
environment:
KEYCLOAK_PASSWORD: admin
KEYCLOAK_USER: admin
volumes:
- ./deployments:/opt/jboss/keycloak/standalone/deployments
keycloak-scripts.json:
{
"policies": [
{
"name": "my-policy",
"fileName": "my-script-policy.js",
"description": "My Policy from a JS file"
}
]
}
my-script-policy.js:
var context = $evaluation.getContext();
var contextAttributes = context.getAttributes();
if (contextAttributes.containsValue('kc.client.network.ip_address', '127.0.0.1')) {
$evaluation.grant();
}
Client policy setting
Thank you in advance for any suggestions.
electron-builder version: 20.9.2
Target: windows/portable
I'm building a portable app with electron-builder and using socket.io to keep a real-time connection with a backend service but I have an issue with the firewall. Because this is a portable app everytime the app is opened it looks that it is extracted in the temporary folder, which will generate a new folder (so the path to the app will be different) in every run which will make the firewall think that this is another app asking for the connection permissions. How can I change the extraction path when I run the app?
(This is the screen that I get every time I run the app)
This is my socket.io configuration
const io = require("socket.io")(6524);
io.on("connect", socket => {
socket.on("notification", data => {
EventBus.$emit("notifications", JSON.parse(data));
});
});
My build settings in package.json
"build": {
"productName": "xxx",
"appId": "xxx.xxx.xxx",
"directories": {
"output": "build"
},
"files": [
"dist/electron/**/*",
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme,test,__tests__,tests,powered-test,example,examples,*.d.ts}",
"!**/node_modules/.bin",
"!**/*.{o,hprof,orig,pyc,pyo,rbc}",
"!**/._*",
"!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,__pycache__,thumbs.db,.gitignore,.gitattributes,.editorconfig,.flowconfig,.yarn-metadata.json,.idea,appveyor.yml,.travis.yml,circle.yml,npm-debug.log,.nyc_output,yarn.lock,.yarn-integrity}",
"!**/node_modules/search-index/si${/*}"
],
"win": {
"icon": "build/icons/myicon.ico",
"target": "portable"
}
},
Any idea about how at least I could specify an extraction path or make this extract it the execution folder?
BTW I already created an issue about this in the electron-builder repo
In version 20.40.1 they added a new configuration key unpackDirName
/**
* The unpack directory name in [TEMP](https://www.askvg.com/where-does-windows-store-temporary-files-and-how-to-change-temp-folder-location/) directory.
*
* Defaults to [uuid](https://github.com/segmentio/ksuid) of build (changed on each build of portable executable).
*/
readonly unpackDirName?: string
Example
config: {
portable: {
unpackDirName: "0ujssxh0cECutqzMgbtXSGnjorm",
}
}
More info #3799.
I am using https://github.com/sequelize/sequelize to learn using the database migrations. This works fine.
As a next step, I would like to be able to run tests. My test is very simple (not using anything related to Sequelize) and looks like
import request from 'supertest';
import app from '../src/app.js';
describe('GET /', () => {
it('should render properly', async () => {
await request(app).get('/').expect(200);
});
});
describe('GET /404', () => {
it('should return 404 for non-existent URLs', async () => {
await request(app).get('/404').expect(404);
await request(app).get('/notfound').expect(404);
});
});
When I run this as npm test, I get error as
➜ contactz git:(master) ✗ npm test
> express-babel#1.0.0 test /Users/harit/bl/sources/webs/q2/contactz
> jest
FAIL test/routes.test.js
● Test suite failed to run
TypeError: Cannot read property 'use_env_variable' of undefined
at Object.<anonymous> (db/models/index.js:11:11)
at Object.<anonymous> (src/routes.js:3:14)
at Object.<anonymous> (src/app.js:4:15)
at Object.<anonymous> (test/routes.test.js:2:12)
at Generator.next (<anonymous>)
at Promise (<anonymous>)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.702s
Ran all test suites.
npm ERR! Test failed. See above for more details.
➜ contactz git:(master) ✗
I am new to NodeJS, Express so not sure what is going wrong here.
The code is available at https://github.com/hhimanshu/contactz
Could someone please help me know what's wrong and how to fix it?
I got this error today and fixed it.
When running jest, by default it will set the NODE_ENV (process.env.NODE_ENV) to "test".
If you generated basic sequelize files using sequelize-cli, in your sequelize config.json file there should be (by default) three types of config options used which are: "development", "test", and "production".
However I see that you are using your own config.js file and there is no "test" option there, only development and production https://github.com/hhimanshu/contactz/blob/master/db/config.js
You are receiving this error as the model/index.js file is looking for said "test" option but finds it undefined instead. Specifically, at line 12 of https://github.com/hhimanshu/contactz/blob/master/db/models/index.js it will find the config as undefined, and throw error looking for undefined's use_env_variable property.
The solution is to add "test" config to your config.js file. Just copy the config you used for development and it should run.
*note that you should probably set a different db for each of the different types of config, but this is another topic.
Export your config.js file for example check this below
module.exports ={
"development": {
"username": "root",
"password": null,
"database": "database_development",
"host": "127.0.0.1",
"dialect": "mysql"
},
"test": {
"username": "root",
"password": null,
"database": "database_test",
"host": "127.0.0.1",
"dialect": "mysql"
},
"production": {
"username": "root",
"password": null,
"database": "database_production",
"host": "127.0.0.1",
"dialect": "mysql"
}
}
I simply used javascript trim()
before
process.env.NODE_ENV() // return "development " with space
After
process.env.NODE_ENV.**trim()** // "development" no space
Here is my solution
I'm a newbie in server stuff, specifically heroku + node express + sequelize. So in my case, my config var on Heroku settings was wrong.
NODE_ENV was set to a wrong value like live instead of production.
The correct value production must be equal to your config.js, assuming you're using Sequelize too.
instead of npm test, can you try this command ?
jest yourfile.js --env=node --runInBand
I'm attempting to setup Nightwatch.js for the first time. I'm following the following tutorial: https://github.com/dwyl/learn-nightwatch
Unfortunately I've hit a roadblock, and I'm in need of help resolving it.
Error retrieving a new session from the selenium server.
Connection refused! Is selenium server started?
nightwatch.conf.js
module.exports = {
"src_folders": [
"test"// Where you are storing your Nightwatch e2e/UAT tests
],
"output_folder": "./reports", // reports (test outcome) output by nightwatch
"selenium": {
"start_process": true, // tells nightwatch to start/stop the selenium process
"server_path": "./node_modules/nightwatch/bin/selenium.jar",
"host": "127.0.0.1",
"port": 4444, // standard selenium port
"cli_args": {
"webdriver.chrome.driver" : "./node_modules/nightwatch/bin/chromedriver"
}
},
"test_settings": {
"default": {
"screenshots": {
"enabled": true, // if you want to keep screenshots
"path": './screenshots' // save screenshots here
},
"globals": {
"waitForConditionTimeout": 5000 // sometimes internet is slow so wait.
},
"desiredCapabilities": { // use Chrome as the default browser for tests
"browserName": "chrome"
}
},
"chrome": {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true // set to false to test progressive enhancement
}
}
}
}
guinea-pig.js
module.exports = { // addapted from: https://git.io/vodU0
'Guinea Pig Assert Title': function(browser) {
browser
.url('https://saucelabs.com/test/guinea-pig')
.waitForElementVisible('body')
.assert.title('I am a page title - Sauce Labs')
.saveScreenshot('ginea-pig-test.png')
.end();
}
};
Based on the configuration setup. I kept it as basic as possible. I cannot pinpoint the source where it would suggest another selenium server has started. Any ideas?
EDIT: TIMEOUT ERROR
In your nightwatch.json file, within "selenium"
Make sure your server path is correct.
Make sure your webdriver.chrome.driver path is correct.
Those are specific to your machine. If those do not refer to the correct file in the correct location, you'll get problems starting the selenium server.
After that, you want to make certain that the version of the selenium server you have works with the version of chrome driver you have and that that will work with the version of the Chrome browser you have.
But as Krishnan Mahadevanindicated, without the whole error message, we can't be of much more help.
The solution involved deleting my instance of Chrome (although it was the most recent version) and simply reinstalling the browser again.
I encourage all facing the same problems to first look at QualiT's response above as it's the more conventional troubleshooting strategy.
I had got the same issue when I used vue-cli init on my project. after I updated to Java 9, this problem was resolved.
I've been trying to create a Smart Package for the SkelJS framework.
The file is being loaded by the browser but when I try and access the object it exports it says its undefined. I'm using the following code in package.js:
Package.describe({
summary: "SkelJS for Meteor"
});
Package.on_use(function (api) {
api.use('jquery', 'client');
api.add_files(['skel.js'], 'client');
api.export('skel', 'client');
});
Also trying to access Package.skeljs.skel returns undefined as well.
In smart.json I'm using:
{
"name": "skeljs",
"description": "SkelJS for Meteor",
"homepage": "",
"author": "Giles Butler (http://giles.io)",
"version": "0.1.0",
"git": ""
}
I know SkelJS has been loaded because it logs to the console no configuration detected, waiting for manual init but then when I try and run skel.init() it returns undefined.
Any help or tips would be really appreciated.
Thanks
Giles
You also need to modify the first line of skel.min.js/skel.js
Within packages variable scoping still applies so you have to remove the var keyword if you want the file to let other files (such as package.js for api.export) access its variables.
The fix would be to change:
var skel=function() ....
to
skel=function() ....