Add photo rail test
This commit is contained in:
parent
47c87f7068
commit
34dd02df1b
3 changed files with 18 additions and 1 deletions
|
@ -50,7 +50,8 @@ proc getMediaTimeline*(id: string; after=""): Future[Timeline] {.async.} =
|
||||||
result = parseTimeline(await fetch(url), after)
|
result = parseTimeline(await fetch(url), after)
|
||||||
|
|
||||||
proc getPhotoRail*(id: string): Future[PhotoRail] {.async.} =
|
proc getPhotoRail*(id: string): Future[PhotoRail] {.async.} =
|
||||||
result = parsePhotoRail(await getMediaTimeline(id))
|
let url = mediaTimeline / (id & ".json") ? genParams()
|
||||||
|
result = parsePhotoRail(await fetch(url))
|
||||||
|
|
||||||
proc getSearch*[T](query: Query; after=""): Future[Result[T]] {.async.} =
|
proc getSearch*[T](query: Query; after=""): Future[Result[T]] {.async.} =
|
||||||
when T is Profile:
|
when T is Profile:
|
||||||
|
|
|
@ -53,6 +53,7 @@ class Timeline(object):
|
||||||
end = '.timeline-end'
|
end = '.timeline-end'
|
||||||
none = '.timeline-none'
|
none = '.timeline-none'
|
||||||
protected = '.timeline-protected'
|
protected = '.timeline-protected'
|
||||||
|
photo_rail = '.photo-rail-grid'
|
||||||
|
|
||||||
|
|
||||||
class Conversation(object):
|
class Conversation(object):
|
||||||
|
|
|
@ -12,6 +12,13 @@ empty = [['emptyuser'], ['mobile_test_10']]
|
||||||
|
|
||||||
protected = [['mobile_test_7'], ['Empty_user']]
|
protected = [['mobile_test_7'], ['Empty_user']]
|
||||||
|
|
||||||
|
photo_rail = [['mobile_test', [
|
||||||
|
'BzUnaDFCUAAmrjs', 'Bo0nDsYIYAIjqVn', 'Bos--KNIQAAA7Li', 'Boq1sDJIYAAxaoi',
|
||||||
|
'BonISmPIEAAhP3G', 'BoQbwJAIUAA0QCY', 'BoQbRQxIIAA3FWD', 'Bn8Qh8iIIAABXrG',
|
||||||
|
'Bn8QIG3IYAA0IGT', 'Bn8O3QeIUAAONai', 'Bn8NGViIAAATNG4', 'BkKovdrCUAAEz79',
|
||||||
|
'BkKoe_oCIAASAqr', 'BkKoRLNCAAAYfDf', 'BkKndxoCQAE1vFt', 'BPEmIbYCMAE44dl'
|
||||||
|
]]]
|
||||||
|
|
||||||
|
|
||||||
class TweetTest(BaseTestCase):
|
class TweetTest(BaseTestCase):
|
||||||
@parameterized.expand(normal)
|
@parameterized.expand(normal)
|
||||||
|
@ -52,3 +59,11 @@ class TweetTest(BaseTestCase):
|
||||||
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)
|
||||||
|
|
||||||
|
@parameterized.expand(photo_rail)
|
||||||
|
def test_photo_rail(self, username, images):
|
||||||
|
self.open_nitter(username)
|
||||||
|
self.assert_element_visible(Timeline.photo_rail)
|
||||||
|
for i, url in enumerate(images):
|
||||||
|
img = self.get_attribute(Timeline.photo_rail + f' a:nth-child({i + 1}) img', 'src')
|
||||||
|
self.assertIn(url, img)
|
||||||
|
|
Loading…
Reference in a new issue