Unable to perform drag and drop in Cypress - drag-and-drop

Unable to perform drag and drop in Cypress.
Here is the piece of code:
it('verify user is able drag and drop a new widget from the widget list',()=>{
cy.get('.ant-input').first().type(NAMES.widgetName). //Search for a particular item
cy.xpath('//div[#class="item-container"]//span[#class="column-drag-handle"]')
.trigger('dragstart', { dataTransfer });
cy.get('div.items-sec:nth-child(3) > div.smooth-dnd-container.vertical')
.trigger('drop', { dataTransfer });
cy.xpath('//div[#class="item-container"]//span[#class="column-drag-handle"]')
.trigger('dragend'); // <-- seleniumeasy listens for this...
cy.get('[title="CROUTON_WIDGET"]').should('have.length',2)
})

https://www.npmjs.com/package/#4tw/cypress-drag-drop
There is a separate npm library that adds this support to Cypress that you will need to install.

Hit this command -
npm install --save-dev #4tw/cypress-drag-drop
Paste this into command.js file -
require('#4tw/cypress-drag-drop')
Try this script
cy.get('.sourceitem').drag('.targetitem');

Related

Reloading server in nuxt3js after Clear Cache

I have clear cache in my nuxt3js application with npx nuxi clean, this command removes .nuxt ,
.output , node_modules/.vite and node_modules/.cache. So inorder to run the app again I need to run npm install and then start the serve with npm run dev.
But I receive the below message without ending. Error: Reloding server...
How do I stop this.
I would like to answer my own question after a day of research. I found out that by adding the below code in nuxt.config.ts solved the issue
export default defineNuxtConfig({
nitro: {
esbuild: {
options: {
target: 'esnext'
}
}
}
})
thereafter every thing works back to normally again.

Unable to configure Log4js in Protractor

Can anyone please suggest how to configure log4js in protractor. Unable to proper documentation with clear steps to configure. I want a log file to be created with the all the information.
You can use log4js-protractor-appender. log4js-protractor-appender overrides log4js' default console appender. Just install it as a dependency
$ npm install log4js-protractor-appender --save
Then you can load it as any file appender. For example:
{
"appenders": [
{
"type": "log4js-protractor-appender-file"
}
]
}
Then you can print log statements like below
logger.info('Navigating to /');
browser.get('/');
element(by.css('#someText')).getText().then(function (text) {
logger.info('Displayed text is: ', text);
});
logger.info('Should be displayed last');
You can refer the following thread as well
log4j-protractor-appender
Hope this helps

run part of code as root

I have a package which runs uses Gtk and written in vala.A dialog box or a gui opens after selecting a file.I want this dialog box or gui to run as root so as to open and read the files which don't open with normal users.I have this code
static void open_file(string filename) {
selected_file = filename;
stdout.printf(selected_file);
new ProgressWindow(selected_file, {});
}
I want to run ProgressWindow to run as root.Is it possible?
No. To run as root, it must be in a separate process and you must run that process using pkexec via PolicyKit. Here's a tutorial on PolicyKit in Vala.

Using gulp with a team on a Local Server. Error: EPERM: operation not permitted, chmod

I am working with a web team and we keep all our files on a local shared server in the office. ( we are slowly moving everything over to git so please no comments about how dumb we are for not using git. Thanks! )
We are using gulp to compile our sass to css and when one of us compiles we are fine but once someone else tries to run a node process and compile with gulp we get the following error....
[10:12:53] Starting 'sass'...
[10:12:53] Starting 'watch'...
[10:12:54] Finished 'watch' after 173 ms
[10:12:54] 'sass' errored after 442 ms
EPERM: operation not permitted, chmod '/the file path/'
I have tried using chmod to change the file permissions but I don't think that is the issue. I use atom as my editor and some of the other developers on the team use sublime.
I have read that some editors can lock files. Not sure if this is the cause but if it is I don't know how to fix this. Is the only solution to this problem to use git and have local copies on our own personal computers?
Thanks in advance!
gulpfile.js
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var cleanCSS = require('gulp-clean-css');
var sourcemaps = require('gulp-sourcemaps');
var sassOptions = {
errLogToConsole: true,
outputStyle: 'nested' // Styles: nested, compact, expanded, compressed
};
// Compile Sass file to CSS, and reload browser(s).
gulp.task('sass', function() {
return gulp.src('includes/scss/*.scss')
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(sass.sync(sassOptions))
.pipe(sass.sync().on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest('includes/css'));
});
gulp.task('minify-css', function() {
return gulp.src('includes/css/*.css')
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('includes/css'));
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('includes/scss/**/*.scss', ['sass']);
});
// Default Task
//gulp.task('serve', ['sass', 'minify-css', 'watch']);
gulp.task('serve', ['sass', 'watch']);
This happens because you need to run your gulpfile as admin.
So run sudo -i, insert your admin password, and then just run again.
I was on the same problem, it worked for me.
Sometimes this is caused by Watch. But more often this is because Gulp preserve the flags in the gulp.dest command. If you have a source file with read-only flags. You have to overwrite the flags each time your source file is included in gulp.dest command.
This way:
.pipe(gulp.dest('includes/css', mode: 0o777));
That problem has also happened to me. What I did was start from a terminal as root, and just write gulp to me I worked.
Just uninstall your gulp :
npm uninstall gulp -g
then
npm install gulp -g
Set path in environment valiable in windows.
Restart your system or cmd prompt.
I was getting the error on compile-sass. I had to delete the destination .css file, then all was well.

Include node module as a file to inject

I want to include /node_modules/es6-shim/es6-shim.min.js into the client side in Sails v0.11.
I've tried including it into the pipeline as such:
var jsFilesToInject = [
// Load sails.io before everything else
'js/dependencies/sails.io.js',
/* INCLUDE NODE MODULE */
'/node_modules/es6-shim/es6-shim.min.js',
// Dependencies like jQuery, or Angular are brought in here
'js/dependencies/**/*.js',
// All of the rest of your client-side js files
// will be injected here in no particular order.
'js/**/*.js',
// Use the "exclude" operator to ignore files
// '!js/ignore/these/files/*.js'
];
Is this possible? I don't really want to use bower or a CDN, I would like to install/update the dependency via npm.
The simplest way to accomplish this would be to leave the pipeline.js file alone and just make a symlink inside of assets/js pointing to the file you want, e.g.:
ln -s ../../node_modules/es6-shim/es6-shim.min.js assets/js/es6-shim.min.js
Next time you run sails lift, Grunt will see the new Javascript file in your assets/js folder and process it with the rest.
If this is for some reason not an option, you'll need to add a new subtask to the tasks/copy.js Grunt task:
dev_es6: {
files: [{
expand: true,
src: ['./node_modules/es6-shim/es6-shim.min.js'],
dest: '.tmp/public/js'
}]
}
and then add that to the compileAssets task in tasks/register/compileAssets:
module.exports = function (grunt) {
grunt.registerTask('compileAssets', [
'clean:dev',
'jst:dev',
'less:dev',
'copy:dev',
'copy:dev_es6', // <-- adding our new subtask
'coffee:dev'
]);
};