describe('My TestSuite', function()
it('Verify title of page', function() cy.visit("https://demo.nopcommerce.com/")
cy.title().should('eq','nopCommerce demo store')
The function goes between the curly brackets.
/// <reference types="cypress" />
describe('My TestSuite', function() {
it('Verify title of page', function() {
cy.visit("https://demo.nopcommerce.com/")
cy.title().should('eq','nopCommerce demo store')
})
})
Related
I integrate google login api and It works fine but there is an error in logout.The sign out process is not working.The logged user will not sign out after click the sign out link function.
This is my code:
<meta name="google-signin-client_id" content="here my api .apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer></script>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
Sign Out
<script>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
if(profile.getEmail()!="") {
var myKeyVals = { token : googleUser.getAuthResponse().id_token }
$.ajax({
type: "POST",
url: "validate.php",
data: myKeyVals,
dataType: "text",
success : function(data) {
window.location = "page";
}
});
}
}
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
});
}
</script>
Here signOut js function is not working and the page will auto reload and go to adminpage.
This is my document.
Thanks in advance.
this works for me instead of http://localhost/application-name/logoutUser you can add your domain name
document.location.href = "https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue=http://localhost/application-name/logoutUser";
This works for me,
Simply modify the signout function as follows,Here carefully note that reload() method is used to reload the current document soon after signout.
<button onclick="myFunction()">Sign Out</button>
<script>
function myFunction() {
gapi.auth2.getAuthInstance().signOut().then(function () {
console.log('User signed out.');
location.reload();
});
}
</script>
May be this will help.
const onGoogleSignOut = () => {
// using google logout redirect
//location.href = 'document.location.href = "https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue=' + window.location.href;
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut()
.then(function () {
auth2.disconnect();
console.log('User signed out.');
//location.reload();
});
}
This worked for me. Full JS function code.
The asterisks are just an example of how to define the URL you want to redirect to after the logout is performed.
<button onclick="myFunction()">Sign Out</button>
<script>
function myFunction() {
location.href = 'https://accounts.google.com/Logout?&continue=http://******.com/';
}
</script>
Save this in a HTML file and access it from the browser where you are logged into the account you want to log out of. Can also be placed in a PHP file ETC. AS long as you dont place it in a manner that breaks the existing script.
I was surprised that I didn't find any help in the documentation or a blog post about this.
I'm trying to add tests to make sure the eventing is setup correctly and stays that way.
The durandal app and events objects from Require are null. So there must be a setup step before they become available that I'm not aware of.
I have this Knockout view model:
define([
'knockout',
'durandal/events',
'durandal/app',
'Common/Modules/KoComponents/slideInEventListKeys'
],
function (ko, durandalEvents, durandalApp, slideInEventListKeys) {
function SlideInVm(params) {
// listen for anyone broadcasting this specific event.
durandalEvents.includeIn(this);
var _this = this;
durandalApp.on(slideInEventListKeys.open).then(function () {
_this.isShowing(true);
});
durandalApp.on(slideInEventListKeys.close).then(function () {
_this.isShowing(false);
});
}
SlideInVm.prototype.isShowing = ko.observable(false);
});
and in Jasmine:
define([
'knockout',
'Common/Modules/slideInVm',
'durandal/events',
'durandal/app',
'Common/Modules/slideInEventListKeys'
],
function (ko, SlideInVm, durandalEvents, durandalApp, slideInEventListKeys) {
'use strict';
describe('Given the Slide In component', function () {
var vm;
beforeEach(function(){
vm = new SlideInVm();
});
it('Should subscribe for open events', function () {
debugger;
// events and app are null!
// how to check this?
});
it('Should subscribe for close events', function () {
});
describe('When opening', function(){
beforeEach(function(){
// how to trigger this if app is null?
app.trigger(slideInEventListKeys.open);
});
it('Should show the component', function(){
expect(vm.isShowing()).toBeTruthy();
});
});
});
});
i'm using PhoneGap with JQuery mobile ajax to retrieve some records from a database here's my code !! but unfortunately its not working
can somebody tell me what's wrong
<script>
$(document).ready(function() {
$('#cont').bind('pageshow', function () {
$.get('http://tech-tude.com/freedomwobas/getepisodes.php', function (data) {
$(this).find('div[data-role="content"]').append(data);
});
});
});
</script></head><body ><div data-role="content"></div>
You need to (at least) wait for the device to be ready. Try this:
<script>
function onDeviceReady() {
$('#cont').bind('pageshow', function () {
$.get('http://tech-tude.com/freedomwobas/getepisodes.php', function (data) {
$(this).find('div[data-role="content"]').append(data);
});
});
}
$(document).ready(function() {
document.addEventListener("deviceready", onDeviceReady, true);
});
</script></head><body ><div data-role="content"></div>
So I have in index.py:
class Test:
#cherrypy.expose
def index(self):
return mylookup.get_template('test.html').render(item="<div id='blah'>test</div>")
And in test.html:
<script>
window.addEvent('domready', function() {
$('blah').addEvent('click', function() {
alert('success');
});
});
</script>
When clicking on that element nothing happens. Any ideas?
% if item:
${item}
% endif
Here is my code:
Event.observe(window, 'load', function() {
Event.observe('form_post', 'submit', function(){
new Ajax.Updater('Posts', 'getPosts.php', {
});
});
});
I just want to delay the call to Updater, any ideas??
Thanks
Use the prototype delay method.
Event.observe(window, 'load', function() {
Event.observe('form_post', 'submit', function(){
new Ajax.Updater.delay(1, 'Posts', 'getPosts.php', {
});
});
});
Wrap it in a setTimeout call.