Search code examples
javascriptangularjsnode.jsprotractorjasmine2.0

Is it possible to change protractor event queue or control flow?


I am working on an automation project where we are using protractor and jasmine2 for automating our angularjs+nodejs app. So as part of automation I have a scenario where I need to upload a file and just after clicking the file upload button, while the upload is on progress, I need to click on another button and validate something. And when I execute my script, protractor is waiting by itself until the upload process is complete to perform further steps. Is there anyway to handle this? Means after clicking the upload button, script need to perform the next action without even waiting for the upload to complete.

I am sure that this is something related to the control flow, where the promises are added to the event queue. Is there any way to change protractor's event queue?


Solution

  • I remember having a similar problem and I had to turn the synchronization off temporarily:

    browser.ignoreSynchronization = true;
    uploadButton.click();
    anotherButton.click();
    

    You can also do both clicks in a single command through the "action chains":

    browser.actions()
      .mouseMove(uploadButton).click()
      .mouseMove(anotherButton).click()
      .perform();