I’m trying to write simple tests for my login flow. Previously, my tests worked fine on Auth0 Lock v9, but some changes in Lock v10 have made it difficult for me to automate my tests.
Here’s what my code looked like in Lock v9:
window.auth0Lock.on('ready', function() {
console.log('Auth0 ready');
$('#a0-signin_easy_email').val('test@test.com');
$('#a0-signin_easy_password').val('usemefortests');
$(document).on('auth0-profile-available', function(e, profile) {
// auth0-profile-available is fired by client-side JS on login
console.log('profile available');
var payload = {
nickname: profile.nickname,
exit: false
};
window.callPhantom(payload);
$(document).trigger('login-complete');
});
$('.a0-primary.a0-next').click();
});
The recent changes seem to be more than just changes in the selectors:
For example, making the following replacements, does not seem to work.
$('#a0-signin_easy_email') --> $('input[name="email"]')
$('#a0-signin_easy_password') --> $('input[name="password"]')
$('.a0-primary.a0-next') --> $('.auth0-lock-submit')
Upon testing the code via browser console, Auth0 complains that the email and password fields are empty.
How can I create tests for my login workflow?