Skip to content
Merged
6 changes: 6 additions & 0 deletions app/(main)/player/components/complain-popup.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
.complains {
@apply w-full flex flex-col gap-2.5;
}

.complain {
@apply w-full h-fit flex justify-between items-center cursor-pointer;
}

.label {
@apply text-[18px];
}

.buttons {
@apply bg-[#191717] rounded-lg;
}
50 changes: 36 additions & 14 deletions app/(main)/player/components/complain-popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import CustomButton from "@/app/ui/custom-button";
import Popup from "@/app/ui/popup/popup";
import TextArea from "@/app/ui/text-area/text-area";
import Complains from "./complains";
import styles from "./complain-popup.module.scss";

export default function ComplainPopup() {
const [isOpen, setOpen] = useState<boolean>(false);
const [isComplainOpen, setComplainOpen] = useState<boolean>(false);
const [isShareOpen, setShareOpen] = useState<boolean>(false);
const [textValue, setTextValue] = useState<string | null>(null);
const [complainData, setComplainData] = useState<string | null>(null);
useEffect(() => {
Expand All @@ -31,9 +33,9 @@ export default function ComplainPopup() {
text="Пожаловаться"
title="Комментарий к жалобе"
icoSize={24}
bgClass="bg-[#191717]"
isOpen={isOpen}
setOpen={setOpen}
bgClass="bg-transparent"
isOpen={isComplainOpen}
setOpen={setComplainOpen}
>
<TextArea maxLen={256} onValueChange={setTextValue} />
<CustomButton
Expand All @@ -42,21 +44,41 @@ export default function ComplainPopup() {
rounded="rounded-md"
hoverClass="hover:scale-[101%]"
bgClass="bg-[#989AA21F]"
test-id="button:send_btn"
onClick={() => handleSendComplain()}
/>
</Popup>
);
}
return (
<Popup
text="Пожаловаться"
title="Пожаловаться"
icoSize={24}
bgClass="bg-[#191717]"
isOpen={isOpen}
setOpen={setOpen}
>
<Complains onSelect={handleReasonSelect} />
</Popup>
<div className={styles.buttons}>
<Popup
text="Поделиться"
title="Поделиться"
icoSize={24}
classes="semi-compact:hidden"
bgClass="bg-transparent"
isOpen={isShareOpen}
setOpen={setShareOpen}
test-id="button:share_btn"
>
{/* TODO share modal window */}
<div />
</Popup>
<Popup
text="Пожаловаться"
title="Пожаловаться"
icoSize={24}
bgClass="bg-transparent"
isOpen={isComplainOpen}
setOpen={setComplainOpen}
test-id="button:complain_btn"
>
<Complains
test-id="button:complains_modal"
onSelect={handleReasonSelect}
/>
</Popup>
</div>
);
}
1 change: 1 addition & 0 deletions app/(main)/player/components/complains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function Complains({ onSelect }: Props) {
id={obj.id}
className={styles.complain}
onClick={() => onSelect(obj.label)}
data-testid={`button:complain_${obj.id}`}
>
<p className={styles.label}>{obj.label}</p>
<Image
Expand Down
5 changes: 3 additions & 2 deletions app/(main)/player/components/player-aside.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.aside {
@apply flex gap-[66] compact:max-semi-compact:gap-8;
@apply justify-between items-center;

@media (max-width: 480px) {
@apply w-full;
}
Expand All @@ -20,7 +20,7 @@
}

.getmore {
@apply semi-compact:size-13 compact:size-13 mobile:size-10 flex items-center justify-center rounded-full relative z-10;
@apply semi-compact:size-13 compact:size-13 mobile:size-10 flex items-center justify-center relative z-10;
}

.buttons {
Expand All @@ -41,6 +41,7 @@

.playerTooltipContainer {
@apply flex items-center justify-center semi-compact:size-13 compact:size-10 bg-[#989AA21F] rounded-[100] cursor-pointer;
outline: none !important;
&:hover {
scale: 105%;
}
Expand Down
11 changes: 9 additions & 2 deletions app/(main)/player/components/player-tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import ComplainPopup from "./complain-popup";
export default function PlayerTooltip() {
return (
<Popover className={styles.getmore}>
<PopoverButton className={styles.playerTooltipContainer}>
<PopoverButton
className={styles.playerTooltipContainer}
test-id="Player: player tooltip button"
>
<Image
width={22}
height={5}
Expand All @@ -17,7 +20,11 @@ export default function PlayerTooltip() {
alt="getmore"
/>
</PopoverButton>
<PopoverPanel transition anchor={{ to: "bottom end", gap: "16px" }}>
<PopoverPanel
className="z-46"
transition
anchor={{ to: "bottom end", gap: "10px" }}
>
<ComplainPopup />
</PopoverPanel>
</Popover>
Expand Down
14 changes: 12 additions & 2 deletions tests/locators/player_page_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,20 @@ class PlayerLocators:
COUNT_DISLIKES_ANIME = (By.XPATH, '//div[@class="player-aside-module-scss-module__fAYBZa__span"][2]//p[@class="w-3"]')
SHARE_BUTTON_ANIME = (By.XPATH, '//div[@class="player-aside-module-scss-module__fAYBZa__buttons"]//button[text()="Поделиться"]')

GETMORE_BUTTON_ANIME = (By.XPATH, '//div[@class="player-aside-module-scss-module__fAYBZa__getmore"]//button')
GETMORE_BUTTON_ANIME = (By.XPATH, '//button[@test-id="Player: player tooltip button"]')
GETMORE_POP_UP = (By.XPATH, '//div[@id="headlessui-popover-panel-«R5ekivf9nl7»"]')
REPORT_BUTTON_ANIME = (By.XPATH, '//div[@id="headlessui-popover-panel-«R5ekivf9nl7»"]//button[text()="Пожаловаться"]')
REPORT_BUTTON_ANIME = (By.XPATH, '//button[@test-id="button:complain_btn"]')
REPORT_WINDOW_ANIME_BUTTONS_ALL = (By.XPATH, '//div[@class="popup-module-scss-module__VIQHUW__panel"]//div[@class="complain-popup-module-scss-module__XG6Idq__complains"]//div[@class="complain-popup-module-scss-module__XG6Idq__complain"]')
REPORT_WINDOW_ANIME_BUTTON_DISLIKE = (By.XPATH, '//div[@data-testid="button:complain_dislike"]')
REPORT_WINDOW_ANIME_BUTTON_ABUSE = (By.XPATH, '//div[@data-testid="button:complain_violence"]')
REPORT_WINDOW_ANIME_BUTTON_CONTRAFACT = (By.XPATH, '//div[@data-testid="button:complain_illegalGoods"]')
REPORT_WINDOW_ANIME_BUTTON_PORN = (By.XPATH, '//div[@data-testid="button:complain_pornography"]')
REPORT_WINDOW_ANIME_BUTTON_PERSONAL_DATA = (By.XPATH, '//div[@data-testid="button:complain_personalData"]')
REPORT_WINDOW_ANIME_BUTTON_TERROR = (By.XPATH, '//div[@data-testid="button:complain_terrorism"]')
REPORT_WINDOW_ANIME_BUTTON_SCAM = (By.XPATH, '//div[@data-testid="button:complain_scamOrSpam"]')
REPORT_WINDOW_ANIME_BUTTON_COPYRIGHT = (By.XPATH, '//div[@data-testid="button:complain_copyright"]')
REPORT_WINDOW_ANIME_BUTTON_OTHER = (By.XPATH, '//div[@data-testid="button:complain_other"]')
REPORT_WINDOW_ANIME_BUTTON_DELETE = (By.XPATH, '//div[@data-testid="button:complain_notIllegalButShouldBeRemoved"]')

REPORT_WINDOW_CONTAINER = (By.XPATH, '//div[@class="popup-module-scss-module__VIQHUW__backdrop"]//div[@class="popup-module-scss-module__VIQHUW__panel"]')
TEXTAREA_REPORT_WINDOW = (By.XPATH, '//div[@class="textarea-module-scss-module__WbmcLa__field"]//textarea')
Expand Down
42 changes: 31 additions & 11 deletions tests/pages/player_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,46 +81,66 @@ def click_to_report_anime(self):
self.find(locators.GETMORE_BUTTON_ANIME).click()
self.element_is_clickable(locators.REPORT_BUTTON_ANIME, 20)
self.find(locators.REPORT_BUTTON_ANIME).click()
map(lambda x: self.element_is_clickable(x), self.finds(locators.REPORT_WINDOW_ANIME_BUTTONS_ALL))
#map(lambda x: self.element_is_clickable(x), self.finds(locators.REPORT_WINDOW_ANIME_BUTTONS_ALL))

def not_like_button_click(self):
self.finds(locators.REPORT_WINDOW_ANIME_BUTTONS_ALL)[0].click()
self.go_to_element_center(element=self.find(locators.REPORT_WINDOW_ANIME_BUTTON_DISLIKE))
self.element_is_clickable(locators.REPORT_WINDOW_ANIME_BUTTON_DISLIKE, 20)
self.find(locators.REPORT_WINDOW_ANIME_BUTTON_DISLIKE).click()
self.element_is_visible(locators.REPORT_WINDOW_CONTAINER, 20)

def abuse_button_click(self):
self.finds(locators.REPORT_WINDOW_ANIME_BUTTONS_ALL)[1].click()
self.go_to_element_center(element=self.find(locators.REPORT_WINDOW_ANIME_BUTTON_ABUSE))
self.element_is_clickable(locators.REPORT_WINDOW_ANIME_BUTTON_ABUSE, 20)
self.find(locators.REPORT_WINDOW_ANIME_BUTTON_ABUSE).click()
self.element_is_visible(locators.REPORT_WINDOW_CONTAINER, 20)

def contrafact_button_click(self):
self.finds(locators.REPORT_WINDOW_ANIME_BUTTONS_ALL)[2].click()
self.go_to_element_center(element=self.find(locators.REPORT_WINDOW_ANIME_BUTTON_CONTRAFACT))
self.element_is_clickable(locators.REPORT_WINDOW_ANIME_BUTTON_CONTRAFACT, 20)
self.find(locators.REPORT_WINDOW_ANIME_BUTTON_CONTRAFACT).click()
self.element_is_visible(locators.REPORT_WINDOW_CONTAINER, 20)

def porn_button_click(self):
self.finds(locators.REPORT_WINDOW_ANIME_BUTTONS_ALL)[3].click()
self.go_to_element_center(element=self.find(locators.REPORT_WINDOW_ANIME_BUTTON_PORN))
self.element_is_clickable(locators.REPORT_WINDOW_ANIME_BUTTON_PORN, 20)
self.find(locators.REPORT_WINDOW_ANIME_BUTTON_PORN).click()
self.element_is_visible(locators.REPORT_WINDOW_CONTAINER, 20)

def personal_data_button_click(self):
self.finds(locators.REPORT_WINDOW_ANIME_BUTTONS_ALL)[4].click()
self.go_to_element_center(element=self.find(locators.REPORT_WINDOW_ANIME_BUTTON_PERSONAL_DATA))
self.element_is_clickable(locators.REPORT_WINDOW_ANIME_BUTTON_PERSONAL_DATA, 20)
self.find(locators.REPORT_WINDOW_ANIME_BUTTON_PERSONAL_DATA).click()
self.element_is_visible(locators.REPORT_WINDOW_CONTAINER, 20)

def terror_button_click(self):
self.finds(locators.REPORT_WINDOW_ANIME_BUTTONS_ALL)[5].click()
self.go_to_element_center(element=self.find(locators.REPORT_WINDOW_ANIME_BUTTON_TERROR))
self.element_is_clickable(locators.REPORT_WINDOW_ANIME_BUTTON_TERROR, 20)
self.find(locators.REPORT_WINDOW_ANIME_BUTTON_TERROR).click()
self.element_is_visible(locators.REPORT_WINDOW_CONTAINER, 20)

def spam_data_button_click(self):
self.finds(locators.REPORT_WINDOW_ANIME_BUTTONS_ALL)[6].click()
self.go_to_element_center(element=self.find(locators.REPORT_WINDOW_ANIME_BUTTON_SCAM))
self.element_is_clickable(locators.REPORT_WINDOW_ANIME_BUTTON_SCAM, 20)
self.find(locators.REPORT_WINDOW_ANIME_BUTTON_SCAM).click()
self.element_is_visible(locators.REPORT_WINDOW_CONTAINER, 20)

def copyright_button_click(self):
self.finds(locators.REPORT_WINDOW_ANIME_BUTTONS_ALL)[7].click()
self.go_to_element_center(element=self.find(locators.REPORT_WINDOW_ANIME_BUTTON_COPYRIGHT))
self.element_is_clickable(locators.REPORT_WINDOW_ANIME_BUTTON_COPYRIGHT, 20)
self.find(locators.REPORT_WINDOW_ANIME_BUTTON_COPYRIGHT).click()
self.element_is_visible(locators.REPORT_WINDOW_CONTAINER, 20)

def other_button_click(self):
self.finds(locators.REPORT_WINDOW_ANIME_BUTTONS_ALL)[8].click()
self.go_to_element_center(element=self.find(locators.REPORT_WINDOW_ANIME_BUTTON_OTHER))
self.element_is_clickable(locators.REPORT_WINDOW_ANIME_BUTTON_OTHER, 20)
self.find(locators.REPORT_WINDOW_ANIME_BUTTON_OTHER).click()
self.element_is_visible(locators.REPORT_WINDOW_CONTAINER, 20)

def must_delete_button_click(self):
self.finds(locators.REPORT_WINDOW_ANIME_BUTTONS_ALL)[9].click()
self.go_to_element_center(element=self.find(locators.REPORT_WINDOW_ANIME_BUTTON_DELETE))
self.element_is_clickable(locators.REPORT_WINDOW_ANIME_BUTTON_DELETE, 20)
self.find(locators.REPORT_WINDOW_ANIME_BUTTON_DELETE).click()
self.element_is_visible(locators.REPORT_WINDOW_CONTAINER, 20)

def send_form_report(self):
Expand Down