appiumtests: port away from deprecated desired_capabilities

AppiumOptions replaces it
This commit is contained in:
Fushan Wen
2023-10-01 12:08:35 +08:00
committed by Tobias Fella
parent 843deefaf8
commit 541350e678

View File

@@ -4,25 +4,26 @@
# SPDX-FileCopyrightText: 2021-2022 Harald Sitter <sitter@kde.org> # SPDX-FileCopyrightText: 2021-2022 Harald Sitter <sitter@kde.org>
# SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org> # SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
import unittest
from appium import webdriver
from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.support.ui import WebDriverWait
import os import os
import time
import subprocess import subprocess
import sys import sys
import unittest
from appium import webdriver
from appium.options.common.base import AppiumOptions
from appium.webdriver.common.appiumby import AppiumBy
class LoginTest(unittest.TestCase): class LoginTest(unittest.TestCase):
mockServerProcess: subprocess.Popen
@classmethod @classmethod
def setUpClass(self): def setUpClass(cls):
desired_caps = {} options = AppiumOptions()
desired_caps["app"] = "neochat --ignore-ssl-errors" options.set_capability("app", "neochat --ignore-ssl-errors")
desired_caps["timeouts"] = {'implicit': 10000} cls.driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options)
self.driver = webdriver.Remote( cls.mockServerProcess = subprocess.Popen([sys.executable, os.path.join(os.path.dirname(__file__), "login-server.py")])
command_executor='http://127.0.0.1:4723',
desired_capabilities=desired_caps)
self.mockServerProcess = subprocess.Popen([sys.executable, os.path.join(os.path.dirname(__file__), "login-server.py")])
def setUp(self): def setUp(self):
pass pass
@@ -45,5 +46,6 @@ class LoginTest(unittest.TestCase):
self.driver.find_element(by=AppiumBy.NAME, value="Login").click() self.driver.find_element(by=AppiumBy.NAME, value="Login").click()
self.driver.find_element(by=AppiumBy.NAME, value="Join some rooms to get started").click() self.driver.find_element(by=AppiumBy.NAME, value="Join some rooms to get started").click()
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()