From a5676e1c2ca2566dcf185a72d959a9dd7f084075 Mon Sep 17 00:00:00 2001 From: Zed Date: Sat, 29 Jun 2019 00:41:57 +0200 Subject: [PATCH] Improve test base --- tests/base.py | 12 +++++++----- tests/test_search.py | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/base.py b/tests/base.py index 6579277..cceed17 100644 --- a/tests/base.py +++ b/tests/base.py @@ -3,19 +3,21 @@ from seleniumbase import BaseCase class Tweet(object): def __init__(self, tweet=''): - namerow = tweet + 'div.media-heading > div > .fullname-and-username > ' + namerow = tweet + 'div.media-heading ' self.fullname = namerow + '.fullname' self.username = namerow + '.username' - self.date = tweet + 'div.media-heading > div > .heading-right' - self.text = tweet + '.status-content-wrapper > .status-content.media-body' + self.date = tweet + 'div.media-heading .heading-right' + self.text = tweet + '.status-content-wrapper .status-content.media-body' + self.retweet = tweet = '.retweet' class Profile(object): fullname = '.profile-card-fullname' username = '.profile-card-username' - bio = '.profile-bio' protected = '.protected-icon' verified = '.verified-icon' + banner = '.profile-banner' + bio = '.profile-bio' class BaseTestCase(BaseCase): @@ -35,4 +37,4 @@ class BaseTestCase(BaseCase): def get_timeline_tweet(num=1): - return Tweet(f'#tweets > div:nth-child({num}) > div > div ') + return Tweet(f'#tweets > div:nth-child({num}) ') diff --git a/tests/test_search.py b/tests/test_search.py index 1ba434c..9be13d5 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -2,7 +2,7 @@ from base import BaseTestCase from parameterized import parameterized -class TestSearch(BaseTestCase): +class SearchTest(BaseTestCase): @parameterized.expand([['mobile_test'], ['mobile_test_2']]) def test_username_search(self, username): self.search_username(username)