READ ME added

Co-authored-by: Yamuna Adhikari <adhikariamuna4444@gmail.com>
This commit is contained in:
SwikritiT 2020-10-08 12:50:22 +05:45
parent 7b4123cb78
commit 475893f4de
2 changed files with 328 additions and 287 deletions

View File

@ -8,36 +8,13 @@ dist: xenial
#dist: bionic #dist: bionic
sudo: required sudo: required
matrix: language: php
include:
- language: php
php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- nightly
- language: node_js
node_js:
- '12.14.0'
before_install:
- docker run -d -p 4444:4444 -p 5900:5900 -v /dev/shm:/dev/shm --name selenium selenium/standalone-chrome-debug
install:
- npm install
script: yarn test:e2e test/acceptance/features
env:
global:
- LAUNCH_URL=http://127.0.0.1/$TRAVIS_BUILD_DIR/htdocs
# Start on every boot # Start on every boot
services: services:
- memcached - memcached
- mysql - mysql
- postgresql - postgresql
- docker
addons: addons:
# Force postgresql to 9.4 (the oldest availablable on xenial) # Force postgresql to 9.4 (the oldest availablable on xenial)
@ -55,6 +32,14 @@ addons:
# We need pgloader for import mysql database into pgsql # We need pgloader for import mysql database into pgsql
- pgloader - pgloader
php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- nightly
env: env:
global: global:
@ -107,14 +92,14 @@ notifications:
use_notice: true use_notice: true
before_install: before_install:
- | - |
echo "Disabling Xdebug for composer" echo "Disabling Xdebug for composer"
export PHP_VERSION_NAME=$(phpenv version-name) export PHP_VERSION_NAME=$(phpenv version-name)
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini
phpenv config-rm xdebug.ini phpenv config-rm xdebug.ini
echo echo
- | - |
if [ "$DB" = 'postgresql' ]; then if [ "$DB" = 'postgresql' ]; then
echo "Check pgloader version" echo "Check pgloader version"
pgloader --version pgloader --version
@ -122,7 +107,7 @@ before_install:
fi fi
install: install:
- | - |
echo "Updating Composer" echo "Updating Composer"
rm $TRAVIS_BUILD_DIR/composer.json rm $TRAVIS_BUILD_DIR/composer.json
rm $TRAVIS_BUILD_DIR/composer.lock rm $TRAVIS_BUILD_DIR/composer.lock
@ -133,7 +118,7 @@ install:
composer -n config vendor-dir htdocs/includes composer -n config vendor-dir htdocs/includes
echo echo
- | - |
echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION" echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION"
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] \ if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] \
[ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
@ -150,7 +135,7 @@ install:
fi fi
echo echo
- | - |
echo "Adding path of binaries tools installed by composer to the PATH" echo "Adding path of binaries tools installed by composer to the PATH"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH"
echo echo
@ -276,7 +261,7 @@ before_script:
script: script:
- | - |
echo "Checking webserver availability by a wget -O - http://127.0.0.1" echo "Checking webserver availability by a wget -O - http://127.0.0.1"
# Ensure we stop on error with set -e # Ensure we stop on error with set -e
set +e set +e
@ -287,7 +272,7 @@ script:
set +e set +e
echo echo
- | - |
echo "Checking PHP syntax errors" echo "Checking PHP syntax errors"
# Ensure we catch errors # Ensure we catch errors
set -e set -e
@ -300,7 +285,7 @@ script:
set +e set +e
echo echo
- | - |
echo "Checking coding style (excluding Pull Requests builds)" echo "Checking coding style (excluding Pull Requests builds)"
# Ensure we catch errors # Ensure we catch errors
set -e set -e
@ -310,7 +295,7 @@ script:
set +e set +e
echo echo
- | - |
export INSTALL_FORCED_FILE=htdocs/install/install.forced.php export INSTALL_FORCED_FILE=htdocs/install/install.forced.php
echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation" echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation"
# Ensure we catch errors # Ensure we catch errors
@ -335,23 +320,23 @@ script:
echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE
#cat $INSTALL_FORCED_FILE #cat $INSTALL_FORCED_FILE
#- | #- |
# echo "Installing Dolibarr" # echo "Installing Dolibarr"
# cd htdocs/install # cd htdocs/install
# php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log # php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log
# php step2.php set >> $TRAVIS_BUILD_DIR/install.log # php step2.php set >> $TRAVIS_BUILD_DIR/install.log
# if [ "$?" -ne "0" ]; then # if [ "$?" -ne "0" ]; then
# echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS" # echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS"
# cat $TRAVIS_BUILD_DIR/install.log # cat $TRAVIS_BUILD_DIR/install.log
# exit 1 # exit 1
# fi # fi
# cd ../.. # cd ../..
# rm $INSTALL_FORCED_FILE # rm $INSTALL_FORCED_FILE
# #cat $TRAVIS_BUILD_DIR/install.log # #cat $TRAVIS_BUILD_DIR/install.log
# set +e # set +e
# echo # echo
- | - |
echo "Setting up database to test migrations" echo "Setting up database to test migrations"
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
echo "MySQL" echo "MySQL"
@ -374,7 +359,7 @@ script:
fi fi
echo echo
- | - |
echo "Upgrading Dolibarr" echo "Upgrading Dolibarr"
# Ensure we catch errors. Set this to +e if you want to go to the end to see log files. # Ensure we catch errors. Set this to +e if you want to go to the end to see log files.
set +e set +e
@ -431,7 +416,7 @@ script:
#cat /tmp/dolibarr_install.log #cat /tmp/dolibarr_install.log
cat $TRAVIS_BUILD_DIR/enablemodule.log cat $TRAVIS_BUILD_DIR/enablemodule.log
- | - |
echo "Unit testing" echo "Unit testing"
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
set -e set -e
@ -441,18 +426,18 @@ script:
set +e set +e
after_script: after_script:
- | - |
echo "After script - Output lines of dolibarr.log" echo "After script - Output lines of dolibarr.log"
ls $TRAVIS_BUILD_DIR/documents ls $TRAVIS_BUILD_DIR/documents
#cat $TRAVIS_BUILD_DIR/documents/dolibarr.log #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log
sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
after_success: after_success:
- | - |
echo Success echo Success
after_failure: after_failure:
- | - |
echo Failure detected, so we show samples of log to help diagnose echo Failure detected, so we show samples of log to help diagnose
# This part of code is executed only if previous command that fails are enclosed with set +e # This part of code is executed only if previous command that fails are enclosed with set +e
# Upgrade log files # Upgrade log files

56
test/README.md Normal file
View File

@ -0,0 +1,56 @@
#Run End-to-End Tests
###Run Selenium
Selenium has been used for automating the browser.
We can run selenium by two ways:
* Usually, for running tests using selenium we download `selenium standalone server JAR file` and `chrome driver` and start selenium server with a command which usually looks like:
`java -jar selenium-server-standalone-<selenium version>.jar -port <port-no>`
* Run selenium in docker with
`docker run -d -p 4444:4444 -p 5900:5900 -v /dev/shm:/dev/shm selenium/standalone-chrome-debug`
OR
`docker run -d --network="host" -v /dev/shm:/dev/shm selenium/standalone-chrome-debug`
OR
`docker run -d --network host -v /dev/shm:/dev/shm selenium/standalone-chrome-debug`
###Run the acceptance tests
* In `nightwatch.conf.js` file inside the root directory of the project and inside the configuration file following environment variable has been specified. We can change the default values according to our local configuration.
```
const admin_username = process.env.ADMIN_USERNAME || 'dolibarr';
const admin_password = process.env.ADMIN_PASSWORD || 'password';
const launch_url = process.env.LAUNCH_URL || 'http://localhost/dolibarr/htdocs/';
```
* You can run test using following commands
`yarn run test:e2e test/acceptance/features/<feature_file>`
For example: `yarn run test:e2e test/acceptance/features/addUsers.feature`
OR
`LAUNCH_URL='<launch_url>' ADMIN_USERNAME='<admin_username>' ADMIN_PASSWORD='<admin_password>' yarn run test:e2e test/acceptance/features/`
The full script to run the acceptance tests is specified in `scripts` object of `package.json` file inside the project's root directory as :
`"test:e2e": "node_modules/cucumber/bin/cucumber-js --require test/acceptance/index.js --require test/acceptance/stepDefinitions -f node_modules/cucumber-pretty"`
After you run the above command you can see the test running. For that :
* open `Remmina` (Remmina is a Remote Desktop Client and comes installed with Ubuntu)
* choose `VNC` and enter `localhost` on the address bar
* enter `secret` as the password