forked from bwalkowi/pytest-selenium-multi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_remote.py
38 lines (27 loc) · 1.07 KB
/
test_remote.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from functools import partial
import pytest
pytestmark = pytest.mark.nondestructive
@pytest.fixture
def testfile(testdir):
return testdir.makepyfile("""
import pytest
@pytest.mark.nondestructive
def test_pass(selenium): pass
""")
def failure_with_output(testdir, *args, **kwargs):
reprec = testdir.inline_run(*args, **kwargs)
passed, skipped, failed = reprec.listoutcomes()
assert len(failed) == 1
out = failed[0].longrepr.reprcrash.message
return out
@pytest.fixture
def failure(testdir, testfile, httpserver_base_url):
return partial(failure_with_output, testdir, testfile, httpserver_base_url,
'--driver', 'Remote')
def test_missing_browser_name(failure):
out = failure()
assert ('UsageError: The \'browserName\' capability must be specified '
'when using the remote driver.') in out