Update end-to-end tests: use own apache server
This commit is contained in:
parent
8d1f3d2740
commit
c3ad2c39ed
62
Makefile
62
Makefile
|
@ -217,7 +217,24 @@ extra_test: all
|
||||||
# PERL_DL_NONLAZY=1 $(PERL) "-MExtUtils::Command::MM" "-e" "test_harness(0, 'lemonldap-ng-common/blib/lib', 'lemonldap-ng-handler/blib/lib', 'lemonldap-ng-manager/blib/lib', 'lemonldap-ng-portal/blib/lib')" extra-tests/*.t
|
# PERL_DL_NONLAZY=1 $(PERL) "-MExtUtils::Command::MM" "-e" "test_harness(0, 'lemonldap-ng-common/blib/lib', 'lemonldap-ng-handler/blib/lib', 'lemonldap-ng-manager/blib/lib', 'lemonldap-ng-portal/blib/lib')" extra-tests/*.t
|
||||||
|
|
||||||
e2e_test:
|
e2e_test:
|
||||||
protractor e2e-tests/protractor-conf.js
|
@mkdir -p e2e-tests/conf
|
||||||
|
$(MAKE) install_webserver_conf \
|
||||||
|
RCONFDIR=e2e-tests/conf \
|
||||||
|
ERASECONFIG=1 \
|
||||||
|
VHOSTLISTEN='*:19876' \
|
||||||
|
PORTALDIR=`pwd`/lemonldap-ng-portal/example \
|
||||||
|
MANAGERDIR=`pwd`/lemonldap-ng-manager/site \
|
||||||
|
MANAGERPSGIDIR=`pwd`/e2e-tests \
|
||||||
|
DEFDOCDIR=`pwd`/doc \
|
||||||
|
FRDOCDIR=`pwd`/po-doc/fr
|
||||||
|
# Start web server
|
||||||
|
-@[ -e e2e-tests/conf/apache2.pid ] && kill `cat e2e-tests/conf/apache2.pid` && sleep 1
|
||||||
|
@/usr/sbin/apache2 -d `pwd`/e2e-tests -f apache2.conf -k start
|
||||||
|
# Start e2e tests
|
||||||
|
@protractor e2e-tests/protractor-conf.js
|
||||||
|
# Clean
|
||||||
|
@kill `cat e2e-tests/conf/apache2.pid`
|
||||||
|
@rm -rf e2e-tests/conf
|
||||||
|
|
||||||
#
|
#
|
||||||
# INSTALL
|
# INSTALL
|
||||||
|
@ -276,31 +293,13 @@ install_bin: install_conf_dir
|
||||||
#
|
#
|
||||||
# SITE INSTALL
|
# SITE INSTALL
|
||||||
#
|
#
|
||||||
install_site: install_manager_site install_portal_site install_handler_site install_test_site install_examples_site install_doc_site
|
install_site: install_manager_site install_portal_site install_handler_site install_test_site install_examples_site install_doc_site install_webserver_conf
|
||||||
# Site install
|
# Site install
|
||||||
@install -v -d $(RCONFDIR)
|
@install -v -d $(RCONFDIR)
|
||||||
# Check if erase is wanted
|
# Check if erase is wanted
|
||||||
@if [ "$(ERASECONFIG)" -eq "1" ]; then \
|
@if [ "$(ERASECONFIG)" -eq "1" ]; then \
|
||||||
cp -f _example/etc/portal-apache$(APACHEVERSION).conf $(RCONFDIR); \
|
|
||||||
cp -f _example/etc/handler-apache$(APACHEVERSION).conf $(RCONFDIR); \
|
|
||||||
cp -f _example/etc/manager-apache$(APACHEVERSION).conf $(RCONFDIR); \
|
|
||||||
cp -f _example/etc/test-apache$(APACHEVERSION).conf $(RCONFDIR); \
|
|
||||||
cp -f _example/etc/handler-nginx.conf $(RCONFDIR); \
|
|
||||||
cp -f _example/etc/test-nginx.conf $(RCONFDIR); \
|
|
||||||
cp -f _example/etc/nginx-access-control $(RCONFDIR); \
|
|
||||||
cp -f _example/etc/nginx-http-accounting $(RCONFDIR); \
|
|
||||||
cp -f _example/etc/nginx-fcgi-accounting $(RCONFDIR); \
|
|
||||||
cp -f _example/etc/for_etc_hosts $(RCONFDIR); \
|
cp -f _example/etc/for_etc_hosts $(RCONFDIR); \
|
||||||
fi
|
fi
|
||||||
@$(PERL) -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g; \
|
|
||||||
s#__PORTALDIR__#$(PORTALDIR)/#g; \
|
|
||||||
s#__MANAGERDIR__#$(MANAGERDIR)/#g; \
|
|
||||||
s#__MANAGERSTATICDIR__#$(MANAGERSTATICDIR)/#g; \
|
|
||||||
s#__MANAGERPSGIDIR__#$(MANAGERPSGIDIR)/#g; \
|
|
||||||
s#__TESTDIR__#$(TESTDIR)/#g; \
|
|
||||||
s#__VHOSTLISTEN__#$(VHOSTLISTEN)#g; \
|
|
||||||
s#__DEFDOCDIR__#$(DEFDOCDIR)/#g; \
|
|
||||||
s#__FRDOCDIR__#$(FRDOCDIR)/#g;' $(RCONFDIR)/*apache*.conf $(RCONFDIR)/*nginx*.conf
|
|
||||||
@$(PERL) -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $(RCONFDIR)/for_etc_hosts
|
@$(PERL) -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $(RCONFDIR)/for_etc_hosts
|
||||||
# Fix a lost of rights on the main directory
|
# Fix a lost of rights on the main directory
|
||||||
@chmod 755 $(RBINDIR) $(RDOCUMENTROOT) $(REXAMPLESDIR) $(RHANDLERDIR) $(RPORTALSKINSDIR) $(RMANAGERSITEDIR) $(RTOOLSDIR) $(RCONFDIR) $(RDATADIR)
|
@chmod 755 $(RBINDIR) $(RDOCUMENTROOT) $(REXAMPLESDIR) $(RHANDLERDIR) $(RPORTALSKINSDIR) $(RMANAGERSITEDIR) $(RTOOLSDIR) $(RCONFDIR) $(RDATADIR)
|
||||||
|
@ -335,6 +334,29 @@ install_site: install_manager_site install_portal_site install_handler_site inst
|
||||||
fi
|
fi
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
|
install_webserver_conf:
|
||||||
|
@install -m 755 -v -d $(RCONFDIR)
|
||||||
|
@if [ "$(ERASECONFIG)" -eq "1" ]; then \
|
||||||
|
cp -f _example/etc/portal-apache$(APACHEVERSION).conf $(RCONFDIR); \
|
||||||
|
cp -f _example/etc/handler-apache$(APACHEVERSION).conf $(RCONFDIR); \
|
||||||
|
cp -f _example/etc/manager-apache$(APACHEVERSION).conf $(RCONFDIR); \
|
||||||
|
cp -f _example/etc/test-apache$(APACHEVERSION).conf $(RCONFDIR); \
|
||||||
|
cp -f _example/etc/handler-nginx.conf $(RCONFDIR); \
|
||||||
|
cp -f _example/etc/test-nginx.conf $(RCONFDIR); \
|
||||||
|
cp -f _example/etc/nginx-access-control $(RCONFDIR); \
|
||||||
|
cp -f _example/etc/nginx-http-accounting $(RCONFDIR); \
|
||||||
|
cp -f _example/etc/nginx-fcgi-accounting $(RCONFDIR); \
|
||||||
|
fi
|
||||||
|
@$(PERL) -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g; \
|
||||||
|
s#__PORTALDIR__#$(PORTALDIR)/#g; \
|
||||||
|
s#__MANAGERDIR__#$(MANAGERDIR)/#g; \
|
||||||
|
s#__MANAGERSTATICDIR__#$(MANAGERSTATICDIR)/#g; \
|
||||||
|
s#__MANAGERPSGIDIR__#$(MANAGERPSGIDIR)/#g; \
|
||||||
|
s#__TESTDIR__#$(TESTDIR)/#g; \
|
||||||
|
s#__VHOSTLISTEN__#$(VHOSTLISTEN)#g; \
|
||||||
|
s#__DEFDOCDIR__#$(DEFDOCDIR)/#g; \
|
||||||
|
s#__FRDOCDIR__#$(FRDOCDIR)/#g;' $(RCONFDIR)/*apache*.conf $(RCONFDIR)/*nginx*.conf
|
||||||
|
|
||||||
install_manager_site: install_conf_dir
|
install_manager_site: install_conf_dir
|
||||||
# Manager install
|
# Manager install
|
||||||
@install -v -d ${RMANAGERDIR} $(RMANAGERSTATICDIR) $(RMANAGERPSGIDIR) \
|
@install -v -d ${RMANAGERDIR} $(RMANAGERSTATICDIR) $(RMANAGERPSGIDIR) \
|
||||||
|
|
57
e2e-tests/apache2.conf
Normal file
57
e2e-tests/apache2.conf
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
PidFile conf/apache2.pid
|
||||||
|
Timeout 300
|
||||||
|
KeepAlive On
|
||||||
|
MaxKeepAliveRequests 100
|
||||||
|
KeepAliveTimeout 5
|
||||||
|
HostnameLookups Off
|
||||||
|
LogLevel warn
|
||||||
|
Listen 127.0.0.1:19876
|
||||||
|
LoadModule authz_core_module /usr/lib/apache2/modules/mod_authz_core.so
|
||||||
|
LoadModule authz_host_module /usr/lib/apache2/modules/mod_authz_host.so
|
||||||
|
<Directory />
|
||||||
|
Options FollowSymLinks
|
||||||
|
AllowOverride None
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
<Directory /usr/share>
|
||||||
|
AllowOverride None
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
<Directory /var/www/>
|
||||||
|
Options Indexes FollowSymLinks
|
||||||
|
AllowOverride None
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
|
||||||
|
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
||||||
|
ErrorLog conf/apache2.log
|
||||||
|
CustomLog conf/apache2.log vhost_combined
|
||||||
|
|
||||||
|
LoadModule alias_module /usr/lib/apache2/modules/mod_alias.so
|
||||||
|
LoadModule dir_module /usr/lib/apache2/modules/mod_dir.so
|
||||||
|
LoadModule env_module /usr/lib/apache2/modules/mod_env.so
|
||||||
|
LoadModule mime_module /usr/lib/apache2/modules/mod_mime.so
|
||||||
|
LoadModule fcgid_module /usr/lib/apache2/modules/mod_fcgid.so
|
||||||
|
FcgidConnectTimeout 20
|
||||||
|
FcgidProcessTableFile conf/fcgid_shm
|
||||||
|
FcgidIPCDir conf/
|
||||||
|
AddHandler fcgid-script .fcgi
|
||||||
|
LoadModule filter_module /usr/lib/apache2/modules/mod_filter.so
|
||||||
|
TypesConfig /etc/mime.types
|
||||||
|
AddLanguage en .en
|
||||||
|
AddLanguage fr .fr
|
||||||
|
LoadModule mpm_event_module /usr/lib/apache2/modules/mod_mpm_event.so
|
||||||
|
<IfModule mpm_event_module>
|
||||||
|
StartServers 1
|
||||||
|
MinSpareThreads 2
|
||||||
|
MaxSpareThreads 4
|
||||||
|
ThreadLimit 64
|
||||||
|
ThreadsPerChild 4
|
||||||
|
MaxRequestWorkers 12
|
||||||
|
MaxConnectionsPerChild 0
|
||||||
|
</IfModule>
|
||||||
|
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
|
||||||
|
LoadModule setenvif_module /usr/lib/apache2/modules/mod_setenvif.so
|
||||||
|
LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so
|
||||||
|
IncludeOptional conf/manager-apache2.X.conf
|
||||||
|
IncludeOptional conf/portal-apache2.X.conf
|
|
@ -7,10 +7,10 @@ describe('my app', function() {
|
||||||
describe('Auth mechanism', function() {
|
describe('Auth mechanism', function() {
|
||||||
|
|
||||||
it('should want to authenticate', function() {
|
it('should want to authenticate', function() {
|
||||||
browser.driver.get('http://auth.example.com/');
|
browser.driver.get('http://auth.example.com:19876/');
|
||||||
browser.driver.findElement(by.xpath("//input[@name='user']")).sendKeys('dwho');
|
browser.driver.findElement(by.xpath("//input[@name='user']")).sendKeys('dwho');
|
||||||
browser.driver.findElement(by.xpath("//input[@name='password']")).sendKeys('dwho');
|
browser.driver.findElement(by.xpath("//input[@name='password']")).sendKeys('dwho');
|
||||||
browser.driver.findElement(by.xpath("//button[@type='submit']")).click();
|
browser.driver.findElement(by.xpath("//button[@type='submit']")).click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
describe('Auth mechanism', function() {
|
describe('Auth mechanism', function() {
|
||||||
|
|
||||||
it('should allow logout', function() {
|
it('should allow logout', function() {
|
||||||
browser.driver.get('http://auth.example.com/?logout=1');
|
browser.driver.get('http://auth.example.com:19876/?logout=1');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,16 +1,6 @@
|
||||||
#End 2 End Testing (Protractor)
|
#End 2 End Testing (Protractor)
|
||||||
To run the end-2-end tests against the application you use [Protractor](https://github.com/angular/protractor).
|
To run the end-2-end tests against the application you use [Protractor](https://github.com/angular/protractor).
|
||||||
|
|
||||||
## Starting the Web Server
|
|
||||||
In either case you will need the application to be running via the web-server.
|
|
||||||
From the root folder of the repository run:
|
|
||||||
|
|
||||||
```
|
|
||||||
npm start
|
|
||||||
```
|
|
||||||
|
|
||||||
The application should now be available at `http://localhost:8000/`
|
|
||||||
|
|
||||||
## Testing with Protractor
|
## Testing with Protractor
|
||||||
|
|
||||||
As a one-time setup, download webdriver.
|
As a one-time setup, download webdriver.
|
||||||
|
@ -21,7 +11,7 @@ npm run update-webdriver
|
||||||
Start the Protractor test runner using the e2e configuration:
|
Start the Protractor test runner using the e2e configuration:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm run protractor
|
make e2e_test
|
||||||
```
|
```
|
||||||
|
|
||||||
## Devel tips
|
## Devel tips
|
||||||
|
|
21
e2e-tests/manager-server.fcgi
Executable file
21
e2e-tests/manager-server.fcgi
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
$pwd = `pwd`;
|
||||||
|
chomp $pwd;
|
||||||
|
eval qq{
|
||||||
|
use lib "$pwd/lemonldap-ng-common/blib/lib";
|
||||||
|
use lib "$pwd/lemonldap-ng-handler/blib/lib";
|
||||||
|
use lib "$pwd/lemonldap-ng-portal/blib/lib";
|
||||||
|
use lib "$pwd/lemonldap-ng-manager/blib/lib";
|
||||||
|
};
|
||||||
|
die $@ if ($@);
|
||||||
|
}
|
||||||
|
use Plack::Handler::FCGI;
|
||||||
|
use Lemonldap::NG::Manager;
|
||||||
|
|
||||||
|
# Roll your own
|
||||||
|
my $server = Plack::Handler::FCGI->new();
|
||||||
|
$server->run( Lemonldap::NG::Manager->run( {} ) );
|
|
@ -11,7 +11,7 @@ exports.config = {
|
||||||
|
|
||||||
chromeOnly: true,
|
chromeOnly: true,
|
||||||
|
|
||||||
baseUrl: 'http://manager.example.com/',
|
baseUrl: 'http://manager.example.com:19876/',
|
||||||
|
|
||||||
framework: 'jasmine',
|
framework: 'jasmine',
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user