@@ -40,27 +40,37 @@ void main() {
4040 final user
= await fakeTestScenario.
createTestUser (email
: '[email protected] ' );
4141
4242 await user.withBrowserPage ((page) async {
43- Future <String > getCountLabel () async {
44- final label = await page.$('.like-button-and-label--count' );
45- return await label.textContent ();
43+ Future <List <String >> getCountLabels () async {
44+ final buttonLabel = await page.$('.like-button-and-label--count' );
45+ final viewLabel =
46+ await page.$('.packages-score-like .packages-score-value-number' );
47+ final keyScoreLabel = await page
48+ .$OrNull ('.score-key-figure--likes .score-key-figure-value' );
49+ return [
50+ await buttonLabel.textContent (),
51+ await viewLabel.textContent (),
52+ (await keyScoreLabel? .textContent ()) ?? '' ,
53+ ];
4654 }
4755
4856 await page.gotoOrigin ('/packages/test_pkg' );
49- expect (await getCountLabel (), '0' );
57+ expect (await getCountLabels (), [ '0' , '0' , '' ] );
5058
5159 await page.click ('.like-button-and-label--button' );
5260 await Future .delayed (Duration (seconds: 1 ));
53- expect (await getCountLabel (), '1' );
61+ expect (await getCountLabels (), [ '1' , '1' , '' ] );
5462
55- await page.gotoOrigin ('/packages/test_pkg' );
56- expect (await getCountLabel (), '1' );
63+ // displaying all three
64+ await page.gotoOrigin ('/packages/test_pkg/score' );
65+ expect (await getCountLabels (), ['1' , '1' , '1' ]);
5766
5867 await page.click ('.like-button-and-label--button' );
5968 await Future .delayed (Duration (seconds: 1 ));
6069
61- expect (await getCountLabel (), '0' );
70+ // checking it on the main package page too
71+ expect (await getCountLabels (), ['0' , '0' , '0' ]);
6272 await page.gotoOrigin ('/packages/test_pkg' );
63- expect (await getCountLabel (), '0' );
73+ expect (await getCountLabels (), [ '0' , '0' , '' ] );
6474 });
6575 });
6676 });
0 commit comments