Using browser.pause() to do manual "recaptcha" validation but page doesn't resync with protractor on return

367 views
Skip to first unread message

j...@gyft.com

unread,
Sep 21, 2015, 1:05:31 PM9/21/15
to AngularJS
I have a user enrollment page I am trying to test with a recaptcha verification. There is no reasonable way to automate the recaptcha (that is its purpose, to prevent automation of the validation process so that bots can't access the site) and there is no reasonable way to disable it for testing (that's a long story but we can leave it undiscussed for now).  

I decided to do automated testing with a manual "pause" to enter the recaptcha verification so that we can test the enrollment process semi-automatically.  This page https://github.com/angular/protractor/blob/master/docs/debugging.md says that you can add "browser.pause();" to a test and you will drop into a manual entry mode where you can interact with the page and then continue when you are ready (by hitting Ctl-C).  

So here are the essentials of my test (I use page objects, but have simplified this to show the direct code in a single file):

describe("enroll user page", function() {
  it("should enroll a user", function() { 
    browser
.get("http://my.url.com/enroll"
);
    element(by.model("enroll.firstName")).sendKeys("Firstname");    
    element(by.model("enroll.lastName")).sendKeys("Lastname"); 
    element(by.model("enroll.email")).sendKeys("em...@gmail.com");    
    element(by.model("enroll.password")).sendKeys("pswdpswdpswd");    
    browser.pause();    
    element(by.css("form[name='enroll'] input[type='submit']")).click();    
    expect(by.css("div.email")).getText().toContain("em...@gmail.com");

When I run this -spec file and get to the "browser.pause()" statement, the following happens:


Starting WebDriver debugger in a child process. Pause is still beta, please report issues at github.com/angular/protractor

------- WebDriver Debugger -------

Starting debugger agent.

Debugger listening on port 5858 ready

press c to continue to the next webdriver command
press d to continue to the next debugger statement

type "repl" to enter interactive mode

type "exit" to break out of interactive mode

press ^C to exit

-- Next command: executeScript
ControlFlow::1

| Frame::73

| | (pending) Task::72<Asynchronous test function: it()>

| | | Task: Asynchronous test function: it()

| | | Frame::81

| | | | Frame::1525

| | | | | Frame::384

| | | | | | (pending) Task::1539<empty debugger hook>

| | | | | | | Task: empty debugger hook

| | | | | | |     at Array.forEach (native)

| | | | | | | (active) Frame::1545

| | | | | | | | Frame::1547

| | | | Task::396<Protractor.waitForAngular()>

| | | | | Task: Protractor.waitForAngular()

| | | | |     at [object Object].<anonymous> (/Users/jonrosen/Documents/repo/gyft/gyft-b2b-webapp/test/e2e/enrollment-spec.js:14:69)

wd-debug>

(^C again to quit)

wd-debug>


At this point, the script pauses and I use the browser to fix the recaptcha which seems to work (it checks the box that reads "I am not a bot" and everything else looks fine.  I return to the terminal window and type Ctl-C (to exit the debugger) and it continues and ultimately prints:

Exiting debugger.

enroll user page
   should enroll a user - fail


Failures:
  1) enroll user page should enroll a user

  Message:

    Timed out waiting for Protractor to synchronize with the page after 11 seconds. Please see https://github.com/angular/protractor/blob/master/docs/faq.md


  Stacktrace:

    undefined


Finished in 56.356 seconds
1 test, 1 assertion, 1 failure

[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1

:


I have tried several variations of this including going into the interactive mode with "repl" and then exiting with "exit" after submitting the recaptcha, but the same results. I have also tried using "c" to just continue to the next statement but I get the same thing.  Apparently whenever I interact with the page manually, it somehow unsynchronizes and then it fails to sychronize the page after 11 seconds (the standard timeout).    

Help! :-)

Jon Rosen
Reply all
Reply to author
Forward
0 new messages