diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..544c9b50c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,21 @@ +node_modules +bower_components +tmp +application/config/email.php +application/config/database.php +*.patch +patches/ +.idea/ +git-svn-diff.py +*.bash +.swp +.buildpath +.project +.settings/* +*.swp +*.rej +*.orig +*~ +*.~ +*.log +application/sessions/* diff --git a/.travis.yml b/.travis.yml index 7a5999869..2bbd9f2b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,14 @@ sudo: false -language: node_js - -node_js: - - "4.1" - services: - docker before_install: - - docker build -t jekkos/opensourcepos . - - docker run -d jekkos/opensourcepos + - docker-compose build + - docker-compose up -d script: - - docker exec -t -i $(docker ps | tail -n 1 | cut -d' ' -f1) /bin/sh -c "while ! curl http://localhost/index.php | grep username; do sleep 1; done; cd app && grunt mochaWebdriver:test" + - docker-wait opensourcepos_php_1 after_success: - docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" diff --git a/Dockerfile b/Dockerfile index e97c9d9a5..17f0a157e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,36 +1,19 @@ -FROM ubuntu:utopic +FROM php:5-apache MAINTAINER jekkos RUN sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - mysql-client \ - mysql-server \ - apache2 \ - libapache2-mod-php5 \ - pwgen python-setuptools \ - vim-tiny \ - php5-mysql \ php5-gd \ - php5-apcu \ - nodejs \ - npm \ - curl \ - software-properties-common \ - python \ - git -RUN easy_install supervisor + php5-apcu -COPY ./docker/foreground.sh /etc/apache2/foreground.sh -COPY ./docker/supervisord.conf /etc/supervisord.conf -RUN chmod 755 /etc/apache2/foreground.sh +RUN a2enmod rewrite +RUN docker-php-ext-install mysql mysqli +WORKDIR /app COPY . /app -RUN ln -s /usr/bin/nodejs /usr/bin/node -RUN cd app && npm install -RUN npm install -g grunt-cli -RUN ln -s /usr/local/bin/grunt /usr/bin/grunt -RUN ln -fs /app/* /var/www/html -COPY ./docker/start_container.sh /start_container.sh -RUN chmod 755 /start_container.sh -EXPOSE 80 3306 -CMD ["/bin/bash", "/start_container.sh"] +RUN cp application/config/database.php.tmpl application/config/database.php && \ + sed -i -e "s/\(localhost\)/web/g" test/ospos.js && \ + sed -i -e "s/\(user.*\?=.\).*\(.\)$/\1'${MYSQL_USERNAME}'\2/g" application/config/database.php && \ + sed -i -e "s/\(password.*\?=.\).*\(.\)$/\1'${MYSQL_PASSWORD}'\2/g" application/config/database.php && \ + sed -i -e "s/\(database.*\?=.\).*\(.\)$/\1'${MYSQL_DB_NAME}'\2/g" application/config/database.php && \ + sed -i -e "s/\(hostname.*\?=.\).*\(.\)$/\1'${MYSQL_HOST_NAME}'\2/g" application/config/database.php diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 000000000..cb55d5275 --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,11 @@ +FROM digitallyseamless/nodejs-bower-grunt:5 +MAINTAINER jekkos + +apt-get install curl + +COPY Gruntfile.js . +COPY package.json . +COPY test . +RUN npm install + +CMD ['while ! curl web/index.php | grep username; do sleep 1; done; && grunt mochaWebdriver:test'] diff --git a/application/models/Sale.php b/application/models/Sale.php index d65034804..2450c607c 100644 --- a/application/models/Sale.php +++ b/application/models/Sale.php @@ -56,6 +56,7 @@ class Sale extends CI_Model $this->db->like('last_name', $search); $this->db->or_like('first_name', $search); $this->db->or_like('CONCAT(customer.first_name, " ", last_name)', $search); + $this->db->or_like('company_name', $search); $this->db->group_end(); } } @@ -196,6 +197,7 @@ class Sale extends CI_Model $this->db->like('last_name', $search); $this->db->or_like('first_name', $search); $this->db->or_like('CONCAT(first_name, " ", last_name)', $search); + $this->db->or_like('company_name', $search); $this->db->order_by('last_name', 'asc'); foreach($this->db->get()->result_array() as $result) diff --git a/database/database.sql b/database/database.sql index dacd85897..2b6572c0d 100644 --- a/database/database.sql +++ b/database/database.sql @@ -1,3 +1,4 @@ +USE ospos; -- >> This file is autogenerated from tables.sql and constraints.sql. Do not modify directly << -- -- -- Table structure for table `ospos_app_config` diff --git a/docker-compose.test.yml b/docker-compose.test.yml new file mode 100644 index 000000000..2940fe3ef --- /dev/null +++ b/docker-compose.test.yml @@ -0,0 +1,39 @@ +version: '2' + +volumes: + ospos: + driver: local + +services: + test: + build: + context: . + dockerfile: Dockerfile.test + php: + build: + context: . + dockerfile: Dockerfile + links: + - mysql + ports: + - "80:80" + volumes: + - ospos:/var/www/html + - ospos:/app + environment: + - MYSQL_USERNAME=admin + - MYSQL_PASSWORD=pointofsale + - MYSQL_DB_NAME=ospos + - MYSQL_HOST_NAME=mysql + + mysql: + image: mysql:5.7 + environment: + - MYSQL_ROOT_PASSWORD=pointofsale + - MYSQL_DATABASE=ospos + - MYSQL_USER=admin + - MYSQL_PASSWORD=pointofsale + ports: + - "3306:3306" + volumes: + - ./database/database.sql:/docker-entrypoint-initdb.d/database.sql diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..467f5c57b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +version: '2' + +volumes: + ospos: + driver: local + +services: + php: + build: + context: . + dockerfile: Dockerfile + links: + - mysql + ports: + - "80:80" + volumes: + - ospos:/var/www/html + - ospos:/app + environment: + - MYSQL_USERNAME=admin + - MYSQL_PASSWORD=pointofsale + - MYSQL_DB_NAME=ospos + - MYSQL_HOST_NAME=mysql + + mysql: + image: mysql:5.7 + environment: + - MYSQL_ROOT_PASSWORD=pointofsale + - MYSQL_DATABASE=ospos + - MYSQL_USER=admin + - MYSQL_PASSWORD=pointofsale + ports: + - "3306:3306" + volumes: + - ./database/database.sql:/docker-entrypoint-initdb.d/database.sql diff --git a/docker/foreground.sh b/docker/foreground.sh deleted file mode 100644 index 565c55c6f..000000000 --- a/docker/foreground.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -read pid cmd state ppid pgrp session tty_nr tpgid rest < /proc/self/stat -trap "kill -TERM -$pgrp; exit" EXIT TERM KILL SIGKILL SIGTERM SIGQUIT - - -source /etc/apache2/envvars -apache2 -D FOREGROUND - diff --git a/docker/start_container.sh b/docker/start_container.sh deleted file mode 100644 index 0c13fd423..000000000 --- a/docker/start_container.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -if [ ! -f /app/mysql-configured ]; then - /usr/bin/mysqld_safe & - sleep 10s - MYSQL_PASSWORD=`pwgen -c -n -1 12` - echo mysql root password: $MYSQL_PASSWORD - echo $MYSQL_PASSWORD > /app/mysql-root-pw.txt - [ -f /var/www/html/index.html ] && rm /var/www/html/index.html - mysqladmin -u root password $MYSQL_PASSWORD - cp /app/application/config/database.php.tmpl /app/application/config/database.php - sed -i -e "s/\(user.*\?=.\).*\(.\)$/\1'root'\2/g" /app/application/config/database.php - sed -i -e "s/\(password.*\?=.\).*\(.\)$/\1'${MYSQL_PASSWORD}'\2/g" /app/application/config/database.php - sed -i -e "s/\(database.*\?=.\).*\(.\)$/\1'ospos'\2/g" /app/application/config/database.php - mysql -e "CREATE DATABASE IF NOT EXISTS ospos; use ospos; source /app/database/tables.sql; source /app/database/constraints.sql;" -uroot -p${MYSQL_PASSWORD} - touch /app/mysql-configured - killall mysqld - sleep 10s -fi -supervisord -n diff --git a/docker/supervisor.conf b/docker/supervisor.conf deleted file mode 100644 index a4270360a..000000000 --- a/docker/supervisor.conf +++ /dev/null @@ -1,147 +0,0 @@ -; Sample supervisor config file. -; -; For more information on the config file, please see: -; http://supervisord.org/configuration.html -; -; Note: shell expansion ("~" or "$HOME") is not supported. Environment -; variables can be expanded using this syntax: "%(ENV_HOME)s". - -[unix_http_server] -file=/tmp/supervisor.sock ; (the path to the socket file) -;chmod=0700 ; socket file mode (default 0700) -;chown=nobody:nogroup ; socket file uid:gid owner -;username=user ; (default is no username (open server)) -;password=123 ; (default is no password (open server)) - -;[inet_http_server] ; inet (TCP) server disabled by default -;port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface) -;username=user ; (default is no username (open server)) -;password=123 ; (default is no password (open server)) - -[supervisord] -logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log) -logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) -logfile_backups=10 ; (num of main logfile rotation backups;default 10) -loglevel=info ; (log level;default info; others: debug,warn,trace) -pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) -nodaemon=false ; (start in foreground if true;default false) -minfds=1024 ; (min. avail startup file descriptors;default 1024) -minprocs=200 ; (min. avail process descriptors;default 200) -;umask=022 ; (process file creation umask;default 022) -;user=chrism ; (default is current user, required if root) -;identifier=supervisor ; (supervisord identifier, default is 'supervisor') -;directory=/tmp ; (default is not to cd during start) -;nocleanup=true ; (don't clean up tempfiles at start;default false) -;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP) -;environment=KEY=value ; (key value pairs to add to environment) -;strip_ansi=false ; (strip ansi escape codes in logs; def. false) - -; the below section must remain in the config file for RPC -; (supervisorctl/web interface) to work, additional interfaces may be -; added by defining them in separate rpcinterface: sections -[rpcinterface:supervisor] -supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface - -[supervisorctl] -serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket -;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket -;username=chris ; should be same as http_username if set -;password=123 ; should be same as http_password if set -;prompt=mysupervisor ; cmd line prompt (default "supervisor") -;history_file=~/.sc_history ; use readline history if available - -; The below sample program section shows all possible program subsection values, -; create one or more 'real' program: sections to be able to control them under -; supervisor. - -;[program:theprogramname] -;command=/bin/cat ; the program (relative uses PATH, can take args) -;process_name=%(program_name)s ; process_name expr (default %(program_name)s) -;numprocs=1 ; number of processes copies to start (def 1) -;directory=/tmp ; directory to cwd to before exec (def no cwd) -;umask=022 ; umask for process (default None) -;priority=999 ; the relative start priority (default 999) -;autostart=true ; start at supervisord start (default: true) -;autorestart=unexpected ; whether/when to restart (default: unexpected) -;startsecs=1 ; number of secs prog must stay running (def. 1) -;startretries=3 ; max # of serial start failures (default 3) -;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) -;stopsignal=QUIT ; signal used to kill process (default TERM) -;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) -;stopasgroup=false ; send stop signal to the UNIX process group (default false) -;killasgroup=false ; SIGKILL the UNIX process group (def false) -;user=chrism ; setuid to this UNIX account to run the program -;redirect_stderr=true ; redirect proc stderr to stdout (default false) -;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO -;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) -;stdout_events_enabled=false ; emit events on stdout writes (default false) -;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO -;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10) -;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) -;stderr_events_enabled=false ; emit events on stderr writes (default false) -;environment=A=1,B=2 ; process environment additions (def no adds) -;serverurl=AUTO ; override serverurl computation (childutils) - -; The below sample eventlistener section shows all possible -; eventlistener subsection values, create one or more 'real' -; eventlistener: sections to be able to handle event notifications -; sent by supervisor. - -;[eventlistener:theeventlistenername] -;command=/bin/eventlistener ; the program (relative uses PATH, can take args) -;process_name=%(program_name)s ; process_name expr (default %(program_name)s) -;numprocs=1 ; number of processes copies to start (def 1) -;events=EVENT ; event notif. types to subscribe to (req'd) -;buffer_size=10 ; event buffer queue size (default 10) -;directory=/tmp ; directory to cwd to before exec (def no cwd) -;umask=022 ; umask for process (default None) -;priority=-1 ; the relative start priority (default -1) -;autostart=true ; start at supervisord start (default: true) -;autorestart=unexpected ; whether/when to restart (default: unexpected) -;startsecs=1 ; number of secs prog must stay running (def. 1) -;startretries=3 ; max # of serial start failures (default 3) -;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) -;stopsignal=QUIT ; signal used to kill process (default TERM) -;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) -;stopasgroup=false ; send stop signal to the UNIX process group (default false) -;killasgroup=false ; SIGKILL the UNIX process group (def false) -;user=chrism ; setuid to this UNIX account to run the program -;redirect_stderr=true ; redirect proc stderr to stdout (default false) -;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO -;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -;stdout_events_enabled=false ; emit events on stdout writes (default false) -;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO -;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stderr_logfile_backups ; # of stderr logfile backups (default 10) -;stderr_events_enabled=false ; emit events on stderr writes (default false) -;environment=A=1,B=2 ; process environment additions -;serverurl=AUTO ; override serverurl computation (childutils) - -; The below sample group section shows all possible group values, -; create one or more 'real' group: sections to create "heterogeneous" -; process groups. - -;[group:thegroupname] -;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions -;priority=999 ; the relative start priority (default 999) - -; The [include] section can just contain the "files" setting. This -; setting can list multiple files (separated by whitespace or -; newlines). It can also contain wildcards. The filenames are -; interpreted as relative to this file. Included files *cannot* -; include files themselves. - -;[include] -;files = relative/directory/*.ini -;mysql and apache2 -[program:mysqld] -command=/usr/bin/mysqld_safe -[program:httpd] -command=/etc/apache2/foreground.sh -stopsignal=6 - - diff --git a/docker/supervisord.conf b/docker/supervisord.conf deleted file mode 100644 index a4270360a..000000000 --- a/docker/supervisord.conf +++ /dev/null @@ -1,147 +0,0 @@ -; Sample supervisor config file. -; -; For more information on the config file, please see: -; http://supervisord.org/configuration.html -; -; Note: shell expansion ("~" or "$HOME") is not supported. Environment -; variables can be expanded using this syntax: "%(ENV_HOME)s". - -[unix_http_server] -file=/tmp/supervisor.sock ; (the path to the socket file) -;chmod=0700 ; socket file mode (default 0700) -;chown=nobody:nogroup ; socket file uid:gid owner -;username=user ; (default is no username (open server)) -;password=123 ; (default is no password (open server)) - -;[inet_http_server] ; inet (TCP) server disabled by default -;port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface) -;username=user ; (default is no username (open server)) -;password=123 ; (default is no password (open server)) - -[supervisord] -logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log) -logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) -logfile_backups=10 ; (num of main logfile rotation backups;default 10) -loglevel=info ; (log level;default info; others: debug,warn,trace) -pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) -nodaemon=false ; (start in foreground if true;default false) -minfds=1024 ; (min. avail startup file descriptors;default 1024) -minprocs=200 ; (min. avail process descriptors;default 200) -;umask=022 ; (process file creation umask;default 022) -;user=chrism ; (default is current user, required if root) -;identifier=supervisor ; (supervisord identifier, default is 'supervisor') -;directory=/tmp ; (default is not to cd during start) -;nocleanup=true ; (don't clean up tempfiles at start;default false) -;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP) -;environment=KEY=value ; (key value pairs to add to environment) -;strip_ansi=false ; (strip ansi escape codes in logs; def. false) - -; the below section must remain in the config file for RPC -; (supervisorctl/web interface) to work, additional interfaces may be -; added by defining them in separate rpcinterface: sections -[rpcinterface:supervisor] -supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface - -[supervisorctl] -serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket -;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket -;username=chris ; should be same as http_username if set -;password=123 ; should be same as http_password if set -;prompt=mysupervisor ; cmd line prompt (default "supervisor") -;history_file=~/.sc_history ; use readline history if available - -; The below sample program section shows all possible program subsection values, -; create one or more 'real' program: sections to be able to control them under -; supervisor. - -;[program:theprogramname] -;command=/bin/cat ; the program (relative uses PATH, can take args) -;process_name=%(program_name)s ; process_name expr (default %(program_name)s) -;numprocs=1 ; number of processes copies to start (def 1) -;directory=/tmp ; directory to cwd to before exec (def no cwd) -;umask=022 ; umask for process (default None) -;priority=999 ; the relative start priority (default 999) -;autostart=true ; start at supervisord start (default: true) -;autorestart=unexpected ; whether/when to restart (default: unexpected) -;startsecs=1 ; number of secs prog must stay running (def. 1) -;startretries=3 ; max # of serial start failures (default 3) -;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) -;stopsignal=QUIT ; signal used to kill process (default TERM) -;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) -;stopasgroup=false ; send stop signal to the UNIX process group (default false) -;killasgroup=false ; SIGKILL the UNIX process group (def false) -;user=chrism ; setuid to this UNIX account to run the program -;redirect_stderr=true ; redirect proc stderr to stdout (default false) -;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO -;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) -;stdout_events_enabled=false ; emit events on stdout writes (default false) -;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO -;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10) -;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) -;stderr_events_enabled=false ; emit events on stderr writes (default false) -;environment=A=1,B=2 ; process environment additions (def no adds) -;serverurl=AUTO ; override serverurl computation (childutils) - -; The below sample eventlistener section shows all possible -; eventlistener subsection values, create one or more 'real' -; eventlistener: sections to be able to handle event notifications -; sent by supervisor. - -;[eventlistener:theeventlistenername] -;command=/bin/eventlistener ; the program (relative uses PATH, can take args) -;process_name=%(program_name)s ; process_name expr (default %(program_name)s) -;numprocs=1 ; number of processes copies to start (def 1) -;events=EVENT ; event notif. types to subscribe to (req'd) -;buffer_size=10 ; event buffer queue size (default 10) -;directory=/tmp ; directory to cwd to before exec (def no cwd) -;umask=022 ; umask for process (default None) -;priority=-1 ; the relative start priority (default -1) -;autostart=true ; start at supervisord start (default: true) -;autorestart=unexpected ; whether/when to restart (default: unexpected) -;startsecs=1 ; number of secs prog must stay running (def. 1) -;startretries=3 ; max # of serial start failures (default 3) -;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) -;stopsignal=QUIT ; signal used to kill process (default TERM) -;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) -;stopasgroup=false ; send stop signal to the UNIX process group (default false) -;killasgroup=false ; SIGKILL the UNIX process group (def false) -;user=chrism ; setuid to this UNIX account to run the program -;redirect_stderr=true ; redirect proc stderr to stdout (default false) -;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO -;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) -;stdout_events_enabled=false ; emit events on stdout writes (default false) -;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO -;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) -;stderr_logfile_backups ; # of stderr logfile backups (default 10) -;stderr_events_enabled=false ; emit events on stderr writes (default false) -;environment=A=1,B=2 ; process environment additions -;serverurl=AUTO ; override serverurl computation (childutils) - -; The below sample group section shows all possible group values, -; create one or more 'real' group: sections to create "heterogeneous" -; process groups. - -;[group:thegroupname] -;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions -;priority=999 ; the relative start priority (default 999) - -; The [include] section can just contain the "files" setting. This -; setting can list multiple files (separated by whitespace or -; newlines). It can also contain wildcards. The filenames are -; interpreted as relative to this file. Included files *cannot* -; include files themselves. - -;[include] -;files = relative/directory/*.ini -;mysql and apache2 -[program:mysqld] -command=/usr/bin/mysqld_safe -[program:httpd] -command=/etc/apache2/foreground.sh -stopsignal=6 - - diff --git a/test/giftcard_numbering.js b/test/giftcard_numbering.js index c70b448fb..e42c59d68 100644 --- a/test/giftcard_numbering.js +++ b/test/giftcard_numbering.js @@ -9,12 +9,12 @@ describe("giftcard numbering test", function () { }); it.skip("issue #65: giftcard numbering should add properly", function(done) { - return this.browser.get(ospos.url("/index.php/giftcards")).waitForElementByCss(".modal-dlg").click() - .waitForElementByName("value", 10000).type("100").elementById('giftcard_number').clear().type("10") - .elementById("submit").click().waitForElementByXPath("//table/tbody/tr[td/text()='10']", 2000).text().then(function (value) { + return this.browser.get(ospos.url("/index.php/giftcards")).elementByCssSelector(".modal-dlg").click() + .elementByName("value", 10000).type("100").elementById('giftcard_number').clear().type("10") + .elementById("submit").click().elementByXPath("//table/tbody/tr[td/text()='10']", 2000).text().then(function (value) { assert.ok(value, "giftcard failed to be added properly!"); - }).waitForElementByCss(".modal-dlg").click().waitForElementByName("value", 4000).type("100").elementById("submit").click() - .waitForElementByXPath("//table/tbody/tr[td/text()='11']").text().then(function (value) { + }).elementByCssSelector(".modal-dlg").click().elementByName("value", 4000).type("100").elementById("submit").click() + .elementByXPath("//table/tbody/tr[td/text()='11']").text().then(function (value) { assert.equal(value, "11", "giftcard number not incrementing properly!!"); }).then(done, done); }); diff --git a/test/make_sale_receiving.js b/test/make_sale_receiving.js index 496da7568..87c50ac51 100644 --- a/test/make_sale_receiving.js +++ b/test/make_sale_receiving.js @@ -16,7 +16,7 @@ describe("create item and make sale", function () { it("should be able to make sale", function(done) { return this.browser.get(ospos.url("/index.php/sales")) .elementById("item", def_timeout).clear().type("1\uE007") - .waitForElementByName("quantity", def_timeout).clear().type("2").elementByName("discount", def_timeout).type(item.cost_price).waitForElementByCss(".glyphicon.glyphicon-refresh").click() + .elementByName("quantity", def_timeout).clear().type("2").elementByName("discount", def_timeout).type(item.cost_price).elementByCssSelector(".glyphicon.glyphicon-refresh").click() .elementById("add_payment_button", def_timeout).click().elementByCssSelector("tbody#payment_contents tr td:last-child", def_timeout).text().then(function(value) { assert.equal(value, "$43.56", "price " + value + " in sale register is not correct!!"); }).elementById("finish_sale_button", def_timeout).click().elementByCssSelector("#receipt_items tbody tr:nth-child(8) td:last-child", def_timeout).text().then(function(value) { @@ -30,7 +30,7 @@ describe("create item and make sale", function () { it("should be able to make receiving", function(done) { return this.browser.get(ospos.url("/index.php/receivings")) .elementById("item", def_timeout).clear().type("1\uE007") - .waitForElementByName("quantity", def_timeout).clear().type("2").elementByCssSelector("a[title='Update']").click() + .elementByName("quantity", def_timeout).clear().type("2").elementByCssSelector("a[title='Update']").click() .elementByCssSelector("td:nth-last-child(2)").text().then(function(value) { assert.equal(value, "$20.00", "price " + value + " in receiving register is not correct!!"); }).elementById("finish_receiving_button").click().elementByCssSelector("#receipt_items tbody tr:nth-last-child(2) td:nth-child(2) div.total-value").text().then(function(value) { diff --git a/test/ospos.js b/test/ospos.js index 244ea3c20..01f8f08b2 100644 --- a/test/ospos.js +++ b/test/ospos.js @@ -38,7 +38,7 @@ var ospos = function() { .elementById("category", 2000).clear().type(item.category) .elementById('receiving_quantity', 2000).type(item.receiving_quantity || 1) .elementById("quantity_1", 2000).type("1").elementById("reorder_level", 2000).type("0").elementById("submit", 2000).click() - .waitForElementByXPath("//table/tbody/tr[td/text()='anItem']", 5000).text().then(function (value) { + .elementByXPath("//table/tbody/tr[td/text()='anItem']", 5000).text().then(function (value) { assert.equal(value, "1 - anItem aCategory - $10.00 $20.00 1 21.00%"); }); } diff --git a/test/receiving_quantity.js b/test/receiving_quantity.js index 0b216f4de..63e78ea9f 100644 --- a/test/receiving_quantity.js +++ b/test/receiving_quantity.js @@ -19,8 +19,8 @@ describe("test receiving quantity", function() { it("should be able to receive quantities with multiplier", function(done) { this.browser.get(ospos.url('/index.php/receivings')).elementById("item").clear().type(item.name) - .waitForElementByCss(".ui-autocomplete .ui-menu-item", def_timeout).click() - .waitForElementByName("quantity") + .elementByCssSelector(".ui-autocomplete .ui-menu-item", def_timeout).click() + .elementByName("quantity") .elementByCssSelector("#cart_contents tr td:nth-child(5)").text().then(function(value) { assert(value, "x " + item.receiving_quantity, "receiving quantity " + item.receiving_quantity + " is not displayed correctly in receivings module!"); }).elementById("finish_receiving_button", def_timeout).submit()