Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos
Commits
ba527b82
Commit
ba527b82
authored
Apr 17, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/seleniumserver: check screenshots to make sure fonts are OK
parent
cc056efe
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
7 deletions
+35
-7
software/seleniumserver/test/data/test.TestChrome69.test_screenshot.png
...iumserver/test/data/test.TestChrome69.test_screenshot.png
+0
-0
software/seleniumserver/test/data/test.TestFirefox52.test_screenshot.png
...umserver/test/data/test.TestFirefox52.test_screenshot.png
+0
-0
software/seleniumserver/test/data/test.TestFirefox60.test_screenshot.png
...umserver/test/data/test.TestFirefox60.test_screenshot.png
+0
-0
software/seleniumserver/test/data/test.TestFirefox68.test_screenshot.png
...umserver/test/data/test.TestFirefox68.test_screenshot.png
+0
-0
software/seleniumserver/test/test.py
software/seleniumserver/test/test.py
+35
-7
No files found.
software/seleniumserver/test/data/test.TestChrome69.test_screenshot.png
0 → 100644
View file @
ba527b82
11.2 KB
software/seleniumserver/test/data/test.TestFirefox52.test_screenshot.png
0 → 100644
View file @
ba527b82
7.77 KB
software/seleniumserver/test/data/test.TestFirefox60.test_screenshot.png
0 → 100644
View file @
ba527b82
3.18 KB
software/seleniumserver/test/data/test.TestFirefox68.test_screenshot.png
0 → 100644
View file @
ba527b82
6.32 KB
software/seleniumserver/test/test.py
View file @
ba527b82
...
@@ -48,7 +48,7 @@ from selenium.webdriver.support import expected_conditions as EC
...
@@ -48,7 +48,7 @@ from selenium.webdriver.support import expected_conditions as EC
from
selenium.webdriver.support.ui
import
WebDriverWait
from
selenium.webdriver.support.ui
import
WebDriverWait
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
from
slapos.testing.utils
import
findFreeTCPPort
from
slapos.testing.utils
import
findFreeTCPPort
,
ImageComparisonTestCase
setUpModule
,
SeleniumServerTestCase
=
makeModuleSetUpAndTestCaseClass
(
setUpModule
,
SeleniumServerTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
os
.
path
.
abspath
(
...
@@ -80,11 +80,13 @@ class WebServerMixin(object):
...
@@ -80,11 +80,13 @@ class WebServerMixin(object):
<html>
<html>
<title>Test page</title>
<title>Test page</title>
<body>
<body>
<style> p { font-family: Arial; } </style>
<form action="/" method="POST" enctype="multipart/form-data">
<form action="/" method="POST" enctype="multipart/form-data">
<input name="q" type="text"></input>
<input name="q" type="text"></input>
<input name="f" type="file" ></input>
<input name="f" type="file" ></input>
<input type="submit" value="I'm feeling lucky"></input>
<input type="submit" value="I'm feeling lucky"></input>
</form>
</form>
<p>the quick brown fox jumps over the lazy dog</p>
</body>
</body>
</html>'''
)
</html>'''
)
...
@@ -168,8 +170,18 @@ class BrowserCompatibilityMixin(WebServerMixin):
...
@@ -168,8 +170,18 @@ class BrowserCompatibilityMixin(WebServerMixin):
def
test_screenshot
(
self
):
def
test_screenshot
(
self
):
self
.
driver
.
get
(
self
.
server_url
)
self
.
driver
.
get
(
self
.
server_url
)
screenshot
=
Image
.
open
(
BytesIO
(
self
.
driver
.
get_screenshot_as_png
()))
screenshot
=
Image
.
open
(
BytesIO
(
self
.
driver
.
get_screenshot_as_png
()))
# just check it's not a white screen
reference_filename
=
os
.
path
.
join
(
self
.
assertGreater
(
len
(
screenshot
.
getcolors
(
maxcolors
=
512
)),
2
)
os
.
path
.
dirname
(
__file__
),
"data"
,
self
.
id
()
+
".png"
)
# save the screenshot somewhere in a path that will be in snapshot folder.
# XXX we could use a better folder name ...
screenshot
.
save
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'etc'
,
self
.
id
()
+
".png"
))
reference
=
Image
.
open
(
reference_filename
)
self
.
assertImagesSame
(
screenshot
,
reference
)
def
test_window_and_screen_size
(
self
):
def
test_window_and_screen_size
(
self
):
size
=
json
.
loads
(
size
=
json
.
loads
(
...
@@ -388,7 +400,11 @@ class TestSSHServer(SeleniumServerTestCase):
...
@@ -388,7 +400,11 @@ class TestSSHServer(SeleniumServerTestCase):
self
.
assertIn
(
"Welcome to SlapOS Selenium Server."
,
received
)
self
.
assertIn
(
"Welcome to SlapOS Selenium Server."
,
received
)
class
TestFirefox52
(
BrowserCompatibilityMixin
,
SeleniumServerTestCase
):
class
TestFirefox52
(
BrowserCompatibilityMixin
,
SeleniumServerTestCase
,
ImageComparisonTestCase
,
):
desired_capabilities
=
dict
(
DesiredCapabilities
.
FIREFOX
,
version
=
'52.9.0esr'
)
desired_capabilities
=
dict
(
DesiredCapabilities
.
FIREFOX
,
version
=
'52.9.0esr'
)
user_agent
=
'Gecko/20100101 Firefox/52.0'
user_agent
=
'Gecko/20100101 Firefox/52.0'
# resizing window is not supported on firefox 52 geckodriver
# resizing window is not supported on firefox 52 geckodriver
...
@@ -396,16 +412,28 @@ class TestFirefox52(BrowserCompatibilityMixin, SeleniumServerTestCase):
...
@@ -396,16 +412,28 @@ class TestFirefox52(BrowserCompatibilityMixin, SeleniumServerTestCase):
BrowserCompatibilityMixin
.
test_resize_window
)
BrowserCompatibilityMixin
.
test_resize_window
)
class
TestFirefox60
(
BrowserCompatibilityMixin
,
SeleniumServerTestCase
):
class
TestFirefox60
(
BrowserCompatibilityMixin
,
SeleniumServerTestCase
,
ImageComparisonTestCase
,
):
desired_capabilities
=
dict
(
DesiredCapabilities
.
FIREFOX
,
version
=
'60.0.2esr'
)
desired_capabilities
=
dict
(
DesiredCapabilities
.
FIREFOX
,
version
=
'60.0.2esr'
)
user_agent
=
'Gecko/20100101 Firefox/60.0'
user_agent
=
'Gecko/20100101 Firefox/60.0'
class
TestFirefox68
(
BrowserCompatibilityMixin
,
SeleniumServerTestCase
):
class
TestFirefox68
(
BrowserCompatibilityMixin
,
SeleniumServerTestCase
,
ImageComparisonTestCase
,
):
desired_capabilities
=
dict
(
DesiredCapabilities
.
FIREFOX
,
version
=
'68.0.2esr'
)
desired_capabilities
=
dict
(
DesiredCapabilities
.
FIREFOX
,
version
=
'68.0.2esr'
)
user_agent
=
'Gecko/20100101 Firefox/68.0'
user_agent
=
'Gecko/20100101 Firefox/68.0'
class
TestChrome69
(
BrowserCompatibilityMixin
,
SeleniumServerTestCase
):
class
TestChrome69
(
BrowserCompatibilityMixin
,
SeleniumServerTestCase
,
ImageComparisonTestCase
,
):
desired_capabilities
=
dict
(
DesiredCapabilities
.
CHROME
,
version
=
'69.0.3497.0'
)
desired_capabilities
=
dict
(
DesiredCapabilities
.
CHROME
,
version
=
'69.0.3497.0'
)
user_agent
=
'Chrome/69.0.3497.0'
user_agent
=
'Chrome/69.0.3497.0'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment