From 418168e570c0e38f08f7b8dd0de775c464c537fc Mon Sep 17 00:00:00 2001 From: Zed Date: Thu, 19 Sep 2019 02:29:24 +0200 Subject: [PATCH] Fix tests --- src/sass/tweet/quote.scss | 1 + src/views/profile.nim | 7 +++---- tests/base.py | 14 +++++++------- tests/test_timeline.py | 8 ++++---- tests/test_tweet.py | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/sass/tweet/quote.scss b/src/sass/tweet/quote.scss index 65b772e..9b7f7c2 100644 --- a/src/sass/tweet/quote.scss +++ b/src/sass/tweet/quote.scss @@ -28,6 +28,7 @@ left: 0; top: 0; position: absolute; + z-index: 1; } .quote-text { diff --git a/src/views/profile.nim b/src/views/profile.nim index 694bd78..59e466c 100644 --- a/src/views/profile.nim +++ b/src/views/profile.nim @@ -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 = diff --git a/tests/base.py b/tests/base.py index 1e1ed8f..0aa7604 100644 --- a/tests/base.py +++ b/tests/base.py @@ -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}) ') diff --git a/tests/test_timeline.py b/tests/test_timeline.py index 884350e..8829735 100644 --- a/tests/test_timeline.py +++ b/tests/test_timeline.py @@ -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) diff --git a/tests/test_tweet.py b/tests/test_tweet.py index 8520603..9c86a74 100644 --- a/tests/test_tweet.py +++ b/tests/test_tweet.py @@ -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)