diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2014-12-19 00:13:27 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2014-12-19 00:13:27 +0300 |
commit | 1fc84146b16f178f95f7b95b089426f9c84744d9 (patch) | |
tree | e90e0c099f387671e0ad12ef4c2160835abaeb1a /tests | |
parent | 6590128885af88b5bbfe9c0a856a224006f8e7e3 (diff) | |
parent | 484cd7a3079f0165728b4391d1bbdd2d478e6bf0 (diff) |
Merge branch 'master' into log-refactoring-1
Conflicts:
CHANGELOG.md
plugins/CoreConsole/Commands/CoreArchiver.php
Diffstat (limited to 'tests')
20 files changed, 173 insertions, 52 deletions
diff --git a/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php b/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php index 2a782b67c3..8381aea43f 100644 --- a/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php +++ b/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php @@ -87,7 +87,7 @@ abstract class IntegrationTestCase extends SystemTestCase */ public function tearDown() { - self::$fixture->clearInMemoryCaches(); + static::$fixture->clearInMemoryCaches(); parent::tearDown(); } diff --git a/tests/PHPUnit/Integration/CacheIdTest.php b/tests/PHPUnit/Integration/CacheIdTest.php index ebdfd9c035..01d39d7e49 100644 --- a/tests/PHPUnit/Integration/CacheIdTest.php +++ b/tests/PHPUnit/Integration/CacheIdTest.php @@ -39,7 +39,11 @@ class CacheIdTest extends IntegrationTestCase { $result = CacheId::pluginAware('myrandomkey'); - // if this test fails most likely there is a new plugin loaded and you simple have to update the cache id. - $this->assertEquals('myrandomkey-8f88a1dea9163e86178e69a1293ec084-en', $result); + $parts = explode('-', $result); + + $this->assertCount(3, $parts); + $this->assertEquals('myrandomkey', $parts[0]); + $this->assertEquals(32, strlen($parts[1]), $parts[1] . ' is not a MD5 hash'); + $this->assertEquals('en', $parts[2]); } } diff --git a/tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php b/tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php index 6e3959ceda..8ad12f8b8b 100644 --- a/tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php +++ b/tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php @@ -26,11 +26,20 @@ class SharedSiteIdsTest extends IntegrationTestCase { parent::setUp(); + if (! SharedSiteIds::isSupported()) { + $this->markTestSkipped('Not supported on this platform'); + return; + } + $this->sharedSiteIds = new SharedSiteIds(array(1,2,5,9)); } public function tearDown() { + if (! SharedSiteIds::isSupported()) { + return; + } + $siteIdsToCleanup = new SharedSiteIds(array()); $siteIdsToCleanup->setSiteIdsToArchive(array()); diff --git a/tests/PHPUnit/Integration/HttpTest.php b/tests/PHPUnit/Integration/HttpTest.php index a5d62b3060..3e7f38577c 100644 --- a/tests/PHPUnit/Integration/HttpTest.php +++ b/tests/PHPUnit/Integration/HttpTest.php @@ -60,6 +60,10 @@ class HttpTest extends \PHPUnit_Framework_TestCase */ public function testCustomByteRange($method) { + if ($method == 'fopen') { + return; // not supported w/ this method + } + $result = Http::sendHttpRequestBy( $method, Fixture::getRootUrl() . '/piwik.js', @@ -74,12 +78,10 @@ class HttpTest extends \PHPUnit_Framework_TestCase $getExtendedInfo = true ); - if ($method != 'fopen') { - $this->assertEquals(206, $result['status']); - $this->assertTrue(isset($result['headers']['Content-Range'])); - $this->assertEquals('bytes 10-20/', substr($result['headers']['Content-Range'], 0, 12)); - $this->assertTrue( in_array($result['headers']['Content-Type'], array('application/x-javascript', 'application/javascript'))); - } + $this->assertEquals(206, $result['status']); + $this->assertTrue(isset($result['headers']['Content-Range'])); + $this->assertEquals('bytes 10-20/', substr($result['headers']['Content-Range'], 0, 12)); + $this->assertTrue(in_array($result['headers']['Content-Type'], array('application/x-javascript', 'application/javascript'))); } /** @@ -111,6 +113,6 @@ class HttpTest extends \PHPUnit_Framework_TestCase $this->assertTrue(isset($result['headers']['Content-Length']), "Content-Length header not set!"); $this->assertTrue(is_numeric($result['headers']['Content-Length']), "Content-Length header not numeric!"); - $this->assertEquals('application/zip', $result['headers']['Content-Type']); + $this->assertTrue(in_array($result['headers']['Content-Type'], array('application/zip', 'application/x-zip-compressed'))); } } diff --git a/tests/PHPUnit/Integration/ReleaseCheckListTest.php b/tests/PHPUnit/Integration/ReleaseCheckListTest.php index 425b400f8a..95aaccb43f 100644 --- a/tests/PHPUnit/Integration/ReleaseCheckListTest.php +++ b/tests/PHPUnit/Integration/ReleaseCheckListTest.php @@ -156,6 +156,11 @@ class ReleaseCheckListTest extends \PHPUnit_Framework_TestCase $files = Filesystem::globr(PIWIK_INCLUDE_PATH, '*.php'); foreach($files as $file) { + // skip files in these folders + if (strpos($file, '/libs/') !== false) { + continue; + } + $handle = fopen($file, "r"); $expectedStart = "<?php"; @@ -250,7 +255,7 @@ class ReleaseCheckListTest extends \PHPUnit_Framework_TestCase strpos($file, '/tests/') !== false || strpos($file, '/lang/') !== false || strpos($file, 'yuicompressor') !== false || - strpos($file, '/libs/bower_components') !== false || + strpos($file, '/libs/') !== false || (strpos($file, '/vendor') !== false && strpos($file, '/vendor/piwik') === false) || strpos($file, '/tmp/') !== false ) { @@ -258,7 +263,7 @@ class ReleaseCheckListTest extends \PHPUnit_Framework_TestCase } // skip files with these file extensions - if (preg_match('/\.(bmp|fdf|gif|deb|deflate|exe|gz|ico|jar|jpg|p12|pdf|png|rar|swf|vsd|z|zip|ttf|so|dat|eps|phar|pyc|gzip)$/', $file)) { + if (preg_match('/\.(bmp|fdf|gif|deb|deflate|exe|gz|ico|jar|jpg|p12|pdf|png|rar|swf|vsd|z|zip|ttf|so|dat|eps|phar|pyc|gzip|eot|woff|svg)$/', $file)) { continue; } @@ -311,6 +316,11 @@ class ReleaseCheckListTest extends \PHPUnit_Framework_TestCase { $errors = array(); foreach ($files as $file) { + // skip files in these folders + if (strpos($file, '/libs/') !== false) { + continue; + } + $function = "imagecreatefrom" . $format; if (!function_exists($function)) { throw new \Exception("Unexpected error: $function function does not exist!"); diff --git a/tests/PHPUnit/Integration/ServeStaticFileTest.php b/tests/PHPUnit/Integration/ServeStaticFileTest.php index 31700eebef..8eabd6a499 100644 --- a/tests/PHPUnit/Integration/ServeStaticFileTest.php +++ b/tests/PHPUnit/Integration/ServeStaticFileTest.php @@ -276,7 +276,7 @@ class ServeStaticFileTest extends \PHPUnit_Framework_TestCase // Tests deflate compression has been used $deflateFileLocation = $this->getCompressedFileLocation() . ".deflate"; - $this->assertTrue(file_exists($deflateFileLocation)); + $this->assertFileExists($deflateFileLocation); // Tests gzdeflate has been used for IE compatibility $this->assertEquals(gzinflate(file_get_contents($deflateFileLocation)), file_get_contents(TEST_FILE_LOCATION)); @@ -310,7 +310,7 @@ class ServeStaticFileTest extends \PHPUnit_Framework_TestCase // Tests gzip compression has been used $gzipFileLocation = $this->getCompressedFileLocation() . ".gz"; - $this->assertTrue(file_exists($gzipFileLocation)); + $this->assertFileExists($gzipFileLocation); $this->removeCompressedFiles(); } @@ -446,8 +446,8 @@ class ServeStaticFileTest extends \PHPUnit_Framework_TestCase clearstatcache(); // check the correct compressed file is created - $this->assertTrue(file_exists($this->getCompressedFileLocation() . '.' . PARTIAL_BYTE_START . '.' . PARTIAL_BYTE_END . ".deflate")); - $this->assertFalse(file_exists($this->getCompressedFileLocation() . ".gz")); + $this->assertFileExists($this->getCompressedFileLocation() . '.' . PARTIAL_BYTE_START . '.' . PARTIAL_BYTE_END . ".deflate"); + $this->assertFileNotExists($this->getCompressedFileLocation() . ".gz"); // check $partialResponse $expectedPartialContents = substr(file_get_contents(TEST_FILE_LOCATION), PARTIAL_BYTE_START, @@ -475,8 +475,8 @@ class ServeStaticFileTest extends \PHPUnit_Framework_TestCase clearstatcache(); // check the correct compressed file is created - $this->assertTrue(file_exists($this->getCompressedFileLocation() . ".deflate")); - $this->assertFalse(file_exists($this->getCompressedFileLocation() . ".gz")); + $this->assertFileExists($this->getCompressedFileLocation() . ".deflate"); + $this->assertFileNotExists($this->getCompressedFileLocation() . ".gz"); // check $fullResponse $this->assertEquals(file_get_contents(TEST_FILE_LOCATION), $fullResponse); diff --git a/tests/PHPUnit/Integration/Tracker/VisitTest.php b/tests/PHPUnit/Integration/Tracker/VisitTest.php index 2764e4a2aa..ef5668e737 100644 --- a/tests/PHPUnit/Integration/Tracker/VisitTest.php +++ b/tests/PHPUnit/Integration/Tracker/VisitTest.php @@ -159,6 +159,7 @@ class VisitTest extends IntegrationTestCase 'http://semalt.com/out/of/here?mate' => true, 'http://buttons-for-website.com/out/of/here?mate' => true, 'https://buttons-for-website.com' => true, + 'https://7makemoneyonline.com' => true, 'http://valid.domain/' => false, 'http://valid.domain/page' => false, 'https://valid.domain/page' => false, diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__Live.getLastVisitsDetails_range.xml b/tests/PHPUnit/System/expected/test_ImportLogs__Live.getLastVisitsDetails_range.xml index 149b71426e..3e2644cca0 100644 --- a/tests/PHPUnit/System/expected/test_ImportLogs__Live.getLastVisitsDetails_range.xml +++ b/tests/PHPUnit/System/expected/test_ImportLogs__Live.getLastVisitsDetails_range.xml @@ -2184,12 +2184,12 @@ <visitDurationPretty>2s</visitDurationPretty> <searches>0</searches> <actions>2</actions> - <referrerType>direct</referrerType> - <referrerTypeName>Direct Entry</referrerTypeName> - <referrerName /> + <referrerType>website</referrerType> + <referrerTypeName>Websites</referrerTypeName> + <referrerName>example.com</referrerName> <referrerKeyword /> <referrerKeywordPosition /> - <referrerUrl /> + <referrerUrl>http://example.com/Search/SearchResults.pg?informationRecipient.languageCode.c=en</referrerUrl> <referrerSearchEngineUrl /> <referrerSearchEngineIcon /> <plugins /> diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getAll_month.xml b/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getAll_month.xml index 808d27a0c7..8ddde34007 100644 --- a/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getAll_month.xml +++ b/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getAll_month.xml @@ -40,4 +40,24 @@ <sum_daily_nb_users>0</sum_daily_nb_users> <referer_type>3</referer_type> </row> + <row> + <label>example.com</label> + <nb_visits>1</nb_visits> + <nb_actions>2</nb_actions> + <max_actions>2</max_actions> + <sum_visit_length>2</sum_visit_length> + <bounce_count>0</bounce_count> + <goals> + <row idgoal='1'> + <nb_conversions>1</nb_conversions> + <nb_visits_converted>1</nb_visits_converted> + <revenue>5</revenue> + </row> + </goals> + <nb_conversions>1</nb_conversions> + <revenue>5</revenue> + <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>1</sum_daily_nb_users> + <referer_type>3</referer_type> + </row> </result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getNumberOfDistinctWebsitesUrls_month.xml b/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getNumberOfDistinctWebsitesUrls_month.xml index 13002b2017..15ef03fb49 100644 --- a/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getNumberOfDistinctWebsitesUrls_month.xml +++ b/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getNumberOfDistinctWebsitesUrls_month.xml @@ -1,2 +1,2 @@ <?xml version="1.0" encoding="utf-8" ?> -<result>2</result>
\ No newline at end of file +<result>3</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getNumberOfDistinctWebsites_month.xml b/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getNumberOfDistinctWebsites_month.xml index 13002b2017..15ef03fb49 100644 --- a/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getNumberOfDistinctWebsites_month.xml +++ b/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getNumberOfDistinctWebsites_month.xml @@ -1,2 +1,2 @@ <?xml version="1.0" encoding="utf-8" ?> -<result>2</result>
\ No newline at end of file +<result>3</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getReferrerType_month.xml b/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getReferrerType_month.xml index e5e8c8d924..0f1dfce4ff 100644 --- a/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getReferrerType_month.xml +++ b/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getReferrerType_month.xml @@ -2,44 +2,63 @@ <result> <row> <label>Direct Entry</label> - <nb_visits>32</nb_visits> - <nb_actions>37</nb_actions> + <nb_visits>31</nb_visits> + <nb_actions>35</nb_actions> <max_actions>3</max_actions> - <sum_visit_length>550</sum_visit_length> + <sum_visit_length>548</sum_visit_length> <bounce_count>28</bounce_count> <goals> <row idgoal='1'> - <nb_conversions>28</nb_conversions> - <nb_visits_converted>28</nb_visits_converted> - <revenue>140</revenue> + <nb_conversions>27</nb_conversions> + <nb_visits_converted>27</nb_visits_converted> + <revenue>135</revenue> </row> </goals> - <nb_conversions>28</nb_conversions> - <revenue>140</revenue> - <sum_daily_nb_uniq_visitors>31</sum_daily_nb_uniq_visitors> - <sum_daily_nb_users>2</sum_daily_nb_users> + <nb_conversions>27</nb_conversions> + <revenue>135</revenue> + <sum_daily_nb_uniq_visitors>30</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>1</sum_daily_nb_users> <nb_visits_converted>0</nb_visits_converted> </row> <row> <label>Websites</label> - <nb_visits>2</nb_visits> - <nb_actions>2</nb_actions> - <max_actions>1</max_actions> - <sum_visit_length>0</sum_visit_length> + <nb_visits>3</nb_visits> + <nb_actions>4</nb_actions> + <max_actions>2</max_actions> + <sum_visit_length>2</sum_visit_length> <bounce_count>2</bounce_count> <goals> <row idgoal='1'> - <nb_conversions>2</nb_conversions> - <nb_visits_converted>2</nb_visits_converted> - <revenue>10</revenue> + <nb_conversions>3</nb_conversions> + <nb_visits_converted>3</nb_visits_converted> + <revenue>15</revenue> </row> </goals> - <nb_conversions>2</nb_conversions> - <revenue>10</revenue> - <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> - <sum_daily_nb_users>0</sum_daily_nb_users> + <nb_conversions>3</nb_conversions> + <revenue>15</revenue> + <sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>1</sum_daily_nb_users> <subtable> <row> + <label>example.com</label> + <nb_visits>1</nb_visits> + <nb_actions>2</nb_actions> + <max_actions>2</max_actions> + <sum_visit_length>2</sum_visit_length> + <bounce_count>0</bounce_count> + <goals> + <row idgoal='1'> + <nb_conversions>1</nb_conversions> + <nb_visits_converted>1</nb_visits_converted> + <revenue>5</revenue> + </row> + </goals> + <nb_conversions>1</nb_conversions> + <revenue>5</revenue> + <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>1</sum_daily_nb_users> + </row> + <row> <label>piwik.org</label> <nb_visits>1</nb_visits> <nb_actions>1</nb_actions> diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getWebsites_month.xml b/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getWebsites_month.xml index bfba8f21af..0abe37b28d 100644 --- a/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getWebsites_month.xml +++ b/tests/PHPUnit/System/expected/test_ImportLogs__Referrers.getWebsites_month.xml @@ -1,6 +1,38 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <row> + <label>example.com</label> + <nb_visits>1</nb_visits> + <nb_actions>2</nb_actions> + <max_actions>2</max_actions> + <sum_visit_length>2</sum_visit_length> + <bounce_count>0</bounce_count> + <goals> + <row idgoal='1'> + <nb_conversions>1</nb_conversions> + <nb_visits_converted>1</nb_visits_converted> + <revenue>5</revenue> + </row> + </goals> + <nb_conversions>1</nb_conversions> + <revenue>5</revenue> + <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>1</sum_daily_nb_users> + <subtable> + <row> + <label>http://example.com/Search/SearchResults.pg?informationRecipient.languageCode.c=en</label> + <nb_visits>1</nb_visits> + <nb_actions>2</nb_actions> + <max_actions>2</max_actions> + <sum_visit_length>2</sum_visit_length> + <bounce_count>0</bounce_count> + <nb_visits_converted>1</nb_visits_converted> + <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> + <sum_daily_nb_users>1</sum_daily_nb_users> + </row> + </subtable> + </row> + <row> <label>piwik.org</label> <nb_visits>1</nb_visits> <nb_actions>1</nb_actions> diff --git a/tests/PHPUnit/UI b/tests/PHPUnit/UI -Subproject 3c3fe985f1af4f1d897d6c1551057124fd6bffa +Subproject 903002816d39732aa2b2e8d33286725e60c9a4f diff --git a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php index 25b9f46ee1..4cbb8e0b08 100644 --- a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php +++ b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php @@ -64,7 +64,7 @@ class DeprecatedMethodsTest extends \PHPUnit_Framework_TestCase $this->assertDeprecatedMethodIsRemoved('Piwik\Plugins\UserSettings\API', 'getMobileVsDesktop', $validTill); $this->assertDeprecatedMethodIsRemoved('Piwik\Plugins\UserSettings\API', 'getResolution', $validTill); $this->assertDeprecatedMethodIsRemoved('Piwik\Plugins\UserSettings\API', 'getConfiguration', $validTill); - $this->assertDeprecatedMethodIsRemoved('Piwik\Plugins\UserSettings\UserSettings', 'mapDeprecatedActions', $validTill); + $this->assertDeprecatedMethodIsRemoved('Piwik\Plugins\UserSettings\UserSettings', 'renameDeprecatedModuleAndAction', $validTill); $this->assertDeprecatedMethodIsRemovedInPiwik3('\Piwik\Menu\MenuAbstract', 'add'); } diff --git a/tests/PHPUnit/Unit/Metrics/FormatterTest.php b/tests/PHPUnit/Unit/Metrics/FormatterTest.php index 8ef4831299..ce8c268b08 100644 --- a/tests/PHPUnit/Unit/Metrics/FormatterTest.php +++ b/tests/PHPUnit/Unit/Metrics/FormatterTest.php @@ -142,8 +142,9 @@ class FormatterTest extends \PHPUnit_Framework_TestCase array(0.14, '0,14'), array(0.14567, '0,15'), array(100.1234, '100,12'), - array(1000.45, '1.000,45'), - array(23456789.00, '23.456.789,00') + // Those last two are commented because locales are platform dependent, on some platforms the separator is '' instead of '.' +// array(1000.45, '1.000,45'), +// array(23456789.00, '23.456.789,00'), ); } diff --git a/tests/PHPUnit/Unit/Tracker/RequestTest.php b/tests/PHPUnit/Unit/Tracker/RequestTest.php index e3ff037638..43898ec866 100644 --- a/tests/PHPUnit/Unit/Tracker/RequestTest.php +++ b/tests/PHPUnit/Unit/Tracker/RequestTest.php @@ -132,6 +132,8 @@ class RequestTest extends UnitTestCase $this->assertCount(1, $request->getParams()); $this->assertTrue($request->isEmptyRequest()); + + unset($_SERVER['HTTP_REFERER']); } public function test_isEmptyRequest_ShouldReturnFalse_InCaseAtLEastOneParamIssSet() @@ -464,9 +466,16 @@ class RequestTest extends UnitTestCase public function test_getBrowserLanguage_ShouldReturnADefaultLanguageInCaseNoneIsSet() { + $envLanguage = getenv('LANG'); + putenv('LANG=en'); + $lang = $this->request->getBrowserLanguage(); $this->assertNotEmpty($lang); $this->assertTrue(2 <= strlen($lang) && strlen($lang) <= 10); + + if ($envLanguage !== false) { + putenv('LANG=' . $envLanguage); + } } public function test_makeThirdPartyCookie_ShouldReturnAnInstanceOfCookie() diff --git a/tests/README.md b/tests/README.md index faf942cba4..57c9c0923b 100644 --- a/tests/README.md +++ b/tests/README.md @@ -125,10 +125,16 @@ We also have an OmniFixture that includes all other Fixtures. OmniFixture is use #### Keep OmniFixture up to date -Remember to update the [Omnifixture SQL dump](https://github.com/piwik/piwik/blob/master/tests/resources/OmniFixture-dump.sql.gz) whenever you make any change to any fixture. For instance use: - ./console tests:setup-fixture OmniFixture --sqldump=OmniFixture-dump.sql` and then gzip. +Remember to update the [Omnifixture SQL dump](https://github.com/piwik/piwik/blob/master/tests/resources/OmniFixture-dump.sql.gz) whenever you make any change to any fixture. +For instance use: -Keeping the OmniFixture up to date makes it easier to see which tests fail after each small fixture change. If we don't update the OmniFixture then we end up with many failed screenshots tests which makes it hard to see whether those changes are expected or not. + ./console tests:setup-fixture OmniFixture --sqldump=OmniFixture-dump.sql + +and then gzip. + +Keeping the OmniFixture up to date makes it easier to see which tests fail after each small fixture change. + +If we don't update the OmniFixture then we end up with many failed screenshots tests which makes it hard to see whether those changes are expected or not. ### Scheduled Reports Tests diff --git a/tests/lib/screenshot-testing/support/page-renderer.js b/tests/lib/screenshot-testing/support/page-renderer.js index 7e8edcb466..d4886e2ed2 100644 --- a/tests/lib/screenshot-testing/support/page-renderer.js +++ b/tests/lib/screenshot-testing/support/page-renderer.js @@ -250,7 +250,15 @@ PageRenderer.prototype.capture = function (outputPath, callback, selector) { var clipRect = {bottom: null, height: null, left: null, right: null, top: null, width: null}; element.each(function (index, node) { - var rect = node.getBoundingClientRect(); + if (!$(node).is(':visible')) { + return; + } + + var rect = $(node).offset(); + rect.width = $(node).outerWidth(); + rect.height = $(node).outerHeight(); + rect.right = rect.left + rect.width; + rect.bottom = rect.top + rect.height; if (isInvalidBoundingRect(rect)) { // element is not visible diff --git a/tests/resources/OmniFixture-dump.sql.gz b/tests/resources/OmniFixture-dump.sql.gz Binary files differindex 710962a0b7..cc17a2a9dd 100644 --- a/tests/resources/OmniFixture-dump.sql.gz +++ b/tests/resources/OmniFixture-dump.sql.gz |