Can not set mapboxgl.GeolocateControl() - mapbox-gl-js

I can not set GeolocateControl()
It have not error, but not show Geolocate??
map.addControl(new mapboxgl.GeolocateControl({
positionOptions: {
enableHighAccuracy: true
},
trackUserLocation: true,
}));

your code is perfect but you need to have secure https connection to visible the GeolocateControl in your application.

Related

Adding Placeholder

tinymce.init({
mode: "exact",
elements: "Grievance",
forced_root_block: "",
theme: "advanced",
paste_text_sticky: true,
paste_text_sticky_default: true,
plugins: "wordcount,paste,autolink,advlink,contextmenu,fullscreen,nonbreaking,template,inlinepopups,style",
//plugins: "wordcount,paste,autolink,advlink,fullscreen,nonbreaking,template,inlinepopups,style",
// Theme options
//theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,undo,redo,|,justifyleft,justifycenter,justifyfull,|,link,unlink,|,fullscreen",
//theme_advanced_buttons2: "cut,copy,paste,|,cleanup,removeformat,|,bullist,numlist,outdent,indent,hr,charmap",
//theme_advanced_buttons1: "cut,copy,paste,removeformat,|,undo,redo,|,bullist,numlist,outdent,indent,|,formatselect,bold,italic,underline,forecolor,backcolor,|,justifyleft,justifycenter,justifyfull,|,link,unlink,|,fullscreen",
theme_advanced_buttons1: "cut,copy,paste,removeformat,|,undo,redo,|,bullist,numlist,outdent,indent,|,bold,italic,underline,|,fullscreen",
//theme_advanced_blockformats: 'p,h1,h2,h4,h4,h5,h6',
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
//theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing: true,
theme_advanced_path: false,
content_css: "/css/admin.css",
selector: 'textarea', // change this value according to your HTML
setup: function (editor) {
editor.on('init', function(){
if (tinymce.get('Text').getContent() == ''){
tinymce.get('Text').setContent("<p id='#Grievance'>Please put Case Information here</p>");
}
});
//and remove it on focus
editor.on('focus',function(){
$('iframe').contents().find('#Grievance').remove();
});
}
});
I am trying to add a Placeholder but I am getting "editor.on is not a function" so how do I add a place holder please without going to version 5 as that seems to be completely different. Thanks
I managed it in the end using Blur and Focus. Thanks

what is mongoose connection validity time?

I have custom circuit breaker logic for 3rd party services. I checked mongoose connection status like below,
mongoose.connection.on("connected", function() {
console.log("Mongoose connected");
});
mongoose.connection.on("disconnected", function() {
console.log("Mongoose disconnected");
});
while running on server logs like below,
Mongoose disconnected //Happened 12.30PM
// after sometime
Mongoose connected //Happened 12.35PM
Mongoose disconnected //Happened 12.35PM
Mongoose connected //Happened 12.35PM
My connection string,
mongoose.connect(URL, {
keepAlive: true,
keepAliveInitialDelay: 300000,
socketTimeoutMS: 300000,
poolSize: 10,
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true
})
I dont know while connect why system act like above in same second of time interval ?
Why mongo connection goes to disconneted mode even i apply "keepAlive" ?
Is there any validity for mongoose connection alive status?

Is there a way to not show invite popups in conversejs when converse is initialized as singleton in embeded mode?

I am using conversejs as client for providing a multiuser chat embeded in an html page. User might be added to a lot of groups. When a user is chating in a group and gets invite to join another group a popup is shown to accept the invite, i do not want the user to see that invitation and rather user should stay in the same group that he has opened.
Given bellow is the initialization sample :
converse.initialize({
authentication: 'login',
credentials_url: 'https://myserver.primet.com/chatapi/apiserver/api/chat/autologin/auth?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6ImFQY3R3X29kdlJPb0VOZzNWb09sSWgydGlFcyJ9.eyJhdWQiOiI2YTE1NzNkMS03ZDZjLTRkZGItYjVlYS1hZGQyZWM1MDkzZjEiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vZmNlNTAxOTUtMjMxNS00N2FmLWE2ODQtZmY5M',
auto_login: 'true',
bosh_service_url: 'https://myserver.primet.com/chatserver/http-bind/',
jid: ‘james#qachatserver.primet.com',
keepalive: true,
trusted: false,
auto_reconnect: true,
muc_nickname_from_jid: true,
auto_join_rooms: ['deal_909090390898989090909#conference.qachatserver.primet.com'],
auto_focus: false,
locked_muc_nickname: true,
show_desktop_notifications: false,
send_chat_state_notifications: false,
blacklisted_plugins: [
'converse-notification'
],
singleton: true,
muc_show_join_leave: false,
visible_toolbar_buttons: {
call: false,
spoiler: false,
emoji: false,
toggle_occupants: true
},
notify_all_room_messages: false,
notification_delay: 3000,
allow_message_corrections: 'false',
view_mode: 'embedded'
}).then(() => { setTimeout(function(){ var toggleButton = document.getElementsByClassName('toggle-occupants fa fa-angle-double-right')[0]; if (toggleButton) { toggleButton.click(); toggleButton.style.display="none"}},500);})
You can set allow_muc_invitations to false.

How can I email reports generated from 'protractor-jasmine2-html-reporter' to stakeholders after successful test execution.

I have a config file as below:
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {
directConnect: true,
onPrepare: function() {
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: './test/reports/',
screenshotsFolder: 'images',
})
);
},
multiCapabilities: [
{
'browserName': 'chrome',
}],
framework: 'jasmine',
specs: ['zoo_spec.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
My question is is there any code i can write in order to send the report generated from jasmine2-html-reporter as soon as test execution is complete.
Did you try using onComplete instead? Please refer below previous answer
Unable to send Email using nodemailer in protractor.conf.js onComplete: function()
In the config onComplete:function(){} you can write custom code to send email. There are many nodejs email clients that you can reuse to send emails without reinventing. Here is the example client you can use https://nodemailer.com/about/ and also review SMTP section to for configuration;

Want to use Jasmine HTML reporter along with the Protractor HTML reporter

i have tried to use Jasmine HTML reporter along with the Protractor HTML reporter.
My Config.js code look like this
var HtmlReporter = require('protractor-html-screenshot-reporter');
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: '/protractor-result',
docTitle: 'Protractor Demo Reporter',
docName: 'protractor-demo-tests-report.html'
}));
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
savePath: '../Report/HTML/',
showSummary: true,
showQuickLinks: true,
showConfiguration: true,
screenshotsFolder: 'images',
takeScreenshots: true,
takeScreenshotsOnlyOnFailures: true,
fixedScreenshotName: true,
ignoreSkippedSpecs: true,
consolidate: true,
consolidateAll: true,
preserveDirectory: true,
reportTitle: 'Protractor-Execution-Report-' + timeStamp
}));
i could able to see HTML reports generated by Jasmine but still unable to see the HTML reports generated by Protractor.Please correct me if i am trying something unreal.
Any help would be appreciated.
protractor-html-screenshot-reporter is not compatible with jasmine 2 and latest version of protractor uses jasmine 2 by default, instead switch to
protractor-jasmine2-html-reporter
You need to put those lines inside your onPrepare section of the protractor.config.js file:
var HtmlReporter = require('protractor-html-screenshot-reporter');
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {
//other stuff
onPrepare: function() {
// Add a screenshot reporter and store screenshots to `/tmp/screnshots`:
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: '/tmp/screenshots'
//...
}));
jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
savePath: '../Report/HTML/'
//...
}));
}
}
I know this is pretty old, but I ran into an issue trying to get jasmine-reporters and protractor-jasmine2-html-reporter to work and didn't like the idea that I had to downgrade in order for them to work. I found out that protractor-jasmine2-html-reporter wasn't resolving the savePath correctly and was actually putting the reports folder output in protractor-jasmine2-html-reporter directory instead of the root directory of where I ran gulp. In order to make this work correctly I ended up using process.env.INIT_CWD to get the initial Current Working Directory which should be the directory where you ran gulp. Hope this helps someone.
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
var jasmine2HtmlReporter = new Jasmine2HtmlReporter({
savePath: process.env.INIT_CWD + '/report/e2e/',
screenshotsFolder: 'images',
takeScreenshots: true,
takeScreenshotsOnlyOnFailures: true,
fileName: 'index.html'
});
onPrepare: function () {
jasmine.getEnv().addReporter(jasmine2HtmlReporter);
}
I use protractor-jasmine2-screenshot-reporter and protractor-jasmine2-html-reporter to handle that, here is my configuration file protractor.conf.js, hope it can help you.
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var jasmine2HtmlReporter = new Jasmine2HtmlReporter({
savePath: 'report/e2e/protractor-jasmine2-html-reporter/',
filePrefix: 'index',
screenshotsFolder: 'screenshots'
});
var htmlScreenshotReporter = new HtmlScreenshotReporter({
dest: 'report/e2e/protractor-jasmine2-screenshot-reporter/',
filename: 'index.html'
});
exports.config = {
allScriptsTimeout: 11000,
specs: [
'*.e2e.js'
],
capabilities: {
'browserName': 'chrome'
},
baseUrl: 'http://localhost:8080/app/',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000,
showColors: true
},
// Setup the report before any tests start
beforeLaunch: function() {
return new Promise(function(resolve){
htmlScreenshotReporter.beforeLaunch(resolve);
});
},
// Assign the test reporter to each running instance
onPrepare: function () {
jasmine.getEnv().addReporter(jasmine2HtmlReporter);
jasmine.getEnv().addReporter(htmlScreenshotReporter);
},
// Close the report after all tests finish
afterLaunch: function(exitCode) {
return new Promise(function(resolve){
htmlScreenshotReporter.afterLaunch(resolve.bind(this, exitCode));
});
}
};
For details you see here