forked from openimsdk/test-e2e
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request openimsdk#20 from longyuqing112/delete_friend
delete_friend
- Loading branch information
Showing
5 changed files
with
107 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import time | ||
|
||
from selenium.common import NoSuchElementException | ||
|
||
from base.base_page import BasePage | ||
from config import HOST | ||
from loc import Locators | ||
from utils.read_accounts import read_registered_accounts | ||
|
||
class DeleteFriedn(BasePage): | ||
def __init__(self,driver): | ||
super().__init__(driver) | ||
self.url = HOST | ||
def go_to(self): | ||
self.driver.get(self.url) | ||
|
||
def del_friend(self): | ||
self.wait_masks_invisible() | ||
has_accounts = read_registered_accounts(1) | ||
_, _, friend_nickname = has_accounts | ||
# print('好友:', friend_nickname) | ||
friend_names = self.base_get_text(Locators.session_friendList_loc) | ||
print('name', friend_names) | ||
for friend in friend_names: | ||
# name_elem = friend.find_elements(Locators.Specify_friend_loc) | ||
# if name_elem.text == friend_nickname: | ||
# print('name', name_elem.text) | ||
if friend_nickname in friend: | ||
self.base_click(Locators.session_friendList_loc) | ||
else: | ||
print('no friend', friend_nickname) | ||
self.base_click(Locators.setting_loc) | ||
self.base_find(Locators.del_loc) | ||
self.base_click(Locators.del_loc) | ||
self.base_find(Locators.del_confirm_loc) | ||
self.base_click(Locators.del_confirm_loc) | ||
# self.base_click(Locators.two_avtor_loc) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import time | ||
from unittest import result | ||
|
||
import pytest | ||
from selenium.common import NoSuchElementException, TimeoutException | ||
from selenium.webdriver.support.wait import WebDriverWait | ||
|
||
from loc import Locators | ||
from pages.del_friend import DeleteFriedn | ||
from utils.headless_browser import create_driver | ||
from utils.read_accounts import read_registered_accounts | ||
from utils.token import login | ||
|
||
from selenium.webdriver.support import expected_conditions as EC | ||
@pytest.fixture | ||
def browser_driver(): | ||
driver = create_driver() | ||
time.sleep(3) | ||
yield driver | ||
driver.quit() | ||
|
||
|
||
@pytest.fixture | ||
def driver(browser_driver): | ||
return browser_driver | ||
|
||
@pytest.mark.run(order=8) | ||
def test_del_friend(driver, login): | ||
has_accounts = read_registered_accounts(0) | ||
phone_number, pwd, _ = has_accounts | ||
login(phone_number, pwd) | ||
del_friend_page = DeleteFriedn(driver) | ||
del_friend_page.go_to() | ||
del_friend_page.del_friend() | ||
|
||
try: | ||
WebDriverWait(driver, 10).until( | ||
EC.invisibility_of_element_located(Locators.del_loc) | ||
) | ||
print("Delete button disappeared, friend deletion successful.") | ||
except TimeoutException: | ||
pytest.fail("Friend deletion failed, delete button still visible after timeout.") |