{"action":"opened","issue":{"url":"https://api.github.com/repos/zulip/zulip/issues/1243","repository_url":"https://api.github.com/repos/zulip/zulip","labels_url":"https://api.github.com/repos/zulip/zulip/issues/1243/labels{/name}","comments_url":"https://api.github.com/repos/zulip/zulip/issues/1243/comments","events_url":"https://api.github.com/repos/zulip/zulip/issues/1243/events","html_url":"https://github.com/zulip/zulip/issues/1243","id":165213406,"number":1243,"title":"casper: create high level functions for navigating through the app","user":{"login":"rishig","id":890911,"avatar_url":"https://avatars.githubusercontent.com/u/890911?v=3","gravatar_id":"","url":"https://api.github.com/users/rishig","html_url":"https://github.com/rishig","followers_url":"https://api.github.com/users/rishig/followers","following_url":"https://api.github.com/users/rishig/following{/other_user}","gists_url":"https://api.github.com/users/rishig/gists{/gist_id}","starred_url":"https://api.github.com/users/rishig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rishig/subscriptions","organizations_url":"https://api.github.com/users/rishig/orgs","repos_url":"https://api.github.com/users/rishig/repos","events_url":"https://api.github.com/users/rishig/events{/privacy}","received_events_url":"https://api.github.com/users/rishig/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-13T00:47:21Z","updated_at":"2016-07-13T00:47:21Z","closed_at":null,"body":"There are navigation actions common to many casper tests, such as changing to the admin tab, going to the home page, going to the streams page, etc. The hard part of doing the navigation is writing the correct waitFor.. statement, so that the page is fully loaded before you proceed with the test. Currently, tests implement this in a haphazard way, creating potential race conditions (see below) and messy code. One potential way to solve this would be to add invisible divs (maybe one per page/tab?) with a class that changes state when the page is fully loaded. Or possibly deciding that some subset of the current code is doing it correctly, and just copying it out. \r\n\r\nIn particular, I believe ran into this race condition in navigating to the home page (from the admin page). A current test in 10-admin.js waits for `casper.waitForSelector('.message_table')`, which I think can fire before all the messages are loaded. \r\n\r\nThe test is `casper.waitForText('Error saving edit: Your organization has turned off message editing.' ..`, here is a screenshot from when it passes\r\n\r\n![z](https://cloud.githubusercontent.com/assets/890911/16788295/a22a1c84-4858-11e6-82c4-7af91410247f.png)\r\n\r\nand a screenshot from when it fails\r\n![casper-failure1](https://cloud.githubusercontent.com/assets/890911/16788303/acacc29c-4858-11e6-8d5d-6a66c76d3b80.png)\r\n"}}
{"actor":{"display_login":"rishig"}}