{"action":"created","issue":{"url":"https://api.github.com/repos/angular/protractor/issues/1752","labels_url":"https://api.github.com/repos/angular/protractor/issues/1752/labels{/name}","comments_url":"https://api.github.com/repos/angular/protractor/issues/1752/comments","events_url":"https://api.github.com/repos/angular/protractor/issues/1752/events","html_url":"https://github.com/angular/protractor/issues/1752","id":55417511,"number":1752,"title":"Asserting state on current page after button click, but before next page loads","user":{"login":"ljwagerfield","id":3638917,"avatar_url":"https://avatars.githubusercontent.com/u/3638917?v=3","gravatar_id":"","url":"https://api.github.com/users/ljwagerfield","html_url":"https://github.com/ljwagerfield","followers_url":"https://api.github.com/users/ljwagerfield/followers","following_url":"https://api.github.com/users/ljwagerfield/following{/other_user}","gists_url":"https://api.github.com/users/ljwagerfield/gists{/gist_id}","starred_url":"https://api.github.com/users/ljwagerfield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljwagerfield/subscriptions","organizations_url":"https://api.github.com/users/ljwagerfield/orgs","repos_url":"https://api.github.com/users/ljwagerfield/repos","events_url":"https://api.github.com/users/ljwagerfield/events{/privacy}","received_events_url":"https://api.github.com/users/ljwagerfield/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-25T14:32:42Z","updated_at":"2015-01-26T17:09:07Z","closed_at":"2015-01-26T17:09:07Z","body":"We have a submission button that becomes disabled while waiting for the operation to complete. In this case, the operation completes by navigating to the `/dashboard` page.\r\n\r\nWe would like to assert this 'disabled while pending' behaviour in our end-to-end Protractor tests:\r\n```\r\nit('should disable button after submission', function(){\r\n  page.usernameTextBox.sendKeys(username);\r\n  page.passwordTextBox.sendKeys('password1');\r\n  page.signInButton.click();\r\n  expect(page.signInButton.getAttribute('disabled')).toContain('true');\r\n  expect(browser.getCurrentUrl()).toContain('/dashboard');\r\n});\r\n```\r\nThe assertion on the `disabled` attribute fails as the next page has already loaded. This is because Protractor waits for the operation to complete before running the assertion - i.e. its not being missed due to a race condition - Protractor actually has it synchronised so that the assertion will not be run until the operation completes.\r\n\r\nHow can we test the above behaviour?"},"comment":{"url":"https://api.github.com/repos/angular/protractor/issues/comments/71496514","html_url":"https://github.com/angular/protractor/issues/1752#issuecomment-71496514","issue_url":"https://api.github.com/repos/angular/protractor/issues/1752","id":71496514,"user":{"login":"juliemr","id":2081709,"avatar_url":"https://avatars.githubusercontent.com/u/2081709?v=3","gravatar_id":"","url":"https://api.github.com/users/juliemr","html_url":"https://github.com/juliemr","followers_url":"https://api.github.com/users/juliemr/followers","following_url":"https://api.github.com/users/juliemr/following{/other_user}","gists_url":"https://api.github.com/users/juliemr/gists{/gist_id}","starred_url":"https://api.github.com/users/juliemr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliemr/subscriptions","organizations_url":"https://api.github.com/users/juliemr/orgs","repos_url":"https://api.github.com/users/juliemr/repos","events_url":"https://api.github.com/users/juliemr/events{/privacy}","received_events_url":"https://api.github.com/users/juliemr/received_events","type":"User","site_admin":false},"created_at":"2015-01-26T17:09:07Z","updated_at":"2015-01-26T17:09:07Z","body":"You can use `browser.ignoreSynchronization = true`, but I would caution against testing this kind of timing-specific thing in end to end tests, because sometimes the test will be running slowly and even without synchronization your test will fail. \r\n\r\nPlease read the [contributing guidelines](https://github.com/angular/protractor/blob/master/CONTRIBUTING.md#questions); these types of questions are ill-suited for GitHub. Thanks! "}}