Update tests
This commit is contained in:
parent
81d6d1ac7f
commit
12c8b2659c
6 changed files with 27 additions and 52 deletions
|
@ -19,10 +19,8 @@ class Quote(object):
|
||||||
self.fullname = namerow + '.fullname'
|
self.fullname = namerow + '.fullname'
|
||||||
self.username = namerow + '.username'
|
self.username = namerow + '.username'
|
||||||
self.text = quote + '.quote-text'
|
self.text = quote + '.quote-text'
|
||||||
self.media = quote + '.quote-media'
|
self.media = quote + '.quote-media-container'
|
||||||
self.unavailable = quote + '.quote.unavailable'
|
self.unavailable = quote + '.quote.unavailable'
|
||||||
self.sensitive = quote + '.quote-sensitive'
|
|
||||||
self.badge = quote + '.quote-badge'
|
|
||||||
|
|
||||||
|
|
||||||
class Tweet(object):
|
class Tweet(object):
|
||||||
|
|
|
@ -71,9 +71,9 @@ no_thumb = [
|
||||||
'reddit.com'],
|
'reddit.com'],
|
||||||
|
|
||||||
['lorenlugosch/status/1115440394148487168',
|
['lorenlugosch/status/1115440394148487168',
|
||||||
'lorenlugosch/end-to-end-SLU',
|
'Fluent Speech Commands: A dataset for spoken language understanding research',
|
||||||
'PyTorch code for end-to-end spoken language understanding (SLU) with ASR-based transfer learning - lorenlugosch/end-to-end-SLU',
|
'In recent years, with the advent of deep neural networks, the accuracy of speech recognition models have been notably improved which have made possible the production of speech-to-text systems that...',
|
||||||
'github.com'],
|
'fluent.ai'],
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ invalid = [['thisprofiledoesntexist'], ['%']]
|
||||||
|
|
||||||
banner_color = [
|
banner_color = [
|
||||||
['TheTwoffice', '29, 161, 242'],
|
['TheTwoffice', '29, 161, 242'],
|
||||||
['profiletest', '80, 176, 58']
|
['profiletest', '80, 176, 58'],
|
||||||
|
['nim_lang', '24, 26, 36']
|
||||||
]
|
]
|
||||||
|
|
||||||
banner_image = [
|
banner_image = [
|
||||||
|
|
|
@ -28,7 +28,7 @@ gif = [
|
||||||
]
|
]
|
||||||
|
|
||||||
video = [
|
video = [
|
||||||
['bkuensting/status/1067316003200217088', 'IyCaQlzF0q8u9vBd', '1:05']
|
['bkuensting/status/1067316003200217088', 'IyCaQlzF0q8u9vBd']
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,21 +46,18 @@ class QuoteTest(BaseTestCase):
|
||||||
self.open_nitter(tweet)
|
self.open_nitter(tweet)
|
||||||
quote = Quote(Conversation.main + " ")
|
quote = Quote(Conversation.main + " ")
|
||||||
self.assert_element_visible(quote.media)
|
self.assert_element_visible(quote.media)
|
||||||
self.assert_element_not_visible(quote.badge)
|
|
||||||
self.assertIn(url, self.get_image_url(quote.media + ' img'))
|
self.assertIn(url, self.get_image_url(quote.media + ' img'))
|
||||||
|
|
||||||
@parameterized.expand(gif)
|
@parameterized.expand(gif)
|
||||||
def test_gif(self, tweet, thumb):
|
def test_gif(self, tweet, url):
|
||||||
self.open_nitter(tweet)
|
self.open_nitter(tweet)
|
||||||
quote = Quote(Conversation.main + " ")
|
quote = Quote(Conversation.main + " ")
|
||||||
self.assert_element_visible(quote.badge)
|
self.assert_element_visible(quote.media)
|
||||||
self.assert_text('GIF', quote.badge)
|
self.assertIn(url, self.get_attribute(quote.media + ' source', 'src'))
|
||||||
self.assertIn(thumb, self.get_image_url(quote.media + ' img'))
|
|
||||||
|
|
||||||
@parameterized.expand(video)
|
@parameterized.expand(video)
|
||||||
def test_video(self, tweet, thumb, length):
|
def test_video(self, tweet, url):
|
||||||
self.open_nitter(tweet)
|
self.open_nitter(tweet)
|
||||||
quote = Quote(Conversation.main + " ")
|
quote = Quote(Conversation.main + " ")
|
||||||
self.assert_element_visible(quote.badge)
|
self.assert_element_visible(quote.media)
|
||||||
self.assert_text(length, quote.badge)
|
self.assertIn(url, self.get_image_url(quote.media + ' img'))
|
||||||
self.assertIn(thumb, self.get_image_url(quote.media + ' img'))
|
|
||||||
|
|
|
@ -3,18 +3,14 @@ from parameterized import parameterized
|
||||||
|
|
||||||
normal = [['mobile_test'], ['mobile_test_2']]
|
normal = [['mobile_test'], ['mobile_test_2']]
|
||||||
|
|
||||||
after = [['mobile_test', '627635134573862912'],
|
after = [['mobile_test', 'HBaAgJPsqtGNhA0AAA%3D%3D'],
|
||||||
['mobile_test_2', '377196342281388032']]
|
['mobile_test_2', 'HBaAgJPsqtGNhA0AAA%3D%3D']]
|
||||||
|
|
||||||
short = [['mobile_test_8'], ['picman']]
|
no_more = [['mobile_test_8?cursor=HBaAwJCsk%2F6%2FtgQAAA%3D%3D']]
|
||||||
|
|
||||||
no_more = [['mobile_test_8?max_position=159455542543257601']]
|
empty = [['emptyuser'], ['mobile_test_10']]
|
||||||
|
|
||||||
none_found = [['mobile_test_8?max_position=159455542543257600']]
|
protected = [['mobile_test_7'], ['Empty_user']]
|
||||||
|
|
||||||
empty = [['maybethis'], ['mobile_test_10']]
|
|
||||||
|
|
||||||
protected = [['mobile_test_7'], ['Poop']]
|
|
||||||
|
|
||||||
|
|
||||||
class TweetTest(BaseTestCase):
|
class TweetTest(BaseTestCase):
|
||||||
|
@ -27,20 +23,13 @@ class TweetTest(BaseTestCase):
|
||||||
self.assert_element_absent(Timeline.none)
|
self.assert_element_absent(Timeline.none)
|
||||||
|
|
||||||
@parameterized.expand(after)
|
@parameterized.expand(after)
|
||||||
def test_after(self, username, index):
|
def test_after(self, username, cursor):
|
||||||
self.open_nitter(f'{username}?max_position={index}')
|
self.open_nitter(f'{username}?cursor={cursor}')
|
||||||
self.assert_element_present(Timeline.newest)
|
self.assert_element_present(Timeline.newest)
|
||||||
self.assert_element_present(Timeline.older)
|
self.assert_element_present(Timeline.older)
|
||||||
self.assert_element_absent(Timeline.end)
|
self.assert_element_absent(Timeline.end)
|
||||||
self.assert_element_absent(Timeline.none)
|
self.assert_element_absent(Timeline.none)
|
||||||
|
|
||||||
@parameterized.expand(short)
|
|
||||||
def test_short(self, username):
|
|
||||||
self.open_nitter(username)
|
|
||||||
self.assert_text('No more items', Timeline.end)
|
|
||||||
self.assert_element_absent(Timeline.newest)
|
|
||||||
self.assert_element_absent(Timeline.older)
|
|
||||||
|
|
||||||
@parameterized.expand(no_more)
|
@parameterized.expand(no_more)
|
||||||
def test_no_more(self, username):
|
def test_no_more(self, username):
|
||||||
self.open_nitter(username)
|
self.open_nitter(username)
|
||||||
|
@ -48,14 +37,6 @@ class TweetTest(BaseTestCase):
|
||||||
self.assert_element_present(Timeline.newest)
|
self.assert_element_present(Timeline.newest)
|
||||||
self.assert_element_absent(Timeline.older)
|
self.assert_element_absent(Timeline.older)
|
||||||
|
|
||||||
@parameterized.expand(none_found)
|
|
||||||
def test_none_found(self, username):
|
|
||||||
self.open_nitter(username)
|
|
||||||
self.assert_text('No items found', Timeline.none)
|
|
||||||
self.assert_element_present(Timeline.newest)
|
|
||||||
self.assert_element_absent(Timeline.older)
|
|
||||||
self.assert_element_absent(Timeline.end)
|
|
||||||
|
|
||||||
@parameterized.expand(empty)
|
@parameterized.expand(empty)
|
||||||
def test_empty(self, username):
|
def test_empty(self, username):
|
||||||
self.open_nitter(username)
|
self.open_nitter(username)
|
||||||
|
|
|
@ -11,15 +11,15 @@ timeline = [
|
||||||
[3, 'Test account', 'mobile_test', '3 Mar 2016', '705522133443571712',
|
[3, 'Test account', 'mobile_test', '3 Mar 2016', '705522133443571712',
|
||||||
'LIVE on #Periscope pscp.tv/w/aadiTzF6dkVOTXZSbX…'],
|
'LIVE on #Periscope pscp.tv/w/aadiTzF6dkVOTXZSbX…'],
|
||||||
|
|
||||||
[6, 'mobile test 2', 'mobile_test_2', '1 Oct 2014', '517449200045277184',
|
[6, 'mobile test 2', 'mobile_test_2', '2 Oct 2014', '517449200045277184',
|
||||||
'Testing. One two three four. Test.']
|
'Testing. One two three four. Test.']
|
||||||
]
|
]
|
||||||
|
|
||||||
status = [
|
status = [
|
||||||
[20, 'jack', 'jack', '21 Mar 2006', 'just setting up my twttr'],
|
[20, 'jack', 'jack', '21 Mar 2006', 'just setting up my twttr'],
|
||||||
[134849778302464000, 'The Twoffice', 'TheTwoffice', '10 Nov 2011', 'test'],
|
[134849778302464000, 'The Twoffice', 'TheTwoffice', '11 Nov 2011', 'test'],
|
||||||
[105685475985080322, 'The Twoffice', 'TheTwoffice', '22 Aug 2011', 'regular tweet'],
|
[105685475985080322, 'The Twoffice', 'TheTwoffice', '22 Aug 2011', 'regular tweet'],
|
||||||
[572593440719912960, 'Test account', 'mobile_test', '2 Mar 2015', 'testing test']
|
[572593440719912960, 'Test account', 'mobile_test', '3 Mar 2015', 'testing test']
|
||||||
]
|
]
|
||||||
|
|
||||||
invalid = [
|
invalid = [
|
||||||
|
@ -87,8 +87,7 @@ retweet = [
|
||||||
]
|
]
|
||||||
|
|
||||||
reply = [
|
reply = [
|
||||||
['mobile_test?max_position=471336696307392513', '@mobile_test', '@mobile_test'],
|
['mobile_test/with_replies', 15]
|
||||||
['mobile_test_2?max_position=375101899214561280', '@mobile_test_2', '@mobile_test']
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,8 +150,7 @@ class TweetTest(BaseTestCase):
|
||||||
self.assert_text('Tweet not found', '.error-panel')
|
self.assert_text('Tweet not found', '.error-panel')
|
||||||
|
|
||||||
@parameterized.expand(reply)
|
@parameterized.expand(reply)
|
||||||
def test_reply(self, tweet, username, reply):
|
def test_thread(self, tweet, num):
|
||||||
self.open_nitter(tweet)
|
self.open_nitter(tweet)
|
||||||
tweet = get_timeline_tweet(2)
|
thread = self.find_element(f'.timeline > div:nth-child({num})')
|
||||||
self.assert_text(username, tweet.username)
|
self.assertIn(thread.get_attribute('class'), 'thread-line')
|
||||||
self.assert_text('Replying to ' + reply, tweet.reply)
|
|
||||||
|
|
Loading…
Reference in a new issue