Fix tests

This commit is contained in:
Zed 2019-09-19 02:29:24 +02:00
parent bd774cf0ca
commit 418168e570
5 changed files with 16 additions and 16 deletions

View File

@ -28,6 +28,7 @@
left: 0;
top: 0;
position: absolute;
z-index: 1;
}
.quote-text {

View File

@ -76,10 +76,9 @@ proc renderBanner(profile: Profile): VNode =
proc renderProtected(username: string): VNode =
buildHtml(tdiv(class="timeline-container")):
tdiv(class="timeline-container timeline"):
tdiv(class="timeline-header timeline-protected"):
h2: text "This account's tweets are protected."
p: text &"Only confirmed followers have access to @{username}'s tweets."
tdiv(class="timeline-header timeline-protected"):
h2: text "This account's tweets are protected."
p: text &"Only confirmed followers have access to @{username}'s tweets."
proc renderProfile*(profile: Profile; timeline: Timeline;
photoRail: seq[GalleryPhoto]; prefs: Prefs; path: string): VNode =

View File

@ -31,7 +31,7 @@ class Tweet(object):
self.fullname = namerow + '.fullname'
self.username = namerow + '.username'
self.date = namerow + '.tweet-date'
self.text = tweet + '.status-content.media-body'
self.text = tweet + '.tweet-content.media-body'
self.retweet = tweet + '.retweet'
self.reply = tweet + '.replying-to'
@ -50,7 +50,7 @@ class Profile(object):
class Timeline(object):
newest = 'div[class="status-el show-more"]'
newest = 'div[class="timeline-item show-more"]'
older = 'div[class="show-more"]'
end = '.timeline-end'
none = '.timeline-none'
@ -63,8 +63,8 @@ class Conversation(object):
after = '.after-tweet'
replies = '.replies'
thread = '.reply'
tweet = '.status-el'
tweet_text = '.status-content'
tweet = '.timeline-item'
tweet_text = '.tweet-content'
class Poll(object):
@ -95,9 +95,9 @@ class BaseTestCase(BaseCase):
def search_username(self, username):
self.open_nitter()
self.update_text('.search-panel input', username)
self.submit('.search-panel form')
self.update_text('.search-bar input[type=text]', username)
self.submit('.search-bar form')
def get_timeline_tweet(num=1):
return Tweet(f'#posts > div:nth-child({num}) ')
return Tweet(f'.timeline > div:nth-child({num}) ')

View File

@ -37,21 +37,21 @@ class TweetTest(BaseTestCase):
@parameterized.expand(short)
def test_short(self, username):
self.open_nitter(username)
self.assert_text('No more tweets.', Timeline.end)
self.assert_text('No more items', Timeline.end)
self.assert_element_absent(Timeline.newest)
self.assert_element_absent(Timeline.older)
@parameterized.expand(no_more)
def test_no_more(self, username):
self.open_nitter(username)
self.assert_text('No more tweets.', Timeline.end)
self.assert_text('No more items', Timeline.end)
self.assert_element_present(Timeline.newest)
self.assert_element_absent(Timeline.older)
@parameterized.expand(none_found)
def test_none_found(self, username):
self.open_nitter(username)
self.assert_text('No tweets found.', Timeline.none)
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)
@ -59,7 +59,7 @@ class TweetTest(BaseTestCase):
@parameterized.expand(empty)
def test_empty(self, username):
self.open_nitter(username)
self.assert_text('No tweets found.', Timeline.none)
self.assert_text('No items found', Timeline.none)
self.assert_element_absent(Timeline.newest)
self.assert_element_absent(Timeline.older)
self.assert_element_absent(Timeline.end)

View File

@ -147,6 +147,6 @@ class TweetTest(BaseTestCase):
@parameterized.expand(reply)
def test_reply(self, tweet, username, reply):
self.open_nitter(tweet)
tweet = get_timeline_tweet(1)
tweet = get_timeline_tweet(2)
self.assert_text(username, tweet.username)
self.assert_text('Replying to ' + reply, tweet.reply)