2019-06-28 22:42:53 +00:00
|
|
|
from base import BaseTestCase, Timeline
|
|
|
|
from parameterized import parameterized
|
|
|
|
|
2023-07-22 01:03:45 +00:00
|
|
|
normal = [['jack'], ['elonmusk']]
|
2019-06-28 22:42:53 +00:00
|
|
|
|
2023-07-22 01:03:45 +00:00
|
|
|
after = [['jack', '1681686036294803456'],
|
|
|
|
['elonmusk', '1681686036294803456']]
|
2019-06-28 22:42:53 +00:00
|
|
|
|
2023-07-22 01:03:45 +00:00
|
|
|
no_more = [['mobile_test_8?cursor=1000']]
|
2019-06-28 22:42:53 +00:00
|
|
|
|
2020-06-01 00:25:56 +00:00
|
|
|
empty = [['emptyuser'], ['mobile_test_10']]
|
2019-06-28 22:42:53 +00:00
|
|
|
|
2020-06-01 00:25:56 +00:00
|
|
|
protected = [['mobile_test_7'], ['Empty_user']]
|
2019-06-28 22:42:53 +00:00
|
|
|
|
2020-06-07 05:56:28 +00:00
|
|
|
photo_rail = [['mobile_test', [
|
|
|
|
'BzUnaDFCUAAmrjs', 'Bo0nDsYIYAIjqVn', 'Bos--KNIQAAA7Li', 'Boq1sDJIYAAxaoi',
|
|
|
|
'BonISmPIEAAhP3G', 'BoQbwJAIUAA0QCY', 'BoQbRQxIIAA3FWD', 'Bn8Qh8iIIAABXrG',
|
|
|
|
'Bn8QIG3IYAA0IGT', 'Bn8O3QeIUAAONai', 'Bn8NGViIAAATNG4', 'BkKovdrCUAAEz79',
|
|
|
|
'BkKoe_oCIAASAqr', 'BkKoRLNCAAAYfDf', 'BkKndxoCQAE1vFt', 'BPEmIbYCMAE44dl'
|
|
|
|
]]]
|
|
|
|
|
2019-06-28 22:42:53 +00:00
|
|
|
|
|
|
|
class TweetTest(BaseTestCase):
|
|
|
|
@parameterized.expand(normal)
|
|
|
|
def test_timeline(self, username):
|
|
|
|
self.open_nitter(username)
|
|
|
|
self.assert_element_present(Timeline.older)
|
|
|
|
self.assert_element_absent(Timeline.newest)
|
|
|
|
self.assert_element_absent(Timeline.end)
|
|
|
|
self.assert_element_absent(Timeline.none)
|
|
|
|
|
|
|
|
@parameterized.expand(after)
|
2020-06-01 00:25:56 +00:00
|
|
|
def test_after(self, username, cursor):
|
|
|
|
self.open_nitter(f'{username}?cursor={cursor}')
|
2019-06-28 22:42:53 +00:00
|
|
|
self.assert_element_present(Timeline.newest)
|
|
|
|
self.assert_element_present(Timeline.older)
|
|
|
|
self.assert_element_absent(Timeline.end)
|
|
|
|
self.assert_element_absent(Timeline.none)
|
|
|
|
|
|
|
|
@parameterized.expand(no_more)
|
|
|
|
def test_no_more(self, username):
|
|
|
|
self.open_nitter(username)
|
2019-09-19 00:29:24 +00:00
|
|
|
self.assert_text('No more items', Timeline.end)
|
2019-06-28 22:42:53 +00:00
|
|
|
self.assert_element_present(Timeline.newest)
|
|
|
|
self.assert_element_absent(Timeline.older)
|
|
|
|
|
|
|
|
@parameterized.expand(empty)
|
|
|
|
def test_empty(self, username):
|
|
|
|
self.open_nitter(username)
|
2019-09-19 00:29:24 +00:00
|
|
|
self.assert_text('No items found', Timeline.none)
|
2019-06-28 22:42:53 +00:00
|
|
|
self.assert_element_absent(Timeline.newest)
|
|
|
|
self.assert_element_absent(Timeline.older)
|
|
|
|
self.assert_element_absent(Timeline.end)
|
|
|
|
|
|
|
|
@parameterized.expand(protected)
|
|
|
|
def test_protected(self, username):
|
|
|
|
self.open_nitter(username)
|
|
|
|
self.assert_text('This account\'s tweets are protected.', Timeline.protected)
|
|
|
|
self.assert_element_absent(Timeline.newest)
|
|
|
|
self.assert_element_absent(Timeline.older)
|
|
|
|
self.assert_element_absent(Timeline.end)
|
2020-06-07 05:56:28 +00:00
|
|
|
|
|
|
|
@parameterized.expand(photo_rail)
|
|
|
|
def test_photo_rail(self, username, images):
|
|
|
|
self.open_nitter(username)
|
|
|
|
self.assert_element_visible(Timeline.photo_rail)
|
|
|
|
for i, url in enumerate(images):
|
|
|
|
img = self.get_attribute(Timeline.photo_rail + f' a:nth-child({i + 1}) img', 'src')
|
|
|
|
self.assertIn(url, img)
|