mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Merge pull request #1161 from micahflee/1076_mac_win_tests
Make GUI test suite run in Windows and macOS
This commit is contained in:
commit
74a945620f
30
BUILD.md
30
BUILD.md
@ -115,7 +115,7 @@ Download and install Python 3.7.4 from https://www.python.org/downloads/release/
|
||||
|
||||
You may also need to run the command `/Applications/Python\ 3.7/Install\ Certificates.command` to update Python 3.6's internal certificate store. Otherwise, you may find that fetching the Tor Browser .dmg file fails later due to a certificate validation error.
|
||||
|
||||
Install Qt 5.13.1 for macOS from https://www.qt.io/offline-installers. I downloaded `qt-opensource-mac-x64-5.13.1.dmg`. In the installer, you can skip making an account, and all you need is `Qt` > `Qt 5.13.1` > `macOS`.
|
||||
Install Qt 5.14.0 for macOS from https://www.qt.io/offline-installers. I downloaded `qt-opensource-mac-x64-5.14.0.dmg`. In the installer, you can skip making an account, and all you need is `Qt` > `Qt 5.14.0` > `macOS`.
|
||||
|
||||
If you don't have it already, install poetry (`pip3 install --user poetry`). Then install dependencies:
|
||||
|
||||
@ -150,9 +150,11 @@ Now you should have `dist/OnionShare.pkg`.
|
||||
|
||||
### Setting up your dev environment
|
||||
|
||||
These instructions include adding folders to the path in Windows. To do this, go to Start and type "advanced system settings", and open "View advanced system settings" in the Control Panel. Click Environment Variables. Under "System variables" double-click on Path. From there you can add and remove folders that are available in the PATH.
|
||||
|
||||
Download Python 3.7.4, 32-bit (x86) from https://www.python.org/downloads/release/python-374/. I downloaded `python-3.7.4.exe`. When installing it, make sure to check the "Add Python 3.7 to PATH" checkbox on the first page of the installer.
|
||||
|
||||
Install the Qt 5.13.1 from https://www.qt.io/offline-installers. I downloaded `qt-opensource-windows-x86-5.13.1.exe`. In the installer, you can skip making an account, and all you need `Qt` > `Qt 5.13.1` > `MSVC 2017 32-bit`.
|
||||
Install the Qt 5.14.0 from https://www.qt.io/offline-installers. I downloaded `qt-opensource-windows-x86-5.14.0.exe`. In the installer, you can skip making an account, and all you need `Qt` > `Qt 5.14.0` > `MSVC 2017 32-bit`.
|
||||
|
||||
Install [poetry](https://python-poetry.org/). Open PowerShell, and run:
|
||||
|
||||
@ -160,7 +162,7 @@ Install [poetry](https://python-poetry.org/). Open PowerShell, and run:
|
||||
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python
|
||||
```
|
||||
|
||||
And add `%USERPROFILE%\.poetry\bin` to your path. Then open a command prompt and cd to the `dangerzone` folder, and install the poetry dependencies:
|
||||
Then open a Command Prompt and cd to the `onionshare` folder, and install the poetry dependencies:
|
||||
|
||||
```
|
||||
poetry install
|
||||
@ -175,8 +177,6 @@ poetry run python dev_scripts\onionshare-gui
|
||||
|
||||
#### If you want to build a .exe
|
||||
|
||||
These instructions include adding folders to the path in Windows. To do this, go to Start and type "advanced system settings", and open "View advanced system settings" in the Control Panel. Click Environment Variables. Under "System variables" double-click on Path. From there you can add and remove folders that are available in the PATH.
|
||||
|
||||
Download and install 7-Zip from http://www.7-zip.org/download.html. I downloaded `7z1900.exe`.
|
||||
|
||||
Download and install the standalone [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk). Note that you may not need this if you already have Visual Studio.
|
||||
@ -264,6 +264,8 @@ This will prompt you to codesign three binaries and execute one unsigned binary.
|
||||
|
||||
# Running tests
|
||||
|
||||
## Tests in macOS and Linux
|
||||
|
||||
OnionShare includes PyTest unit tests. To run tests, you can run `pytest` against the `tests/` directory.
|
||||
|
||||
```sh
|
||||
@ -276,20 +278,20 @@ You can run GUI tests like this:
|
||||
poetry run ./tests/run.sh --rungui
|
||||
```
|
||||
|
||||
If you would like to also run the GUI unit tests in 'tor' mode, start Tor Browser in the background, then run:
|
||||
|
||||
```sh
|
||||
poetry run ./tests/run.sh --rungui --runtor
|
||||
```
|
||||
|
||||
Keep in mind that the Tor tests take a lot longer to run than local mode, but they are also more comprehensive.
|
||||
|
||||
You can also choose to wrap the tests in `xvfb-run` so that a ton of OnionShare windows don't pop up on your desktop (you may need to install the `xorg-x11-server-Xvfb` package), like this:
|
||||
If you're using Linux, you can also choose to wrap the tests in `xvfb-run` so that a ton of OnionShare windows don't pop up on your desktop (you may need to install the `xorg-x11-server-Xvfb` package), like this:
|
||||
|
||||
```sh
|
||||
xvfb-run poetry run ./tests/run.sh --rungui
|
||||
```
|
||||
|
||||
## Tests in Windows
|
||||
|
||||
You can run this Windows batch script to run all of the CLI and GUI tests.
|
||||
|
||||
```
|
||||
poetry run tests\run.bat
|
||||
```
|
||||
|
||||
# Making releases
|
||||
|
||||
This section documents the release process. Unless you're a core OnionShare developer making a release, you'll probably never need to follow it.
|
||||
|
@ -18,8 +18,11 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
import os
|
||||
import pwd
|
||||
import json
|
||||
import platform
|
||||
|
||||
if platform.system() == "Darwin":
|
||||
import pwd
|
||||
|
||||
|
||||
class ModeSettings:
|
||||
|
@ -669,15 +669,16 @@ class Onion(object):
|
||||
Stop a specific onion service
|
||||
"""
|
||||
onion_host = mode_settings.get("general", "service_id")
|
||||
self.common.log("Onion", "stop_onion_service", f"onion host: {onion_host}")
|
||||
try:
|
||||
self.c.remove_ephemeral_hidden_service(
|
||||
mode_settings.get("general", "service_id")
|
||||
)
|
||||
except:
|
||||
self.common.log(
|
||||
"Onion", "stop_onion_service", f"failed to remove {onion_host}"
|
||||
)
|
||||
if onion_host:
|
||||
self.common.log("Onion", "stop_onion_service", f"onion host: {onion_host}")
|
||||
try:
|
||||
self.c.remove_ephemeral_hidden_service(
|
||||
mode_settings.get("general", "service_id")
|
||||
)
|
||||
except:
|
||||
self.common.log(
|
||||
"Onion", "stop_onion_service", f"failed to remove {onion_host}"
|
||||
)
|
||||
|
||||
def cleanup(self, stop_tor=True):
|
||||
"""
|
||||
|
@ -98,9 +98,10 @@ def temp_file_1024_delete(temp_dir):
|
||||
The temporary file will be deleted after fixture usage.
|
||||
"""
|
||||
|
||||
with tempfile.NamedTemporaryFile(dir=temp_dir) as tmp_file:
|
||||
with tempfile.NamedTemporaryFile(dir=temp_dir, delete=False) as tmp_file:
|
||||
tmp_file.write(b"*" * 1024)
|
||||
tmp_file.flush()
|
||||
tmp_file.close()
|
||||
yield tmp_file.name
|
||||
|
||||
|
||||
|
@ -8,6 +8,7 @@ import shutil
|
||||
import base64
|
||||
import tempfile
|
||||
import secrets
|
||||
import platform
|
||||
|
||||
from PyQt5 import QtCore, QtTest, QtWidgets
|
||||
|
||||
@ -86,6 +87,7 @@ class GuiBaseTest(unittest.TestCase):
|
||||
self.assertFalse(hasattr(tab, "share_mode"))
|
||||
self.assertFalse(hasattr(tab, "receive_mode"))
|
||||
self.assertFalse(hasattr(tab, "website_mode"))
|
||||
self.assertFalse(hasattr(tab, "chat_mode"))
|
||||
|
||||
def new_share_tab(self):
|
||||
tab = self.gui.tabs.widget(0)
|
||||
@ -275,9 +277,17 @@ class GuiBaseTest(unittest.TestCase):
|
||||
|
||||
def add_button_visible(self, tab):
|
||||
"""Test that the add button should be visible"""
|
||||
self.assertTrue(
|
||||
tab.get_mode().server_status.file_selection.add_button.isVisible()
|
||||
)
|
||||
if platform.system() == "Darwin":
|
||||
self.assertTrue(
|
||||
tab.get_mode().server_status.file_selection.add_files_button.isVisible()
|
||||
)
|
||||
self.assertTrue(
|
||||
tab.get_mode().server_status.file_selection.add_folder_button.isVisible()
|
||||
)
|
||||
else:
|
||||
self.assertTrue(
|
||||
tab.get_mode().server_status.file_selection.add_button.isVisible()
|
||||
)
|
||||
|
||||
def url_description_shown(self, tab):
|
||||
"""Test that the URL label is showing"""
|
||||
@ -299,7 +309,10 @@ class GuiBaseTest(unittest.TestCase):
|
||||
|
||||
def have_show_qr_code_button(self, tab):
|
||||
"""Test that the Show QR Code URL button is shown and that it loads a QR Code Dialog"""
|
||||
self.assertTrue(tab.get_mode().server_status.show_url_qr_code_button.isVisible())
|
||||
self.assertTrue(
|
||||
tab.get_mode().server_status.show_url_qr_code_button.isVisible()
|
||||
)
|
||||
|
||||
def accept_dialog():
|
||||
window = tab.common.gui.qtapp.activeWindow()
|
||||
if window:
|
||||
@ -358,11 +371,15 @@ class GuiBaseTest(unittest.TestCase):
|
||||
):
|
||||
tab.get_mode().server_status.server_button.click()
|
||||
self.assertEqual(tab.get_mode().server_status.status, 0)
|
||||
self.assertFalse(tab.get_mode().server_status.show_url_qr_code_button.isVisible())
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.show_url_qr_code_button.isVisible()
|
||||
)
|
||||
self.assertFalse(tab.get_mode().server_status.copy_url_button.isVisible())
|
||||
self.assertFalse(tab.get_mode().server_status.url.isVisible())
|
||||
self.assertFalse(tab.get_mode().server_status.url_description.isVisible())
|
||||
self.assertFalse(tab.get_mode().server_status.copy_hidservauth_button.isVisible())
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.copy_hidservauth_button.isVisible()
|
||||
)
|
||||
|
||||
def web_server_is_stopped(self, tab):
|
||||
"""Test that the web server also stopped"""
|
||||
@ -406,9 +423,17 @@ class GuiBaseTest(unittest.TestCase):
|
||||
|
||||
def add_remove_buttons_hidden(self, tab):
|
||||
"""Test that the add and remove buttons are hidden when the server starts"""
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.file_selection.add_button.isVisible()
|
||||
)
|
||||
if platform.system() == "Darwin":
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.file_selection.add_files_button.isVisible()
|
||||
)
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.file_selection.add_folder_button.isVisible()
|
||||
)
|
||||
else:
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.file_selection.add_button.isVisible()
|
||||
)
|
||||
self.assertFalse(
|
||||
tab.get_mode().server_status.file_selection.remove_button.isVisible()
|
||||
)
|
||||
|
9
tests/run.bat
Normal file
9
tests/run.bat
Normal file
@ -0,0 +1,9 @@
|
||||
pytest -vvv tests\test_cli.py
|
||||
pytest -vvv tests\test_cli_common.py
|
||||
pytest -vvv tests\test_cli_settings.py
|
||||
pytest -vvv tests\test_cli_strings.py
|
||||
pytest -vvv tests\test_cli_web.py
|
||||
pytest -vvv --rungui tests\test_gui_tabs.py
|
||||
pytest -vvv --rungui tests\test_gui_share.py
|
||||
pytest -vvv --rungui tests\test_gui_receive.py
|
||||
pytest -vvv --rungui tests\test_gui_website.py
|
@ -29,13 +29,6 @@ import zipfile
|
||||
|
||||
import pytest
|
||||
|
||||
LOG_MSG_REGEX = re.compile(
|
||||
r"""
|
||||
^\[Jun\ 06\ 2013\ 11:05:00\]
|
||||
\ TestModule\.<function\ TestLog\.test_output\.<locals>\.dummy_func
|
||||
\ at\ 0x[a-f0-9]+>(:\ TEST_MSG)?$""",
|
||||
re.VERBOSE,
|
||||
)
|
||||
PASSWORD_REGEX = re.compile(r"^([a-z]+)(-[a-z]+)?-([a-z]+)(-[a-z]+)?$")
|
||||
|
||||
|
||||
@ -194,7 +187,7 @@ class TestGetResourcePath:
|
||||
) == os.path.join(prefix, "test_filename")
|
||||
|
||||
def test_linux(self, common_obj, platform_linux, sys_argv_sys_prefix):
|
||||
prefix = os.path.join(sys.prefix, "share/onionshare")
|
||||
prefix = os.path.join(sys.prefix, "share", "onionshare")
|
||||
assert common_obj.get_resource_path(
|
||||
os.path.join(prefix, "test_filename")
|
||||
) == os.path.join(prefix, "test_filename")
|
||||
@ -207,7 +200,7 @@ class TestGetResourcePath:
|
||||
|
||||
|
||||
class TestGetTorPaths:
|
||||
# @pytest.mark.skipif(sys.platform != 'Darwin', reason='requires MacOS') ?
|
||||
@pytest.mark.skipif(sys.platform != "Darwin", reason="requires MacOS")
|
||||
def test_get_tor_paths_darwin(
|
||||
self, platform_darwin, common_obj, sys_frozen, sys_meipass
|
||||
):
|
||||
@ -225,7 +218,7 @@ class TestGetTorPaths:
|
||||
obfs4proxy_file_path,
|
||||
)
|
||||
|
||||
# @pytest.mark.skipif(sys.platform != 'Linux', reason='requires Linux') ?
|
||||
@pytest.mark.skipif(sys.platform != "Linux", reason="requires Linux")
|
||||
def test_get_tor_paths_linux(self, platform_linux, common_obj):
|
||||
(
|
||||
tor_path,
|
||||
@ -235,10 +228,16 @@ class TestGetTorPaths:
|
||||
) = common_obj.get_tor_paths()
|
||||
|
||||
assert os.path.basename(tor_path) == "tor"
|
||||
assert tor_geo_ip_file_path == "/usr/share/tor/geoip"
|
||||
assert tor_geo_ipv6_file_path == "/usr/share/tor/geoip6"
|
||||
assert (
|
||||
tor_geo_ip_file_path == "/usr/share/tor/geoip"
|
||||
or tor_geo_ip_file_path == "/usr/local/share/tor/geoip"
|
||||
)
|
||||
assert (
|
||||
tor_geo_ipv6_file_path == "/usr/share/tor/geoip6"
|
||||
or tor_geo_ipv6_file_path == "/usr/local/share/tor/geoip6"
|
||||
)
|
||||
|
||||
# @pytest.mark.skipif(sys.platform != 'Windows', reason='requires Windows') ?
|
||||
@pytest.mark.skipif(sys.platform != "win32", reason="requires Windows")
|
||||
def test_get_tor_paths_windows(self, platform_windows, common_obj, sys_frozen):
|
||||
base_path = os.path.join(
|
||||
os.path.dirname(os.path.dirname(common_obj.get_resource_path(""))), "tor"
|
||||
@ -281,36 +280,15 @@ class TestHumanReadableFilesize:
|
||||
|
||||
|
||||
class TestLog:
|
||||
@pytest.mark.parametrize(
|
||||
"test_input",
|
||||
(
|
||||
(
|
||||
"[Jun 06 2013 11:05:00]"
|
||||
" TestModule.<function TestLog.test_output.<locals>.dummy_func"
|
||||
" at 0xdeadbeef>"
|
||||
),
|
||||
(
|
||||
"[Jun 06 2013 11:05:00]"
|
||||
" TestModule.<function TestLog.test_output.<locals>.dummy_func"
|
||||
" at 0xdeadbeef>: TEST_MSG"
|
||||
),
|
||||
),
|
||||
)
|
||||
def test_log_msg_regex(self, test_input):
|
||||
assert bool(LOG_MSG_REGEX.match(test_input))
|
||||
|
||||
def test_output(self, common_obj, time_strftime):
|
||||
def dummy_func():
|
||||
pass
|
||||
|
||||
common_obj.verbose = True
|
||||
|
||||
# From: https://stackoverflow.com/questions/1218933
|
||||
with io.StringIO() as buf, contextlib.redirect_stdout(buf):
|
||||
common_obj.log("TestModule", dummy_func)
|
||||
common_obj.log("TestModule", dummy_func, "TEST_MSG")
|
||||
common_obj.log("TestModule", "dummy_func")
|
||||
common_obj.log("TestModule", "dummy_func", "TEST_MSG")
|
||||
output = buf.getvalue()
|
||||
|
||||
line_one, line_two, _ = output.split("\n")
|
||||
assert LOG_MSG_REGEX.match(line_one)
|
||||
assert LOG_MSG_REGEX.match(line_two)
|
||||
assert line_one == "[Jun 06 2013 11:05:00] TestModule.dummy_func"
|
||||
assert line_two == "[Jun 06 2013 11:05:00] TestModule.dummy_func: TEST_MSG"
|
||||
|
@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import json
|
||||
import os
|
||||
import tempfile
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
@ -135,18 +136,27 @@ class TestSettings:
|
||||
settings_obj.set("socks_port", "NON_INTEGER")
|
||||
assert settings_obj._settings["socks_port"] == 9050
|
||||
|
||||
@pytest.mark.skipif(sys.platform != "Darwin", reason="requires Darwin")
|
||||
def test_filename_darwin(self, monkeypatch, platform_darwin):
|
||||
obj = settings.Settings(common.Common())
|
||||
assert obj.filename == os.path.expanduser(
|
||||
"~/Library/Application Support/OnionShare-testdata/onionshare.json"
|
||||
)
|
||||
|
||||
@pytest.mark.skipif(sys.platform != "Linux", reason="requires Linux")
|
||||
def test_filename_linux(self, monkeypatch, platform_linux):
|
||||
obj = settings.Settings(common.Common())
|
||||
assert obj.filename == os.path.expanduser(
|
||||
"~/.config/onionshare-testdata/onionshare.json"
|
||||
)
|
||||
|
||||
@pytest.mark.skipif(sys.platform != "win32", reason="requires Windows")
|
||||
def test_filename_windows(self, monkeypatch, platform_windows):
|
||||
obj = settings.Settings(common.Common())
|
||||
assert obj.filename == os.path.expanduser(
|
||||
"~\\AppData\\Roaming\\OnionShare-testdata\\onionshare.json"
|
||||
)
|
||||
|
||||
def test_set_custom_bridge(self, settings_obj):
|
||||
settings_obj.set(
|
||||
"tor_bridges_use_custom_bridges",
|
||||
|
@ -93,7 +93,10 @@ class TestWeb:
|
||||
res = c.get("/download", headers=self._make_auth_headers(web.password))
|
||||
res.get_data()
|
||||
assert res.status_code == 200
|
||||
assert res.mimetype == "application/zip"
|
||||
assert (
|
||||
res.mimetype == "application/zip"
|
||||
or res.mimetype == "application/x-zip-compressed"
|
||||
)
|
||||
|
||||
def test_share_mode_autostop_sharing_on(self, temp_dir, common_obj, temp_file_1024):
|
||||
web = web_obj(temp_dir, common_obj, "share", 3)
|
||||
@ -106,11 +109,16 @@ class TestWeb:
|
||||
res = c.get("/download", headers=self._make_auth_headers(web.password))
|
||||
res.get_data()
|
||||
assert res.status_code == 200
|
||||
assert res.mimetype == "application/zip"
|
||||
assert (
|
||||
res.mimetype == "application/zip"
|
||||
or res.mimetype == "application/x-zip-compressed"
|
||||
)
|
||||
|
||||
assert web.running == False
|
||||
|
||||
def test_share_mode_autostop_sharing_off(self, temp_dir, common_obj, temp_file_1024):
|
||||
def test_share_mode_autostop_sharing_off(
|
||||
self, temp_dir, common_obj, temp_file_1024
|
||||
):
|
||||
web = web_obj(temp_dir, common_obj, "share", 3)
|
||||
web.settings.set("share", "autostop_sharing", False)
|
||||
|
||||
@ -121,7 +129,10 @@ class TestWeb:
|
||||
res = c.get("/download", headers=self._make_auth_headers(web.password))
|
||||
res.get_data()
|
||||
assert res.status_code == 200
|
||||
assert res.mimetype == "application/zip"
|
||||
assert (
|
||||
res.mimetype == "application/zip"
|
||||
or res.mimetype == "application/x-zip-compressed"
|
||||
)
|
||||
assert web.running == True
|
||||
|
||||
def test_receive_mode(self, temp_dir, common_obj):
|
||||
|
@ -2,6 +2,7 @@ import pytest
|
||||
import os
|
||||
import requests
|
||||
import shutil
|
||||
import sys
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from PyQt5 import QtCore, QtTest
|
||||
@ -213,6 +214,7 @@ class TestReceive(GuiBaseTest):
|
||||
self.close_all_tabs()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="Windows doesn't have chmod")
|
||||
def test_upload_non_writable_dir(self):
|
||||
"""
|
||||
Test uploading files to a non-writable directory
|
||||
@ -237,6 +239,7 @@ class TestReceive(GuiBaseTest):
|
||||
self.close_all_tabs()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="Windows doesn't have chmod")
|
||||
def test_public_upload_non_writable_dir(self):
|
||||
"""
|
||||
Test uploading files to a non-writable directory in public mode
|
||||
|
@ -83,13 +83,13 @@ class TestShare(GuiBaseTest):
|
||||
),
|
||||
)
|
||||
|
||||
tmp_file = tempfile.NamedTemporaryFile()
|
||||
with open(tmp_file.name, "wb") as f:
|
||||
f.write(r.content)
|
||||
tmp_file = tempfile.NamedTemporaryFile("wb", delete=False)
|
||||
tmp_file.write(r.content)
|
||||
tmp_file.close()
|
||||
|
||||
zip = zipfile.ZipFile(tmp_file.name)
|
||||
z = zipfile.ZipFile(tmp_file.name)
|
||||
QtTest.QTest.qWait(50)
|
||||
self.assertEqual("onionshare", zip.read("test.txt").decode("utf-8"))
|
||||
self.assertEqual("onionshare", z.read("test.txt").decode("utf-8"))
|
||||
|
||||
QtTest.QTest.qWait(500)
|
||||
|
||||
@ -135,12 +135,13 @@ class TestShare(GuiBaseTest):
|
||||
),
|
||||
)
|
||||
|
||||
tmp_file = tempfile.NamedTemporaryFile()
|
||||
with open(tmp_file.name, "wb") as f:
|
||||
f.write(r.content)
|
||||
tmp_file = tempfile.NamedTemporaryFile("wb", delete=False)
|
||||
tmp_file.write(r.content)
|
||||
tmp_file.close()
|
||||
|
||||
with open(tmp_file.name, "r") as f:
|
||||
self.assertEqual("onionshare", f.read())
|
||||
os.remove(tmp_file.name)
|
||||
|
||||
QtTest.QTest.qWait(500)
|
||||
|
||||
@ -200,6 +201,7 @@ class TestShare(GuiBaseTest):
|
||||
self.add_remove_buttons_hidden(tab)
|
||||
self.mode_settings_widget_is_hidden(tab)
|
||||
self.set_autostart_timer(tab, 10)
|
||||
QtTest.QTest.qWait(500)
|
||||
QtTest.QTest.mousePress(
|
||||
tab.get_mode().server_status.server_button, QtCore.Qt.LeftButton
|
||||
)
|
||||
@ -207,7 +209,11 @@ class TestShare(GuiBaseTest):
|
||||
QtTest.QTest.mouseRelease(
|
||||
tab.get_mode().server_status.server_button, QtCore.Qt.LeftButton
|
||||
)
|
||||
self.assertEqual(tab.get_mode().server_status.status, 0)
|
||||
QtTest.QTest.qWait(500)
|
||||
self.assertEqual(
|
||||
tab.get_mode().server_status.status,
|
||||
tab.get_mode().server_status.STATUS_STOPPED,
|
||||
)
|
||||
self.server_is_stopped(tab)
|
||||
self.web_server_is_stopped(tab)
|
||||
|
||||
|
@ -20,7 +20,7 @@ class TestTabs(GuiBaseTest):
|
||||
tab.get_mode().server_status.status,
|
||||
tab.get_mode().server_status.STATUS_WORKING,
|
||||
)
|
||||
QtTest.QTest.qWait(500)
|
||||
QtTest.QTest.qWait(1000)
|
||||
self.assertEqual(
|
||||
tab.get_mode().server_status.status,
|
||||
tab.get_mode().server_status.STATUS_STARTED,
|
||||
@ -138,21 +138,27 @@ class TestTabs(GuiBaseTest):
|
||||
self.gui.tabs.widget(1).share_button.click()
|
||||
self.assertFalse(self.gui.tabs.widget(1).new_tab.isVisible())
|
||||
self.assertTrue(self.gui.tabs.widget(1).share_mode.isVisible())
|
||||
self.assertEqual(self.gui.status_bar.server_status_label.text(), 'Ready to share')
|
||||
self.assertEqual(
|
||||
self.gui.status_bar.server_status_label.text(), "Ready to share"
|
||||
)
|
||||
|
||||
# New tab, receive files
|
||||
self.gui.tabs.new_tab_button.click()
|
||||
self.gui.tabs.widget(2).receive_button.click()
|
||||
self.assertFalse(self.gui.tabs.widget(2).new_tab.isVisible())
|
||||
self.assertTrue(self.gui.tabs.widget(2).receive_mode.isVisible())
|
||||
self.assertEqual(self.gui.status_bar.server_status_label.text(), 'Ready to receive')
|
||||
self.assertEqual(
|
||||
self.gui.status_bar.server_status_label.text(), "Ready to receive"
|
||||
)
|
||||
|
||||
# New tab, publish website
|
||||
self.gui.tabs.new_tab_button.click()
|
||||
self.gui.tabs.widget(3).website_button.click()
|
||||
self.assertFalse(self.gui.tabs.widget(3).new_tab.isVisible())
|
||||
self.assertTrue(self.gui.tabs.widget(3).website_mode.isVisible())
|
||||
self.assertEqual(self.gui.status_bar.server_status_label.text(), 'Ready to share')
|
||||
self.assertEqual(
|
||||
self.gui.status_bar.server_status_label.text(), "Ready to share"
|
||||
)
|
||||
|
||||
# Close tabs
|
||||
self.gui.tabs.tabBar().tabButton(0, QtWidgets.QTabBar.RightSide).click()
|
||||
|
Loading…
Reference in New Issue
Block a user