Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LemonLDAP NG
lemonldap-ng
Commits
5dfb50ce
Commit
5dfb50ce
authored
Jan 03, 2019
by
Christophe Maudoux
🐛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP - Improve e2e tests (#1600)
parent
8c36bab6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
12 deletions
+13
-12
Makefile
Makefile
+3
-2
e2e-tests/portal/00-auth.js
e2e-tests/portal/00-auth.js
+7
-5
e2e-tests/protractor-conf.js
e2e-tests/protractor-conf.js
+3
-5
No files found.
Makefile
View file @
5dfb50ce
...
...
@@ -120,6 +120,7 @@ VHOSTLISTEN="*:$(PORT)"
TESTWEBSERVER
=
apache
TESTWEBSERVERPORT
=
19876
TESTUSESSL
=
0
E2E_TESTS
=
'portal/*.js'
# LDAP backend test
LLNGTESTLDAP_SLAPD_BIN
=
/usr/sbin/slapd
...
...
@@ -548,7 +549,7 @@ launch_protractor:
# Start e2e tests
# NB: you must have protractor installed
(
using npm
install
-g
protractor
)
# and have run update-webdriver at least once and have a node.js > 4.0
@
TESTWEBSERVERPORT
=
$(TESTWEBSERVERPORT)
protractor e2e-tests/protractor-conf.js
@
E2E_TESTS
=
$(E2E_TESTS)
TESTWEBSERVERPORT
=
$(TESTWEBSERVERPORT)
protractor e2e-tests/protractor-conf.js
stop_web_server
:
# Stop web server
...
...
@@ -568,7 +569,7 @@ plackup:
-F
>
e2e-tests/conf/fastcgi.log 2>&1 &
install_test
:
@
TESTWEBSERVERPORT
=
$(PORT)
protractor e2e-tests/protractor-conf.js
@
E2E_TESTS
=
$(E2E_TESTS)
TESTWEBSERVERPORT
=
$(PORT)
protractor e2e-tests/protractor-conf.js
# Install targets
# ---------------
...
...
e2e-tests/portal/00-auth.js
View file @
5dfb50ce
...
...
@@ -33,7 +33,7 @@ describe('00 Lemonldap::NG', function() {
it
(
'
should want to authenticate with history
'
,
function
()
{
expect
(
browser
.
driver
.
findElement
(
by
.
css
(
'
[trspan="back2Portal"]
'
)).
getText
()).
toEqual
(
'
Retourner au portail
'
);
browser
.
driver
.
findElement
(
by
.
css
(
'
[trspan="back2Portal"]
'
)).
click
();
// Failed login attempt
browser
.
driver
.
findElement
(
by
.
xpath
(
"
//input[@name='user']
"
)).
sendKeys
(
'
dwho
'
);
browser
.
driver
.
findElement
(
by
.
xpath
(
"
//input[@name='password']
"
)).
sendKeys
(
'
ohwd
'
);
...
...
@@ -41,7 +41,7 @@ describe('00 Lemonldap::NG', function() {
browser
.
driver
.
findElement
(
by
.
xpath
(
"
//button[@type='submit']
"
)).
click
();
expect
(
browser
.
driver
.
findElement
(
by
.
css
(
'
[trmsg="5"]
'
)).
getText
()).
toEqual
(
'
Mot de passe ou identifiant incorrect
'
);
browser
.
driver
.
findElement
(
by
.
css
(
'
[trspan="goToPortal"]
'
)).
click
();
// Login attempt
browser
.
driver
.
findElement
(
by
.
xpath
(
"
//input[@name='user']
"
)).
sendKeys
(
'
dwho
'
);
browser
.
driver
.
findElement
(
by
.
xpath
(
"
//input[@name='password']
"
)).
sendKeys
(
'
dwho
'
);
...
...
@@ -49,8 +49,10 @@ describe('00 Lemonldap::NG', function() {
browser
.
driver
.
findElement
(
by
.
xpath
(
"
//button[@type='submit']
"
)).
click
();
browser
.
driver
.
findElement
(
by
.
xpath
(
"
//img[@title='de']
"
)).
click
();
expect
(
browser
.
driver
.
findElement
(
by
.
css
(
'
[trspan="info"]
'
)).
getText
()).
toEqual
(
"
Information
"
);
// Two entries
browser
.
driver
.
findElements
(
by
.
xpath
(
'
//table/tbody/tr
'
)).
then
(
function
(
elems
)
{
expect
(
elems
.
length
).
toEqual
(
5
);
expect
(
elems
.
length
).
toEqual
(
2
);
});
// Expect history with one login and one failed login
...
...
@@ -67,11 +69,11 @@ describe('00 Lemonldap::NG', function() {
expect
(
elems
[
4
].
getText
()).
toEqual
(
'
Fehlermeldung
'
);
});
browser
.
driver
.
findElements
(
by
.
xpath
(
'
//table/tbody/tr/td
'
)).
then
(
function
(
elems
)
{
expect
(
elems
.
length
).
toEqual
(
11
);
expect
(
elems
.
length
).
toEqual
(
5
);
expect
(
elems
[
1
].
getText
()).
toEqual
(
'
127.0.0.1
'
);
expect
(
elems
[
3
].
getText
()).
toEqual
(
'
127.0.0.1
'
);
expect
(
elems
[
4
].
getText
()).
toEqual
(
'
Benutzername oder Passwort nicht korrekt
'
);
});
browser
.
sleep
(
5000
);
expect
(
browser
.
driver
.
findElement
(
by
.
css
(
'
[trspan="PE5"]
'
)).
getText
()).
toEqual
(
'
Benutzername oder Passwort nicht korrekt
'
);
expect
(
browser
.
driver
.
findElement
(
by
.
id
(
'
timer
'
)).
getText
()).
toMatch
(
/^Du wirst in
\d{2}
Sekunden umgeleitet$/
);
browser
.
driver
.
findElement
(
by
.
xpath
(
"
//button[@type='reset']
"
)).
click
();
...
...
e2e-tests/protractor-conf.js
View file @
5dfb50ce
exports
.
config
=
{
allScriptsTimeout
:
11000
,
specs
:
[
'
handler/*.js
'
,
'
portal/*.js
'
,
'
manager/*.js
'
],
//specs: ['manager/*.js'],
specs
:
process
.
env
.
E2E_TESTS
,
//specs: ['handler/*.js', 'portal/*.js', 'manager/*.js' ],
//specs: ['manager/00-auth.js', 'manager/01-tree.js'],
capabilities
:
{
capabilities
:
{
'
browserName
'
:
'
chrome
'
},
...
...
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