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; left: 0;
top: 0; top: 0;
position: absolute; position: absolute;
z-index: 1;
} }
.quote-text { .quote-text {

View file

@ -76,7 +76,6 @@ proc renderBanner(profile: Profile): VNode =
proc renderProtected(username: string): VNode = proc renderProtected(username: string): VNode =
buildHtml(tdiv(class="timeline-container")): buildHtml(tdiv(class="timeline-container")):
tdiv(class="timeline-container timeline"):
tdiv(class="timeline-header timeline-protected"): tdiv(class="timeline-header timeline-protected"):
h2: text "This account's tweets are protected." h2: text "This account's tweets are protected."
p: text &"Only confirmed followers have access to @{username}'s tweets." p: text &"Only confirmed followers have access to @{username}'s tweets."

View file

@ -31,7 +31,7 @@ class Tweet(object):
self.fullname = namerow + '.fullname' self.fullname = namerow + '.fullname'
self.username = namerow + '.username' self.username = namerow + '.username'
self.date = namerow + '.tweet-date' self.date = namerow + '.tweet-date'
self.text = tweet + '.status-content.media-body' self.text = tweet + '.tweet-content.media-body'
self.retweet = tweet + '.retweet' self.retweet = tweet + '.retweet'
self.reply = tweet + '.replying-to' self.reply = tweet + '.replying-to'
@ -50,7 +50,7 @@ class Profile(object):
class Timeline(object): class Timeline(object):
newest = 'div[class="status-el show-more"]' newest = 'div[class="timeline-item show-more"]'
older = 'div[class="show-more"]' older = 'div[class="show-more"]'
end = '.timeline-end' end = '.timeline-end'
none = '.timeline-none' none = '.timeline-none'
@ -63,8 +63,8 @@ class Conversation(object):
after = '.after-tweet' after = '.after-tweet'
replies = '.replies' replies = '.replies'
thread = '.reply' thread = '.reply'
tweet = '.status-el' tweet = '.timeline-item'
tweet_text = '.status-content' tweet_text = '.tweet-content'
class Poll(object): class Poll(object):
@ -95,9 +95,9 @@ class BaseTestCase(BaseCase):
def search_username(self, username): def search_username(self, username):
self.open_nitter() self.open_nitter()
self.update_text('.search-panel input', username) self.update_text('.search-bar input[type=text]', username)
self.submit('.search-panel form') self.submit('.search-bar form')
def get_timeline_tweet(num=1): 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) @parameterized.expand(short)
def test_short(self, username): def test_short(self, username):
self.open_nitter(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.newest)
self.assert_element_absent(Timeline.older) 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)
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_present(Timeline.newest)
self.assert_element_absent(Timeline.older) self.assert_element_absent(Timeline.older)
@parameterized.expand(none_found) @parameterized.expand(none_found)
def test_none_found(self, username): def test_none_found(self, username):
self.open_nitter(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_present(Timeline.newest)
self.assert_element_absent(Timeline.older) self.assert_element_absent(Timeline.older)
self.assert_element_absent(Timeline.end) self.assert_element_absent(Timeline.end)
@ -59,7 +59,7 @@ class TweetTest(BaseTestCase):
@parameterized.expand(empty) @parameterized.expand(empty)
def test_empty(self, username): def test_empty(self, username):
self.open_nitter(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.newest)
self.assert_element_absent(Timeline.older) self.assert_element_absent(Timeline.older)
self.assert_element_absent(Timeline.end) self.assert_element_absent(Timeline.end)

View file

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