Why I can't check google login with zombie.js?

147 views Asked by At

I have a web app and I want to test google login with zombie.js and mocha. My code looks like this:

...
describe('Google login', function() {
    this.timeout(100000);
    const server = init_server;
    const browser = new Browser({ site: 'https://127.0.0.1:8181', waitDuration: 20*1000 });
    process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

    browser.userAgent = [
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2)",
        "AppleWebKit/537.36 (KHTML, like Gecko)",
        "Chrome/55.0.2883.95 Safari/537.36"
    ].join(" ");

    before(function() {
        return browser.visit('/');
    });

    describe('click login button ', function() {
        before(function() {
            return browser.clickLink(".google_signin");
        });
        before(function() {
            function pageLoaded(window) {
                return window.document.querySelector("#next:enabled") && window.document.querySelector("#Email:enabled");
            }
            return browser.wait(pageLoaded, function(){
                browser.fill('#Email', '[email protected]');
                browser.pressButton('#next');
                fs.writeFile('password_page.html', browser.html());
            });
        });

        it('should be successful', function() {
            browser.assert.success();
        });
    });
});

Google login flow has a page with email input and once you enter the email, it asks you for a password.

So I would expect that I will see a password page in password_page.html, but instead I see the first email page with empty email input and disabled "next" button.

I tried a lot of things, but I can't pass the first step.

Do you have an idea why?

0

There are 0 answers