Bug 1095303 - Update the test case to the new Rooms UI. r=dmose
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Fri, 12 Dec 2014 16:03:00 -0500
changeset 219781 6953b6a787ce2d501ca1b8ed3d5204c854ac432e
parent 219780 06a8f110f1cd73cc38afb236e1892650fd736bee
child 219782 333eda1b009985af71334f511e228acc66e8e715
push id10419
push usercbook@mozilla.com
push dateTue, 16 Dec 2014 12:45:27 +0000
treeherderfx-team@ec87657146eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmose
bugs1095303
milestone37.0a1
Bug 1095303 - Update the test case to the new Rooms UI. r=dmose
browser/components/loop/content/js/panel.js
browser/components/loop/content/js/panel.jsx
browser/components/loop/test/functional/config.py
browser/components/loop/test/functional/test_1_browser_call.py
--- a/browser/components/loop/content/js/panel.js
+++ b/browser/components/loop/content/js/panel.js
@@ -681,17 +681,17 @@ loop.panel = (function(_, mozL10n) {
             EditInPlace({text: room.roomName, onChange: this.renameRoom}), 
             React.DOM.button({className: copyButtonClasses, 
               title: mozL10n.get("rooms_list_copy_url_tooltip"), 
               onClick: this.handleCopyButtonClick}), 
             React.DOM.button({className: "delete-link", 
               title: mozL10n.get("rooms_list_delete_tooltip"), 
               onClick: this.handleDeleteButtonClick})
           ), 
-          React.DOM.p(null, React.DOM.a({href: "#"}, room.roomUrl))
+          React.DOM.p(null, React.DOM.a({className: "room-url-link", href: "#"}, room.roomUrl))
         )
       );
     }
   });
 
   /**
    * Room list.
    */
--- a/browser/components/loop/content/js/panel.jsx
+++ b/browser/components/loop/content/js/panel.jsx
@@ -681,17 +681,17 @@ loop.panel = (function(_, mozL10n) {
             <EditInPlace text={room.roomName} onChange={this.renameRoom} />
             <button className={copyButtonClasses}
               title={mozL10n.get("rooms_list_copy_url_tooltip")}
               onClick={this.handleCopyButtonClick} />
             <button className="delete-link"
               title={mozL10n.get("rooms_list_delete_tooltip")}
               onClick={this.handleDeleteButtonClick} />
           </h2>
-          <p><a href="#">{room.roomUrl}</a></p>
+          <p><a className="room-url-link" href="#">{room.roomUrl}</a></p>
         </div>
       );
     }
   });
 
   /**
    * Room list.
    */
--- a/browser/components/loop/test/functional/config.py
+++ b/browser/components/loop/test/functional/config.py
@@ -1,20 +1,20 @@
 # Loop server configuration
 CONTENT_SERVER_PORT = 3001
 LOOP_SERVER_PORT = 5001
 FIREFOX_PREFERENCES = {
     "loop.server": "http://localhost:" + str(LOOP_SERVER_PORT),
     "browser.dom.window.dump.enabled": True,
-    # Need to find the correct Pythonic syntax for this (unless just using
-    # a string is the way to go), as well as find the bug with the
-    # other preference for shunting ice to localhost that ekr/drno did,
-    # and other stuff before we can support offline call tests
-    # XXX "media.peerconnection.default_iceservers": "[]",
+    # Some more changes might be necesarry to have this working in offline mode
+    "media.peerconnection.default_iceservers": "[]",
     "media.peerconnection.use_document_iceservers": False,
+    "stun.allow_loopback": True,
     "devtools.chrome.enabled": True,
     "devtools.debugger.prompt-connection": False,
     "devtools.debugger.remote-enabled": True,
     "media.volume_scale": "0",
+    "loop.gettingStarted.seen": True,
+    "loop.seenToS": "seen",
 
     # this dialog is fragile, and likely to introduce intermittent failures
     "media.navigator.permission.disabled": True
 }
--- a/browser/components/loop/test/functional/test_1_browser_call.py
+++ b/browser/components/loop/test/functional/test_1_browser_call.py
@@ -55,79 +55,58 @@ class Test1BrowserCall(MarionetteTestCas
         # switch to the frame
         frame = self.marionette.find_element(By.ID, "loop")
         self.marionette.switch_to_frame(frame)
 
     def load_and_verify_standalone_ui(self, url):
         self.marionette.set_context("content")
         self.marionette.navigate(url)
 
-        call_url_link = self.marionette.find_element(By.CLASS_NAME, "call-url") \
-            .text
-        self.assertEqual(url, call_url_link,
-                         "should be on the correct page")
+    def start_a_conversation(self):
+        # TODO: wait for react elements
+        sleep(2)
+        button = self.marionette.find_element(By.CSS_SELECTOR, ".rooms .btn-info")
+
+        # click the element
+        button.click()
 
     def get_and_verify_call_url(self):
-        # get and check for a call url
-        url_input_element = self.wait_for_element_displayed(By.TAG_NAME,
-                                                            "input")
-
-        # wait for pending state to finish
-        self.assertEqual(url_input_element.get_attribute("class"), "pending",
-                         "expect the input to be pending")
+        # in the new room model we have to first start a conversation
+        self.start_a_conversation()
 
-        # get and check the input (the "callUrl" class is only added after
-        # the pending class is removed and the URL has arrived).
-        #
-        # XXX should investigate getting rid of the fragile and otherwise
-        # unnecessary callUrl class and replacing this with a By.CSS_SELECTOR
-        # and some possible combination of :not and/or an attribute selector
-        # once bug 1048551 is fixed.
-        url_input_element = self.wait_for_element_displayed(By.CLASS_NAME,
-                                                            "callUrl")
-        call_url = url_input_element.get_attribute("value")
+        # TODO: wait for react elements
+        sleep(2)
+        call_url = self.marionette.find_element(By.CLASS_NAME, \
+                                                "room-url-link").text
 
-        self.assertNotEqual(call_url, u'',
-                            "input is populated with call URL after pending"
-                            " is finished")
         self.assertIn(urlparse.urlparse(call_url).scheme, ['http', 'https'],
                       "call URL returned by server " + call_url +
                       " has invalid scheme")
         return call_url
 
     def start_and_verify_outgoing_call(self):
+        # TODO: wait for react elements
+        sleep(2)
         # make the call!
         call_button = self.marionette.find_element(By.CLASS_NAME,
-                                                   "btn-accept")
+                                                   "btn-join")
         call_button.click()
 
-        # make sure the standalone progresses to the pending state
-        pending_header = self.wait_for_element_displayed(By.CLASS_NAME,
-                                                         "pending-header")
-        self.assertEqual(pending_header.tag_name, "header",
-                         "expect a pending header")
-
     def accept_and_verify_incoming_call(self):
         self.marionette.set_context("chrome")
         self.marionette.switch_to_frame()
 
         # XXX should be using wait_for_element_displayed, but need to wait
         # for Marionette bug 1055309 to be fixed.
         chatbox = self.wait_for_element_exists(By.TAG_NAME, 'chatbox')
         script = ("return document.getAnonymousElementByAttribute("
                   "arguments[0], 'class', 'chat-frame');")
         frame = self.marionette.execute_script(script, [chatbox])
         self.marionette.switch_to_frame(frame)
 
-        # Accept the incoming call
-        call_button = self.marionette.find_element(By.CLASS_NAME,
-                                                   "btn-accept")
-        # accept call from the desktop side
-        call_button.click()
-
         # expect a video container on desktop side
         video = self.wait_for_element_displayed(By.CLASS_NAME, "media")
         self.assertEqual(video.tag_name, "div", "expect a video container")
 
     def hangup_call_and_verify_feedback(self):
         self.marionette.set_context("chrome")
         button = self.marionette.find_element(By.CLASS_NAME, "btn-hangup")
 
@@ -151,14 +130,18 @@ class Test1BrowserCall(MarionetteTestCas
         # load the link clicker interface into the current content browser
         self.load_and_verify_standalone_ui(call_url)
 
         self.start_and_verify_outgoing_call()
 
         # Switch to the conversation window and answer
         self.accept_and_verify_incoming_call()
 
+        # Let's wait for the call/media to get established.
+        # TODO: replace this with some media detection
+        sleep(5)
+
         # hangup the call
         self.hangup_call_and_verify_feedback()
 
     def tearDown(self):
         self.loop_test_servers.shutdown()
         MarionetteTestCase.tearDown(self)