Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthieu Napoli <matthieu@mnapoli.fr>2015-02-09 06:20:42 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2015-02-09 06:20:42 +0300
commit5723e93aaeeee34914abc41869c24a1e10476f31 (patch)
treec99491c32822281aab067f0ea9c5378623e80778 /tests
parent47772c937bf32baa1ad2af3dbf96e70354a64d59 (diff)
parent8a15d3a0ee47d24582843cd0c157d69ff16a8907 (diff)
Merge branch 'master' into removed-registry
Conflicts: CHANGELOG.md
Diffstat (limited to 'tests')
-rwxr-xr-xtests/PHPUnit/BenchmarkTestCase.php16
-rw-r--r--tests/PHPUnit/ConsoleCommandTestCase.php16
-rwxr-xr-xtests/PHPUnit/DatabaseTestCase.php21
-rw-r--r--tests/PHPUnit/FakeAccess.php18
-rw-r--r--tests/PHPUnit/Fixture.php31
-rw-r--r--tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php6
-rwxr-xr-xtests/PHPUnit/Framework/TestCase/SystemTestCase.php2
-rw-r--r--tests/PHPUnit/Integration/ArchiveTest.php134
-rw-r--r--tests/PHPUnit/Integration/Plugin/ManagerTest.php2
-rw-r--r--tests/PHPUnit/Integration/WidgetsListTest.php4
-rw-r--r--tests/PHPUnit/IntegrationTestCase.php22
-rwxr-xr-xtests/PHPUnit/System/BlobReportLimitingTest.php2
-rw-r--r--tests/PHPUnit/System/PivotByQueryParamTest.php2
-rw-r--r--tests/PHPUnit/System/expected/test_ImportLogs__UserLanguage.getLanguageCode_month.xml14
-rw-r--r--tests/PHPUnit/System/expected/test_ImportLogs__UserLanguage.getLanguage_month.xml14
-rw-r--r--tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__UserLanguage.getLanguageCode_day.xml13
-rw-r--r--tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__UserLanguage.getLanguage_day.xml13
-rw-r--r--tests/PHPUnit/System/expected/test_OneVisitor_LongUrlsTruncated__UserSettings.getPlugin_day.xml20
-rw-r--r--tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html8
-rw-r--r--tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getReportMetadata_day.xml16
-rw-r--r--tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html8
-rw-r--r--tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguageCode_day.xml10
-rw-r--r--tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguageCode_week.xml10
-rw-r--r--tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguage_day.xml10
-rw-r--r--tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguage_week.xml10
-rw-r--r--tests/PHPUnit/System/expected/test_noVisit__UserLanguage.getLanguageCode_day.xml2
-rw-r--r--tests/PHPUnit/System/expected/test_noVisit__UserLanguage.getLanguage_day.xml2
-rw-r--r--tests/PHPUnit/System/expected/test_reportLimiting__Resolution.getConfiguration_day.xml (renamed from tests/PHPUnit/System/expected/test_reportLimiting__UserSettings.getConfiguration_day.xml)0
-rw-r--r--tests/PHPUnit/System/expected/test_reportLimiting__Resolution.getResolution_day.xml (renamed from tests/PHPUnit/System/expected/test_reportLimiting__UserSettings.getResolution_day.xml)0
-rw-r--r--tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__Resolution.getConfiguration_day.xml (renamed from tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__UserSettings.getConfiguration_day.xml)0
-rw-r--r--tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__Resolution.getResolution_day.xml (renamed from tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__UserSettings.getResolution_day.xml)0
m---------tests/PHPUnit/UI0
-rw-r--r--tests/PHPUnit/Unit/DeprecatedMethodsTest.php4
-rw-r--r--tests/PHPUnit/bootstrap.php8
-rw-r--r--tests/README.screenshots.md193
-rw-r--r--tests/README.testing-data.md21
-rw-r--r--tests/UI/.gitignore10
-rw-r--r--tests/UI/Fixtures/UpdaterTestFixture.php21
-rw-r--r--tests/UI/config.dist.js (renamed from tests/lib/screenshot-testing/config.js)0
m---------tests/UI/expected-ui-screenshots0
-rw-r--r--tests/UI/resources/piwik1.0.sql.gzbin0 -> 249108 bytes
-rw-r--r--tests/UI/screenshot-diffs/diffgenerator.js58
-rw-r--r--tests/UI/screenshot-diffs/singlediff.html27
-rw-r--r--tests/UI/specs/ActionsDataTable_spec.js78
-rw-r--r--tests/UI/specs/BarGraph_spec.js33
-rw-r--r--tests/UI/specs/DBStats_spec.js20
-rw-r--r--tests/UI/specs/DashboardManager_spec.js52
-rw-r--r--tests/UI/specs/Dashboard_spec.js216
-rw-r--r--tests/UI/specs/EvolutionGraph_spec.js143
-rw-r--r--tests/UI/specs/GoalsTable_spec.js56
-rw-r--r--tests/UI/specs/Installation_spec.js136
-rw-r--r--tests/UI/specs/Login_spec.js98
-rw-r--r--tests/UI/specs/Menus_spec.js48
-rw-r--r--tests/UI/specs/Overlay_spec.js97
-rw-r--r--tests/UI/specs/PeriodSelector_spec.js89
-rw-r--r--tests/UI/specs/PieGraph_spec.js39
-rw-r--r--tests/UI/specs/PivotByDimension_spec.js40
-rw-r--r--tests/UI/specs/RowEvolution_spec.js65
-rw-r--r--tests/UI/specs/SegmentSelectorEditor_spec.js187
-rw-r--r--tests/UI/specs/SiteSelector_spec.js55
-rw-r--r--tests/UI/specs/Transitions_spec.js33
-rw-r--r--tests/UI/specs/UIIntegration_spec.js608
-rw-r--r--tests/UI/specs/Updater_spec.js37
-rw-r--r--tests/UI/specs/ViewDataTable_spec.js143
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_0_initial.pngbin19620 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_10_change_limit.pngbin28185 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_11_flattened.pngbin35957 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_12_aggregate_shown.pngbin37890 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_13_make_hierarchical.pngbin28185 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_14_visits_percent.pngbin33738 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_15_search.pngbin19324 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_1_all_columns.pngbin25255 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_2_column_sorted_desc.pngbin28463 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_3_column_sorted_asc.pngbin24571 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_4_exclude_low_population.pngbin24892 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_5_goals.pngbin29218 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_6_bar_graph.pngbin12645 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_7_pie_graph.pngbin26126 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_8_tag_cloud.pngbin30972 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_9_normal_table.pngbin36538 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_export_options.pngbin22297 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_related_report_click.pngbin19061 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_subtables_loaded.pngbin34649 -> 0 bytes
-rw-r--r--tests/lib/screenshot-testing/run-tests.js15
-rw-r--r--tests/lib/screenshot-testing/support/app.js6
-rw-r--r--tests/lib/screenshot-testing/support/diff-viewer.js4
-rw-r--r--tests/lib/screenshot-testing/support/globals.js2
-rw-r--r--tests/lib/screenshot-testing/support/page-renderer.js4
-rw-r--r--tests/resources/OmniFixture-dump.sql.gzbin656140 -> 656155 bytes
-rwxr-xr-xtests/travis/initiate_ui_tests.sh32
-rwxr-xr-xtests/travis/travis.sh2
-rwxr-xr-xtests/travis/upload_artifacts.sh4
92 files changed, 2714 insertions, 396 deletions
diff --git a/tests/PHPUnit/BenchmarkTestCase.php b/tests/PHPUnit/BenchmarkTestCase.php
deleted file mode 100755
index a067a3286a..0000000000
--- a/tests/PHPUnit/BenchmarkTestCase.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-/**
- * Piwik - free/libre analytics platform
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-
-/**
- * Base class for benchmarks.
- *
- * @deprecated since 2.10.0 use Piwik\Tests\Framework\TestCase\BenchmarkTestCase instead
- */
-abstract class BenchmarkTestCase extends \Piwik\Tests\Framework\TestCase\BenchmarkTestCase
-{
-}
diff --git a/tests/PHPUnit/ConsoleCommandTestCase.php b/tests/PHPUnit/ConsoleCommandTestCase.php
deleted file mode 100644
index 138e6e77eb..0000000000
--- a/tests/PHPUnit/ConsoleCommandTestCase.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-/**
- * Piwik - free/libre analytics platform
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-
-namespace Piwik\Tests;
-
-/**
- * @deprecated since 2.10.0 use \Piwik\Tests\Framework\TestCase\ConsoleCommandTestCase instead
- */
-class ConsoleCommandTestCase extends Framework\TestCase\ConsoleCommandTestCase
-{
-} \ No newline at end of file
diff --git a/tests/PHPUnit/DatabaseTestCase.php b/tests/PHPUnit/DatabaseTestCase.php
deleted file mode 100755
index 70a06ca303..0000000000
--- a/tests/PHPUnit/DatabaseTestCase.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-/**
- * Piwik - free/libre analytics platform
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-
-/**
- * @deprecated since 2.8.0 use \Piwik\Tests\Framework\TestCase\IntegrationTestCase instead
- */
-class DatabaseTestCase extends \Piwik\Tests\Framework\TestCase\IntegrationTestCase
-{
-
- public static function setUpBeforeClass()
- {
- \Piwik\Log::debug('\DatabaseTestCase is deprecated since 2.8.0 extend \Piwik\Tests\Framework\TestCase\IntegrationTestCase instead');
-
- parent::setUpBeforeClass();
- }
-}
diff --git a/tests/PHPUnit/FakeAccess.php b/tests/PHPUnit/FakeAccess.php
deleted file mode 100644
index 66f58c795b..0000000000
--- a/tests/PHPUnit/FakeAccess.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-/**
- * Piwik - free/libre analytics platform
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-
-use \Piwik\Tests\Framework\Mock\FakeAccess as MockFakeAccess;
-
-/**
- * FakeAccess for UnitTests
- *
- * @deprecated since 2.10.0 use \Piwik\Tests\Framework\Mock\FakeAccess instead
- */
-class FakeAccess extends MockFakeAccess
-{
-} \ No newline at end of file
diff --git a/tests/PHPUnit/Fixture.php b/tests/PHPUnit/Fixture.php
deleted file mode 100644
index 4d15574808..0000000000
--- a/tests/PHPUnit/Fixture.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Piwik - free/libre analytics platform
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-namespace Piwik\Tests;
-use Piwik\Log;
-
-/**
- * @deprecated since 2.8.0 use \Piwik\Tests\Framework\Fixture instead
- */
-class Fixture extends Framework\Fixture
-{
-
- /** Adds data to Piwik. Creates sites, tracks visits, imports log files, etc. */
- public function setUp()
- {
- Log::warning('Piwik\Tests\Fixture is deprecated, use \Piwik\Tests\Framework\Fixture instead');
-
- parent::setUp();
- }
-}
-
-/**
- * @deprecated since 2.8.0 use \Piwik\Tests\Framework\OverrideLogin instead
- */
-class OverrideLogin extends Framework\OverrideLogin
-{
-} \ No newline at end of file
diff --git a/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php b/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php
index 8381aea43f..bbd76f453f 100644
--- a/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php
+++ b/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php
@@ -56,6 +56,7 @@ abstract class IntegrationTestCase extends SystemTestCase
{
static::configureFixture(static::$fixture);
parent::setUpBeforeClass();
+ static::beforeTableDataCached();
self::$tableData = self::getDbTablesWithData();
}
@@ -98,6 +99,11 @@ abstract class IntegrationTestCase extends SystemTestCase
$fixture->createSuperUser = false;
$fixture->configureComponents = false;
}
+
+ protected static function beforeTableDataCached()
+ {
+ // empty
+ }
}
IntegrationTestCase::$fixture = new Fixture(); \ No newline at end of file
diff --git a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php
index d0932ec0cf..5826ab04ba 100755
--- a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php
+++ b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php
@@ -399,7 +399,7 @@ abstract class SystemTestCase extends PHPUnit_Framework_TestCase
* Assert that the response of an API method call is the same as the contents in an
* expected file.
*
- * @param string $api ie, `"UserSettings.getBrowser"`
+ * @param string $api ie, `"DevicesDetection.getBrowsers"`
* @param array $queryParams Query parameters to send to the API.
*/
public function assertApiResponseEqualsExpected($apiMethod, $queryParams)
diff --git a/tests/PHPUnit/Integration/ArchiveTest.php b/tests/PHPUnit/Integration/ArchiveTest.php
new file mode 100644
index 0000000000..b22a835f34
--- /dev/null
+++ b/tests/PHPUnit/Integration/ArchiveTest.php
@@ -0,0 +1,134 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+namespace Piwik\Tests\Integration;
+
+use Piwik\Archive;
+use Piwik\ArchiveProcessor\Rules;
+use Piwik\Common;
+use Piwik\Config;
+use Piwik\DataAccess\ArchiveTableCreator;
+use Piwik\Date;
+use Piwik\Db;
+use Piwik\Piwik;
+use Piwik\Tests\Fixtures\OneVisitorTwoVisits;
+use Piwik\Tests\Framework\Fixture;
+use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
+
+/**
+ * @group Core
+ */
+class ArchiveTest extends IntegrationTestCase
+{
+ /**
+ * @var OneVisitorTwoVisits
+ */
+ public static $fixture;
+
+ public function tearDown()
+ {
+ parent::tearDown();
+
+ unset($_GET['trigger']);
+ }
+
+ protected static function configureFixture($fixture)
+ {
+ $fixture->createSuperUser = true;
+ }
+
+ protected static function beforeTableDataCached()
+ {
+ $date = Date::factory('2010-03-01');
+
+ $archiveTableCreator = new ArchiveTableCreator();
+ $archiveTableCreator->getBlobTable($date);
+ $archiveTableCreator->getNumericTable($date);
+ }
+
+ public function getForceOptionsForForceArchivingOnBrowserRequest()
+ {
+ return array(
+ array(1),
+ array(null)
+ );
+ }
+
+ /**
+ * @dataProvider getForceOptionsForForceArchivingOnBrowserRequest
+ */
+ public function test_ArchivingIsLaunchedForRanges_WhenForceOnBrowserRequest_IsTruthy($optionValue)
+ {
+ $this->archiveDataForIndividualDays();
+
+ Config::getInstance()->General['archiving_range_force_on_browser_request'] = $optionValue;
+ Rules::setBrowserTriggerArchiving(false);
+
+ $data = $this->initiateArchivingForRange();
+
+ $this->assertNotEmpty($data);
+ $this->assertArchiveTablesAreNotEmpty('2010_03');
+ }
+
+ public function test_ArchivingIsNotLaunchedForRanges_WhenForceOnBrowserRequest_IsFalse()
+ {
+ $this->archiveDataForIndividualDays();
+
+ Config::getInstance()->General['archiving_range_force_on_browser_request'] = 0;
+ Rules::setBrowserTriggerArchiving(false);
+
+ $data = $this->initiateArchivingForRange();
+
+ $this->assertEmpty($data);
+ $this->assertArchiveTablesAreEmpty('2010_03');
+ }
+
+ public function test_ArchiveIsLaunched_WhenForceOnBrowserRequest_IsFalse_AndArchivePhpTriggered()
+ {
+ $this->archiveDataForIndividualDays();
+
+ Config::getInstance()->General['archiving_range_force_on_browser_request'] = 0;
+ $_GET['trigger'] = 'archivephp';
+ Rules::setBrowserTriggerArchiving(false);
+
+ $data = $this->initiateArchivingForRange();
+
+ $this->assertNotEmpty($data);
+ $this->assertArchiveTablesAreNotEmpty('2010_03');
+ }
+
+ private function assertArchiveTablesAreNotEmpty($tableMonth)
+ {
+ $this->assertNotEquals(0, $this->getRangeArchiveTableCount('archive_numeric', $tableMonth));
+ }
+
+ private function assertArchiveTablesAreEmpty($tableMonth)
+ {
+ $this->assertEquals(0, $this->getRangeArchiveTableCount('archive_numeric', $tableMonth));
+ $this->assertEquals(0, $this->getRangeArchiveTableCount('archive_blob', $tableMonth));
+ }
+
+ private function getRangeArchiveTableCount($tableType, $tableMonth)
+ {
+ $table = Common::prefixTable($tableType . '_' . $tableMonth);
+ return Db::fetchOne("SELECT COUNT(*) FROM $table WHERE period = " . Piwik::$idPeriods['range']);
+ }
+
+ private function initiateArchivingForRange()
+ {
+ $archive = Archive::build(self::$fixture->idSite, 'range', '2010-03-04,2010-03-07');
+ return $archive->getNumeric('nb_visits');
+ }
+
+ private function archiveDataForIndividualDays()
+ {
+ $archive = Archive::build(self::$fixture->idSite, 'day', '2010-03-04,2010-03-07');
+ return $archive->getNumeric('nb_visits');
+ }
+}
+
+ArchiveTest::$fixture = new OneVisitorTwoVisits(); \ No newline at end of file
diff --git a/tests/PHPUnit/Integration/Plugin/ManagerTest.php b/tests/PHPUnit/Integration/Plugin/ManagerTest.php
index e9bd4ad801..e05c259cda 100644
--- a/tests/PHPUnit/Integration/Plugin/ManagerTest.php
+++ b/tests/PHPUnit/Integration/Plugin/ManagerTest.php
@@ -55,7 +55,7 @@ class ManagerTest extends IntegrationTestCase
public function test_loadTrackerPlugins_shouldBeAbleToLoadPluginsCorrectWhenItIsCached()
{
- $pluginsToLoad = array('CoreHome', 'UserSettings', 'Login', 'CoreAdminHome');
+ $pluginsToLoad = array('CoreHome', 'UserLanguage', 'Login', 'CoreAdminHome');
$this->getCacheForTrackerPlugins()->save($this->trackerCacheId, $pluginsToLoad);
$pluginsToLoad = $this->manager->loadTrackerPlugins();
diff --git a/tests/PHPUnit/Integration/WidgetsListTest.php b/tests/PHPUnit/Integration/WidgetsListTest.php
index 22967a9d2d..340bb9abed 100644
--- a/tests/PHPUnit/Integration/WidgetsListTest.php
+++ b/tests/PHPUnit/Integration/WidgetsListTest.php
@@ -41,11 +41,11 @@ class WidgetsListTest extends IntegrationTestCase
'VisitsSummary_VisitsSummary' => 6,
'Live!' => 4,
'General_Visitors' => 12,
- 'UserSettings_VisitorSettings' => 5,
+ 'General_VisitorSettings' => 5,
'General_Actions' => 10,
'Events_Events' => 3,
'Actions_SubmenuSitesearch' => 5,
- 'Referrers_Referrers' => 7,
+ 'Referrers_Referrers' => 7,
'Goals_Goals' => 1,
'SEO' => 2,
'Example Widgets' => 4,
diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php
deleted file mode 100644
index 47c2f16bff..0000000000
--- a/tests/PHPUnit/IntegrationTestCase.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-/**
- * Piwik - free/libre analytics platform
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-
-/**
- * @deprecated since 2.8.0 extend \Piwik\Tests\Framework\TestCase\SystemTestCase instead
- */
-class IntegrationTestCase extends \Piwik\Tests\Framework\TestCase\SystemTestCase
-{
- public static function setUpBeforeClass()
- {
- \Piwik\Log::debug('\IntegrationTestCase is deprecated since 2.8.0 extend \Piwik\Tests\Framework\TestCase\SystemTestCase instead');
-
- parent::setUpBeforeClass();
- }
-}
-
-IntegrationTestCase::$fixture = new \Piwik\Tests\Framework\Fixture();
diff --git a/tests/PHPUnit/System/BlobReportLimitingTest.php b/tests/PHPUnit/System/BlobReportLimitingTest.php
index b539e111b8..f40305d1ad 100755
--- a/tests/PHPUnit/System/BlobReportLimitingTest.php
+++ b/tests/PHPUnit/System/BlobReportLimitingTest.php
@@ -37,7 +37,7 @@ class BlobReportLimitingTest extends SystemTestCase
'CustomVariables.getCustomVariables',
'Referrers.getReferrerType', 'Referrers.getKeywords', 'Referrers.getSearchEngines',
'Referrers.getWebsites', 'Referrers.getAll', /* TODO 'Referrers.getCampaigns', */
- 'UserSettings.getResolution', 'UserSettings.getConfiguration', 'DevicesDetection.getOsVersions',
+ 'Resolution.getResolution', 'Resolution.getConfiguration', 'DevicesDetection.getOsVersions',
'DevicesDetection.getBrowserVersions',
'UserCountry.getRegion', 'UserCountry.getCity',
);
diff --git a/tests/PHPUnit/System/PivotByQueryParamTest.php b/tests/PHPUnit/System/PivotByQueryParamTest.php
index e07ab83280..099f82fcf6 100644
--- a/tests/PHPUnit/System/PivotByQueryParamTest.php
+++ b/tests/PHPUnit/System/PivotByQueryParamTest.php
@@ -125,7 +125,7 @@ class PivotByQueryParamTest extends SystemTestCase
$this->markTestSkipped("Not working right now.");
- $this->assertApiResponseEqualsExpected("UserSettings.getBrowser", array( // should have logo metadata in output
+ $this->assertApiResponseEqualsExpected("DevicesDetection.getBrowsers", array( // should have logo metadata in output
'idSite' => self::$fixture->idSite,
'date' => Date::factory(self::$fixture->dateTime)->toString(),
'period' => 'week',
diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__UserLanguage.getLanguageCode_month.xml b/tests/PHPUnit/System/expected/test_ImportLogs__UserLanguage.getLanguageCode_month.xml
new file mode 100644
index 0000000000..55b8fea073
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_ImportLogs__UserLanguage.getLanguageCode_month.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <label>Unknown (xx)</label>
+ <nb_visits>35</nb_visits>
+ <nb_actions>40</nb_actions>
+ <max_actions>3</max_actions>
+ <sum_visit_length>550</sum_visit_length>
+ <bounce_count>31</bounce_count>
+ <nb_visits_converted>31</nb_visits_converted>
+ <sum_daily_nb_uniq_visitors>34</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>2</sum_daily_nb_users>
+ </row>
+</result> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__UserLanguage.getLanguage_month.xml b/tests/PHPUnit/System/expected/test_ImportLogs__UserLanguage.getLanguage_month.xml
new file mode 100644
index 0000000000..b8dd5583e4
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_ImportLogs__UserLanguage.getLanguage_month.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <label>Unknown</label>
+ <nb_visits>35</nb_visits>
+ <nb_actions>40</nb_actions>
+ <max_actions>3</max_actions>
+ <sum_visit_length>550</sum_visit_length>
+ <bounce_count>31</bounce_count>
+ <nb_visits_converted>31</nb_visits_converted>
+ <sum_daily_nb_uniq_visitors>34</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>2</sum_daily_nb_users>
+ </row>
+</result> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__UserLanguage.getLanguageCode_day.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__UserLanguage.getLanguageCode_day.xml
new file mode 100644
index 0000000000..b5d5e44542
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__UserLanguage.getLanguageCode_day.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <label>French (fr)</label>
+ <nb_uniq_visitors>1</nb_uniq_visitors>
+ <nb_visits>2</nb_visits>
+ <nb_actions>8</nb_actions>
+ <max_actions>7</max_actions>
+ <sum_visit_length>1621</sum_visit_length>
+ <bounce_count>1</bounce_count>
+ <nb_visits_converted>2</nb_visits_converted>
+ </row>
+</result> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__UserLanguage.getLanguage_day.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__UserLanguage.getLanguage_day.xml
new file mode 100644
index 0000000000..a1a81bcc68
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__UserLanguage.getLanguage_day.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <label>French</label>
+ <nb_uniq_visitors>1</nb_uniq_visitors>
+ <nb_visits>2</nb_visits>
+ <nb_actions>8</nb_actions>
+ <max_actions>7</max_actions>
+ <sum_visit_length>1621</sum_visit_length>
+ <bounce_count>1</bounce_count>
+ <nb_visits_converted>2</nb_visits_converted>
+ </row>
+</result> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_OneVisitor_LongUrlsTruncated__UserSettings.getPlugin_day.xml b/tests/PHPUnit/System/expected/test_OneVisitor_LongUrlsTruncated__UserSettings.getPlugin_day.xml
new file mode 100644
index 0000000000..000a410083
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_OneVisitor_LongUrlsTruncated__UserSettings.getPlugin_day.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <label>Cookie</label>
+ <nb_visits>7</nb_visits>
+ <nb_visits_percentage>100%</nb_visits_percentage>
+ <logo>plugins/DevicePlugins/images/plugins/cookie.gif</logo>
+ </row>
+ <row>
+ <label>Flash</label>
+ <nb_visits>7</nb_visits>
+ <nb_visits_percentage>100%</nb_visits_percentage>
+ <logo>plugins/DevicePlugins/images/plugins/flash.gif</logo>
+ </row>
+ <row>
+ <label>Autres</label>
+ <nb_visits>7</nb_visits>
+ <nb_visits_percentage>100%</nb_visits_percentage>
+ </row>
+</result> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html
index 7bdeab9d38..1442ad9c23 100644
--- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html
+++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html
@@ -60,12 +60,12 @@
</a>
</li>
<li>
- <a href="#UserSettings_getLanguage" style="text-decoration:none; color: rgb(13,13,13);">
+ <a href="#UserLanguage_getLanguage" style="text-decoration:none; color: rgb(13,13,13);">
Browser language
</a>
</li>
<li>
- <a href="#UserSettings_getLanguageCode" style="text-decoration:none; color: rgb(13,13,13);">
+ <a href="#UserLanguage_getLanguageCode" style="text-decoration:none; color: rgb(13,13,13);">
Language code
</a>
</li>
@@ -2208,7 +2208,7 @@
<a style="text-decoration:none; color: rgb(13,13,13); font-size: 9pt;" href="#reportTop">
Back to top
</a>
-<h2 id="UserSettings_getLanguage" style="color: rgb(13,13,13); font-size: 24pt; font-weight:normal;">
+<h2 id="UserLanguage_getLanguage" style="color: rgb(13,13,13); font-size: 24pt; font-weight:normal;">
Browser language
</h2>
@@ -2291,7 +2291,7 @@
<a style="text-decoration:none; color: rgb(13,13,13); font-size: 9pt;" href="#reportTop">
Back to top
</a>
-<h2 id="UserSettings_getLanguageCode" style="color: rgb(13,13,13); font-size: 24pt; font-weight:normal;">
+<h2 id="UserLanguage_getLanguageCode" style="color: rgb(13,13,13); font-size: 24pt; font-weight:normal;">
Language code
</h2>
diff --git a/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getReportMetadata_day.xml b/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getReportMetadata_day.xml
index c358cad903..efa250ecf4 100644
--- a/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getReportMetadata_day.xml
+++ b/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getReportMetadata_day.xml
@@ -269,7 +269,7 @@
<row>
<category>Visitor Settings</category>
<name>Browser language</name>
- <module>UserSettings</module>
+ <module>UserLanguage</module>
<action>getLanguage</action>
<dimension>Language</dimension>
<metrics>
@@ -290,14 +290,14 @@
<bounce_rate>Bounce Rate</bounce_rate>
<conversion_rate>Conversion Rate</conversion_rate>
</processedMetrics>
- <imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=UserSettings&amp;apiAction=getLanguage&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
- <imageGraphEvolutionUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=UserSettings&amp;apiAction=getLanguage&amp;period=day&amp;date=2008-12-06,2009-01-04</imageGraphEvolutionUrl>
- <uniqueId>UserSettings_getLanguage</uniqueId>
+ <imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=UserLanguage&amp;apiAction=getLanguage&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
+ <imageGraphEvolutionUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=UserLanguage&amp;apiAction=getLanguage&amp;period=day&amp;date=2008-12-06,2009-01-04</imageGraphEvolutionUrl>
+ <uniqueId>UserLanguage_getLanguage</uniqueId>
</row>
<row>
<category>Visitor Settings</category>
<name>Language code</name>
- <module>UserSettings</module>
+ <module>UserLanguage</module>
<action>getLanguageCode</action>
<dimension>Language</dimension>
<metrics>
@@ -318,9 +318,9 @@
<bounce_rate>Bounce Rate</bounce_rate>
<conversion_rate>Conversion Rate</conversion_rate>
</processedMetrics>
- <imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=UserSettings&amp;apiAction=getLanguageCode&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
- <imageGraphEvolutionUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=UserSettings&amp;apiAction=getLanguageCode&amp;period=day&amp;date=2008-12-06,2009-01-04</imageGraphEvolutionUrl>
- <uniqueId>UserSettings_getLanguageCode</uniqueId>
+ <imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=UserLanguage&amp;apiAction=getLanguageCode&amp;period=day&amp;date=2009-01-04</imageGraphUrl>
+ <imageGraphEvolutionUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=UserLanguage&amp;apiAction=getLanguageCode&amp;period=day&amp;date=2008-12-06,2009-01-04</imageGraphEvolutionUrl>
+ <uniqueId>UserLanguage_getLanguageCode</uniqueId>
</row>
<row>
<category>API</category>
diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html
index 7792107689..6b23888c12 100644
--- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html
+++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html
@@ -60,12 +60,12 @@
</a>
</li>
<li>
- <a href="#UserSettings_getLanguage" style="text-decoration:none; color: rgb(13,13,13);">
+ <a href="#UserLanguage_getLanguage" style="text-decoration:none; color: rgb(13,13,13);">
Browser language
</a>
</li>
<li>
- <a href="#UserSettings_getLanguageCode" style="text-decoration:none; color: rgb(13,13,13);">
+ <a href="#UserLanguage_getLanguageCode" style="text-decoration:none; color: rgb(13,13,13);">
Language code
</a>
</li>
@@ -2199,7 +2199,7 @@
<a style="text-decoration:none; color: rgb(13,13,13); font-size: 9pt;" href="#reportTop">
Back to top
</a>
-<h2 id="UserSettings_getLanguage" style="color: rgb(13,13,13); font-size: 24pt; font-weight:normal;">
+<h2 id="UserLanguage_getLanguage" style="color: rgb(13,13,13); font-size: 24pt; font-weight:normal;">
Browser language
</h2>
@@ -2282,7 +2282,7 @@
<a style="text-decoration:none; color: rgb(13,13,13); font-size: 9pt;" href="#reportTop">
Back to top
</a>
-<h2 id="UserSettings_getLanguageCode" style="color: rgb(13,13,13); font-size: 24pt; font-weight:normal;">
+<h2 id="UserLanguage_getLanguageCode" style="color: rgb(13,13,13); font-size: 24pt; font-weight:normal;">
Language code
</h2>
diff --git a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguageCode_day.xml b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguageCode_day.xml
new file mode 100644
index 0000000000..106f23f16b
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguageCode_day.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<results>
+ <result date="2009-01-04" />
+ <result date="2009-01-05" />
+ <result date="2009-01-06" />
+ <result date="2009-01-07" />
+ <result date="2009-01-08" />
+ <result date="2009-01-09" />
+ <result date="2009-01-10" />
+</results> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguageCode_week.xml b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguageCode_week.xml
new file mode 100644
index 0000000000..5cfb246edc
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguageCode_week.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<results>
+ <result date="From 2008-12-29 to 2009-01-04" />
+ <result date="From 2009-01-05 to 2009-01-11" />
+ <result date="From 2009-01-12 to 2009-01-18" />
+ <result date="From 2009-01-19 to 2009-01-25" />
+ <result date="From 2009-01-26 to 2009-02-01" />
+ <result date="From 2009-02-02 to 2009-02-08" />
+ <result date="From 2009-02-09 to 2009-02-15" />
+</results> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguage_day.xml b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguage_day.xml
new file mode 100644
index 0000000000..106f23f16b
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguage_day.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<results>
+ <result date="2009-01-04" />
+ <result date="2009-01-05" />
+ <result date="2009-01-06" />
+ <result date="2009-01-07" />
+ <result date="2009-01-08" />
+ <result date="2009-01-09" />
+ <result date="2009-01-10" />
+</results> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguage_week.xml b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguage_week.xml
new file mode 100644
index 0000000000..5cfb246edc
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__UserLanguage.getLanguage_week.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<results>
+ <result date="From 2008-12-29 to 2009-01-04" />
+ <result date="From 2009-01-05 to 2009-01-11" />
+ <result date="From 2009-01-12 to 2009-01-18" />
+ <result date="From 2009-01-19 to 2009-01-25" />
+ <result date="From 2009-01-26 to 2009-02-01" />
+ <result date="From 2009-02-02 to 2009-02-08" />
+ <result date="From 2009-02-09 to 2009-02-15" />
+</results> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_noVisit__UserLanguage.getLanguageCode_day.xml b/tests/PHPUnit/System/expected/test_noVisit__UserLanguage.getLanguageCode_day.xml
new file mode 100644
index 0000000000..c234bed59e
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_noVisit__UserLanguage.getLanguageCode_day.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result /> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_noVisit__UserLanguage.getLanguage_day.xml b/tests/PHPUnit/System/expected/test_noVisit__UserLanguage.getLanguage_day.xml
new file mode 100644
index 0000000000..c234bed59e
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_noVisit__UserLanguage.getLanguage_day.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result /> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_reportLimiting__UserSettings.getConfiguration_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting__Resolution.getConfiguration_day.xml
index b90214c2e9..b90214c2e9 100644
--- a/tests/PHPUnit/System/expected/test_reportLimiting__UserSettings.getConfiguration_day.xml
+++ b/tests/PHPUnit/System/expected/test_reportLimiting__Resolution.getConfiguration_day.xml
diff --git a/tests/PHPUnit/System/expected/test_reportLimiting__UserSettings.getResolution_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting__Resolution.getResolution_day.xml
index 7b29bb6e65..7b29bb6e65 100644
--- a/tests/PHPUnit/System/expected/test_reportLimiting__UserSettings.getResolution_day.xml
+++ b/tests/PHPUnit/System/expected/test_reportLimiting__Resolution.getResolution_day.xml
diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__UserSettings.getConfiguration_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__Resolution.getConfiguration_day.xml
index b90214c2e9..b90214c2e9 100644
--- a/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__UserSettings.getConfiguration_day.xml
+++ b/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__Resolution.getConfiguration_day.xml
diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__UserSettings.getResolution_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__Resolution.getResolution_day.xml
index 7b29bb6e65..7b29bb6e65 100644
--- a/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__UserSettings.getResolution_day.xml
+++ b/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__Resolution.getResolution_day.xml
diff --git a/tests/PHPUnit/UI b/tests/PHPUnit/UI
deleted file mode 160000
-Subproject 5d9d1d6691b4f0ebeb0496c3daa077d59200a9d
diff --git a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php
index 94e265c9a1..ffc1418631 100644
--- a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php
+++ b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php
@@ -20,7 +20,7 @@ use ReflectionClass;
*/
class DeprecatedMethodsTest extends \PHPUnit_Framework_TestCase
{
- public function test_version2_0_4()
+ public function test_deprecations()
{
$validTill = '2015-02-25';
$this->assertDeprecatedMethodIsRemoved('\Piwik\Period', 'factory', $validTill);
@@ -65,6 +65,8 @@ class DeprecatedMethodsTest extends \PHPUnit_Framework_TestCase
$this->assertDeprecatedMethodIsRemoved('Piwik\Plugins\UserSettings\API', 'getResolution', $validTill);
$this->assertDeprecatedMethodIsRemoved('Piwik\Plugins\UserSettings\API', 'getConfiguration', $validTill);
$this->assertDeprecatedMethodIsRemoved('Piwik\Plugins\UserSettings\API', 'getPlugin', $validTill);
+ $this->assertDeprecatedMethodIsRemoved('Piwik\Plugins\UserSettings\API', 'getLanguage', $validTill);
+ $this->assertDeprecatedMethodIsRemoved('Piwik\Plugins\UserSettings\API', 'getLanguageCode', $validTill);
$this->assertDeprecatedMethodIsRemoved('Piwik\Plugins\UserSettings\UserSettings', 'renameDeprecatedModuleAndAction', $validTill);
$this->assertDeprecatedMethodIsRemovedInPiwik3('\Piwik\Menu\MenuAbstract', 'add');
diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php
index 2795dc89ac..3e1cd4aa2f 100644
--- a/tests/PHPUnit/bootstrap.php
+++ b/tests/PHPUnit/bootstrap.php
@@ -34,10 +34,7 @@ if (!defined('PIWIK_INCLUDE_SEARCH_PATH')) {
require_once PIWIK_INCLUDE_PATH . '/core/bootstrap.php';
-require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/DatabaseTestCase.php';
-require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/IntegrationTestCase.php';
-require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/BenchmarkTestCase.php';
-require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/FakeAccess.php';
+require_once PIWIK_INCLUDE_PATH . '/libs/PiwikTracker/PiwikTracker.php';
require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/TestingEnvironment.php';
if (getenv('PIWIK_USE_XHPROF') == 1) {
@@ -49,7 +46,7 @@ StaticContainer::setEnvironment('test');
// require test fixtures
$fixturesToLoad = array(
- '/tests/PHPUnit/UI/Fixtures/*.php',
+ '/tests/UI/Fixtures/*.php',
'/plugins/*/tests/Fixtures/*.php',
'/plugins/*/Test/Fixtures/*.php',
);
@@ -117,6 +114,7 @@ Try again.";
// The SQL error is for Travis...
|| strpos($response, 'Table &#039;piwik_tests.option&#039; doesn&#039;t exist') !== false
|| strpos($response, 'Table &#039;piwik_tests.piwiktests_option&#039; doesn&#039;t exist') !== false
+ || strpos($response, 'Unknown database &#039;piwik_tests&#039;') !== false
) {
return;
diff --git a/tests/README.screenshots.md b/tests/README.screenshots.md
index 675d534cee..da3f7fd7a3 100644
--- a/tests/README.screenshots.md
+++ b/tests/README.screenshots.md
@@ -1,9 +1,10 @@
# Screenshots UI tests
Piwik contains UI tests that compare captured screenshots of URLs and UI controls with expected screenshots.
-If a captured screenshot does not match its expected screenshot, the build will fail.
+If a captured screenshot does not match its expected screenshot, the build will fail.
-Read on to learn how to run, manage and create screenshot tests.
+For a plugin developer documentation have a look here: https://developer.piwik.org/guides/tests-ui
+The remaining part of this document is rather Piwik Core Developer related.
## Fixing a broken build
@@ -18,7 +19,7 @@ then you should update the expected screenshots accordingly.
To fix a broken build, follow these steps:
- * Go to the UI tests travis build: [https://travis-ci.org/piwik/piwik-ui-tests](https://travis-ci.org/piwik/piwik-ui-tests)
+ * Go to the Tests travis build: [https://travis-ci.org/piwik/piwik](https://travis-ci.org/piwik/piwik) and select the build containing `TEST_SUITE=UITests`
* Find the build you are interested in. The UI tests build will be run for each commit in each branch, so if you're
looking to resolve a specific failure, you'll have to find the build for the commit you've made.
* In the build output, at the beginning of the test output, there will be a link to a image diff viewer. It will look something
@@ -32,71 +33,22 @@ To fix a broken build, follow these steps:
* If a change is not wanted, revert or fix your commit.
* If a change is correct, then you can set the new screenshot as the expected screenshot.
To do so, in the diffviewer.html page click on the "Processed" link for this screenshot.
- Then "Save this file as" and save it in the piwik/tests/PHPUnit/UI/expected-ui-screenshots/ directory.
+ Then "Save this file as" and save it in the piwik/tests/UI/expected-ui-screenshots/ directory.
(If the screenshot test is for a plugin and not Piwik Core, the expected screenshot should be added to the
plugin's expected screenshot directory. For example: piwik/plugins/DBStats/tests/UI/expected-ui-screenshots.)
_Note: When determining whether a screenshot is correct, the data displayed is not important. Report data correctness is verified through System and other PHP tests. The UI tests should only test UI behavior._
* Push the changes (to your code and/or to the expected-ui-screenshots directory.
- * Wait for next UI Tests build [on travis](https://travis-ci.org/piwik/piwik-ui-tests). Hopefully, the build should be green!
+ * Wait for next Test build [on travis](https://travis-ci.org/piwik/piwik). Hopefully, the build should be green!
_Note: the **development:sync-ui-test-screenshots** console command can be used to speed up the process. Run **./console help development:sync-ui-test-screenshots** to learn more._
-## <a name="setup"></a>Setup screenshots tests on your dev box
-
-These tests are in another repository but are included in Piwik as a submodule. To get the tests, run the following commands:
-
- $ git submodule init
- $ git submodule update
-
-In order to run UI tests, you need to have [phantomjs](http://phantomjs.org) version 1.9.0 or greater
-installed on your machine. You can download phantomjs [here](http://phantomjs.org/download.html). phantomjs is headless, so even if you're on a server without the X window system, you can still run the UI tests.
-
-To generate screenshots identical to those generated by Travis, we install some extra fonts. On Ubuntu run:
-
- $ sudo apt-get install ttf-mscorefonts-installer imagemagick imagemagick-doc
-
-Imagick is used to generate the "difference" screenshots which show which pixels have changed.
-
-Removing this font may be useful if your generated screenshots' fonts do not match the expected screenshots:
-
- $ sudo apt-get remove ttf-bitstream-vera
-
-### Configuring screenshot testing library
-
-The screenshot testing library's configuration resides in the tests/lib/screenshot-testing/config.js file.
-If your development environment's PHP executable isn't named `php`
-or your dev Piwik install isn't at `http://localhost/` you may need to edit the contents of this file.
-
-For example if Piwik is setup at `http://localhost/piwik` modify the config.js such as:
-```
-exports.piwikUrl = "http://localhost/piwik/";
-exports.phpServer = {
- HTTP_HOST: 'localhost',
- REQUEST_URI: '/piwik/',
- REMOTE_ADDR: '127.0.0.1'
-};
-
-```
-
## <a name="run-tests"></a>Running Tests
You can test the UI by running the following command in the root piwik directory:
$ ./console tests:run-ui
-This will run every UI test in Piwik Core as well as in each plugin directory.
-
-To run a single test, run:
-
- $ ./console tests:run-ui TestName
-
-where **TestName** is the name of a mocha test specification. For example, to run the tests within the Dashboard\_spec.js, run:
-
- $ ./console tests:run-ui Dashboard
-
-The test names to use is determined by the test itself in the calls to `describe(...`.
-
The following options may be useful if you plan on running the UI tests locally often:
* **--persist-fixture-data**: This will save the test data in a separate database so the setup only has to be run once.
@@ -104,136 +56,3 @@ The following options may be useful if you plan on running the UI tests locally
* **--drop**: If you've used --persist-fixture-data and need to re-setup the separate data, use this option with --persist-fixture-data.
* **--keep-symlinks**: If you want to visit the URLs of captured pages in a browser to diagnose failures use this option.
This will keep the recursive symlinks in tests/PHPUnit/proxy.
-
-## Writing Tests
-
-UI screenshot tests are run directly by phantomjs and are written using [mocha](http://visionmedia.github.io/mocha/) and [chai](http://chaijs.com).
-
-To create a new test, first decide whether it will belong to Piwik Core or a plugin. If it will belong to Piwik Core, the test should be placed within the [piwik-ui-tests](https://github.com/piwik/piwik-ui-tests) repository. Otherwise, it should be placed within tests/UI sub-directory of your plugin.
-
-All test files should have \_spec.js file name suffixes (for example, **ActionsDataTable\_spec.js**).
-
-Tests should be written using [BDD](http://en.wikipedia.org/wiki/Behavior-driven_development) style, for example:
-
- describe("TheControlImTesting", function () {
- // ...
- });
-
-Since screenshots can take a while to capture, you will want to override mocha's default timeout like this:
-
- describe("TheControlImTesting", function () {
- this.timeout(0);
-
- // ...
- });
-
-Each test should use Piwik's special chai extension to capture and compare screenshots:
-
- describe("TheControlImTesting", function () {
- this.timeout(0);
-
- var url = // ...
-
- it("should load correctly", function (done) {
- expect.screenshot("screenshot_name").to.be.capture(function (page) {
- page.load(url);
- }, done);
- });
- });
-
-If you want to compare a screenshot against an already existing expected screenshot you can do the following:
-
- it("should load correctly", function (done) {
- expect.screenshot("screenshot_to_comapre_against", "OptionalPrefix").to.be.capture("processed_screenshot_name", function (page) {
- page.load(url);
- }, done);
- });
-
-If you want to compare only parts (all content within an element / selector) of a page you can do the following:
-
- it("should load correctly", function (done) {
- expect.screenshot("screenshot_name").to.be.captureSelector("#content", function (page) {
- page.load(url);
- }, done);
- });
-
-If you want to compare a screenshot against an already existing expected screenshot and capture a selector you can do the following:
-
- it("should load correctly", function (done) {
- expect.screenshot("screenshot_name").to.be.captureSelector("processed_screenshot_name", "#content", function (page) {
- page.load(url);
- }, done);
- });
-
-### <a name="manipulating-pages"></a>Manipulating Pages Before Capture
-
-The callback supplied to the `capture()` function accepts one argument: the page renderer. You can use this object to queue events to be sent to the page before taking a screenshot. For example:
-
- .capture(function (page) {
- page.click('.myDropDown');
- page.mouseMove('.someOtherElement');
- }, done);
-
-After each event the page renderer will wait for all AJAX requests to finish and for all images to load and then will wait 1s longer for any JavaScript to finish. If you want to wait longer, you can supply an extra wait time (in milliseconds) to the event queuing call:
-
- .capture(function (page) {
- page.click('.something');
- page.click('.myReallyLongRunningJavaScriptFunctionButton', 10000); // will wait for 10s
- }, done);
-
-_Note: phantomjs has its quirks and you may have to hack around to get certain behavior to work. For example, clicking a &lt;select&gt; will not open the dropdown, so dropdowns have to be manipulated via JavaScript within the page (ie, the .evaluate() method)._
-
-**Page Renderer Object Methods**
-
-The page renderer object has the following methods:
-
- * **click(selector, [modifiers], [waitTime])**: Sends a click to the element referenced by `selector`. Modifiers is an array of strings that can be used to specify keys that are pressed at the same time. Currently only `'shift'` is supported.
- * **mouseMove(selector, [waitTime])**: Sends a mouse move event to the element referenced by `selector`.
- * **mousedown(selector, [waitTime])**: Sends a mouse down event to the element referenced by `selector`.
- * **mouseup(selector, [waitTime])**: Sends a mouse up event to the element referenced by `selector`.
- * **sendKeys(selector, keyString, [waitTime])**: Clicks an element to bring it into focus and then simulates typing a string of keys.
- * **sendMouseEvent(type, pos. [waitTime])**: Sends a mouse event by name to a specific position. `type` is the name of an event that phantomjs will recognize. `pos` is a point, eg, `{x: 0, y: 0}`.
- * **dragDrop(selectorStart, selectorEnd, waitTime)**: Performs a drag/drop of an element (mousedown, mousemove, mouseup) from the element referenced by `selectorStart` and the element referenced by `selectorEnd`.
- * **wait([waitTime])**: Waits without doing anything.
- * **load(url, [waitTime])**: Loads a URL.
- * **reload([waitTime])**: Reloads the current URL.
- * **evaluate(impl, [waitTime])**: Evaluates a function (`impl`) within a webpage. `impl` is an actual function, not a string and must take no arguments.
-
-All **selector**s are jQuery selectors, so you can use jQuery only filters such as `:eq`.
-
-All events are real events, not synthetic DOM events.
-
-### Manipulating the Test Environment
-
-Sometimes it will be necessary to manipulate Piwik for testing purposes. You may want to remove randomness, manipulate data or simulate certain situations (such as there being no config.ini.php file). This section describes how you can do that.
-
-**In your screenshot tests,** use the global **testEnvironment** object. You can use this object to call Piwik API methods using the **callApi(method, params, callback)** method and to call Piwik Controller methods using the **callController(method, params, callback)** method.
-
-You can communicate with PHP code by setting data on the testEnvironment object and calling **save()**, for example:
-
- testEnvironment.myTestVar = "abcdefg";
- testEnvironment.save();
-
-This data will be loaded by the **TestingEnvironment** PHP class.
-
-**In your Piwik plugin,** handle the **TestingEnvironment.addHooks** event and use the data in the TestingEnvironment object. for example:
-
- // event handler in a plugin descriptor class
- public function addTestHooks($testingEnvironment) {
- if ($testingEnvironment->myTestVar) {
- // ...
- }
- }
-
-_Note: the Piwik environment is not initialized when the **TestingEnvironment.addHooks** event is fired, so attempts to use the Config and other objects may fail. It is best to use Piwik::addAction to inject logic._
-
-The following are examples of test environment manipulation:
-
- * [Overlay_spec.js](https://github.com/piwik/piwik-ui-tests/blob/master/specs/Overlay_spec.js)
- * [Dashboard_spec.js](https://github.com/piwik/piwik-ui-tests/blob/master/specs/Dashboard_spec.js)
- * [Login_spec.js](https://github.com/piwik/piwik-ui-tests/blob/master/specs/Login_spec.js)
-
-## Learn more
-
-Check out this blog post to learn more about Screenshot Tests in Piwik:
-[QA Screenshot Testing blog post](http://piwik.org/blog/2013/10/our-latest-improvement-to-qa-screenshot-testing/)
diff --git a/tests/README.testing-data.md b/tests/README.testing-data.md
index 63431a3966..2f926b3966 100644
--- a/tests/README.testing-data.md
+++ b/tests/README.testing-data.md
@@ -1,16 +1,9 @@
As a developer it may be useful to generate test data. Follow these steps:
-1. Install Piwik
-2. Create a site with URL http://piwik.org/
-3. Create a Goal eg. URL Contains "blog"
-4. Import data from an anonimized test log file in piwik/tests/resources/ directory. Run the following command:
-
- $ python /home/piwik/misc/log-analytics/import_logs.py --url=http://localhost/path/ --idsite=1 --enable-http-errors --enable-http-redirects --enable-static --enable-bots /path/to/piwik/tests/resources/access.log-dev-anon-9-days-nov-2012.log.bz2
-
- This will import 9 days worth of data from Nov 20th-Nov 29th 2012.
-
-5. You can then archive the reports with:
-
- $ php5 /home/piwik/console core:archive --url=http://localhost/path/
-
-You should now have some interesting data to test with in November 2012!
+* Install Piwik, for help see [Setting up Piwik](http://developer.piwik.org/guides/getting-started-part-1#getting-setup-to-extend-piwik)
+* Install and activate the `VisitorGenerator` plugin via the Marketplace if needed
+* Generate websites `./console visitorgenerator:generate-websites --limit=50`
+* Generate users `./console visitorgenerator:generate-users --limit=50`
+* Generate goals for a website `./console visitorgenerator:generate-goals --idsite=1`
+* Generate visits for a website `./console visitorgenerator:generate-visits --idsite=1`
+* Trigger the archiving in case browser archiving is disabled `./console core:archive --url=http://localhost/path/`
diff --git a/tests/UI/.gitignore b/tests/UI/.gitignore
new file mode 100644
index 0000000000..7ad59df613
--- /dev/null
+++ b/tests/UI/.gitignore
@@ -0,0 +1,10 @@
+processed-ui-screenshots/*.png
+processed-ui-screenshots/**/*.png
+processed-ui-screenshots
+screenshot-diffs/*.png
+screenshot-diffs/diff*.html
+screenshot-diffs/jquery.js
+screenshot-diffs/resemble.js
+.idea/*
+php_errors.log
+config.js \ No newline at end of file
diff --git a/tests/UI/Fixtures/UpdaterTestFixture.php b/tests/UI/Fixtures/UpdaterTestFixture.php
new file mode 100644
index 0000000000..e2b3a0024e
--- /dev/null
+++ b/tests/UI/Fixtures/UpdaterTestFixture.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+namespace Piwik\Tests\Fixtures;
+
+class UpdaterTestFixture extends SqlDump
+{
+ public function performSetUp($setupEnvironmentOnly = false)
+ {
+ $this->dumpUrl = PIWIK_INCLUDE_PATH . "/tests/UI/resources/piwik1.0.sql.gz";
+ $this->dropDatabaseInSetUp = true;
+ $this->resetPersistedFixture = true;
+
+ parent::performSetUp($setupEnvironmentOnly);
+ }
+} \ No newline at end of file
diff --git a/tests/lib/screenshot-testing/config.js b/tests/UI/config.dist.js
index 93aa763cf1..93aa763cf1 100644
--- a/tests/lib/screenshot-testing/config.js
+++ b/tests/UI/config.dist.js
diff --git a/tests/UI/expected-ui-screenshots b/tests/UI/expected-ui-screenshots
new file mode 160000
+Subproject e7b90c0fbdeb9eace9f57271b8218eb31c02cb4
diff --git a/tests/UI/resources/piwik1.0.sql.gz b/tests/UI/resources/piwik1.0.sql.gz
new file mode 100644
index 0000000000..dbaf9ec1e0
--- /dev/null
+++ b/tests/UI/resources/piwik1.0.sql.gz
Binary files differ
diff --git a/tests/UI/screenshot-diffs/diffgenerator.js b/tests/UI/screenshot-diffs/diffgenerator.js
new file mode 100644
index 0000000000..78063a6674
--- /dev/null
+++ b/tests/UI/screenshot-diffs/diffgenerator.js
@@ -0,0 +1,58 @@
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * Diff generator
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+resemble.outputSettings({
+ errorColor: {
+ red: 255,
+ green: 0,
+ blue: 0,
+ alpha: 125
+ },
+ errorType: 'movement',
+ transparency: 0.3
+});
+
+function compareImages(expected, expectedGithub, processed)
+{
+ resemble(processed).compareTo(expected).onComplete(function(data){
+
+ var info = 'Mismatch percentage: ' + data.misMatchPercentage + '%';
+
+ if (data.dimensionDifference && !data.isSameDimensions) {
+ info += ' Dimension difference width: ' + data.dimensionDifference.width + ' height: ' + data.dimensionDifference.height;
+ }
+
+ $('.info').text(info);
+ $('.diff').attr('src', data.getImageDataUrl());
+ });
+
+ $('.processed').attr('src', encodeURI(processed));
+ $('.expected').attr('src', encodeURI(expected));
+ $('.expectedGithub').attr('src', 'https://raw.githubusercontent.com/piwik/piwik-ui-tests/master/' + encodeURI(expectedGithub));
+}
+
+function getUrlQueryParam(sParam) {
+ var query = window.location.search.substring(1);
+ var variables = query.split('&');
+
+ for (var index = 0; index < variables.length; index++) {
+
+ var paramName = variables[index].split('=');
+ if (paramName[0] == sParam) {
+ return paramName[1];
+ }
+ }
+}
+
+$(function () {
+ var processed = getUrlQueryParam('processed');
+ var expected = getUrlQueryParam('expected');
+ var github = getUrlQueryParam('github');
+ compareImages(expected, github, processed);
+}); \ No newline at end of file
diff --git a/tests/UI/screenshot-diffs/singlediff.html b/tests/UI/screenshot-diffs/singlediff.html
new file mode 100644
index 0000000000..a91ffa7a40
--- /dev/null
+++ b/tests/UI/screenshot-diffs/singlediff.html
@@ -0,0 +1,27 @@
+<html>
+<head>
+ <!-- loaded when on build-artifacts -->
+ <script src='jquery.js'></script>
+ <script src='resemble.js'></script>
+ <!-- loaded when viewing within piwik -->
+ <script src='../../../../libs/bower_components/jquery/dist/jquery.min.js'></script>
+ <script src='../../../../tests/lib/resemblejs/resemble.js'></script>
+ <script src='diffgenerator.js'></script>
+</head>
+<body>
+
+<span class="info"></span>
+<br />
+<br />
+<img class="diff">
+
+<h2>Processed</h2>
+<img class="processed">
+
+<h2>Expected</h2>
+<img class="expected">
+
+<h2>Expected GitHub</h2>
+<img class="expectedGithub">
+
+</body></html> \ No newline at end of file
diff --git a/tests/UI/specs/ActionsDataTable_spec.js b/tests/UI/specs/ActionsDataTable_spec.js
new file mode 100644
index 0000000000..71969c49c3
--- /dev/null
+++ b/tests/UI/specs/ActionsDataTable_spec.js
@@ -0,0 +1,78 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * ActionsDataTable screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("ActionsDataTable", function () {
+ this.timeout(0);
+
+ var url = "?module=Widgetize&action=iframe&idSite=1&period=year&date=2012-08-09&moduleToWidgetize=Actions&actionToWidgetize=getPageUrls&isFooterExpandedInDashboard=1";
+
+ it("should load correctly", function (done) {
+ expect.screenshot('initial').to.be.capture(function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should sort column correctly when column header clicked", function (done) {
+ expect.screenshot('column_sorted').to.be.capture(function (page) {
+ page.click('th#avg_time_on_page');
+ }, done);
+ });
+
+ it("should load subtables correctly when row clicked", function (done) {
+ expect.screenshot('subtables_loaded').to.be.capture(function (page) {
+ page.click('tr.subDataTable:first');
+ page.click('tr.subDataTable:eq(2)');
+ }, done);
+ });
+
+ it("should flatten table when flatten link clicked", function (done) {
+ expect.screenshot('flattened').to.be.capture(function (page) {
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableFlatten');
+ }, done);
+ });
+
+ // Test is skipped as it randomly fails http://builds-artifacts.piwik.org/ui-tests.master/2433.1/screenshot-diffs/diffviewer.html
+ it.skip("should exclude low population rows when exclude low population link clicked", function (done) {
+ expect.screenshot('exclude_low_population').to.be.capture(function (page) {
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableExcludeLowPopulation');
+ }, done);
+ });
+
+ it("should load normal view when switch to view hierarchical view link is clicked", function (done) {
+ expect.screenshot('unflattened').to.be.capture(function (page) {
+ // exclude low population (copied from exclude_low_population test above as it was 'skipped')
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableExcludeLowPopulation');
+
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableFlatten');
+ }, done);
+ });
+
+ it("should display pageview percentages when hovering over pageviews column", function (done) {
+ expect.screenshot('pageview_percentages').to.be.capture(function (page) {
+ page.mouseMove('tr:eq(2) td.column:first');
+ }, done);
+ });
+
+ it("should display unique pageview percentages when hovering over unique pageviews column", function (done) {
+ expect.screenshot('unique_pageview_percentages').to.be.capture(function (page) {
+ page.mouseMove('tr:eq(2) td.column:eq(1)');
+ }, done);
+ });
+
+ it("should search through table when search input entered and search button clicked", function (done) {
+ expect.screenshot('search').to.be.capture(function (page) {
+ page.sendKeys('.dataTableSearchPattern>input[type=text]', 'i');
+ page.click('.dataTableSearchPattern>input[type=submit]');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/BarGraph_spec.js b/tests/UI/specs/BarGraph_spec.js
new file mode 100644
index 0000000000..0acdd15662
--- /dev/null
+++ b/tests/UI/specs/BarGraph_spec.js
@@ -0,0 +1,33 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Bar graph screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("BarGraph", function () {
+ this.timeout(0);
+
+ var url = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=year&date=2012-08-09&"
+ + "actionToWidgetize=getKeywords&viewDataTable=graphVerticalBar&isFooterExpandedInDashboard=1";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("load").to.be.capture(function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should display the metric picker on hover of metric picker icon", function (done) {
+ expect.screenshot('metric_picker_shown').to.be.capture(function (page) {
+ page.mouseMove('.jqplot-seriespicker');
+ }, done);
+ });
+
+ it("should display multiple metrics when another metric picked", function (done) {
+ expect.screenshot('other_metric').to.be.capture(function (page) {
+ page.click('.jqplot-seriespicker-popover input:not(:checked)');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/DBStats_spec.js b/tests/UI/specs/DBStats_spec.js
new file mode 100644
index 0000000000..81b815e14f
--- /dev/null
+++ b/tests/UI/specs/DBStats_spec.js
@@ -0,0 +1,20 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Screenshot tests for the DBStats plugin.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("DBStats", function () {
+ this.timeout(0);
+
+ var url = "?module=DBStats&action=index&idSite=1&period=day&date=yesterday";
+
+ it("should load correctly", function (done) {
+ expect.screenshot('admin_page').to.be.captureSelector('#content', function (page) {
+ page.load(url);
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/DashboardManager_spec.js b/tests/UI/specs/DashboardManager_spec.js
new file mode 100644
index 0000000000..9ada832b83
--- /dev/null
+++ b/tests/UI/specs/DashboardManager_spec.js
@@ -0,0 +1,52 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Dashboard manager screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("DashboardManager", function () {
+
+ this.timeout(0);
+
+ var selectorToCapture = '.dashboard-manager';
+ var url = "?module=CoreHome&action=index&idSite=1&period=day&date=2012-01-01";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("loaded").to.be.captureSelector(selectorToCapture, function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should expand when clicked", function (done) {
+ expect.screenshot("expanded").to.be.captureSelector(selectorToCapture, function (page) {
+ page.click('.dashboard-manager');
+ }, done);
+ });
+
+ it("should show widget for a category when category label hovered", function (done) {
+ expect.screenshot("widget_list_shown").to.be.captureSelector(selectorToCapture, function (page) {
+ page.mouseMove('.widgetpreview-categorylist>li:contains(Live!)'); // have to mouse move twice... otherwise Live! will just be highlighted
+ page.mouseMove('.widgetpreview-categorylist>li:contains(Visits Summary)');
+ }, done);
+ });
+
+ it("should load a widget preview when a widget is hovered", function (done) {
+ expect.screenshot("widget_preview").to.be.captureSelector(selectorToCapture, function (page) {
+ page.mouseMove('.widgetpreview-widgetlist>li:contains(Visits Over Time)');
+ }, done);
+ });
+
+ it("should close the manager when a widget is selected", function (done) {
+ expect.screenshot("loaded").to.be.captureSelector("widget_selected", selectorToCapture, function (page) {
+ // make sure selecting a widget does nothing
+ page.evaluate(function () {
+ $('.dashboard-manager').data('uiControlObject').widgetSelected = function () {};
+ });
+
+ page.click('.widgetpreview-widgetlist>li:contains(Visits Over Time)');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Dashboard_spec.js b/tests/UI/specs/Dashboard_spec.js
new file mode 100644
index 0000000000..b485943449
--- /dev/null
+++ b/tests/UI/specs/Dashboard_spec.js
@@ -0,0 +1,216 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Dashboard screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+// TODO: should move this & dashboard manager test to Dashboard plugin
+describe("Dashboard", function () {
+ this.timeout(0);
+
+ var url = "?module=Widgetize&action=iframe&idSite=1&period=year&date=2012-08-09&moduleToWidgetize=Dashboard&"
+ + "actionToWidgetize=index&idDashboard=5";
+
+ var removeAllExtraDashboards = function (done) {
+ testEnvironment.callController("Dashboard.getAllDashboards", {}, function (err, dashboards) {
+ dashboards = (dashboards || []).filter(function (dash) {
+ return parseInt(dash.iddashboard) > 5;
+ });
+
+ var removeDashboard = function (i) {
+ if (i >= dashboards.length) {
+ done();
+ return;
+ }
+
+ console.log("Removing dashboard ID = " + dashboards[i].iddashboard);
+ testEnvironment.callController("Dashboard.removeDashboard", {idDashboard: dashboards[i].iddashboard}, function () {
+ removeDashboard(i + 1);
+ });
+ };
+
+ removeDashboard(0);
+ });
+ };
+
+ var setup = function (done) {
+ // save empty layout for dashboard ID = 5
+ var layout = [
+ [
+ {
+ uniqueId: "widgetVisitsSummarygetEvolutionGraphcolumnsArray",
+ parameters: {module: "VisitsSummary", action: "getEvolutionGraph", columns: "nb_visits"}
+ }
+ ],
+ [],
+ []
+ ];
+
+ // TODO: should probably include an async lib
+ testEnvironment.callController("Dashboard.saveLayout", {name: 'D4', layout: JSON.stringify(layout), idDashboard: 5, idSite: 2}, function () {
+ // reset default widget selection
+ testEnvironment.callController("Dashboard.saveLayoutAsDefault", {layout: 0}, function () {
+ removeAllExtraDashboards(done);
+ });
+ });
+ };
+
+ before(setup);
+ after(setup);
+
+ it("should load correctly", function (done) {
+ expect.screenshot("loaded").to.be.capture(function (page) {
+ page.load(url, 5000);
+ }, done);
+ });
+
+ it("should move a widget when widget is drag & dropped", function (done) {
+ expect.screenshot("widget_move").to.be.capture(function (page) {
+ page.mousedown('.widgetTop');
+ page.mouseMove('#dashboardWidgetsArea > .col:eq(2)');
+ page.mouseup('#dashboardWidgetsArea > .col:eq(2)');
+ }, done);
+ });
+
+ it("should refresh widget when widget refresh icon clicked", function (done) {
+ expect.screenshot("widget_move").to.be.capture("widget_refresh", function (page) {
+ page.mouseMove('.widgetTop');
+ page.click('.button#refresh');
+ page.mouseMove('.dashboard-manager'); // let widget top hide again
+ }, done);
+ });
+
+ it("should minimise widget when widget minimise icon clicked", function (done) {
+ expect.screenshot("widget_minimised").to.be.capture(function (page) {
+ page.mouseMove('.widgetTop');
+ page.click('.button#minimise');
+ }, done);
+ });
+
+ it("should unminimise widget when widget maximise icon is clicked after being minimised", function (done) {
+ expect.screenshot("widget_move").to.be.capture("widget_unminimised", function (page) {
+ page.mouseMove('.widgetTop');
+ page.click('.button#maximise');
+ page.mouseMove('.dashboard-manager'); // let widget top hide again
+ }, done);
+ });
+
+ it("should maximise widget when widget maximise icon is clicked", function (done) {
+ expect.screenshot("widget_maximise").to.be.capture(function (page) {
+ page.mouseMove('.widgetTop');
+ page.click('.button#maximise');
+ }, done);
+ });
+
+ it("should close maximise dialog when minimise icon is clicked", function (done) {
+ expect.screenshot("widget_move").to.be.capture("widget_unmaximise", function (page) {
+ page.mouseMove('.widgetTop');
+ page.click('.button#minimise');
+ page.mouseMove('.dashboard-manager'); // let widget top hide again
+ }, done);
+ });
+
+ it("should add a widget when a widget is selected in the dashboard manager", function (done) {
+ expect.screenshot("widget_add_widget").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+
+ page.mouseMove('.widgetpreview-categorylist>li:contains(Live!)'); // have to mouse move twice... otherwise Live! will just be highlighted
+ page.mouseMove('.widgetpreview-categorylist>li:contains(Visits Summary)');
+
+ page.mouseMove('.widgetpreview-widgetlist>li:contains(Visits by Local Time)');
+
+ page.click('.widgetpreview-widgetlist>li:contains(Visits by Local Time)');
+ }, done);
+ });
+
+ it("should remove widget when remove widget icon is clicked", function (done) {
+ expect.screenshot("widget_move").to.be.capture("widget_removed", function (page) {
+ page.mouseMove('#widgetVisitTimegetVisitInformationPerLocalTime .widgetTop');
+ page.click('#widgetVisitTimegetVisitInformationPerLocalTime .button#close');
+ page.click('.ui-dialog button>span:contains(Yes)');
+ page.mouseMove('.dashboard-manager');
+ }, done);
+ });
+
+ it("should change dashboard layout when new layout is selected", function (done) {
+ expect.screenshot("change_layout").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+ page.click('li[data-action=showChangeDashboardLayoutDialog]');
+ page.click('div[layout=50-50]');
+ page.click('.ui-dialog button>span:contains(Save)', 3000);
+ }, done);
+ });
+
+ it("should rename dashboard when dashboard rename process completed", function (done) {
+ expect.screenshot("rename").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+ page.click('li[data-action=renameDashboard]');
+ page.evaluate(function () {
+ $('#newDashboardName').val('');
+ });
+ page.sendKeys('#newDashboardName', 'newname');
+
+ // sending a mouse event doesn't seem to work...
+ page.click('.ui-dialog[aria-describedby=renameDashboardConfirm] button>span:contains(Save)');
+ }, done);
+ });
+
+ it("should copy dashboard successfully when copy dashboard process completed", function (done) {
+ expect.screenshot("copied").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+ page.click('li[data-action=copyDashboardToUser]');
+ page.evaluate(function () {
+ $('#copyDashboardName').val('');
+ });
+ page.sendKeys('#copyDashboardName', 'newdash');
+ page.evaluate(function () {
+ $('#copyDashboardUser').val('superUserLogin');
+ });
+ page.click('.ui-dialog button>span:contains(Ok)');
+
+ page.load(url.replace("idDashboard=5", "idDashboard=6"));
+ }, done);
+ });
+
+ it("should reset dashboard when reset dashboard process completed", function (done) {
+ expect.screenshot("reset").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+ page.click('li[data-action=resetDashboard]');
+ page.click('.ui-dialog button>span:contains(Yes)', 10000);
+ page.mouseMove('.dashboard-manager');
+ }, done);
+ });
+
+ it("should remove dashboard when remove dashboard process completed", function (done) {
+ expect.screenshot("removed").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+ page.click('li[data-action=removeDashboard]');
+ page.click('.ui-dialog[aria-describedby=removeDashboardConfirm] button>span:contains(Yes)');
+ page.mouseMove('.dashboard-manager');
+ page.evaluate(function () {
+ $('.widgetTop').removeClass('widgetTopHover');
+ });
+ }, done);
+ });
+
+ it("should not fail when default widget selection changed", function (done) {
+ expect.screenshot("default_widget_selection_changed").to.be.capture(function (page) {
+ page.load(url);
+ page.click('.dashboard-manager');
+ page.click('li[data-action=setAsDefaultWidgets]');
+ page.click('.ui-dialog button>span:contains(Yes)');
+ }, done);
+ });
+
+ it("should create new dashboard with new default widget selection when create dashboard process completed", function (done) {
+ expect.screenshot("create_new").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+ page.click('li[data-action=createDashboard]');
+ page.sendKeys('#createDashboardName', 'newdash2');
+ page.click('.ui-dialog[aria-describedby=createDashboardConfirm] button>span:contains(Yes)');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/EvolutionGraph_spec.js b/tests/UI/specs/EvolutionGraph_spec.js
new file mode 100644
index 0000000000..c6576516a2
--- /dev/null
+++ b/tests/UI/specs/EvolutionGraph_spec.js
@@ -0,0 +1,143 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * evolution graph screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("EvolutionGraph", function () {
+ this.timeout(0);
+
+ var url = "?module=Widgetize&action=iframe&idSite=1&period=day&date=2012-01-31&evolution_day_last_n=30"
+ + "&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry&viewDataTable=graphEvolution"
+ + "&isFooterExpandedInDashboard=1";
+
+ before(function (done) {
+ testEnvironment.callApi("Annotations.deleteAll", {idSite: 3}, done);
+ });
+
+ it("should load correctly", function (done) {
+ expect.screenshot('initial').to.be.capture(function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should show percent metrics like bounce rate correctly", function (done) {
+ expect.screenshot('bounce_rate').to.be.capture(function (page) {
+ page.load(url + "&columns=nb_visits,bounce_rate&filter_add_columns_when_show_all_columns=0");
+ }, done);
+ });
+
+ it("should show only one series when a label is specified", function (done) {
+ expect.screenshot('one_series').to.be.capture(function (page) {
+ page.load(url + "&label=Canada");
+ }, done);
+ });
+
+ it("should display the metric picker on hover of metric picker icon", function (done) {
+ expect.screenshot('metric_picker_shown').to.be.capture(function (page) {
+ page.mouseMove('.jqplot-seriespicker');
+ }, done);
+ });
+
+ it("should show multiple metrics when another metric picked", function (done) {
+ expect.screenshot('two_metrics').to.be.capture(function (page) {
+ page.click('.jqplot-seriespicker-popover input:not(:checked)');
+ }, done);
+ });
+
+ it("should show graph as image when export as image icon clicked", function (done) {
+ expect.screenshot('export_image').to.be.capture(function (page) {
+ page.click('#dataTableFooterExportAsImageIcon>a');
+ }, done);
+ });
+
+ it("should display more periods when limit selection changed", function (done) {
+ expect.screenshot('limit_changed').to.be.capture(function (page) {
+ page.click('.limitSelection');
+ page.evaluate(function () {
+ $('.limitSelection ul li[value=60]').click();
+ });
+ }, done);
+ });
+
+ // annotations tests
+ it("should show annotations when annotation icon on x-axis clicked", function (done) {
+ expect.screenshot('annotations_single_period').to.be.capture(function (page) {
+ page.evaluate(function () {
+ $('.limitSelection ul li[value=30]').click(); // change limit back
+ });
+
+ page.click('.evolution-annotations>span[data-count!=0]', 3000);
+ }, done);
+ });
+
+ it("should show all annotations when annotations footer link clicked", function (done) {
+ expect.screenshot('annotations_all').to.be.capture(function (page) {
+ page.click('.annotationView', 3000);
+ }, done);
+ });
+
+ it("should show no annotations message when no annotations for site", function (done) {
+ expect.screenshot('annotations_none').to.be.capture(function (page) {
+ page.load(page.getCurrentUrl().replace(/idSite=[^&]*/, "idSite=3") + "&columns=nb_visits");
+ page.click('.annotationView', 3000);
+ }, done);
+ });
+
+ it("should show add annotation form when create annotation clicked", function (done) {
+ expect.screenshot('new_annotation_form').to.be.capture(function (page) {
+ page.click('.add-annotation');
+ page.click('.annotation-period-edit>a');
+ page.evaluate(function () {
+ $('.datepicker').datepicker("setDate", new Date(2012,0,02) );
+ $(".ui-datepicker-current-day").trigger("click"); // this triggers onSelect event which sets .annotation-period-edit>a
+ });
+ }, done);
+ });
+
+ it("should add new annotation when create annotation submitted", function (done) {
+ expect.screenshot('new_annotation_submit').to.be.capture(function (page) {
+ page.sendKeys('.new-annotation-edit', 'new annotation');
+ page.click('.annotation-period-edit>a');
+ page.evaluate(function () {
+ $('.ui-datepicker-calendar td a:contains(15)').click();
+ });
+ page.click('.annotation-list-range');
+ page.click('input.new-annotation-save', 3000);
+ }, done);
+ });
+
+ it("should star annotation when star image clicked", function (done) {
+ expect.screenshot('annotation_starred').to.be.capture(function (page) {
+ page.click('.annotation-star');
+ }, done);
+ });
+
+ it("should show edit annotation form", function (done) {
+ expect.screenshot('annotation_edit_form').to.be.capture(function (page) {
+ page.click('.edit-annotation');
+ }, done);
+ });
+
+ it("should edit annotation when edit form submitted", function (done) {
+ expect.screenshot('annotation_edit_submit').to.be.capture(function (page) {
+ page.sendKeys('.annotation-edit', 'edited annotation');
+ page.click('.annotation-period-edit>a');
+ page.evaluate(function () {
+ $('.ui-datepicker-calendar td a:contains(16)').click();
+ });
+ page.click('.annotation-list-range');
+ page.click('input.annotation-save', 3000);
+ }, done);
+ });
+
+ it("should delete annotation when delete link clicked", function (done) {
+ expect.screenshot('annotation_delete').to.be.capture(function (page) {
+ page.click('.edit-annotation');
+ page.click('.delete-annotation');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/GoalsTable_spec.js b/tests/UI/specs/GoalsTable_spec.js
new file mode 100644
index 0000000000..d74b036367
--- /dev/null
+++ b/tests/UI/specs/GoalsTable_spec.js
@@ -0,0 +1,56 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * GoalsTable screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("GoalsTable", function () {
+ this.timeout(0);
+
+ var url = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=year&date=2012-08-09&"
+ + "actionToWidgetize=getKeywords&viewDataTable=table&filter_limit=5&isFooterExpandedInDashboard=1";
+
+ it("should load when the goals icon is clicked", function (done) {
+ expect.screenshot('initial').to.be.capture(function (page) {
+ page.load(url);
+ page.click('.tableIconsGroup a[data-footer-icon-id=tableGoals]');
+ }, done);
+ });
+
+ it("should show columns for all goals when idGoal is 0", function (done) {
+ expect.screenshot('goals_table_full').to.be.capture(function (page) {
+ var url = page.getCurrentUrl().replace(/viewDataTable=[^&]*/, "viewDataTable=tableGoals") + "&idGoal=0";
+ page.load(url);
+ }, done);
+ });
+
+ it("should show columns for a single goal when idGoal is 1", function (done) {
+ expect.screenshot('goals_table_single').to.be.capture(function (page) {
+ page.load(page.getCurrentUrl().replace(/idGoal=[^&]*/, "idGoal=1"));
+ }, done);
+ });
+
+ it("should show an ecommerce view when idGoal is ecommerceOrder", function (done) {
+ expect.screenshot('goals_table_ecommerce').to.be.capture(function (page) {
+ page.load(page.getCurrentUrl().replace(/idGoal=[^&]*/, "idGoal=ecommerceOrder"));
+ }, done);
+ });
+
+ it("should show a special view when idGoal is ecommerceOrder and viewDataTable is ecommerceOrder", function (done) {
+ expect.screenshot('goals_table_ecommerce_view').to.be.capture(function (page) {
+ var url = page.getCurrentUrl().replace(/moduleToWidgetize=[^&]*/, "moduleToWidgetize=Goals")
+ .replace(/actionToWidgetize=[^&]*/, "actionToWidgetize=getItemsSku")
+ .replace(/viewDataTable=[^&]*/, "viewDataTable=ecommerceOrder");
+ page.load(url);
+ }, done);
+ });
+
+ it("should show abandoned carts data when the abandoned carts link is clicked", function (done) {
+ expect.screenshot('goals_table_abandoned_carts').to.be.capture(function (page) {
+ page.click('.tableIconsGroup a[data-footer-icon-id=ecommerceAbandonedCart]');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Installation_spec.js b/tests/UI/specs/Installation_spec.js
new file mode 100644
index 0000000000..3f7bbbf387
--- /dev/null
+++ b/tests/UI/specs/Installation_spec.js
@@ -0,0 +1,136 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Installation screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+var fs = require('fs');
+
+describe("Installation", function () {
+ this.timeout(0);
+
+ this.fixture = null;
+
+ before(function () {
+ testEnvironment.testUseRegularAuth = 1;
+ testEnvironment.configFileLocal = path.join(PIWIK_INCLUDE_PATH, "/tmp/test.config.ini.php");
+ testEnvironment.dontUseTestConfig = true;
+ testEnvironment.tablesPrefix = 'piwik_';
+ testEnvironment.save();
+
+ if (fs.exists(testEnvironment.configFileLocal)) {
+ fs.remove(testEnvironment.configFileLocal);
+ }
+ });
+
+ after(function () {
+ delete testEnvironment.configFileLocal;
+ delete testEnvironment.dontUseTestConfig;
+ delete testEnvironment.tablesPrefix;
+ delete testEnvironment.testUseRegularAuth;
+ testEnvironment.save();
+ });
+
+ it("should display an error message when trying to access a resource w/o a config.ini.php file", function (done) {
+ expect.screenshot("access_no_config").to.be.capture(function (page) {
+ page.load("?module=CoreHome&action=index&ignoreClearAllViewDataTableParameters=1");
+ }, done);
+ });
+
+ it("should start the installation process when the index is visited w/o a config.ini.php file", function (done) {
+ expect.screenshot("start").to.be.capture(function (page) {
+ page.load("?ignoreClearAllViewDataTableParameters=1");
+ }, done);
+ });
+
+ it("should display the system check page when next is clicked on the first page", function (done) {
+ expect.screenshot("system_check").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should display the database setup page when next is clicked on the system check page", function (done) {
+ expect.screenshot("db_setup").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should fail when the next button is clicked and no database info is entered in the form", function (done) {
+ expect.screenshot("db_setup_fail").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should display the tables created page when next is clicked on the db setup page w/ correct info entered in the form", function (done) {
+ expect.screenshot("db_created").to.be.capture(function (page) {
+ var dbInfo = testEnvironment.readDbInfoFromConfig();
+ var username = dbInfo.username;
+ var password = dbInfo.password;
+
+ page.sendKeys('input[name=username]', username);
+
+ if (password) {
+ page.sendKeys('input[name=password]', password);
+ }
+
+ page.sendKeys('input[name=dbname]', 'newdb');
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should display the superuser configuration page when next is clicked on the tables created page", function (done) {
+ expect.screenshot("superuser").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should fail when incorrect information is entered in the superuser configuration page", function (done) {
+ expect.screenshot("superuser_fail").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should display the setup a website page when next is clicked on the filled out superuser config page", function (done) {
+ expect.screenshot("setup_website").to.be.capture(function (page) {
+ page.sendKeys('input[name=login]', 'thesuperuser');
+ page.sendKeys('input[name=password]', 'thepassword');
+ page.sendKeys('input[name=password_bis]', 'thepassword');
+ page.sendKeys('input[name=email]', 'hello@piwik.org');
+ page.click('.submit');
+ page.wait(3000);
+ }, done);
+ });
+
+ it("should should fail when incorrect information is entered in the setup a website page", function (done) {
+ expect.screenshot("setup_website_fail").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should display the javascript tracking page when correct information is entered in the setup website page and next is clicked", function (done) {
+ expect.screenshot("js_tracking").to.be.capture(function (page) {
+ page.sendKeys('input[name=siteName]', 'Serenity');
+ page.sendKeys('input[name=url]', 'serenity.com');
+ page.evaluate(function () {
+ $('select[name=timezone]').val('Europe/Paris');
+ $('select[name=ecommerce]').val('1');
+ });
+ page.click('.submit');
+ page.wait(3000);
+ }, done);
+ });
+
+ it("should display the congratulations page when next is clicked on the javascript tracking page", function (done) {
+ expect.screenshot("congrats").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should continue to piwik after submitting on the privacy settings form in the congrats page", function (done) {
+ expect.screenshot('login_form', 'Login').to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Login_spec.js b/tests/UI/specs/Login_spec.js
new file mode 100644
index 0000000000..bb8372e601
--- /dev/null
+++ b/tests/UI/specs/Login_spec.js
@@ -0,0 +1,98 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * login & password reset screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("Login", function () {
+ this.timeout(0);
+
+ var md5Pass = "0adcc0d741277f74c64c8abab7330d1c", // md5("smarty-pants")
+ formlessLoginUrl = "?module=Login&action=logme&login=oliverqueen&password=" + md5Pass;
+
+ before(function () {
+ testEnvironment.testUseRegularAuth = 1;
+ testEnvironment.queryParamOverride = {date: "2012-01-01", period: "year"};
+ testEnvironment.save();
+ });
+
+ after(function () {
+ testEnvironment.testUseRegularAuth = 0;
+ delete testEnvironment.queryParamOverride;
+ testEnvironment.save();
+ });
+
+ it("should load correctly", function (done) {
+ expect.screenshot("login_form").to.be.capture(function (page) {
+ page.load("");
+ }, done);
+ });
+
+ it("should fail when incorrect credentials are supplied", function (done) {
+ expect.screenshot("login_fail").to.be.capture(function (page) {
+ page.sendKeys('#login_form_login', 'superUserLogin');
+ page.sendKeys('#login_form_password', 'wrongpassword');
+ page.click('#login_form_submit');
+ }, done);
+ });
+
+ it("should redirect to Piwik when correct credentials are supplied", function (done) {
+ expect.current_page.contains("#dashboard", function (page) {
+ page.sendKeys("#login_form_login", "superUserLogin");
+ page.sendKeys("#login_form_password", "superUserPass");
+ page.click("#login_form_submit");
+ }, done);
+ });
+
+ it("should redirect to login when logout link clicked", function (done) {
+ expect.screenshot("login_form").to.be.capture("logout_form", function (page) {
+ page.click("#topBars span.title:contains(superUserLogin)");
+ page.wait(250);
+ page.click("#topBars a:contains(Sign out)");
+ }, done);
+ });
+
+ it("should display password reset form when forgot password link clicked", function (done) {
+ expect.screenshot("forgot_password").to.be.capture(function (page) {
+ page.reload();
+ page.click("a#login_form_nav");
+ }, done);
+ });
+
+ it("should send email when password reset form submitted", function (done) {
+ expect.screenshot("password_reset").to.be.capture(function (page) {
+ page.sendKeys("#reset_form_login", "superUserLogin");
+ page.sendKeys("#reset_form_password", "superUserPass2");
+ page.sendKeys("#reset_form_password_bis", "superUserPass2");
+ page.click("#reset_form_submit", 3000);
+ }, done);
+ });
+
+ it("should reset password when password reset link is clicked", function (done) {
+ expect.screenshot("password_reset_complete").to.be.capture(function (page) {
+ var expectedMailOutputFile = PIWIK_INCLUDE_PATH + '/tmp/Login.resetPassword.mail.json',
+ mailSent = JSON.parse(require("fs").read(expectedMailOutputFile)),
+ resetUrl = mailSent.contents.match(/http:\/\/.*/)[0];
+
+ page.load(resetUrl);
+ }, done);
+ });
+
+ it("should login successfully when new credentials used", function (done) {
+ expect.page("").contains("#dashboard", function (page) {
+ page.sendKeys("#login_form_login", "superUserLogin");
+ page.sendKeys("#login_form_password", "superUserPass2");
+ page.click("#login_form_submit");
+ }, done);
+ });
+
+ it("should login successfully when formless login used", function (done) {
+ expect.page("").contains('#dashboard', 'formless_login', function (page) {
+ page.click("#topBars a:contains(Sign out)");
+ page.load(formlessLoginUrl);
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Menus_spec.js b/tests/UI/specs/Menus_spec.js
new file mode 100644
index 0000000000..45c9efafb0
--- /dev/null
+++ b/tests/UI/specs/Menus_spec.js
@@ -0,0 +1,48 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Screenshot tests for main, top and admin menus.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("Menus", function () {
+ this.timeout(0);
+
+ var generalParams = 'idSite=1&period=year&date=2012-08-09',
+ urlBase = 'module=CoreHome&action=index&' + generalParams
+ ;
+
+ // main menu tests
+ it('should load the main reporting menu correctly', function (done) {
+ expect.screenshot('mainmenu_loaded').to.be.captureSelector('.Menu--dashboard,.nav_sep', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetPageUrls");
+ }, done);
+ });
+
+ it('should change the menu when a upper menu item is clicked in the main menu', function (done) {
+ expect.screenshot('mainmenu_upper_clicked').to.be.captureSelector('.Menu--dashboard,.nav_sep', function (page) {
+ page.click('#VisitsSummary>a');
+ }, done);
+ });
+
+ it('should change the menu when a lower menu item is clicked in the main menu', function (done) {
+ expect.screenshot('mainmenu_lower_clicked').to.be.captureSelector('.Menu--dashboard,.nav_sep', function (page) {
+ page.click('#Live_indexVisitorLog>a');
+ }, done);
+ });
+
+ // admin menu tests
+ it('should load the admin reporting menu correctly', function (done) {
+ expect.screenshot('admin_loaded').to.be.captureSelector('.Menu--admin', function (page) {
+ page.load("?" + generalParams + "&module=UsersManager&action=userSettings");
+ }, done);
+ });
+
+ it('should change the admin page correctly when an admin menu item is clicked', function (done) {
+ expect.screenshot('admin_changed').to.be.captureSelector('.Menu--admin', function (page) {
+ page.click('.Menu--admin a:contains(Websites)');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Overlay_spec.js b/tests/UI/specs/Overlay_spec.js
new file mode 100644
index 0000000000..f38e747474
--- /dev/null
+++ b/tests/UI/specs/Overlay_spec.js
@@ -0,0 +1,97 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Overlay screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+// TODO: should be stored in Overlay plugin
+describe("Overlay", function () {
+ this.timeout(0);
+
+ var url = null;
+
+ before(function (done) {
+ url = "?module=Overlay&period=year&date=today&idSite=3#l=" + encodeURIComponent(testEnvironment.overlayUrl).replace(/[%]/g, "$");
+
+ testEnvironment.callApi("SitesManager.addSiteAliasUrls", {idSite: 3, urls: [config.piwikUrl]}, done);
+ });
+
+ after(function (done) {
+ testEnvironment.callApi("SitesManager.setSiteAliasUrls", {idSite: 3, urls: []}, done);
+ });
+
+ it("should load correctly", function (done) {
+ expect.screenshot("loaded").to.be.capture(function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should show clicks when hover over link in iframe", function (done) {
+ expect.screenshot("page_link_clicks").to.be.capture(function (page) {
+ var pos = page.webpage.evaluate(function () {
+ var iframe = $('iframe'),
+ innerOffset = $('.btn.btn-lg', iframe.contents()).offset();
+ return {
+ x: iframe.offset().left + innerOffset.left,
+ y: iframe.offset().top + innerOffset.top
+ };
+ });
+ page.sendMouseEvent('mousemove', pos);
+ }, done);
+ });
+
+ it("should show stats for new links when dropdown opened", function (done) {
+ expect.screenshot("page_new_links").to.be.capture(function (page) {
+ var pos = page.webpage.evaluate(function () {
+ var iframe = $('iframe'),
+ innerOffset = $('.dropdown-toggle', iframe.contents()).offset();
+ return {
+ x: iframe.offset().left + innerOffset.left + 32, // position is incorrect for some reason w/o adding pixels
+ y: iframe.offset().top + innerOffset.top
+ };
+ });
+ page.sendMouseEvent('click', pos, 2000);
+ }, done);
+ });
+
+ it("should change page when clicking on internal iframe link", function (done) {
+ expect.screenshot("page_change").to.be.capture(function (page) {
+ var pos = page.webpage.evaluate(function () {
+ var iframe = $('iframe'),
+ innerOffset = $('ul.nav>li:nth-child(2)>a', iframe.contents()).offset();
+ return {
+ x: iframe.offset().left + innerOffset.left + 32, // position is incorrect for some reason w/o adding pixels
+ y: iframe.offset().top + innerOffset.top
+ };
+ });
+ page.sendMouseEvent('click', pos);
+ }, done);
+ });
+
+ it("should change date range when period changed", function (done) {
+ expect.screenshot("period_change").to.be.capture(function (page) {
+ page.evaluate(function () {
+ $('#Overlay_DateRangeSelect').val('day;yesterday').trigger('change');
+ });
+ }, done);
+ });
+
+ it("should open row evolution popup when row evolution link clicked", function (done) {
+ expect.screenshot("row_evolution").to.be.capture(function (page) {
+ page.click('#Overlay_RowEvolution');
+ page.evaluate(function () {
+ $('.jqplot-xaxis').hide(); // xaxis will change every day so hide it
+ });
+ }, done);
+ });
+
+ it("should open transitions popup when transitions link clicked", function (done) {
+ expect.screenshot("transitions").to.be.capture(function (page) {
+ page.click('button.ui-dialog-titlebar-close');
+ page.click('#Overlay_Transitions');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/PeriodSelector_spec.js b/tests/UI/specs/PeriodSelector_spec.js
new file mode 100644
index 0000000000..c070f4beb5
--- /dev/null
+++ b/tests/UI/specs/PeriodSelector_spec.js
@@ -0,0 +1,89 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Period selector screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("PeriodSelector", function () {
+ this.timeout(0);
+
+ var url = "?module=CoreHome&action=index&idSite=1&period=day&date=2012-01-01";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("loaded").to.be.captureSelector('#periodString', function (page) {
+ page.load(url);
+
+ // disable broadcast.propagateNewPage & remove loading gif
+ page.evaluate(function () {
+ broadcast.propagateNewPage = function () {};
+ $('#ajaxLoadingCalendar').remove();
+ });
+ }, done);
+ });
+
+ it("should expand when clicked", function (done) {
+ expect.screenshot("expanded").to.be.captureSelector('#periodString', function (page) {
+ page.click('.periodSelector');
+ }, done);
+ });
+
+ it("should select a date when a date is clicked in day-period mode", function (done) {
+ expect.screenshot("day_selected").to.be.captureSelector('#periodString', function (page) {
+ page.click('.period-date .ui-datepicker-calendar a:contains(12)');
+ }, done);
+ });
+
+ it("should change the month displayed when a month is selected in the month dropdown", function (done) {
+ expect.screenshot("month_changed").to.be.captureSelector('#periodString', function (page) {
+ page.evaluate(function () {
+ $('.ui-datepicker-month').val(1).trigger('change');
+ });
+ }, done);
+ });
+
+ it("should change the year displayed when a year is selected in the year dropdown", function (done) {
+ expect.screenshot("year_changed").to.be.captureSelector('#periodString', function (page) {
+ page.evaluate(function () {
+ $('.ui-datepicker-year').val(2013).trigger('change');
+ });
+ }, done);
+ });
+
+ it("should change the date when a date is clicked in week-period mode", function (done) {
+ expect.screenshot("week_selected").to.be.captureSelector('#periodString', function (page) {
+ page.click('label[for=period_id_week]');
+ page.click('.period-date .ui-datepicker-calendar a:contains(13)');
+ }, done);
+ });
+
+ it("should change the date when a date is clicked in month-period mode", function (done) {
+ expect.screenshot("month_selected").to.be.captureSelector('#periodString', function (page) {
+ page.click('label[for=period_id_month]');
+ page.click('.period-date .ui-datepicker-calendar a:contains(14)');
+ }, done);
+ });
+
+ it("should change the date when a date is clicked in year-period mode", function (done) {
+ expect.screenshot("year_selected").to.be.captureSelector('#periodString', function (page) {
+ page.click('label[for=period_id_year]');
+ page.click('.period-date .ui-datepicker-calendar a:contains(15)');
+ }, done);
+ });
+
+ it("should display the range picker when the range radio button is clicked", function (done) {
+ expect.screenshot("range_picker_displayed").to.be.captureSelector('#periodString', function (page) {
+ page.click('label[for=period_id_range]');
+ }, done);
+ });
+
+ it("should change from & to dates when range picker calendar dates are clicked", function (done) {
+ expect.screenshot("date_range_selected").to.be.captureSelector('#periodString', function (page) {
+ page.click('#calendarFrom .ui-datepicker-calendar a:contains(10)');
+ page.click('#calendarTo .ui-datepicker-calendar a:contains(18)');
+ page.mouseMove('#calendarRangeApply');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/PieGraph_spec.js b/tests/UI/specs/PieGraph_spec.js
new file mode 100644
index 0000000000..7c48ce2663
--- /dev/null
+++ b/tests/UI/specs/PieGraph_spec.js
@@ -0,0 +1,39 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Pie graph screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("PieGraph", function () {
+ this.timeout(0);
+
+ var url = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=year&date=2012-08-09&"
+ + "actionToWidgetize=getKeywords&viewDataTable=graphPie&isFooterExpandedInDashboard=1";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("load").to.be.capture(function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should show tooltip on hover", function (done) {
+ expect.screenshot("pie_segment_tooltip").to.be.capture(function (page) {
+ page.mouseMove('.piwik-graph');
+ }, done);
+ });
+
+ it("should display the metric picker on hover of metric picker icon", function (done) {
+ expect.screenshot('metric_picker_shown').to.be.capture(function (page) {
+ page.mouseMove('.jqplot-seriespicker');
+ }, done);
+ });
+
+ it("should change displayed metric when another metric picked", function (done) {
+ expect.screenshot('other_metric').to.be.capture(function (page) {
+ page.click('.jqplot-seriespicker-popover input:not(:checked)');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/PivotByDimension_spec.js b/tests/UI/specs/PivotByDimension_spec.js
new file mode 100644
index 0000000000..f1899f3485
--- /dev/null
+++ b/tests/UI/specs/PivotByDimension_spec.js
@@ -0,0 +1,40 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * PivotByDimension UI tests
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("PivotByDimension", function () {
+ this.timeout(0);
+
+ var eventsUrl = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09#/idSite=1&period=year&date=2012-08-09&module=Events&action=index",
+ actionsUrl = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09#/idSite=1&period=year&date=2012-08-09&module=Actions&action=menuGetPageUrls",
+ cvarsUrl = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09#/idSite=1&period=year&date=2012-08-09&module=CustomVariables&action=menuGetCustomVariables"
+ ;
+
+ it("should pivot a report correctly when the pivot cog option is selected", function (done) {
+ expect.screenshot('pivoted').to.be.captureSelector('.dataTable,.expandDataTableFooterDrawer', function (page) {
+ page.load(eventsUrl);
+ page.click('.dimension:contains(Event Names)');
+ page.click('.expandDataTableFooterDrawer');
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTablePivotBySubtable');
+ }, done);
+ });
+
+ it("should not display the pivot option on actions reports", function (done) {
+ expect.page(actionsUrl).not.contains('.dataTablePivotBySubtable', function () {}, done);
+ });
+
+ it("should display the pivot option on reports that set a custom columns_to_display", function (done) {
+ expect.screenshot('pivoted_columns_report').to.be.captureSelector('.dataTable,.expandDataTableFooterDrawer', function (page) {
+ page.load(cvarsUrl);
+ page.click('.expandDataTableFooterDrawer');
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTablePivotBySubtable');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/RowEvolution_spec.js b/tests/UI/specs/RowEvolution_spec.js
new file mode 100644
index 0000000000..9214ee69b6
--- /dev/null
+++ b/tests/UI/specs/RowEvolution_spec.js
@@ -0,0 +1,65 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * row evolution screenshot tests
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("RowEvolution", function () {
+ this.timeout(0);
+
+ var viewDataTableUrl = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=week&date=2012-02-09&"
+ + "actionToWidgetize=getKeywords&viewDataTable=table&filter_limit=5";
+
+ var ecommerceItemReportWidgetized = "?module=Widgetize&action=iframe&moduleToWidgetize=Goals&actionToWidgetize=getItemsSku&idGoal=ecommerceAbandonedCart"
+ + "&idSite=1&period=year&date=2012-02-09&viewDataTable=ecommerceAbandonedCart&filter_limit=-1";
+
+ it('should load when icon clicked in ViewDataTable', function (done) {
+ expect.screenshot('row_evolution').to.be.captureSelector('.ui-dialog', function (page) {
+ page.load(viewDataTableUrl);
+ page.mouseMove('tbody tr:first-child');
+ page.mouseMove('a.actionRowEvolution:visible'); // necessary to get popover to display
+ page.click('a.actionRowEvolution:visible');
+ }, done);
+ });
+
+ it('should change the metric shown when a metric sparkline row is clicked', function (done) {
+ expect.screenshot('row_evolution_other_metric').to.be.captureSelector('.ui-dialog', function (page) {
+ page.click('table.metrics tr[data-i=1]');
+ }, done);
+ });
+
+ it('should show two serieses when a metric sparkline row is shift+clicked', function (done) {
+ expect.screenshot('row_evolution_multiple_series').to.be.captureSelector('.ui-dialog', function (page) {
+ page.click('table.metrics tr[data-i=2]', ['shift']);
+ }, done);
+ });
+
+ it('should load multi-row evolution correctly', function (done) {
+ expect.screenshot('multirow_evolution').to.be.captureSelector('.ui-dialog', function (page) {
+ page.click('a.rowevolution-startmulti');
+ page.mouseMove('tbody tr:nth-child(2)');
+ page.mouseMove('a.actionRowEvolution:visible');
+ page.click('a.actionRowEvolution:visible');
+ }, done);
+ });
+
+ it('should display a different row evolution metric when the metric selection is changed', function (done) {
+ expect.screenshot('multirow_evolution_other_metric').to.be.captureSelector('.ui-dialog', function (page) {
+ page.evaluate(function () {
+ $('select.multirowevoltion-metric').val($('select.multirowevoltion-metric option:nth-child(3)').val()).change();
+ });
+ }, done);
+ });
+
+ it('should display row evolution for an ecommerce item report correctly', function (done) {
+ expect.screenshot('row_evolution_ecommerce_item').to.be.captureSelector('.ui-dialog', function (page) {
+ page.load(ecommerceItemReportWidgetized);
+ page.mouseMove('tbody tr:first-child');
+ page.mouseMove('a.actionRowEvolution:visible'); // necessary to get popover to display
+ page.click('a.actionRowEvolution:visible');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/SegmentSelectorEditor_spec.js b/tests/UI/specs/SegmentSelectorEditor_spec.js
new file mode 100644
index 0000000000..7552977813
--- /dev/null
+++ b/tests/UI/specs/SegmentSelectorEditor_spec.js
@@ -0,0 +1,187 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * ViewDataTable screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("SegmentSelectorEditorTest", function () {
+ var selectorsToCapture = ".segmentEditorPanel,.segmentEditorPanel .dropdown-body,.segment-element";
+
+ this.timeout(0);
+
+ var url = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("0_initial").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should open selector when control clicked", function (done) {
+ expect.screenshot("1_selector_open").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentationContainer');
+ }, done);
+ });
+
+ it("should open segment editor when edit link clicked for existing segment", function (done) {
+ expect.screenshot("2_segment_editor_update").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentList .editSegment');
+ }, done);
+ });
+
+ it("should start editing segment name when segment name edit link clicked", function (done) {
+ expect.screenshot("3_segment_editor_edit_name").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentEditorPanel .editSegmentName');
+ }, done);
+ });
+
+ it("should expand segment dimension category when category name clicked in segment editor", function (done) {
+ expect.screenshot("4_segment_editor_expanded_dimensions").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentEditorPanel .metric_category:contains(Actions)');
+ }, done);
+ });
+
+ it("should search segment dimensions when text entered in dimension search input", function (done) {
+ expect.screenshot("5_segment_editor_search_dimensions").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.sendKeys('.segmentEditorPanel .segmentSearch', 'page title');
+ }, done);
+ });
+
+ it("should change segment when another available segment clicked in segment editor's available segments dropdown", function (done) {
+ expect.screenshot("6_segment_editor_different").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.available_segments a.dropList');
+ page.click('li.ui-menu-item a:contains(Add new segment)');
+ }, done);
+ });
+
+ it("should close the segment editor when the close link is clicked", function (done) {
+ expect.screenshot("7_segment_editor_closed").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentEditorPanel .segment-footer .close');
+ }, done);
+ });
+
+ it("should open blank segment editor when create new segment link is clicked", function (done) {
+ expect.screenshot("8_segment_editor_create").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentationContainer');
+ page.click('.add_new_segment');
+ }, done);
+ });
+
+ it("should add new segment expression when segment dimension drag dropped", function (done) {
+ expect.screenshot("dimension_drag_drop").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentEditorPanel .metric_category:contains(Actions)');
+ page.dragDrop('.segmentEditorPanel li[data-metric=entryPageUrl]', '.segmentEditorPanel .ui-droppable');
+ }, done);
+ });
+
+ // phantomjs won't take screenshots of dropdown windows, so skip this test
+ it.skip("should show suggested segment values when a segment value input is focused", function (done) {
+ expect.screenshot("suggested_values").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentEditorPanel .ui-autocomplete-input');
+ }, done);
+ });
+
+ it("should add an OR condition when a segment dimension is dragged to the OR placeholder section", function (done) {
+ expect.screenshot("drag_or_condition").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.dragDrop('.segmentEditorPanel li[data-metric=entryPageTitle]', '.segmentEditorPanel .segment-add-or .ui-droppable');
+ }, done);
+ });
+
+ it("should add an AND condition when a segment dimension is dragged to the AND placeholder section", function (done) {
+ expect.screenshot("drag_and_condition").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.dragDrop('.segmentEditorPanel li[data-metric=pageTitle]', '.segmentEditorPanel .segment-add-row .ui-droppable');
+ }, done);
+ });
+
+ it("should save a new segment and add it to the segment list when the form is filled out and the save button is clicked", function (done) {
+ expect.screenshot("saved").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.evaluate(function () {
+ $('.metricMatchBlock>select').each(function () {
+ $(this).val('==');
+ });
+
+ $('.metricValueBlock>input').each(function (index) {
+ $(this).val('value ' + index);
+ });
+ });
+
+ page.sendKeys('input.edit_segment_name', 'new segment');
+ page.click('.segmentEditorPanel .metric_category:contains(Actions)'); // click somewhere else to save new name
+
+ page.click('button.saveAndApply');
+
+ page.click('.segmentationContainer');
+ }, done);
+ });
+
+ it("should show the new segment after page reload", function (done) {
+ expect.screenshot("saved").to.be.captureSelector("saved_reload", selectorsToCapture, function (page) {
+ page.reload();
+ page.click('.segmentationContainer');
+ }, done);
+ });
+
+ it("should correctly load the new segment's details when the new segment is edited", function (done) {
+ expect.screenshot("saved_details").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentList li[data-idsegment=4] .editSegment');
+ }, done);
+ });
+
+ it("should correctly update the segment when its details are changed and saved", function (done) {
+ expect.screenshot("updated").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentEditorPanel .editSegmentName');
+ page.evaluate(function () {
+ $('input.edit_segment_name').val('');
+ });
+ page.sendKeys('input.edit_segment_name', 'edited segment');
+ page.click('.segmentEditorPanel .metric_category:contains(Actions)'); // click somewhere else to save new name
+
+ page.evaluate(function () {
+ $('.metricMatchBlock>select').each(function () {
+ $(this).val('!=');
+ });
+
+ $('.metricValueBlock>input').each(function (index) {
+ $(this).val('new value ' + index);
+ });
+ });
+
+ page.click('button.saveAndApply');
+
+ page.click('.segmentationContainer');
+ }, done);
+ });
+
+ it("should show the updated segment after page reload", function (done) {
+ expect.screenshot("updated").to.be.captureSelector("updated_reload", selectorsToCapture, function (page) {
+ page.reload();
+ page.click('.segmentationContainer');
+ }, done);
+ });
+
+ it("should correctly load the updated segment's details when the updated segment is edited", function (done) {
+ expect.screenshot("updated_details").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentList li[data-idsegment=4] .editSegment');
+ }, done);
+ });
+
+ it("should correctly remove the segment when the delete link is clicked", function (done) {
+ expect.screenshot('deleted').to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentList li[data-idsegment=4] .editSegment');
+ page.click('.segmentEditorPanel a.delete');
+ page.click('.ui-dialog button>span:contains(Yes):visible');
+
+ page.click('.segmentationContainer');
+ }, done);
+ });
+
+ it("should not show the deleted segment after page reload", function (done) {
+ expect.screenshot('deleted').to.be.captureSelector('deleted_reload', selectorsToCapture, function (page) {
+ page.reload();
+ page.click('.segmentationContainer');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/SiteSelector_spec.js b/tests/UI/specs/SiteSelector_spec.js
new file mode 100644
index 0000000000..71ae799558
--- /dev/null
+++ b/tests/UI/specs/SiteSelector_spec.js
@@ -0,0 +1,55 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Site selector screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("SiteSelector", function () {
+ var selectorToCapture = '[piwik-siteselector],[piwik-siteselector] .custom_select';
+
+ this.timeout(0);
+
+ var url = "?module=UsersManager&action=userSettings&idSite=1&period=day&date=yesterday";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("loaded").to.be.captureSelector(selectorToCapture, function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should display expanded when clicked", function (done) {
+ expect.screenshot("expanded").to.be.captureSelector(selectorToCapture, function (page) {
+ page.click('.sites_autocomplete');
+ }, done);
+ });
+
+ it("should show no results when search returns no results", function (done) {
+ expect.screenshot("search_no_results").to.be.captureSelector(selectorToCapture, function (page) {
+ page.sendKeys(".websiteSearch", "abc");
+ }, done);
+ });
+
+ it("should search when one character typed into search input", function (done) {
+ expect.screenshot("search_one_char").to.be.captureSelector(selectorToCapture, function (page) {
+ page.click('.reset');
+ page.sendKeys(".websiteSearch", "s");
+ }, done);
+ });
+
+ // Test is skipped as it randomly fails http://builds-artifacts.piwik.org/ui-tests.master/2295.1/screenshot-diffs/diffviewer.html
+ it.skip("should search again when second character typed into search input", function (done) {
+ expect.screenshot("search_two_chars").to.be.captureSelector(selectorToCapture, function (page) {
+ page.sendKeys(".websiteSearch", "st");
+ page.wait(3000);
+ }, done);
+ });
+
+ it("should change the site when a site is selected", function (done) {
+ expect.screenshot("site_selected").to.be.captureSelector(selectorToCapture, function (page) {
+ page.click(".custom_select_ul_list>li:visible");
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Transitions_spec.js b/tests/UI/specs/Transitions_spec.js
new file mode 100644
index 0000000000..246c4bb3da
--- /dev/null
+++ b/tests/UI/specs/Transitions_spec.js
@@ -0,0 +1,33 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * transitions screenshot tests
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("Transitions", function () {
+ this.timeout(0);
+
+ var generalParams = 'idSite=1&period=year&date=2012-08-09',
+ urlBase = 'module=CoreHome&action=index&' + generalParams
+ ;
+
+ it('should load the transitions popup correctly for the page titles report', function (done) {
+ expect.screenshot('transitions_popup_titles').to.be.captureSelector('.ui-dialog', function (page) {
+ page.load("?" + urlBase + "#/" + generalParams + "&module=Actions&action=menuGetPageTitles");
+
+ page.mouseMove('div.dataTable tbody tr:eq(2)');
+ page.mouseMove('a.actionTransitions:visible'); // necessary to get popover to display
+ page.click('a.actionTransitions:visible');
+ }, done);
+ });
+
+ it('should load the transitions popup correctly for the page urls report', function (done) {
+ expect.screenshot('transitions_popup_urls').to.be.captureSelector('.ui-dialog', function (page) {
+ page.load("?" + urlBase + "#/" + generalParams + "&module=Actions&action=menuGetPageUrls&"
+ + "popover=RowAction$3ATransitions$3Aurl$3Ahttp$3A$2F$2Fpiwik.net$2Fdocs$2Fmanage-websites$2F");
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/UIIntegration_spec.js b/tests/UI/specs/UIIntegration_spec.js
new file mode 100644
index 0000000000..c1c186345b
--- /dev/null
+++ b/tests/UI/specs/UIIntegration_spec.js
@@ -0,0 +1,608 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Screenshot integration tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("UIIntegrationTest", function () { // TODO: Rename to Piwik?
+ this.timeout(0);
+
+ var generalParams = 'idSite=1&period=year&date=2012-08-09',
+ idSite2Params = 'idSite=2&period=year&date=2012-08-09',
+ evolutionParams = 'idSite=1&period=day&date=2012-01-31&evolution_day_last_n=30',
+ urlBase = 'module=CoreHome&action=index&' + generalParams,
+ widgetizeParams = "module=Widgetize&action=iframe",
+ segment = encodeURIComponent("browserCode==FF") // from OmniFixture
+ ;
+
+ before(function (done) {
+ testEnvironment.queryParamOverride = {
+ forceNowValue: testEnvironment.forcedNowTimestamp,
+ visitorId: testEnvironment.forcedIdVisitor,
+ realtimeWindow: 'false'
+ };
+ testEnvironment.save();
+
+ testEnvironment.callApi("SitesManager.setSiteAliasUrls", {idSite: 3, urls: []}, done);
+ });
+
+ beforeEach(function () {
+ delete testEnvironment.configOverride;
+ testEnvironment.testUseRegularAuth = 0;
+ testEnvironment.save();
+ });
+
+ after(function () {
+ delete testEnvironment.queryParamOverride;
+ testEnvironment.testUseRegularAuth = 0;
+ testEnvironment.save();
+ });
+
+ // dashboard tests
+ it("should load dashboard1 correctly", function (done) {
+ expect.screenshot("dashboard1").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Dashboard&action=embeddedIndex&idDashboard=1");
+
+ page.evaluate(function () {
+ // Prevent random sizing error eg. http://builds-artifacts.piwik.org/ui-tests.master/2301.1/screenshot-diffs/diffviewer.html
+ $("[widgetid=widgetActionsgetOutlinks] .widgetContent").text('Displays different at random -> hidden');
+ });
+ }, done);
+ });
+
+ it("should load dashboard2 correctly", function (done) {
+ expect.screenshot("dashboard2").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Dashboard&action=embeddedIndex&idDashboard=2");
+ }, done);
+ });
+
+ it("should load dashboard3 correctly", function (done) {
+ expect.screenshot("dashboard3").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Dashboard&action=embeddedIndex&idDashboard=3");
+ }, done);
+ });
+
+ it("should load dashboard4 correctly", function (done) {
+ expect.screenshot("dashboard4").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Dashboard&action=embeddedIndex&idDashboard=4");
+ }, done);
+ });
+
+ it("should display dashboard correctly on a mobile phone", function (done) {
+ expect.screenshot("dashboard5_mobile").to.be.capture(function (page) { // capture with menu
+ page.setViewportSize(480, 320);
+ page.load("?" + urlBase + "#" + generalParams + "&module=Dashboard&action=embeddedIndex&idDashboard=5");
+ }, done);
+ });
+
+ // visitors pages
+ it('should load visitors > overview page correctly', function (done) {
+ expect.screenshot("visitors_overview").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=VisitsSummary&action=index");
+ }, done);
+ });
+
+ it('should load visitors > visitor log page correctly', function (done) {
+ expect.screenshot("visitors_visitorlog").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Live&action=indexVisitorLog");
+ }, done);
+ });
+
+ it('should load the visitors > devices page correctly', function (done) {
+ expect.screenshot("visitors_devices").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=DevicesDetection&action=index");
+ }, done);
+ });
+
+ it('should load visitors > locations & provider page correctly', function (done) {
+ expect.screenshot("visitors_locations_provider").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=UserCountry&action=index");
+ }, done);
+ });
+
+ it('should load the visitors > settings page correctly', function (done) {
+ expect.screenshot("visitors_settings").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=UserSettings&action=index");
+ }, done);
+ });
+
+ it('should load the visitors > times page correctly', function (done) {
+ expect.screenshot("visitors_times").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=VisitTime&action=index");
+ }, done);
+ });
+
+ it('should load the visitors > engagement page correctly', function (done) {
+ expect.screenshot("visitors_engagement").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=VisitFrequency&action=index");
+ }, done);
+ });
+
+ it('should load the visitors > custom variables page correctly', function (done) {
+ expect.screenshot('visitors_custom_vars').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=CustomVariables&action=menuGetCustomVariables");
+ }, done);
+ });
+
+ it('should load the visitors > real-time map page correctly', function (done) {
+ expect.screenshot('visitors_realtime_map').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + idSite2Params + "&module=UserCountryMap&action=realtimeWorldMap"
+ + "&showDateTime=0&realtimeWindow=last2&changeVisitAlpha=0&enableAnimation=0&doNotRefreshVisits=1"
+ + "&removeOldVisits=0");
+ }, done);
+ });
+
+ // actions pages
+ it('should load the actions > pages page correctly', function (done) {
+ expect.screenshot('actions_pages').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetPageUrls");
+ }, done);
+ });
+
+ it('should load the actions > entry pages page correctly', function (done) {
+ expect.screenshot('actions_entry_pages').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetEntryPageUrls");
+ }, done);
+ });
+
+ it('should load the actions > exit pages page correctly', function (done) {
+ expect.screenshot('actions_exit_pages').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetExitPageUrls");
+ }, done);
+ });
+
+ it('should load the actions > page titles page correctly', function (done) {
+ expect.screenshot('actions_page_titles').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetPageTitles");
+ }, done);
+ });
+
+ it('should load the actions > site search page correctly', function (done) {
+ expect.screenshot('actions_site_search').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=indexSiteSearch");
+ }, done);
+ });
+
+ it('should load the actions > outlinks page correctly', function (done) {
+ expect.screenshot('actions_outlinks').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetOutlinks");
+ }, done);
+ });
+
+ it('should load the actions > downloads page correctly', function (done) {
+ expect.screenshot('actions_downloads').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetDownloads");
+ }, done);
+ });
+
+ it('should load the actions > contents page correctly', function (done) {
+ expect.screenshot('actions_contents').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Contents&action=index&period=day&date=2012-01-01");
+ }, done);
+ });
+
+ it("should show all corresponding content pieces when clicking on a content name", function (done) {
+ expect.screenshot("actions_content_name_piece").to.be.captureSelector('.pageWrap', function (page) {
+ page.click('.dataTable .subDataTable .value:contains(ImageAd)');
+ }, done);
+ });
+
+ it("should show all tracked content pieces when clicking on the table", function (done) {
+ expect.screenshot("actions_content_piece").to.be.captureSelector('.pageWrap', function (page) {
+ page.click('.reportDimension .dimension:contains(Content Piece)');
+ }, done);
+ });
+
+ it("should show all corresponding content names when clicking on a content piece", function (done) {
+ expect.screenshot("actions_content_piece_name").to.be.captureSelector('.pageWrap', function (page) {
+ page.click('.dataTable .subDataTable .value:contains(Click NOW)');
+ }, done);
+ });
+
+ // referrers pages
+ it('should load the referrers > overview page correctly', function (done) {
+ expect.screenshot('referrers_overview').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Referrers&action=index");
+ }, done);
+ });
+
+ // referrers pages
+ it('should load the referrers > overview page correctly', function (done) {
+ expect.screenshot('referrers_allreferrers').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Referrers&action=allReferrers");
+ }, done);
+ });
+
+ it('should load the referrers > search engines & keywords page correctly', function (done) {
+ expect.screenshot('referrers_search_engines_keywords').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Referrers&action=getSearchEnginesAndKeywords");
+ }, done);
+ });
+
+ it('should load the referrers > websites & social page correctly', function (done) {
+ expect.screenshot('referrers_websites_social').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Referrers&action=indexWebsites");
+ }, done);
+ });
+
+ it('should load the referrers > campaigns page correctly', function (done) {
+ expect.screenshot('referrers_campaigns').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Referrers&action=menuGetCampaigns");
+ }, done);
+ });
+
+ // goals pages
+ it('should load the goals > ecommerce page correctly', function (done) {
+ expect.screenshot('goals_ecommerce').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Ecommerce&action=ecommerceReport&idGoal=ecommerceOrder");
+ }, done);
+ });
+
+ it('should load the goals > overview page correctly', function (done) {
+ expect.screenshot('goals_overview').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load( "?" + urlBase + "#" + generalParams + "&module=Goals&action=index");
+ }, done);
+ });
+
+ it('should load the goals > management page correctly', function (done) {
+ expect.screenshot('goals_manage').to.be.captureSelector('.centerLargeDiv,.top_bar_sites_selector,.entityContainer', function (page) {
+ page.load( "?" + generalParams + "&module=Goals&action=manage");
+ page.wait(200);
+ }, done);
+ });
+
+ it('should load the goals > single goal page correctly', function (done) {
+ expect.screenshot('goals_individual_goal').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Goals&action=goalReport&idGoal=1");
+ }, done);
+ });
+
+ // one page w/ segment
+ it('should load the visitors > overview page correctly when a segment is specified', function (done) {
+ expect.screenshot('visitors_overview_segment').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=VisitsSummary&action=index&segment=" + segment);
+ }, done);
+ });
+
+ // example ui pages
+ it('should load the example ui > dataTables page correctly', function (done) {
+ expect.screenshot('exampleui_dataTables').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=dataTables");
+ }, done);
+ });
+
+ it('should load the example ui > barGraph page correctly', function (done) {
+ expect.screenshot('exampleui_barGraph').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=barGraph");
+ }, done);
+ });
+
+ it('should load the example ui > pieGraph page correctly', function (done) {
+ expect.screenshot('exampleui_pieGraph').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=pieGraph");
+ }, done);
+ });
+
+ it('should load the example ui > tagClouds page correctly', function (done) {
+ expect.screenshot('exampleui_tagClouds').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=tagClouds");
+ }, done);
+ });
+
+ it('should load the example ui > sparklines page correctly', function (done) {
+ expect.screenshot('exampleui_sparklines').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=sparklines");
+ }, done);
+ });
+
+ it('should load the example ui > evolution graph page correctly', function (done) {
+ expect.screenshot('exampleui_evolutionGraph').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=evolutionGraph");
+ }, done);
+ });
+
+ it('should load the example ui > treemap page correctly', function (done) {
+ expect.screenshot('exampleui_treemap').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=treemap");
+ page.wait(2000);
+ }, done);
+ });
+
+ // widgetize
+ it('should load the widgetized visitor log correctly', function (done) {
+ expect.screenshot('widgetize_visitor_log').to.be.capture(function (page) {
+ page.load("?" + widgetizeParams + "&" + generalParams + "&moduleToWidgetize=Live&actionToWidgetize=getVisitorLog");
+ page.evaluate(function () {
+ $('.expandDataTableFooterDrawer').click();
+ });
+ }, done);
+ });
+
+ it('should load the widgetized all websites dashboard correctly', function (done) {
+ expect.screenshot('widgetize_allwebsites').to.be.capture(function (page) {
+ page.load("?" + widgetizeParams + "&" + generalParams + "&moduleToWidgetize=MultiSites&actionToWidgetize=standalone");
+ }, done);
+ });
+
+ it('should widgetize the ecommerce log correctly', function (done) {
+ expect.screenshot('widgetize_ecommercelog').to.be.capture(function (page) {
+ page.load("?" + widgetizeParams + "&" + generalParams + "&moduleToWidgetize=Ecommerce&actionToWidgetize=getEcommerceLog&filter_limit=-1");
+ }, done);
+ });
+
+ it('should load the ecommerce overview page', function (done) {
+ expect.screenshot('ecommerce_overview').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Ecommerce&action=ecommerceReport&idGoal=ecommerceOrder");
+ }, done);
+ });
+
+ it('should load the ecommerce log page', function (done) {
+ expect.screenshot('ecommerce_log').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Ecommerce&action=ecommerceLogReport");
+ }, done);
+ });
+
+ it('should load the ecommerce products page', function (done) {
+ expect.screenshot('ecommerce_products').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Ecommerce&action=products&idGoal=ecommerceOrder");
+ }, done);
+ });
+
+ it('should load the ecommerce sales page', function (done) {
+ expect.screenshot('ecommerce_sales').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Ecommerce&action=sales&idGoal=ecommerceOrder");
+ }, done);
+ });
+
+ // Admin user settings (plugins not displayed)
+ it('should load the Manage > Websites admin page correctly', function (done) {
+ expect.screenshot('admin_manage_websites').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=SitesManager&action=index");
+ page.evaluate(function () {
+ $('.ui-inline-help:contains(UTC time is)').hide();
+ });
+ }, done);
+ });
+
+ it('should load the Manage > Users admin page correctly', function (done) {
+ expect.screenshot('admin_manage_users').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=UsersManager&action=index");
+
+ // remove token auth which can be random
+ page.evaluate(function () {
+ $('td#token_auth').each(function () {
+ $(this).text('');
+ });
+ $('td#last_seen').each(function () {
+ $(this).text( '' )
+ });
+ });
+ }, done);
+ });
+
+ it('should load the user settings admin page correctly', function (done) {
+ expect.screenshot('admin_user_settings').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=UsersManager&action=userSettings");
+ }, done);
+ });
+
+ it('should load the Manage > Tracking Code admin page correctly', function (done) {
+ expect.screenshot('admin_manage_tracking_code').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=CoreAdminHome&action=trackingCodeGenerator");
+ }, done);
+ });
+
+ it('should load the Settings > General Settings admin page correctly', function (done) {
+ expect.screenshot('admin_settings_general').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=CoreAdminHome&action=generalSettings");
+ }, done);
+ });
+
+ it('should load the Settings > Privacy admin page correctly', function (done) {
+ expect.screenshot('admin_privacy_settings').to.be.captureSelector('#content,.ui-inline-help', function (page) {
+ page.load("?" + generalParams + "&module=PrivacyManager&action=privacySettings");
+ }, done);
+ });
+
+ it('should load the Privacy Opt out iframe correctly', function (done) {
+ expect.screenshot('admin_privacy_optout_iframe').to.be.capture(function (page) {
+ page.load("?module=CoreAdminHome&action=optOut&language=de");
+ }, done);
+ });
+
+ it('should load the Settings > Mobile Messaging admin page correctly', function (done) {
+ expect.screenshot('admin_settings_mobilemessaging').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=MobileMessaging&action=index");
+ }, done);
+ });
+
+ it('should load the Settings > Mobile Messaging user page correctly', function (done) {
+ expect.screenshot('user_settings_mobilemessaging').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=MobileMessaging&action=userSettings");
+ }, done);
+ });
+
+ it('should load the themes admin page correctly', function (done) {
+ expect.screenshot('admin_themes').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=CorePluginsAdmin&action=themes");
+ }, done);
+ });
+
+ it('should load the plugins admin page correctly', function (done) {
+ expect.screenshot('admin_plugins').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=CorePluginsAdmin&action=plugins");
+ }, done);
+ });
+
+ it('should load the plugin settings admin page correctly', function (done) {
+ expect.screenshot('admin_plugin_settings').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=CoreAdminHome&action=adminPluginSettings");
+ }, done);
+ });
+
+ it('should load the plugin settings user page correctly', function (done) {
+ expect.screenshot('user_plugin_settings').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=CoreAdminHome&action=userPluginSettings");
+ }, done);
+ });
+
+ it('should load the Settings > Visitor Generator admin page correctly', function (done) {
+ expect.screenshot('admin_visitor_generator').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=VisitorGenerator&action=index");
+
+ page.evaluate(function () {
+ var $p = $('#content p:eq(1)');
+ $p.text($p.text().replace(/\(change .*\)/g, ''));
+ });
+ }, done);
+ });
+
+ // Notifications
+ it('should load the notifications page correctly', function (done) {
+ expect.screenshot('notifications').to.be.capture(function (page) {
+ page.load("?" + generalParams + "&module=ExampleUI&action=notifications&idSite=1&period=day&date=yesterday");
+ page.evaluate(function () {
+ $('#header').hide();
+ });
+ }, done);
+ });
+
+ // Fatal error safemode
+ it('should load the safemode fatal error page correctly', function (done) {
+ var message = "Call%20to%20undefined%20function%20Piwik%5CPlugins%5CFoobar%5CPiwik_Translate()",
+ file = "%2Fhome%2Fvagrant%2Fwww%2Fpiwik%2Fplugins%2FFoobar%2FFoobar.php%20line%205",
+ line = 58;
+
+ expect.screenshot('fatal_error_safemode').to.be.capture(function (page) {
+ page.load("?" + generalParams + "&module=CorePluginsAdmin&action=safemode&idSite=1&period=day&date=yesterday&activated"
+ + "&error_message=" + message + "&error_file=" + file + "&error_line=" + line + "&tests_hide_piwik_version=1");
+ }, done);
+ });
+
+ // DB error message
+ it('should fail correctly when db information in config is incorrect', function (done) {
+ testEnvironment.configOverride = {
+ database: {
+ host: '127.50.50.50',
+ username: 'slkdfjsdlkfj',
+ password: 'slkdfjsldkfj',
+ dbname: 'abcdefg',
+ tables_prefix: 'gfedcba'
+ }
+ };
+ testEnvironment.save();
+
+ expect.screenshot('db_connect_error').to.be.capture(function (page) {
+ page.load("");
+ }, done);
+ });
+
+ // CustomAlerts plugin TODO: move to CustomAlerts plugin
+ it('should load the custom alerts list correctly', function (done) {
+ expect.screenshot('customalerts_list').to.be.capture(function (page) {
+ page.load("?" + generalParams + "&module=CustomAlerts&action=index&idSite=1&period=day&date=yesterday&tests_hide_piwik_version=1");
+ }, done);
+ });
+
+ it('should load the triggered custom alerts list correctly', function (done) {
+ expect.screenshot('customalerts_list_triggered').to.be.capture(function (page) {
+ page.load("?" + generalParams + "&module=CustomAlerts&action=historyTriggeredAlerts&idSite=1&period=day&date=yesterday&tests_hide_piwik_version=1");
+ }, done);
+ });
+
+ // top bar pages
+ it('should load the all websites dashboard correctly', function (done) {
+ expect.screenshot('all_websites').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + generalParams + "&module=MultiSites&action=index");
+ }, done);
+ });
+
+ it('should load the widgets listing page correctly', function (done) {
+ expect.screenshot('widgets_listing').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=Widgetize&action=index");
+ page.mouseMove('.widgetpreview-categorylist>li:contains(Visits Summary)');
+ page.mouseMove('li[uniqueid=widgetVisitsSummarygetEvolutionGraphcolumnsArray]');
+ }, done);top
+ });
+
+ it('should load the API listing page correctly', function (done) {
+ expect.screenshot('api_listing').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=API&action=listAllAPI");
+ page.evaluate(function () { // remove token_auth since it can change on each test run
+ $('span#token_auth>strong').text('dummytokenauth');
+ });
+ }, done);
+ });
+
+ it('should load the email reports page correctly', function (done) {
+ expect.screenshot('email_reports').to.be.capture(function (page) {
+ page.load("?" + generalParams + "&module=ScheduledReports&action=index");
+ page.evaluate(function () {
+ $('#header').hide();
+ });
+ }, done);
+ });
+
+ it('should load the feedback form when the feedback form link is clicked', function (done) {
+ expect.screenshot('feedback_form').to.be.capture(function (page) {
+
+ page.load("?" + generalParams + "&module=Feedback&action=index");
+
+ page.evaluate(function () {
+ $('h2 span').each(function () {
+ if ($(this).text().indexOf("Piwik") !== -1) {
+ var replace = $(this).text().replace(/Piwik\s*\d+\.\d+(\.\d+)?([\-a-z]*\d+)?/g, 'Piwik');
+ $(this).text(replace);
+ }
+ });
+
+ $('#header').hide();
+ });
+ }, done);
+ });
+
+ // date range clicked
+ it('should reload to the correct date when a date range is selected in the period selector', function (done) {
+ expect.screenshot('period_select_date_range_click').to.be.capture(function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=VisitTime&action=index");
+ page.evaluate(function () {
+ $(document).ready(function () {
+ $('#date').click();
+ $('#period_id_range').click();
+ $('#inputCalendarFrom').val('2012-08-02');
+ $('#inputCalendarTo').val('2012-08-12');
+ setTimeout(function () {$('#calendarRangeApply').click();}, 500);
+ });
+ });
+ }, done);
+ });
+
+ // visitor profile popup
+ it('should load the visitor profile popup correctly', function (done) {
+ expect.screenshot('visitor_profile_popup').to.be.capture(function (page) {
+ page.load("?" + widgetizeParams + "&" + idSite2Params + "&moduleToWidgetize=Live&actionToWidgetize=getVisitorProfilePopup"
+ + "&enableAnimation=0");
+
+ page.evaluate(function () {
+ $(document).ready(function () {
+ $('.visitor-profile-show-map').click();
+ });
+ });
+
+ page.wait(1000);
+ }, done);
+ });
+
+ // opt out page
+ it('should load the opt out page correctly', function (done) {
+ expect.screenshot('opt_out').to.be.capture(function (page) {
+ testEnvironment.testUseRegularAuth = 1;
+ testEnvironment.save();
+
+ page.load("?module=CoreAdminHome&action=optOut&language=en");
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Updater_spec.js b/tests/UI/specs/Updater_spec.js
new file mode 100644
index 0000000000..0ddc8b67cb
--- /dev/null
+++ b/tests/UI/specs/Updater_spec.js
@@ -0,0 +1,37 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Installation screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("Updater", function () {
+ this.timeout(0);
+
+ this.fixture = "Piwik\\Tests\\Fixtures\\UpdaterTestFixture";
+
+ before(function () {
+ testEnvironment.tablesPrefix = 'piwik_';
+ testEnvironment.save();
+ });
+
+ it("should start the updater when an old version of Piwik is detected in the DB", function (done) {
+ expect.screenshot("main").to.be.capture(function (page) {
+ page.load("");
+ page.evaluate(function () {
+ $('p').each(function () {
+ var replace = $(this).html().replace(/(?!1\.0)\d+\.\d+(\.\d+)?([\-a-z]*\d+)?/g, '');
+ $(this).html(replace);
+ });
+ });
+ }, done);
+ });
+
+ it("should show the donation form when the update process is complete", function (done) {
+ expect.screenshot("updated").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/ViewDataTable_spec.js b/tests/UI/specs/ViewDataTable_spec.js
new file mode 100644
index 0000000000..7a584e7c97
--- /dev/null
+++ b/tests/UI/specs/ViewDataTable_spec.js
@@ -0,0 +1,143 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * ViewDataTable screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("ViewDataTableTest", function () { // TODO: should remove Test suffix from images instead of naming suites ...Test
+ this.timeout(0);
+
+ // TODO: rename screenshot files, remove numbers
+ var url = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=year&date=2012-08-09&"
+ + "actionToWidgetize=getKeywords&viewDataTable=table&filter_limit=5&isFooterExpandedInDashboard=1";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("0_initial").to.be.capture(function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should load all columns when all columns clicked", function (done) {
+ expect.screenshot("1_all_columns").to.be.capture(function (page) {
+ page.click('.tableIcon[data-footer-icon-id=tableAllColumns]');
+ }, done);
+ });
+
+ it("should sort a column in descending order when column clicked initially", function (done) {
+ expect.screenshot("2_column_sorted_desc").to.be.capture(function (page) {
+ page.click('th#avg_time_on_site');
+ }, done);
+ });
+
+ it("should sort a column in ascending order when column clicked second time", function (done) {
+ expect.screenshot("3_column_sorted_asc").to.be.capture(function (page) {
+ page.click('th#avg_time_on_site');
+ }, done);
+ });
+
+ it("should exclude low population rows when low population clicked", function (done) {
+ expect.screenshot("4_exclude_low_population").to.be.capture(function (page) {
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableExcludeLowPopulation');
+ }, done);
+ });
+
+ it("should load goals table when goals footer icon clicked", function (done) {
+ expect.screenshot("5_goals").to.be.capture(function (page) {
+ page.click('.tableIcon[data-footer-icon-id=tableGoals]');
+ }, done);
+ });
+
+ it("should load bar graph when bar graph footer icon clicked", function (done) {
+ expect.screenshot('6_bar_graph').to.be.capture(function (page) {
+ page.mouseMove('.tableIconsGroup:nth-child(2)');
+ page.click('.tableIcon[data-footer-icon-id=graphVerticalBar]');
+ }, done);
+ });
+
+ it("should load pie graph when pie graph footer icon clicked", function (done) {
+ expect.screenshot('7_pie_graph').to.be.capture(function (page) {
+ page.mouseMove('.tableIconsGroup:nth-child(2)');
+ page.click('.tableIcon[data-footer-icon-id=graphPie]');
+ }, done);
+ });
+
+ it("should load a tag cloud when tag cloud footer icon clicked", function (done) {
+ expect.screenshot('8_tag_cloud').to.be.capture(function (page) {
+ page.mouseMove('.tableIconsGroup:nth-child(2)');
+ page.click('.tableIcon[data-footer-icon-id=cloud]');
+ }, done);
+ });
+
+ it("should load normal table when normal table footer icon clicked", function (done) {
+ expect.screenshot('9_normal_table').to.be.capture(function (page) {
+ page.click('.tableIcon[data-footer-icon-id=table]');
+ }, done);
+ });
+
+ it("should change the number of rows when new limit selected", function (done) {
+ expect.screenshot('10_change_limit').to.be.capture(function (page) {
+ page.click('.limitSelection');
+ page.click('.limitSelection ul li[value=10]');
+ }, done);
+ });
+
+ it("should flatten the table when the flatten link is clicked", function (done) {
+ expect.screenshot('11_flattened').to.be.capture(function (page) {
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableFlatten');
+ }, done);
+ });
+
+ it("should show aggregate rows when the aggregate rows option is clicked", function (done) {
+ expect.screenshot('12_aggregate_shown').to.be.capture(function (page) {
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableIncludeAggregateRows');
+ }, done);
+ });
+
+ it("should make the report hierarchical when the flatten link is clicked again", function (done) {
+ expect.screenshot('13_make_hierarchical').to.be.capture(function (page) {
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableFlatten');
+ }, done);
+ });
+
+ it("should show the visits percent when hovering over a column", function (done) {
+ expect.screenshot('14_visits_percent').to.be.capture(function (page) {
+ page.mouseMove('td.column');
+ }, done);
+ });
+
+ it("should load subtables correctly when row clicked", function (done) {
+ expect.screenshot('subtables_loaded').to.be.capture(function (page) {
+ page.click('tr.subDataTable:first');
+ page.click('tr.subDataTable:eq(2)');
+ }, done);
+ });
+
+ it("should search the table when a search string is entered and the search button clicked", function (done) {
+ expect.screenshot('15_search').to.be.capture(function (page) {
+ page.sendKeys('.dataTableSearchPattern>input[type=text]', 'term');
+ page.click('.dataTableSearchPattern>input[type=submit]');
+ }, done);
+ });
+
+ it("should display the export options when clicking the export icon", function (done) {
+ expect.screenshot('export_options').to.be.capture(function (page) {
+ page.click('.exportToFormatIcons', 2000);
+ }, done);
+ });
+
+ it("should display a related report when related report link is clicked", function (done) {
+ expect.screenshot('related_report_click').to.be.capture(function (page) {
+ var newReportUrl = url.replace("=Referrers", "=UserSettings").replace("=getKeywords", "=getOS");
+
+ page.load(newReportUrl);
+ page.click('.datatableRelatedReports li>span:visible');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_0_initial.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_0_initial.png
deleted file mode 100644
index aaf0f12fdd..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_0_initial.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_10_change_limit.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_10_change_limit.png
deleted file mode 100644
index 891f8b0a6c..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_10_change_limit.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_11_flattened.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_11_flattened.png
deleted file mode 100644
index 076654dfcc..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_11_flattened.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_12_aggregate_shown.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_12_aggregate_shown.png
deleted file mode 100644
index db6caebadb..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_12_aggregate_shown.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_13_make_hierarchical.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_13_make_hierarchical.png
deleted file mode 100644
index 891f8b0a6c..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_13_make_hierarchical.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_14_visits_percent.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_14_visits_percent.png
deleted file mode 100644
index 8674bfbe32..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_14_visits_percent.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_15_search.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_15_search.png
deleted file mode 100644
index 8a2f4feca1..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_15_search.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_1_all_columns.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_1_all_columns.png
deleted file mode 100644
index 35c67ed7a3..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_1_all_columns.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_2_column_sorted_desc.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_2_column_sorted_desc.png
deleted file mode 100644
index 7d303c01ce..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_2_column_sorted_desc.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_3_column_sorted_asc.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_3_column_sorted_asc.png
deleted file mode 100644
index f11870080a..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_3_column_sorted_asc.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_4_exclude_low_population.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_4_exclude_low_population.png
deleted file mode 100644
index 82370b1f4d..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_4_exclude_low_population.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_5_goals.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_5_goals.png
deleted file mode 100644
index daa53ad156..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_5_goals.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_6_bar_graph.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_6_bar_graph.png
deleted file mode 100644
index 64aa2330a8..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_6_bar_graph.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_7_pie_graph.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_7_pie_graph.png
deleted file mode 100644
index 828621d5b6..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_7_pie_graph.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_8_tag_cloud.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_8_tag_cloud.png
deleted file mode 100644
index 4f12618a1b..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_8_tag_cloud.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_9_normal_table.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_9_normal_table.png
deleted file mode 100644
index 6dfe56ba90..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_9_normal_table.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_export_options.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_export_options.png
deleted file mode 100644
index 1379a4f24b..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_export_options.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_related_report_click.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_related_report_click.png
deleted file mode 100644
index 654b8497c3..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_related_report_click.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_subtables_loaded.png b/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_subtables_loaded.png
deleted file mode 100644
index 6853b804e8..0000000000
--- a/tests/lib/screenshot-testing/processed-ui-screenshots/ViewDataTableTest_subtables_loaded.png
+++ /dev/null
Binary files differ
diff --git a/tests/lib/screenshot-testing/run-tests.js b/tests/lib/screenshot-testing/run-tests.js
index fd313ee4f0..86f4c7ef55 100644
--- a/tests/lib/screenshot-testing/run-tests.js
+++ b/tests/lib/screenshot-testing/run-tests.js
@@ -8,7 +8,20 @@
*/
// required modules
-var config = require("./config");
+var config = require("./../../UI/config.dist");
+try {
+ var localConfig = require("./../../UI/config");
+} catch (e) {
+ localConfig = null;
+}
+
+if (localConfig) {
+ for (var prop in localConfig) {
+ if (localConfig.hasOwnProperty(prop)) {
+ config[prop] = localConfig[prop];
+ }
+ }
+}
// assume the URI points to a folder and make sure Piwik won't cut off the last path segment
if (config.phpServer.REQUEST_URI.slice(-1) != '/') {
diff --git a/tests/lib/screenshot-testing/support/app.js b/tests/lib/screenshot-testing/support/app.js
index 0de86e1da3..29a7943190 100644
--- a/tests/lib/screenshot-testing/support/app.js
+++ b/tests/lib/screenshot-testing/support/app.js
@@ -42,7 +42,7 @@ var isCorePlugin = function (pathToPlugin) {
var Application = function () {
this.runner = null;
- var diffviewerDir = path.join(PIWIK_INCLUDE_PATH, 'tests/PHPUnit/UI', config.screenshotDiffDir);
+ var diffviewerDir = path.join(PIWIK_INCLUDE_PATH, 'tests/UI', config.screenshotDiffDir);
this.diffViewerGenerator = new DiffViewerGenerator(diffviewerDir);
};
@@ -79,7 +79,7 @@ Application.prototype.init = function () {
var suite = oldDescribe.apply(null, arguments);
suite.baseDirectory = app.currentModulePath.match(/\/plugins\//) ? path.dirname(app.currentModulePath) : uiTestsDir;
if (options['assume-artifacts']) {
- suite.diffDir = path.join(PIWIK_INCLUDE_PATH, 'tests/PHPUnit/UI', config.screenshotDiffDir);
+ suite.diffDir = path.join(PIWIK_INCLUDE_PATH, 'tests/UI', config.screenshotDiffDir);
} else {
suite.diffDir = path.join(suite.baseDirectory, config.screenshotDiffDir);
}
@@ -210,7 +210,7 @@ Application.prototype.doRunTests = function () {
var symlinks = ['libs', 'plugins', 'tests', 'piwik.js'];
symlinks.forEach(function (item) {
- var file = path.join(uiTestsDir, '..', 'proxy', item);
+ var file = path.join(uiTestsDir, '..', 'PHPUnit', 'proxy', item);
if (fs.exists(file)) {
fs.remove(file);
}
diff --git a/tests/lib/screenshot-testing/support/diff-viewer.js b/tests/lib/screenshot-testing/support/diff-viewer.js
index f68eddf8d1..7910887fdd 100644
--- a/tests/lib/screenshot-testing/support/diff-viewer.js
+++ b/tests/lib/screenshot-testing/support/diff-viewer.js
@@ -17,11 +17,11 @@ var DiffViewerGenerator = function (diffDir) {
};
DiffViewerGenerator.prototype.getDiffPath = function (testInfo) {
- var baseDir = path.join(PIWIK_INCLUDE_PATH, 'tests/PHPUnit/UI');
+ var baseDir = path.join(PIWIK_INCLUDE_PATH, 'tests/UI');
return path.resolve(path.join(baseDir, config.screenshotDiffDir, testInfo.name + '.png'));
};
-// TODO: diff output path shouldn't be stored in piwik-ui-tests repo
+// TODO: diff output path shouldn't be stored in piwik repo
DiffViewerGenerator.prototype.getUrlForPath = function (path) {
return fs.relpath(path, this.diffDir);
};
diff --git a/tests/lib/screenshot-testing/support/globals.js b/tests/lib/screenshot-testing/support/globals.js
index 8b7fe944f8..dbbed49c0a 100644
--- a/tests/lib/screenshot-testing/support/globals.js
+++ b/tests/lib/screenshot-testing/support/globals.js
@@ -13,7 +13,7 @@ var __dirname = phantom.libraryPath;
var PIWIK_INCLUDE_PATH = path.join(__dirname, '..', '..', '..');
-var uiTestsDir = path.join(PIWIK_INCLUDE_PATH, 'tests', 'PHPUnit', 'UI')
+var uiTestsDir = path.join(PIWIK_INCLUDE_PATH, 'tests', 'UI')
var testsLibDir = path.join(__dirname, "..", "..", "lib");
diff --git a/tests/lib/screenshot-testing/support/page-renderer.js b/tests/lib/screenshot-testing/support/page-renderer.js
index e615c80777..4f66a728f2 100644
--- a/tests/lib/screenshot-testing/support/page-renderer.js
+++ b/tests/lib/screenshot-testing/support/page-renderer.js
@@ -175,7 +175,9 @@ PageRenderer.prototype._load = function (url, callback) {
this.webpage.open(url, function (status) {
this.evaluate(function () {
var $ = window.jQuery;
- $('html').addClass('uiTest');
+ if ($) {
+ $('html').addClass('uiTest');
+ }
});
if (callback) {
diff --git a/tests/resources/OmniFixture-dump.sql.gz b/tests/resources/OmniFixture-dump.sql.gz
index c128a06767..c8e5e1c72b 100644
--- a/tests/resources/OmniFixture-dump.sql.gz
+++ b/tests/resources/OmniFixture-dump.sql.gz
Binary files differ
diff --git a/tests/travis/initiate_ui_tests.sh b/tests/travis/initiate_ui_tests.sh
deleted file mode 100755
index 9dfd307701..0000000000
--- a/tests/travis/initiate_ui_tests.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-
-# initiate UI tests before starting system tests for php 5.5
-if [ "$TEST_SUITE" != "SystemTests" ] || [[ "$TRAVIS_PHP_VERSION" != 5\.6* ]]; 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
-
-COMMIT_MESSAGE=$(git log "$TRAVIS_COMMIT" -1 --pretty=%B)
-
-cd tests/PHPUnit/UI
-
-UI_BRANCH="master"
-git checkout $UI_BRANCH -q
-git pull --rebase origin $UI_BRANCH -q
-
-echo "$TRAVIS_COMMIT
-$TRAVIS_BRANCH" > piwik_commit.txt
-
-git add ./piwik_commit.txt
-git commit -m "Travis: Initiating build for commit '$TRAVIS_COMMIT' on branch '$TRAVIS_BRANCH': $COMMIT_MESSAGE"
-git remote set-url origin "https://piwik-auto-commit-bot:$PIWIK_AUTOMATION@github.com/piwik/piwik-ui-tests.git"
-
-if ! git push origin $UI_BRANCH 2> /dev/null; then
- echo "Failed to push!"
- exit 1
-fi
diff --git a/tests/travis/travis.sh b/tests/travis/travis.sh
index 383a0e3a2d..239013bb54 100755
--- a/tests/travis/travis.sh
+++ b/tests/travis/travis.sh
@@ -43,7 +43,7 @@ then
echo ""
echo "http://builds-artifacts.piwik.org/$artifacts_folder/$TRAVIS_JOB_NUMBER/screenshot-diffs/diffviewer.html"
echo ""
- echo "If the new screenshots are valid, then you can copy them over to tests/PHPUnit/UI/expected-ui-screenshots/."
+ echo "If the new screenshots are valid, then you can copy them over to tests/UI/expected-ui-screenshots/."
echo ""
if [ -n "$PLUGIN_NAME" ]
diff --git a/tests/travis/upload_artifacts.sh b/tests/travis/upload_artifacts.sh
index f7061b16a5..20782dcab5 100755
--- a/tests/travis/upload_artifacts.sh
+++ b/tests/travis/upload_artifacts.sh
@@ -41,7 +41,7 @@ else
cd "./plugins/$PLUGIN_NAME/tests/UI"
fi
else
- cd ./tests/PHPUnit/UI
+ cd ./tests/UI
fi
# upload processed tarball
@@ -49,7 +49,7 @@ else
curl -X POST --data-binary @processed-ui-screenshots.tar.bz2 "$url_base&artifact_name=processed-ui-screenshots"
# upload diff tarball if it exists
- cd $base_dir/tests/PHPUnit/UI
+ cd $base_dir/tests/UI
if [ -d "./screenshot-diffs" ];
then
echo "Uploading artifcats..."