From 94cc1ea5165111b175ae45b17573631ba5862ee9 Mon Sep 17 00:00:00 2001 From: Julien Chanseaume Date: Mon, 11 Aug 2014 11:27:23 +0200 Subject: [PATCH 01/10] ignore casperjs screenshots in git --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 865c3f6a1..476a241fe 100755 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,7 @@ templates/* codekit-config.json config.codekit .codekit-cache + +# Ignore casperjs screenshots +tests/functionnal/casperjs/screenshot/ + From 473402bf8889b9bc226d326349d07987ea8529e9 Mon Sep 17 00:00:00 2001 From: Julien Chanseaume Date: Mon, 11 Aug 2014 11:28:23 +0200 Subject: [PATCH 02/10] Added functionnal test for front office : home, register, login, cart --- .travis.yml | 14 +++ run_casperjs.sh | 32 +++-- tests/functionnal/casperjs/conf/local.js | 110 ++++++++++++++++- .../functionnal/casperjs/exe/00_parameters.js | 2 +- .../functionnal/casperjs/exe/front/10_home.js | 15 +++ .../casperjs/exe/front/20_register.js | 111 ++++++++++++++++++ .../casperjs/exe/front/30_login.js | 71 +++++++++++ .../functionnal/casperjs/exe/front/40_cart.js | 51 ++++++++ 8 files changed, 395 insertions(+), 11 deletions(-) create mode 100644 tests/functionnal/casperjs/exe/front/10_home.js create mode 100644 tests/functionnal/casperjs/exe/front/20_register.js create mode 100644 tests/functionnal/casperjs/exe/front/30_login.js create mode 100644 tests/functionnal/casperjs/exe/front/40_cart.js diff --git a/.travis.yml b/.travis.yml index e70261a18..61ce2c6be 100755 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,20 @@ before_script: - php setup/faker.php - php Thelia module:activate Colissimo - php Thelia module:activate Cheque + - "export PHANTOMJS_EXECUTABLE='phantomjs --local-to-remote-url-access=yes --ignore-ssl-errors=yes'" + - "export DISPLAY=:99.0" + - "sh -e /etc/init.d/xvfb start" + - sleep 3 + - php -S localhost:8000 -t web/ & + - sleep 3 + - cd .. + - git clone https://github.com/n1k0/casperjs.git + - cd casperjs + - git checkout tags/1.0.4 + +script: + - "DISPLAY=:99.0 ./bin/casperjs test ../test/tests/functionnal/casperjs/exe/front/ --pre=../test/tests/functionnal/casperjs/conf/local.js --verbose --thelia2_base_url='http://localhost:8000/index.php/'" + matrix: allow_failures: diff --git a/run_casperjs.sh b/run_casperjs.sh index 5bdca95f4..21b6c3e8b 100755 --- a/run_casperjs.sh +++ b/run_casperjs.sh @@ -1,25 +1,43 @@ #!/bin/bash # @author Guillaume MOREL +echo -e "\n\033[01;34m[INFO] Clearing caches\033[00m\n" +php Thelia cache:clear + +echo -e "\n\033[01;34m[INFO] Self-updating Composer\033[00m\n" +composer self-update + +echo -e "\n\033[01;34m[INFO] Downloading vendors\033[00m\n" +composer install --prefer-dist --optimize-autoloader + echo "Force dropping database. All data will be lost." cd local/config/ -echo -e "\n\e[01;34m[INFO] Building Models file\e[00m\n" -../../bin/propel build -v --output-dir=../../core/lib/ +echo -e "\n\033[01;34m[INFO] Building Models file\033[00m\n" +../../bin/propel build -v --output-dir=../../core/lib/ --enable-identifier-quoting -echo -e "\n\e[01;34m[INFO] Building SQL CREATE file\e[00m\n" +echo -e "\n\033[01;34m[INFO] Building SQL CREATE file\033[00m\n" ../../bin/propel sql:build -v --output-dir=../../setup/ -echo -e "\n\e[01;34m[INFO] Reloaded Thelia2 database\e[00m\n" +echo -e "\n\033[01;34m[INFO] Reloading Thelia2 database\033[00m\n" cd ../.. -rm install/sqldb.map +rm setup/sqldb.map php Thelia thelia:dev:reloadDB -echo -e "\n\e[01;34m[INFO] Installing fixtures\e[00m\n" +echo -e "\n\033[01;34m[INFO] Installing fixtures\033[00m\n" php setup/faker.php echo -e "\n\e[01;34m[INFO] Adding admin\e[00m\n" -php Thelia thelia:create-admin --login_name thelia2 --password thelia2 --last_name thelia2 --first_name thelia2 +php Thelia admin:create --login_name thelia2 --password thelia2 --last_name thelia2 --first_name thelia2 + +echo -e "\n\033[01;34m[INFO] Clearing caches\033[00m\n" +php Thelia cache:clear + +echo -e "\n\033[01;34m[INFO] Activating Delivery Module(s)\033[00m\n" +php Thelia module:activate Colissimo + +echo -e "\n\033[01;34m[INFO] Activating Payment Module(s)\033[00m\n" +php Thelia module:activate Cheque casperjs test ./tests/functionnal/casperjs/exe --pre=./tests/functionnal/casperjs/conf/local.js --direct diff --git a/tests/functionnal/casperjs/conf/local.js b/tests/functionnal/casperjs/conf/local.js index 9fa930598..2ed42cef6 100644 --- a/tests/functionnal/casperjs/conf/local.js +++ b/tests/functionnal/casperjs/conf/local.js @@ -1,3 +1,107 @@ -//LOCAL = ton pc -var thelia2_base_url = 'http://www.thelia2.dev/index_dev.php/'; -casper.test.done(0); +// LOCAL = ton pc + +var system = require('system'); + +var thelia2_base_url = ''; + + +if (casper.cli.has('thelia2_base_url')){ + thelia2_base_url = casper.cli.get('thelia2_base_url'); + casper.test.comment('CasperJS will use Thelia on : '+ thelia2_base_url); +} else if (system.env.thelia2_base_url){ + thelia2_base_url = system.env.thelia2_base_url; + casper.test.comment('CasperJS will use Thelia (ENV) on : '+ thelia2_base_url); +} else { + thelia2_base_url = 'http://dev.thelia.net/index_dev.php/'; + casper.test.comment('CasperJS will use fallback URL for tests : '+ thelia2_base_url); + casper.test.comment('If you want to use custom URL just set the environment variable `thelia2_base_url`'); +} + +var screenshot_dir = 'tests/functionnal/casperjs/screenshot/'; + + +casper.options.viewportSize = {width: 1024, height: 768}; + +var viewports = [ + { + 'name': 'samsung-galaxy_y-portrait', + 'viewport': {width: 240, height: 320} + }, + { + 'name': 'samsung-galaxy_y-landscape', + 'viewport': {width: 320, height: 240} + }, + { + 'name': 'iphone5-portrait', + 'viewport': {width: 320, height: 568} + }, + { + 'name': 'iphone5-landscape', + 'viewport': {width: 568, height: 320} + }, + { + 'name': 'htc-one-portrait', + 'viewport': {width: 360, height: 640} + }, + { + 'name': 'htc-one-landscape', + 'viewport': {width: 640, height: 360} + }, + { + 'name': 'nokia-lumia-920-portrait', + 'viewport': {width: 240, height: 320} + }, + { + 'name': 'nokia-lumia-920-landscape', + 'viewport': {width: 320, height: 240} + }, + { + 'name': 'google-nexus-7-portrait', + 'viewport': {width: 603, height: 966} + }, + { + 'name': 'google-nexus-7-landscape', + 'viewport': {width: 966, height: 603} + }, + { + 'name': 'ipad-portrait', + 'viewport': {width: 768, height: 1024} + }, + { + 'name': 'ipad-landscape', + 'viewport': {width: 1024, height: 768} + }, + { + 'name': 'desktop-standard-vga', + 'viewport': {width: 640, height: 480} + }, + { + 'name': 'desktop-standard-svga', + 'viewport': {width: 800, height: 600} + }, + { + 'name': 'desktop-standard-hd', + 'viewport': {width: 1280, height: 720} + }, + { + 'name': 'desktop-standard-sxga', + 'viewport': {width: 1280, height: 1024} + }, + { + 'name': 'desktop-standard-sxga-plus', + 'viewport': {width: 1400, height: 1050} + }, + { + 'name': 'desktop-standard-uxga', + 'viewport': {width: 1600, height: 1200} + }, + { + 'name': 'desktop-standard-wuxga', + 'viewport': {width: 1920, height: 1200} + }, + +]; + +; + +casper.test.done(); diff --git a/tests/functionnal/casperjs/exe/00_parameters.js b/tests/functionnal/casperjs/exe/00_parameters.js index c6a78b7f3..793cb1b1a 100644 --- a/tests/functionnal/casperjs/exe/00_parameters.js +++ b/tests/functionnal/casperjs/exe/00_parameters.js @@ -17,4 +17,4 @@ var thelia2_content_image_list_url = thelia2_base_url + 'admin/content/update/1' casper.test.comment('Variables are set'); -casper.test.done(0); +casper.test.done(); diff --git a/tests/functionnal/casperjs/exe/front/10_home.js b/tests/functionnal/casperjs/exe/front/10_home.js new file mode 100644 index 000000000..4d8e319c0 --- /dev/null +++ b/tests/functionnal/casperjs/exe/front/10_home.js @@ -0,0 +1,15 @@ +casper.test.comment('== Front Homepage =='); + +casper.test.begin('Front Homepage', 2, function suite(test) { + + casper.start(thelia2_base_url, function() { + test.assertTitle("", "Thelia 2 homepage title is the one expected"); + test.assertExists('form#form-search', "main search form is found"); + this.capture(screenshot_dir + 'front/10_home.png'); + }); + + casper.run(function() { + test.done(); + }); + +}); \ No newline at end of file diff --git a/tests/functionnal/casperjs/exe/front/20_register.js b/tests/functionnal/casperjs/exe/front/20_register.js new file mode 100644 index 000000000..9ad1beee1 --- /dev/null +++ b/tests/functionnal/casperjs/exe/front/20_register.js @@ -0,0 +1,111 @@ +casper.test.comment('== Register =='); + +casper.test.begin('Register', 15, function suite(test) { + + var newEmail = ''; + + casper.start(thelia2_base_url + "register", function() { + test.assertTitle("Register - Thelia V2", "title is the one expected"); + test.assertExists('form#form-register', "register form is found"); + this.capture(screenshot_dir + 'front/20_register.png'); + + casper.test.comment('== Register blank account'); + + this.fill('form#form-register', { + 'thelia_customer_create[title]': '', + 'thelia_customer_create[firstname]': '', + 'thelia_customer_create[lastname]': '', + 'thelia_customer_create[email]': '', + 'thelia_customer_create[phone]': '', + 'thelia_customer_create[cellphone]': '', + 'thelia_customer_create[company]': '', + 'thelia_customer_create[address1]': '', + 'thelia_customer_create[address2]': '', + 'thelia_customer_create[zipcode]': '', + 'thelia_customer_create[city]': '', + 'thelia_customer_create[country]': '', + 'thelia_customer_create[password]': '', + 'thelia_customer_create[password_confirm]': '', + 'thelia_customer_create[newsletter]': '' + }, true); + + }); + + + casper.then(function() { + + casper.test.comment('== Register thelia account'); + + this.capture(screenshot_dir + 'front/20_register-ko.png'); + + test.assertExists('.group-title.has-error', 'title can not be empty'); + test.assertExists('.group-firstname.has-error', 'firstname can not be empty'); + test.assertExists('.group-lastname.has-error', 'lastname can not be empty'); + test.assertExists('.group-email.has-error', 'email can not be empty'); + test.assertExists('.group-address1.has-error', 'address1 can not be empty'); + test.assertExists('.group-zip.has-error', 'zipcode can not be empty'); + test.assertExists('.group-city.has-error', 'city can not be empty'); + test.assertExists('.group-password.has-error', 'password can not be empty'); + test.assertExists('.group-password_confirm.has-error', 'password confirm can not be empty'); + + newEmail = Math.random().toString(36).substr(2,7) + '@thelia.net'; + + this.fill('form#form-register', { + 'thelia_customer_create[title]': 1, + 'thelia_customer_create[firstname]': 'thelia', + 'thelia_customer_create[lastname]': 'thelia', + 'thelia_customer_create[email]': 'test@thelia.net', + 'thelia_customer_create[phone]': '', + 'thelia_customer_create[cellphone]': '', + 'thelia_customer_create[company]': 'OpenStudio', + 'thelia_customer_create[address1]': '4 rue Rochon', + 'thelia_customer_create[address2]': '', + 'thelia_customer_create[zipcode]': '63000', + 'thelia_customer_create[city]': 'Clermont-Ferrand', + 'thelia_customer_create[country]': 64, + 'thelia_customer_create[password]': 'thelia', + 'thelia_customer_create[password_confirm]': 'thelia', + 'thelia_customer_create[newsletter]': '' + }, false); + + this.click('form#form-register button[type="submit"]'); + + }); + + casper.wait(1000, function(){ + + test.assertSelectorHasText('.group-email .help-block', 'This email already exists.'); + + this.fill('form#form-register', { + 'thelia_customer_create[email]': newEmail, + 'thelia_customer_create[password]': 'thelia', + 'thelia_customer_create[password_confirm]': 'thelia' + }, false); + + this.click('form#form-register button[type="submit"]'); + + }); + + casper.wait(2000, function() { + + this.capture(screenshot_dir + 'front/20_register-ok.png'); + test.assertSelectorHasText('h1#main-label', 'My Account'); + test.assertExists('a.logout', 'Logout button exists'); + + casper.test.comment('== Logout'); + + this.click('a.logout'); + }); + + casper.wait(2000, function() { + + test.assertExists('a.login', 'Login button exists'); + + }); + + + casper.run(function() { + test.done(); + }); + +}); \ No newline at end of file diff --git a/tests/functionnal/casperjs/exe/front/30_login.js b/tests/functionnal/casperjs/exe/front/30_login.js new file mode 100644 index 000000000..3dc415aa9 --- /dev/null +++ b/tests/functionnal/casperjs/exe/front/30_login.js @@ -0,0 +1,71 @@ +casper.test.comment('== Login =='); + +casper.test.begin('Login', 5, function suite(test) { + + casper.start(thelia2_base_url + "login", function() { + test.assertTitle("Login - Thelia V2", "title is the one expected"); + test.assertExists('form#form-login', "login form is found"); + this.capture(screenshot_dir + 'front/30_login.png'); + + casper.test.comment('== Login with a bad account'); + + this.fill('form#form-login', { + 'thelia_customer_login[account]': "1" + }, false); + + }); + + casper.then(function(){ + + casper.evaluate(function(username, password) { + document.querySelector('#email').value = username; + document.querySelector('#password').disabled = false; + document.querySelector('#password').value = password; + }, 'chuck-norris@thelia.net', 'thelia'); + + this.capture(screenshot_dir + 'front/30_login-ko-0.png'); + + this.click('form#form-login button[type="submit"]'); + + }); + + casper.wait(2000, function(){ + + this.capture(screenshot_dir + 'front/30_login-ko.png'); + + test.assertSelectorHasText('form#form-login .alert-danger', 'Wrong email or password. Please try again'); + + casper.test.comment('== Login with a good account'); + + casper.evaluate(function(username, password) { + document.querySelector('#email').value = username; + document.querySelector('#password').disabled = false; + document.querySelector('#password').value = password; + }, 'test@thelia.net', 'azerty'); + + this.click('form#form-login button[type="submit"]'); + }); + + + casper.wait(2000, function(){ + + this.capture(screenshot_dir + 'front/30_login-ok.png'); + test.assertExists('a.logout', 'Logout button exists'); + + casper.test.comment('== Logout'); + + this.click('a.logout'); + }); + + casper.wait(2000, function(){ + + test.assertExists('a.login', 'Login button exists'); + + }); + + + casper.run(function() { + test.done(); + }); + +}); \ No newline at end of file diff --git a/tests/functionnal/casperjs/exe/front/40_cart.js b/tests/functionnal/casperjs/exe/front/40_cart.js new file mode 100644 index 000000000..a004816cc --- /dev/null +++ b/tests/functionnal/casperjs/exe/front/40_cart.js @@ -0,0 +1,51 @@ +casper.test.comment('== Cart =='); + +casper.test.begin('Cart', 4, function suite(test) { + + var productUrl = ''; + + casper.start(thelia2_base_url, function() { + + casper.viewport(1280, 1024) + + productUrl = this.getElementAttribute('a.product-info', 'href'); + + this.echo("product : " + productUrl); + + casper.thenOpen(productUrl, function() { + this.echo(this.getTitle()); + }); + + }); + + casper.wait(2000, function(){ + this.capture(screenshot_dir + 'front/40_product.png'); + this.click("#pse-submit"); + }); + + casper.wait(2000, function() { + this.captureSelector(screenshot_dir + 'front/40_added-to-cart.png', '.bootbox'); + test.assertSelectorHasText('.bootbox h3', 'The product has been added to your cart'); + }); + + + casper.then(function(){ + + this.thenOpen(thelia2_base_url + "cart", function() { + this.echo(this.getTitle()); + test.assertExists("#cart .table-cart", "Cart table exists"); + test.assertElementCount("#cart .table-cart tbody tr", 2, "Cart contains 1 product") + var link = this.getElementInfo('#cart .table-cart tbody tr a.thumbnail'); + //require('utils').dump(link); + test.assertTruthy( link.attributes.href == productUrl, "This is the right product in cart"); + this.capture(screenshot_dir + 'front/40_cart.png'); + }); + + }); + + + casper.run(function() { + test.done(); + }); + +}); \ No newline at end of file From 67fe4125fe886efb19bd809f0ebf021a3ccb0b0b Mon Sep 17 00:00:00 2001 From: Julien Chanseaume Date: Mon, 11 Aug 2014 11:38:32 +0200 Subject: [PATCH 03/10] use beta version of CasperJS for more stability :/ --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 61ce2c6be..a6209e6e3 100755 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ before_script: - cd .. - git clone https://github.com/n1k0/casperjs.git - cd casperjs - - git checkout tags/1.0.4 + - git checkout tags/1.1-beta3 script: - "DISPLAY=:99.0 ./bin/casperjs test ../test/tests/functionnal/casperjs/exe/front/ --pre=../test/tests/functionnal/casperjs/conf/local.js --verbose --thelia2_base_url='http://localhost:8000/index.php/'" From 36b5e653536f712cea2c9477c4ec50fd91305a04 Mon Sep 17 00:00:00 2001 From: Julien Chanseaume Date: Mon, 11 Aug 2014 11:43:57 +0200 Subject: [PATCH 04/10] Fixed test path --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a6209e6e3..b544abe07 100755 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ before_script: - git checkout tags/1.1-beta3 script: - - "DISPLAY=:99.0 ./bin/casperjs test ../test/tests/functionnal/casperjs/exe/front/ --pre=../test/tests/functionnal/casperjs/conf/local.js --verbose --thelia2_base_url='http://localhost:8000/index.php/'" + - "DISPLAY=:99.0 ./bin/casperjs test ../thelia/tests/functionnal/casperjs/exe/front/ --pre=../thelia/tests/functionnal/casperjs/conf/local.js --verbose --thelia2_base_url='http://localhost:8000/index.php/'" matrix: From d7c590961e676ee771cfbf4ac1fa5578b718aa06 Mon Sep 17 00:00:00 2001 From: Julien Chanseaume Date: Mon, 11 Aug 2014 12:22:09 +0200 Subject: [PATCH 05/10] Removed outputs from php built in server --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b544abe07..5d65dca2f 100755 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ before_script: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" - sleep 3 - - php -S localhost:8000 -t web/ & + - php -S localhost:8000 -t web/ >/dev/null 2>&1 & - sleep 3 - cd .. - git clone https://github.com/n1k0/casperjs.git From 8cbfe5e22a5814f3c15aa365a016e15dbea55981 Mon Sep 17 00:00:00 2001 From: Julien Chanseaume Date: Mon, 11 Aug 2014 13:43:12 +0200 Subject: [PATCH 06/10] changed wait timeout --- tests/functionnal/casperjs/exe/front/20_register.js | 6 +++--- tests/functionnal/casperjs/exe/front/30_login.js | 6 +++--- tests/functionnal/casperjs/exe/front/40_cart.js | 7 ++----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/functionnal/casperjs/exe/front/20_register.js b/tests/functionnal/casperjs/exe/front/20_register.js index 9ad1beee1..cd5ce72d8 100644 --- a/tests/functionnal/casperjs/exe/front/20_register.js +++ b/tests/functionnal/casperjs/exe/front/20_register.js @@ -72,7 +72,7 @@ casper.test.begin('Register', 15, function suite(test) { }); - casper.wait(1000, function(){ + casper.wait(4000, function(){ test.assertSelectorHasText('.group-email .help-block', 'This email already exists.'); @@ -86,7 +86,7 @@ casper.test.begin('Register', 15, function suite(test) { }); - casper.wait(2000, function() { + casper.wait(4000, function() { this.capture(screenshot_dir + 'front/20_register-ok.png'); test.assertSelectorHasText('h1#main-label', 'My Account'); @@ -97,7 +97,7 @@ casper.test.begin('Register', 15, function suite(test) { this.click('a.logout'); }); - casper.wait(2000, function() { + casper.wait(4000, function() { test.assertExists('a.login', 'Login button exists'); diff --git a/tests/functionnal/casperjs/exe/front/30_login.js b/tests/functionnal/casperjs/exe/front/30_login.js index 3dc415aa9..28501d630 100644 --- a/tests/functionnal/casperjs/exe/front/30_login.js +++ b/tests/functionnal/casperjs/exe/front/30_login.js @@ -29,7 +29,7 @@ casper.test.begin('Login', 5, function suite(test) { }); - casper.wait(2000, function(){ + casper.wait(4000, function(){ this.capture(screenshot_dir + 'front/30_login-ko.png'); @@ -47,7 +47,7 @@ casper.test.begin('Login', 5, function suite(test) { }); - casper.wait(2000, function(){ + casper.wait(4000, function(){ this.capture(screenshot_dir + 'front/30_login-ok.png'); test.assertExists('a.logout', 'Logout button exists'); @@ -57,7 +57,7 @@ casper.test.begin('Login', 5, function suite(test) { this.click('a.logout'); }); - casper.wait(2000, function(){ + casper.wait(4000, function(){ test.assertExists('a.login', 'Login button exists'); diff --git a/tests/functionnal/casperjs/exe/front/40_cart.js b/tests/functionnal/casperjs/exe/front/40_cart.js index a004816cc..4f6ea76d9 100644 --- a/tests/functionnal/casperjs/exe/front/40_cart.js +++ b/tests/functionnal/casperjs/exe/front/40_cart.js @@ -6,8 +6,6 @@ casper.test.begin('Cart', 4, function suite(test) { casper.start(thelia2_base_url, function() { - casper.viewport(1280, 1024) - productUrl = this.getElementAttribute('a.product-info', 'href'); this.echo("product : " + productUrl); @@ -18,12 +16,12 @@ casper.test.begin('Cart', 4, function suite(test) { }); - casper.wait(2000, function(){ + casper.wait(4000, function(){ this.capture(screenshot_dir + 'front/40_product.png'); this.click("#pse-submit"); }); - casper.wait(2000, function() { + casper.wait(4000, function() { this.captureSelector(screenshot_dir + 'front/40_added-to-cart.png', '.bootbox'); test.assertSelectorHasText('.bootbox h3', 'The product has been added to your cart'); }); @@ -43,7 +41,6 @@ casper.test.begin('Cart', 4, function suite(test) { }); - casper.run(function() { test.done(); }); From 4b85156fb87e5499571af8d0d9fc95f448958c5c Mon Sep 17 00:00:00 2001 From: Julien Chanseaume Date: Mon, 11 Aug 2014 13:43:55 +0200 Subject: [PATCH 07/10] changed screenshot path --- .travis.yml | 3 +-- tests/functionnal/casperjs/conf/local.js | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5d65dca2f..fabb7be2f 100755 --- a/.travis.yml +++ b/.travis.yml @@ -31,8 +31,7 @@ before_script: - git checkout tags/1.1-beta3 script: - - "DISPLAY=:99.0 ./bin/casperjs test ../thelia/tests/functionnal/casperjs/exe/front/ --pre=../thelia/tests/functionnal/casperjs/conf/local.js --verbose --thelia2_base_url='http://localhost:8000/index.php/'" - + - "DISPLAY=:99.0 ./bin/casperjs test ../thelia/tests/functionnal/casperjs/exe/front/ --pre=../thelia/tests/functionnal/casperjs/conf/local.js --verbose --thelia2_base_url='http://localhost:8000/index.php/' --thelia2_screenshot_path='../thelia/tests/functionnal/casperjs/screenshot/'" matrix: allow_failures: diff --git a/tests/functionnal/casperjs/conf/local.js b/tests/functionnal/casperjs/conf/local.js index 2ed42cef6..efa50a4f4 100644 --- a/tests/functionnal/casperjs/conf/local.js +++ b/tests/functionnal/casperjs/conf/local.js @@ -18,7 +18,9 @@ if (casper.cli.has('thelia2_base_url')){ } var screenshot_dir = 'tests/functionnal/casperjs/screenshot/'; - +if (casper.cli.has('thelia2_screenshot_path')){ + screenshot_dir = casper.cli.get('thelia2_screenshot_path'); +} casper.options.viewportSize = {width: 1024, height: 768}; From fbb9afa8b934accf04513f8a4745a84b01d7aec6 Mon Sep 17 00:00:00 2001 From: Julien Chanseaume Date: Mon, 11 Aug 2014 14:01:40 +0200 Subject: [PATCH 08/10] Added script for phpunit --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index fabb7be2f..1d1ac2909 100755 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,7 @@ before_script: - git checkout tags/1.1-beta3 script: + - phpunit - "DISPLAY=:99.0 ./bin/casperjs test ../thelia/tests/functionnal/casperjs/exe/front/ --pre=../thelia/tests/functionnal/casperjs/conf/local.js --verbose --thelia2_base_url='http://localhost:8000/index.php/' --thelia2_screenshot_path='../thelia/tests/functionnal/casperjs/screenshot/'" matrix: From ebb20e075e5c2ad839120fb45cfa6e3a43375485 Mon Sep 17 00:00:00 2001 From: Julien Chanseaume Date: Mon, 11 Aug 2014 14:19:45 +0200 Subject: [PATCH 09/10] make a uniq script to execute phpunit and casperjs --- .travis.yml | 5 ++--- run-tests.sh | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100755 run-tests.sh diff --git a/.travis.yml b/.travis.yml index 1d1ac2909..cda13356f 100755 --- a/.travis.yml +++ b/.travis.yml @@ -29,10 +29,9 @@ before_script: - git clone https://github.com/n1k0/casperjs.git - cd casperjs - git checkout tags/1.1-beta3 + - cd ../thelia -script: - - phpunit - - "DISPLAY=:99.0 ./bin/casperjs test ../thelia/tests/functionnal/casperjs/exe/front/ --pre=../thelia/tests/functionnal/casperjs/conf/local.js --verbose --thelia2_base_url='http://localhost:8000/index.php/' --thelia2_screenshot_path='../thelia/tests/functionnal/casperjs/screenshot/'" +script: "./run-tests.sh" matrix: allow_failures: diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 000000000..b55ccf7aa --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,11 @@ +#/usr/bin/env/sh + +# will exit with non-zero error code if any of the command fails +set -e + +echo "phpunit" +phpunit + +echo "CasperJS" +cd ../casperjs +"DISPLAY=:99.0 ./bin/casperjs test ../thelia/tests/functionnal/casperjs/exe/front/ --pre=../thelia/tests/functionnal/casperjs/conf/local.js --verbose --thelia2_base_url='http://localhost:8000/index.php/' --thelia2_screenshot_path='../thelia/tests/functionnal/casperjs/screenshot/'" From a6cc31db236ba13a3d246721a339f664518f5f51 Mon Sep 17 00:00:00 2001 From: Julien Chanseaume Date: Mon, 11 Aug 2014 14:36:25 +0200 Subject: [PATCH 10/10] changed some paths --- run-tests.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/run-tests.sh b/run-tests.sh index b55ccf7aa..61861e487 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -8,4 +8,7 @@ phpunit echo "CasperJS" cd ../casperjs -"DISPLAY=:99.0 ./bin/casperjs test ../thelia/tests/functionnal/casperjs/exe/front/ --pre=../thelia/tests/functionnal/casperjs/conf/local.js --verbose --thelia2_base_url='http://localhost:8000/index.php/' --thelia2_screenshot_path='../thelia/tests/functionnal/casperjs/screenshot/'" +export DISPLAY=:99.0 +pwd +ls -la +./bin/casperjs test ../thelia/tests/functionnal/casperjs/exe/front/ --pre=../thelia/tests/functionnal/casperjs/conf/local.js --verbose --thelia2_base_url="http://localhost:8000/index.php/" --thelia2_screenshot_path="../thelia/tests/functionnal/casperjs/screenshot/"