Skip to content

Commit

Permalink
check if feed item is a club post (#14)
Browse files Browse the repository at this point in the history
* check if feed item is a club post
* remove debug print statements
---------
Co-authored-by: Domantas Cibas <domantas.cibas@sensmetry.com>
  • Loading branch information
Domantas Cibas authored Oct 18, 2023
1 parent 18b0134 commit 70a1542
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion give_kudos.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ def locate_kudos_buttons_and_maybe_give_kudos(self, web_feed_entry_locator) -> i
web_feed = web_feed_entry_locator.nth(i)
p_count = web_feed.get_by_test_id("entry-header").count()

# check if feed item is a club post
if self.is_club_post(web_feed):
print('c', end='')
continue

# check if activity has multiple participants
if p_count > 1:
for j in range(p_count):
Expand All @@ -102,9 +107,21 @@ def locate_kudos_buttons_and_maybe_give_kudos(self, web_feed_entry_locator) -> i
if not self.is_participant_me(web_feed):
button = self.find_unfilled_kudos_button(web_feed)
given_count += self.click_kudos_button(unfilled_kudos_container=button)
print(f"Kudos given: {given_count}")
print(f"\nKudos given: {given_count}")
return given_count

def is_club_post(self, container) -> bool:
"""
Returns true if the container is a club post
"""
if(container.get_by_test_id("group-header").count() > 0):
return True

if(container.locator(".clubMemberPostHeaderLinks").count() > 0):
return True

return False

def is_participant_me(self, container) -> bool:
"""
Returns true is the container's owner is logged-in user.
Expand Down

0 comments on commit 70a1542

Please sign in to comment.