diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | .travis.yml | 5 | ||||
-rw-r--r-- | core/ViewDataTable.php | 4 | ||||
-rw-r--r-- | plugins/CoreVisualizations/javascripts/jqplot.js | 6 | ||||
-rw-r--r-- | tests/PHPUnit/TestingEnvironment.php | 11 | ||||
m--------- | tests/PHPUnit/UI | 0 | ||||
-rw-r--r-- | tests/PHPUnit/UI/UIIntegrationTest.php | 139 | ||||
-rw-r--r-- | tests/PHPUnit/UITest.php | 40 | ||||
-rw-r--r-- | tests/resources/screenshot-capture/capture.js | 38 | ||||
-rw-r--r-- | tests/resources/screenshot-override/open_sans.woff | bin | 21956 -> 0 bytes | |||
-rw-r--r-- | tests/resources/screenshot-override/open_sans_b.woff | bin | 22748 -> 0 bytes | |||
-rw-r--r-- | tests/resources/screenshot-override/open_sans_bi.woff | bin | 21184 -> 0 bytes | |||
-rw-r--r-- | tests/resources/screenshot-override/open_sans_i.woff | bin | 21092 -> 0 bytes | |||
-rw-r--r-- | tests/resources/screenshot-override/override.css | 29 | ||||
-rw-r--r-- | tests/resources/screenshot-override/override.js | 7 | ||||
-rwxr-xr-x | tests/travis/initiate_ui_tests.sh | 33 | ||||
-rwxr-xr-x | tests/travis/prepare.sh | 13 | ||||
-rwxr-xr-x | tests/travis/upload_artifacts.sh | 2 |
19 files changed, 109 insertions, 226 deletions
diff --git a/.gitignore b/.gitignore index b6b2b2391e..3258340e30 100644 --- a/.gitignore +++ b/.gitignore @@ -62,7 +62,4 @@ tests/lib/xhprof-0.9.2/extension/run-tests.php docs/ composer.phar vendor/ -/.htaccess -tests/PHPUnit/UI/processed-ui-screenshots -tests/PHPUnit/UI/expected-ui-screenshots - +/.htaccess
\ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..47afde004c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tests/PHPUnit/UI"] + path = tests/PHPUnit/UI + url = https://github.com/piwik/piwik-ui-tests.git diff --git a/.travis.yml b/.travis.yml index 391de22321..66330335b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,9 +12,9 @@ env: - TEST_SUITE=PluginTests - TEST_SUITE=CoreTests - TEST_SUITE=IntegrationTests - #- TEST_DIR=UI global: - secure: "AMhZmPZx4SUcuZRBzGHlQPxzM4D8FvFB3UThDa52gbi9KIBrwcumzV2VGi6B\n5fgjwtB4XTE1In7qhY2HMikPWBmWYYOQ5QcMPJsqqHt4iMmahx8WKzne6NOk\nNpqAuje/fulNGeP2LJZi0nrub3Fh4VwXaOvpNloKNQN/2JuqPtM=" + - secure: "AMhZmPZx4SUcuZRBzGHlQPxzM4D8FvFB3UThDa52gbi9KIBrwcumzV2VGi6B\n5fgjwtB4XTE1In7qhY2HMikPWBmWYYOQ5QcMPJsqqHt4iMmahx8WKzne6NOk\nNpqAuje/fulNGeP2LJZi0nrub3Fh4VwXaOvpNloKNQN/2JuqPtM=" + - secure: "DySde80fX3dw0osGY5s5lGiGLjMleUkkONsuRDC4xjT1hAQP94FGHpPXVZV8\nAQY0s8MQmcK2eRLOQrmE9Bh1XXbGqh40s66XhSWq0hulFHxQH5OLaZXccFeu\n5WxGkHXnNDIc+CVhXW/IIbHZPO1K6hffS8fuvP1o6mYgxwFL6Xw=" # Run PHP 5.4 for aa tests to generate # code coverage. @@ -43,6 +43,7 @@ before_script: after_success: - cd $TRAVIS_BUILD_DIR + - ./tests/travis/initiate_ui_tests.sh - ./tests/travis/generate_docs.sh after_script: diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index 76c2063b20..fd4d171615 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -1255,10 +1255,10 @@ class ViewDataTable // TODO: should mark properties that are overridable so not all properties can be overidden this way $queryParams = $_GET + $_POST; foreach ($queryParams as $name => $value) { - if (empty($queryParams[$name])) { + if (empty($value)) { continue; } - + $value = Common::getRequestVar($name, $default = null, $type = null, $queryParams); if (Properties::isCoreViewProperty($name)) { diff --git a/plugins/CoreVisualizations/javascripts/jqplot.js b/plugins/CoreVisualizations/javascripts/jqplot.js index 58de9aa1d8..6445781c85 100644 --- a/plugins/CoreVisualizations/javascripts/jqplot.js +++ b/plugins/CoreVisualizations/javascripts/jqplot.js @@ -101,7 +101,7 @@ tickOptions: { showMark: false, fontSize: '11px', - fontFamily: 'Arial' + fontFamily: window.piwik.jqplotLabelFont || 'Arial' }, rendererOptions: { drawBaseline: false @@ -860,7 +860,7 @@ RowEvolutionSeriesToggle.prototype.beforeReplot = function () { var ctx = legend.legendCanvas._ctx; ctx.save(); - ctx.font = '11px Arial'; + ctx.font = '11px ' + (window.piwik.jqplotLabelFont || 'Arial'); // render series names var x = 0; @@ -996,7 +996,7 @@ RowEvolutionSeriesToggle.prototype.beforeReplot = function () { var ctx = legend.pieLegendCanvas._ctx; ctx.save(); - ctx.font = '11px Arial'; + ctx.font = '11px ' + (window.piwik.jqplotLabelFont || 'Arial'); // render labels var height = legend.pieLegendCanvas._elem.height(); diff --git a/tests/PHPUnit/TestingEnvironment.php b/tests/PHPUnit/TestingEnvironment.php index a5b1509732..d0f644cec8 100644 --- a/tests/PHPUnit/TestingEnvironment.php +++ b/tests/PHPUnit/TestingEnvironment.php @@ -19,6 +19,17 @@ class Piwik_TestingEnvironment }); Piwik_AddAction('Config.createConfigSingleton', function($config) { $config->setTestEnvironment(); + + $pluginsToLoad = array( + "CorePluginsAdmin", "CoreAdminHome", "CoreHome", "Proxy", "API", "Widgetize", "Transitions", + "LanguagesManager", "Actions", "Dashboard", "MultiSites", "Referers", "UserSettings", "Goals", + "SEO", "UserCountry", "VisitsSummary", "VisitFrequency", "VisitTime", "VisitorInterest", + "ExampleAPI", "ExamplePlugin", "ExampleRssWidget", "Provider", "Feedback", "Login", "UsersManager", + "SitesManager", "Installation", "CoreUpdater", "PDFReports", "UserCountryMap", "Live", + "CustomVariables", "PrivacyManager", "ImageGraph", "DoNotTrack", "Annotations", "MobileMessaging", + "Overlay", "SegmentEditor", "VisitorGenerator", "DevicesDetection", "DBStats", + ); + $config->Plugins = array('Plugins' => $pluginsToLoad); }); Piwik_AddAction('FrontController.dispatch', function() { \Piwik\Plugins\CoreVisualizations\Visualizations\Cloud::$debugDisableShuffle = true; diff --git a/tests/PHPUnit/UI b/tests/PHPUnit/UI new file mode 160000 +Subproject 4883aebca9ccffa4f690c1b018a59b2545e6071 diff --git a/tests/PHPUnit/UI/UIIntegrationTest.php b/tests/PHPUnit/UI/UIIntegrationTest.php deleted file mode 100644 index efcc88ce57..0000000000 --- a/tests/PHPUnit/UI/UIIntegrationTest.php +++ /dev/null @@ -1,139 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -/** - * Tests UI code by grabbing screenshots of webpages and comparing with expected files. - * - * Uses slimerjs or phantomjs. - * - * TODO: - * - allow instrumentation javascript to be injected before screenshot is taken (so we can, say, - * take a screenshot of column documentation) - */ -class Test_Piwik_Integration_UIIntegrationTest extends UITest -{ - public static $fixture = null; // initialized below class definition - - public static function getUrlsForTesting() - { - $generalParams = 'idSite=1&period=week&date=2012-08-09'; - $evolutionParams = 'idSite=1&period=day&date=2012-08-11&evolution_day_last_n=30'; - $urlBase = 'module=CoreHome&action=index&' . $generalParams; - $widgetizeParams = "module=Widgetize&action=iframe"; - $segment = urlencode("browserCode==FF"); - - return array( - // dashboard - array('dashboard1', "?$urlBase#$generalParams&module=Dashboard&action=embeddedIndex&idDashboard=1"), - array('dashboard2', "?$urlBase#$generalParams&module=Dashboard&action=embeddedIndex&idDashboard=2"), - array('dashboard3', "?$urlBase#$generalParams&module=Dashboard&action=embeddedIndex&idDashboard=3"), - - // visitors pages (except real time map since it displays current time) - array('visitors_overview', "?$urlBase#$generalParams&module=VisitsSummary&action=index"), - array('visitors_visitorlog', "?$urlBase#$generalParams&module=Live&action=indexVisitorLog"), - array('visitors_devices', "?$urlBase#$generalParams&module=DevicesDetection&action=index"), - array('visitors_locations_provider', "?$urlBase#$generalParams&module=UserCountry&action=index"), - array('visitors_settings', "?$urlBase#$generalParams&module=UserSettings&action=index"), - array('visitors_times', "?$urlBase#$generalParams&module=VisitTime&action=index"), - array('visitors_engagement', "?$urlBase#$generalParams&module=VisitFrequency&action=index"), - array('visitors_custom_vars', "?$urlBase#$generalParams&module=CustomVariables&action=index"), - - // actions pages - array('actions_pages', "?$urlBase#$generalParams&module=Actions&action=indexPageUrls"), - array('actions_entry_pages', "?$urlBase#$generalParams&module=Actions&action=indexEntryPageUrls"), - array('actions_exit_pages', "?$urlBase#$generalParams&module=Actions&action=indexExitPageUrls"), - array('actions_page_titles', "?$urlBase#$generalParams&module=Actions&action=indexPageTitles"), - array('actions_site_search', "?$urlBase#$generalParams&module=Actions&action=indexSiteSearch"), - array('actions_outlinks', "?$urlBase#$generalParams&module=Actions&action=indexOutlinks"), - array('actions_downloads', "?$urlBase#$generalParams&module=Actions&action=indexDownloads"), - - // referrers pages - array('referrers_overview', "?$urlBase#$generalParams&module=Referers&action=index"), - array('referrers_search_engines_keywords', - "?$urlBase#$generalParams&module=Referers&action=getSearchEnginesAndKeywords"), - array('referrers_websites_social', "?$urlBase#$generalParams&module=Referers&action=indexWebsites"), - array('referrers_campaigns', "?$urlBase#$generalParams&module=Referers&action=indexCampaigns"), - - // goals pages - array('goals_ecommerce', - "?$urlBase#$generalParams&module=Goals&action=ecommerceReport&idGoal=ecommerceOrder"), - array('goals_overview', "?$urlBase#$generalParams&module=Goals&action=index"), - array('goals_individual_goal', "?$urlBase#$generalParams&module=Goals&action=goalReport&idGoal=1"), - - // one page w/ segment - array('visitors_overview_segment', - "?$urlBase#$generalParams&module=VisitsSummary&action=index&segment=$segment"), - - // widgetize - array("widgetize_visitor_log", - "?$widgetizeParams&$generalParams&moduleToWidgetize=Live&actionToWidgetize=getVisitorLog"), - array("widgetize_html_table", - "?$widgetizeParams&$generalParams&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry" - . "&viewDataTable=table"), - array("widgetize_goals_table", - "?$widgetizeParams&$generalParams&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry" - . "&viewDataTable=tableGoals"), - array("widgetize_goals_table_ecommerce", - "?$widgetizeParams&$generalParams&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry" - . "&viewDataTable=tableGoals&idGoal=ecommerceOrder"), - array("widgetize_goals_table_single", - "?$widgetizeParams&$generalParams&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry" - . "&viewDataTable=tableGoals&idGoal=1"), - array("widgetize_goals_table_full", - "?$widgetizeParams&$generalParams&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry" - . "&viewDataTable=tableGoals&idGoal=0"), - array("widgetize_all_columns_table", - "?$widgetizeParams&$generalParams&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry" - . "&viewDataTable=tableAllColumns"), - array("widgetize_pie_graph", - "?$widgetizeParams&$generalParams&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry" - . "&viewDataTable=graphPie"), - array("widgetize_bar_graph", - "?$widgetizeParams&$generalParams&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry" - . "&viewDataTable=graphVerticalBar"), - array("widgetize_evolution_graph", - "?$widgetizeParams&$evolutionParams&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry" - . "&viewDataTable=graphEvolution"), - array("widgetize_tag_cloud", - "?$widgetizeParams&$generalParams&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry" - . "&viewDataTable=cloud"), - array("widgetize_actions_search", - "?$widgetizeParams&$generalParams&moduleToWidgetize=Actions&actionToWidgetize=getPageUrls" - . "&filter_column_recursive=label&filter_pattern_recursive=i"), - array("widgetize_actions_flat", - "?$widgetizeParams&$generalParams&moduleToWidgetize=Actions&actionToWidgetize=getPageUrls" - . "&flat=1"), - array("widgetize_actions_excludelowpop", - "?$widgetizeParams&$generalParams&moduleToWidgetize=Actions&actionToWidgetize=getPageUrls" - . "&enable_filter_excludelowpop=1"), - - // row evolution - array("row_evolution_popup", - "?$widgetizeParams&moduleToWidgetize=CoreHome&actionToWidgetize=getRowEvolutionPopover" - . "&apiMethod=UserSettings.getBrowser&label=Chrome&disableLink=1&idSite=1&period=day" - . "&date=2012-08-11"), - array("multi_row_evolution_popup", - "?$widgetizeParams&moduleToWidgetize=CoreHome&actionToWidgetize=getMultiRowEvolutionPopover" - . "&label=" . urlencode("Chrome,Firefox") . "&apiMethod=UserSettings.getBrowser&idSite=1&period=day" - . "&date=2012-08-11&disableLink=1"), - ); - } - - /** - * @dataProvider getUrlsForTesting - * @group Integration - * @group UITests - */ - public function testUIUrl($name, $urlQuery) - { - // compare processed w/ expected - $this->compareScreenshot($name, $urlQuery); - } -} - -Test_Piwik_Integration_UIIntegrationTest::$fixture = new Test_Piwik_Fixture_ManySitesImportedLogsWithXssAttempts();
\ No newline at end of file diff --git a/tests/PHPUnit/UITest.php b/tests/PHPUnit/UITest.php index cadd50e350..4bc4aba9a9 100644 --- a/tests/PHPUnit/UITest.php +++ b/tests/PHPUnit/UITest.php @@ -26,10 +26,8 @@ abstract class UITest extends IntegrationTestCase public static function setUpBeforeClass() { - if (!self::isXvfbAvailable()) { - self::markTestSkipped("xvfb is not available, skipping UI integration tests. (install with 'sudo apt-get install xvfb')"); - } else if (self::CAPTURE_PROGRAM == 'slimerjs' - && !self::isSlimerJsAvailable() + if (self::CAPTURE_PROGRAM == 'slimerjs' + && !self::isSlimerJsAvailable() ) { self::markTestSkipped("slimerjs is not available, skipping UI integration tests. " . "(install by downloading http://slimerjs.org/download.html)"); @@ -51,17 +49,25 @@ abstract class UITest extends IntegrationTestCase // make sure processed & expected dirs exist self::makeDirsAndLinks(); - // run slimerjs/phantomjs w/ all urls so we only invoke it once - $urls = array(); - foreach (static::getUrlsForTesting() as $testInfo) { - list($name, $urlQuery) = $testInfo; + // run slimerjs/phantomjs w/ all urls so we only invoke it once per 25 entries (travis needs + // there to be output) + $urlsToTest = static::getUrlsForTesting(); - list($processedScreenshotPath, $expectedScreenshotPath) = self::getProcessedAndExpectedScreenshotPaths($name); - $urls[] = array($processedScreenshotPath, self::getProxyUrl() . $urlQuery); + reset($urlsToTest); + for ($i = 0; $i < count($urlsToTest); $i += 25) { + $urls = array(); + for ($j = $i; $j != $i + 25 && $j < count($urlsToTest); ++$j) { + list($name, $urlQuery) = current($urlsToTest); + + list($processedScreenshotPath, $expectedScreenshotPath) = self::getProcessedAndExpectedScreenshotPaths($name); + $urls[] = array($processedScreenshotPath, self::getProxyUrl() . $urlQuery); + + next($urlsToTest); + } + + echo "Generating screenshots...\n"; + self::runCaptureProgram($urls); } - - echo "Generating screenshots...\n"; - self::runCaptureProgram($urls); } public static function tearDownAfterClass() @@ -100,7 +106,6 @@ abstract class UITest extends IntegrationTestCase { file_put_contents(PIWIK_INCLUDE_PATH . '/tmp/urls.txt', json_encode($urlInfo)); $cmd = self::CAPTURE_PROGRAM . " \"" . PIWIK_INCLUDE_PATH . "/tests/resources/screenshot-capture/capture.js\" 2>&1"; - $cmd = 'xvfb-run --server-args="-screen 0, 1024x768x24" ' . $cmd; exec($cmd, $output, $result); $output = implode("\n", $output); @@ -140,11 +145,6 @@ abstract class UITest extends IntegrationTestCase return self::isProgramAvailable('phantomjs'); } - private static function isXvfbAvailable() - { - return self::isProgramAvailable('xvfb-run'); - } - private static function isProgramAvailable($name) { exec($name . ' --help 2>&1', $output, $result); @@ -176,7 +176,7 @@ abstract class UITest extends IntegrationTestCase private static function makeDirsAndLinks() { - $dirs = self::getProcessedAndExpectedDirs(); + $dirs = array_merge(self::getProcessedAndExpectedDirs(), array(PIWIK_INCLUDE_PATH . '/tmp/sessions')); foreach ($dirs as $dir) { if (!is_dir($dir)) { mkdir($dir); diff --git a/tests/resources/screenshot-capture/capture.js b/tests/resources/screenshot-capture/capture.js index d866803f70..9a0d0a4775 100644 --- a/tests/resources/screenshot-capture/capture.js +++ b/tests/resources/screenshot-capture/capture.js @@ -2,6 +2,8 @@ var fs = require('fs'); var app = typeof slimer === 'undefined' ? phantom : slimer; var readFileSync = fs.readFileSync || fs.read; +var VERBOSE = false; + var PageRenderer = function() { this.start = new Date(); @@ -11,6 +13,9 @@ var PageRenderer = function() { this.outputPath = ''; this.url = ''; + this.webpage = require('webpage').create(); + this._setupWebpageEvents(); + this._setScriptTimeout(); }; @@ -36,32 +41,21 @@ PageRenderer.prototype = { this.webpage = require('webpage').create(); this._setupWebpageEvents(); - + this.webpage.viewportSize = {width:1350, height:768}; - var self = this; - this.webpage.open(this.url, function () { - self._setPageTimeouts(); - }); + this.webpage.open(this.url); + this._setPageTimeouts(); }, _setPageTimeouts: function () { var url = this.url, self = this; - // in case there are no ajax requests, try triggering after a sec - setTimeout(function () { - if (url == self.url) { - self.webpage.evaluate(function () { - window.piwik.ajaxRequestFinished(); - }); - } - }, 1000) - // only allowed at most one minute to load setTimeout(function () { if (url == self.url) { self.webpage.evaluate(function () { - window.piwik._triggerRenderInsane(); + console.log("__AJAX_DONE__"); }); } }, 1000 * 60); @@ -88,6 +82,18 @@ PageRenderer.prototype = { console.log("LOGGED: " + message); } }; + + if (VERBOSE) { + this.webpage.onResourceReceived = function (response) { + console.log('Response (#' + response.id + ', stage "' + response.stage + '", size "' + response.bodySize + + '", status "' + response.status + '"): ' + response.url); + }; + } + + this.webpage.onResourceError = function (resourceError) { + console.log('Unable to load resource (#' + resourceError.id + 'URL:' + resourceError.url + ')'); + console.log('Error code: ' + resourceError.errorCode + '. Description: ' + resourceError.errorString); + }; }, _renderNextUrl: function () { @@ -114,7 +120,7 @@ PageRenderer.prototype = { setTimeout(function() { console.log("ERROR: Timed out!"); app.exit(1); - }, Math.max(1000 * 15 * this.urls.length, 1000 * 60 * 5)); + }, Math.max(1000 * 15 * this.urls.length, 1000 * 60 * 10)); }, }; diff --git a/tests/resources/screenshot-override/open_sans.woff b/tests/resources/screenshot-override/open_sans.woff Binary files differdeleted file mode 100644 index 55b25f8670..0000000000 --- a/tests/resources/screenshot-override/open_sans.woff +++ /dev/null diff --git a/tests/resources/screenshot-override/open_sans_b.woff b/tests/resources/screenshot-override/open_sans_b.woff Binary files differdeleted file mode 100644 index 27619e7cea..0000000000 --- a/tests/resources/screenshot-override/open_sans_b.woff +++ /dev/null diff --git a/tests/resources/screenshot-override/open_sans_bi.woff b/tests/resources/screenshot-override/open_sans_bi.woff Binary files differdeleted file mode 100644 index e12c3a9f27..0000000000 --- a/tests/resources/screenshot-override/open_sans_bi.woff +++ /dev/null diff --git a/tests/resources/screenshot-override/open_sans_i.woff b/tests/resources/screenshot-override/open_sans_i.woff Binary files differdeleted file mode 100644 index cedefb8f6f..0000000000 --- a/tests/resources/screenshot-override/open_sans_i.woff +++ /dev/null diff --git a/tests/resources/screenshot-override/override.css b/tests/resources/screenshot-override/override.css index 8bc65e63d3..e77c6174f5 100644 --- a/tests/resources/screenshot-override/override.css +++ b/tests/resources/screenshot-override/override.css @@ -1,28 +1 @@ -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 400; - src: url(tests/resources/screenshot-override/open_sans.woff) format('woff'); -} -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 700; - src: url(tests/resources/screenshot-override/open_sans_b.woff) format('woff'); -} -@font-face { - font-family: 'Open Sans'; - font-style: italic; - font-weight: 400; - src: url(tests/resources/screenshot-override/open_sans_i.woff) format('woff'); -} -@font-face { - font-family: 'Open Sans'; - font-style: italic; - font-weight: 700; - src: url(tests/resources/screenshot-override/open_sans_bi.woff) format('woff'); -} - -* { - font-family: 'Open Sans'; -}
\ No newline at end of file +/* empty */
\ No newline at end of file diff --git a/tests/resources/screenshot-override/override.js b/tests/resources/screenshot-override/override.js index c354d5ca13..aa3968e686 100644 --- a/tests/resources/screenshot-override/override.js +++ b/tests/resources/screenshot-override/override.js @@ -27,7 +27,7 @@ waitForAll: true, finished: function () { // wait some more to make sure other javascript is executed & the last image is rendered - setTimeout(triggerRender, 1000); + setTimeout(triggerRender, 10000); }, }); } @@ -38,4 +38,9 @@ window.piwik.ajaxRequestFinished = triggerRenderIfNoAjax; window.piwik._triggerRenderInsane = triggerRenderInsane; + // in case there are no ajax requests, try triggering after a couple secs + setTimeout(function () { + triggerRenderIfNoAjax(); + }, 5000); + }(jQuery));
\ No newline at end of file diff --git a/tests/travis/initiate_ui_tests.sh b/tests/travis/initiate_ui_tests.sh new file mode 100755 index 0000000000..fe2035de98 --- /dev/null +++ b/tests/travis/initiate_ui_tests.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# only initiate UI tests after integration tests for php 5.5 are completed +if [ "$TEST_SUITE" != "IntegrationTests" ] || [[ "$TRAVIS_PHP_VERSION" != 5\.5* ]]; then + echo "Not initiating UI tests (\$TEST_SUITE = $TEST_SUITE, \$TRAVIS_PHP_VERSION = $TRAVIS_PHP_VERSION)." + exit +fi + +if [ "$PIWIK_AUTOMATION" = "" ]; then + echo "Automation details are not present, skipping UI tests." + exit +fi + +git submodule update + +cd tests/PHPUnit/UI + +echo "$TRAVIS_COMMIT +$TRAVIS_BRANCH" > piwik_commit.txt + +git config --global user.email "hello@piwik.org" +git config --global user.name "Piwik Automation" + +git checkout master + +git add ./piwik_commit.txt +git commit -m "Travis: Initiating build for commit '$TRAVIS_COMMIT'." +git remote set-url origin "https://piwik-auto-commit-bot:$PIWIK_AUTOMATION@github.com/piwik/piwik-ui-tests.git" + +if ! git push origin master 2> /dev/null; then + echo "Failed to push!" + exit 1 +fi
\ No newline at end of file diff --git a/tests/travis/prepare.sh b/tests/travis/prepare.sh index 04f50f0354..35b66a9c6b 100755 --- a/tests/travis/prepare.sh +++ b/tests/travis/prepare.sh @@ -4,18 +4,11 @@ set -e # Install XMLStarlet sudo apt-get install -qq xmlstarlet -# Install phantomjs 1.9.1 for UI tests +# Install fonts for UI tests if [ "$TEST_DIR" = "UI" ]; then - cd tmp - wget "https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2" -O phantomjs.tar.bz2 - tar xvjf phantomjs.tar.bz2 - cd phantomjs* - export PATH=$PATH:`pwd`/bin - cd ../.. - - echo "Using phantomjs version:" - phantomjs --version + sudo sh -c "echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections" + sudo apt-get install -qq ttf-mscorefonts-installer fi # Copy Piwik configuration diff --git a/tests/travis/upload_artifacts.sh b/tests/travis/upload_artifacts.sh index 84cbab9efe..2519c53f67 100755 --- a/tests/travis/upload_artifacts.sh +++ b/tests/travis/upload_artifacts.sh @@ -14,7 +14,7 @@ then else if [ "$TEST_DIR" = "UI" ]; then - url="http://builds-artifacts.piwik.org/upload.php?auth_key=$ARTIFACTS_PASS&artifact_name=processed-ui-screenshots&branch=$TRAVIS_BRANCH&build_id=$TRAVIS_JOB_NUMBER" + url="http://builds-artifacts.piwik.org/upload.php?auth_key=$ARTIFACTS_PASS&artifact_name=processed-ui-screenshots&branch=ui-tests.$TRAVIS_BRANCH&build_id=$TRAVIS_JOB_NUMBER" echo "Uploading artifacts for $TEST_DIR..." |