Exemplo n.º 1
0
    def test_can_share_a_list_with_another_user(self):
        """test: можно обмениваться списком с еще одним пользователем"""

        # Эдит является зарегистрированным пользователем
        self.create_pre_authenticated_session('*****@*****.**')
        edith_browser = self.browser
        self.addCleanup(lambda: quit_if_possible(edith_browser))

        # Ее друг Анцифер тоже зависает на сайте списков
        oni_browser = self.make_browser()
        self.addCleanup(lambda: quit_if_possible(oni_browser))
        self.browser = oni_browser
        self.create_pre_authenticated_session('*****@*****.**')

        # Эдит открывает домашнюю страницу и начинает новый список
        self.browser = edith_browser
        self.browser.get(self.live_server_url)
        list_page = ListPage(self).add_list_item('Требуется помощь')

        # Она замечает опцию "Поделиться этим списком"
        share_box = ListPage(self).get_share_box()
        self.assertEqual(share_box.get_attribute('placeholder'),
                         '*****@*****.**')

        # Она делится своим списком
        # Страница обновляется и сообщает, что теперь список используется совместно с Анцифиром
        list_page.share_list_with('*****@*****.**')

        # Анцифер переходит на страницу списков в своем браузере
        self.browser = oni_browser
        MyListsPage(self).go_to_my_lists_page()

        # Он видит на ней список Эдит!
        self.browser.find_element_by_link_text('Требуется помощь').click()

        # На странице, которую Анцифер видит, говорится, что это список Эдит
        self.wait_for(lambda: self.assertEqual(list_page.get_list_owner(),
                                               '*****@*****.**'))

        # Он добавляет элемент в список
        list_page.add_list_item('Hi Edith!')

        # Когда Эдит обновляет страницу, она видит дополнение Анцифера
        self.browser = edith_browser
        self.browser.refresh()
        list_page.wait_for_row_in_list_table('Hi Edith!', 2)
Exemplo n.º 2
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')
Exemplo n.º 3
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)
Exemplo n.º 4
0
    def test_can_share_a_list_with_another_user(self):
        # user A logs in
        self.create_pre_authenticated_session('*****@*****.**')
        a_browser = self.browser

        self.addCleanup(lambda: quit_if_possible(a_browser))

        # user B also logs in
        b_browser = webdriver.Chrome(self.chrome_dir)
        self.addCleanup(lambda: quit_if_possible(b_browser))
        self.browser = b_browser
        self.create_pre_authenticated_session('*****@*****.**')

        # A starts list
        self.browser = a_browser
        self.browser.get(self.live_server_url)
        self.add_list_item('Shared list')
        list_page = ListPage(self)

        # A shares list
        list_page.share_list_with('*****@*****.**')
        list_page.assert_email_in_share_list('*****@*****.**')

        # B goes to my lists page
        self.browser = b_browser
        my_list_page = MyListsPage(self)
        my_list_page.go_to_my_lists_page()

        self.browser.find_element_by_partial_link_text('Shared list').click()

        # B can see list`s owner
        self.assertIn('*****@*****.**', list_page.get_list_owner())

        # B adds an item to the list
        self.add_list_item('Item from B')

        # A sees new item
        self.browser = a_browser
        self.browser.refresh()
        self.wait_for_row_in_list_table('2 Item from B')
Exemplo n.º 5
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(),
                                               '*****@*****.**'))