示例#1
0
    def test_can_share_a_list_with_another_user(self):
        # Edith is a logged-in user
        self.create_pre_authenticated_session('*****@*****.**')
        edith_browser = self.browser
        self.addCleanup(lambda: quit_if_possible(edith_browser))

        # Her friend Oniciferous is also hanging out on the lists site
        oni_browser = webdriver.Firefox(firefox_binary=FirefoxBinary(
            firefox_path='/opt/firefox/firefox'))
        self.addCleanup(lambda: quit_if_possible(oni_browser))
        self.browser = oni_browser
        self.create_pre_authenticated_session('*****@*****.**')

        # Edith goes to the home page and starts a list
        self.browser = edith_browser
        self.browser.get(self.server_url)
        list_page = ListPage(self).add_list_item('Get help')

        # She notices a "Share this list" option
        share_box = list_page.get_share_box()
        self.assertEqual(share_box.get_attribute('placeholder'),
                         '*****@*****.**')

        # She shares her list.
        # The page updates to say that it's shared with Oniciferous:
        list_page.share_list_with('*****@*****.**')

        # Oniciferous now goes to the lists page with his browser
        self.browser = oni_browser
        MyListsPage(self).go_to_my_lists_page()

        # He sees Edith's list in there!
        self.browser.find_element_by_link_text('Get help').click()

        # On the list page, Oniciferous can see says that it's Edith's list
        self.wait_for(
            self.assertEqual(list_page.get_list_owner(), '*****@*****.**'))

        # He adds an item to the list
        list_page.add_list_item('Green Unicorn')

        # When Edith refreshes the page, she sees Oniciferous's addition
        self.browser = edith_browser
        self.browser.refresh()
        list_page.wait_for_row_in_list_table('Green Unicorn')
示例#2
0
    def test_can_share_a_list_with_another_user(self):
        # Lain is a logged-in user
        self.create_pre_authenticated_session('*****@*****.**')
        lain_browser = self.browser
        self.addCleanup(lambda: quit_if_possible(lain_browser))

        # Her friend Edith is also hanging out on the lists site
        edith_browser = webdriver.Firefox()
        self.addCleanup(lambda: quit_if_possible(edith_browser))
        self.browser = edith_browser
        self.create_pre_authenticated_session('*****@*****.**')

        # Lain goes to the home page and starts a list
        self.browser = lain_browser
        self.browser.get(self.live_server_url)
        list_page = ListPage(self).add_list_item('Get help')

        # She notices a 'Share this list' option
        share_box = list_page.get_share_box()
        self.assertEqual(share_box.get_attribute('placeholder'),
                         '*****@*****.**')

        # She shares her list. The page updates to say that it's shared with Edith
        list_page.share_list_with('*****@*****.**')

        # Edith now goes to the lists page with her browser
        self.browser = edith_browser
        MyListsPage(self).go_to_my_lists_page()

        # She sees Lain's list in there!
        self.browser.find_element_by_link_text('Get help').click()

        # On the list page, Edith can see that it's Lain's list
        self.wait_for(lambda: self.assertEqual(list_page.get_list_owner(),
                                               '*****@*****.**'))

        # She adds an item to the list
        list_page.add_list_item('Hi, Lain!')

        # When Lain refreshes the page, she sees Edith's addition
        self.browser = lain_browser
        self.browser.refresh()
        list_page.wait_for_row_in_list_table('Hi, Lain!', 2)
示例#3
0
    def test_can_share_a_list_with_another_user(self):
        # Edith is a logged-in user
        self.create_pre_authenticated_session('*****@*****.**')
        edith_browser = self.browser
        self.addCleanup(lambda: quit_if_possible(edith_browser))

        # Her friend Oniciferous is also hanging out on the lists site
        chrome_options = Options()
        chrome_options.add_argument('--no-sandbox')
        chrome_options.add_argument('--disable-dev-shm-usage')
        oni_browser = webdriver.Chrome(chrome_options=chrome_options)

        self.addCleanup(lambda: quit_if_possible(oni_browser))
        self.browser = oni_browser
        self.create_pre_authenticated_session('*****@*****.**')

        # Edith goes to the home page and starts a list
        self.browser = edith_browser
        self.browser.get(self.live_server_url)
        list_page = ListPage(self).add_list_item('Get help')

        # She notices a "Share this list" option
        share_box = list_page.get_share_box()
        self.assertEqual(share_box.get_attribute('placeholder'),
                         '*****@*****.**')

        # She shares her list.
        # The page updates to say that it's shared with Oniciferous:
        list_page.share_list_with('*****@*****.**')

        # Oniciferous now goes to the lists page with his browser
        self.browser = oni_browser
        MyListPage(self).go_to_my_list_page()

        # He see Edith's list in there!
        self.browser.find_element_by_link_text('Get help').click()

        # On the list page, Oniciferous can see says that it's Edith's list
        self.wait_for(lambda: self.assertEqual(list_page.get_list_owner(),
                                               '*****@*****.**'))