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
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2020-04-20 02:20:46 +0300
committerGitHub <noreply@github.com>2020-04-20 02:20:46 +0300
commit4469a9adad4953298afefb65d6e831e826f42132 (patch)
treee57395decc85166b62a545b06f8512aecd293b3d
parentcf0976f72017a17b3abb70c24123b9bd11f6eb5e (diff)
try to fix two UI tests (#15755)
* try to fix two UI tests * update screenshots * try to fix oneclickupdate * try to fix build * remove debugging code * updates ui files * remove debugging code * Revert "try to fix oneclickupdate" This reverts commit 246de42be2e27e37b56231f4fab1bab3b5b6fb20. * revert oneclickupdate change * Use 4.x-dev TagManager submodule. * Use temp token auth in one click update to make sure second request always works. * try to fix random failure * add expected screenshot * try update again Co-authored-by: Stefan Giehl <stefan@matomo.org>
-rw-r--r--plugins/CoreUpdater/Updater.php3
-rw-r--r--plugins/UsersManager/tests/UI/UserSettings_spec.js4
-rw-r--r--plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_load_security.png4
-rw-r--r--tests/PHPUnit/Fixtures/UITestFixture.php20
-rw-r--r--tests/UI/expected-screenshots/OneClickUpdate_login.png4
-rw-r--r--tests/UI/expected-screenshots/UIIntegrationTest_visitors_realtime_visits.png4
-rw-r--r--tests/UI/specs/OneClickUpdate_spec.js6
-rw-r--r--tests/UI/specs/UIIntegration_spec.js6
8 files changed, 43 insertions, 8 deletions
diff --git a/plugins/CoreUpdater/Updater.php b/plugins/CoreUpdater/Updater.php
index d3f8f54e1c..406be9f06d 100644
--- a/plugins/CoreUpdater/Updater.php
+++ b/plugins/CoreUpdater/Updater.php
@@ -15,6 +15,7 @@ use Piwik\Filechecks;
use Piwik\Filesystem;
use Piwik\Http;
use Piwik\Option;
+use Piwik\Piwik;
use Piwik\Plugin\Manager as PluginManager;
use Piwik\Plugin\ReleaseChannels;
use Piwik\Plugins\CorePluginsAdmin\PluginInstaller;
@@ -124,8 +125,10 @@ class Updater
throw new UpdaterException($e, $messages);
}
+ $tempTokenAuth = Piwik::requestTemporarySystemAuthToken('OneClickUpdate', 1);
$partTwoUrl = Url::getCurrentUrlWithoutQueryString() . Url::getCurrentQueryStringWithParametersModified([
'action' => 'oneClickUpdatePartTwo',
+ 'token_auth' => $tempTokenAuth,
]);
$response = Http::sendHttpRequest($partTwoUrl, 300);
diff --git a/plugins/UsersManager/tests/UI/UserSettings_spec.js b/plugins/UsersManager/tests/UI/UserSettings_spec.js
index c241635f9b..c2a1d0d0cc 100644
--- a/plugins/UsersManager/tests/UI/UserSettings_spec.js
+++ b/plugins/UsersManager/tests/UI/UserSettings_spec.js
@@ -23,6 +23,10 @@ describe("UserSettings", function () {
it('should show user security page', async function () {
await page.goto(userSecurityUrl);
+ await page.waitFor('.listAuthTokens', { visible: true });
+ await page.evaluate(() => { // give table headers constant width so the screenshot stays the same
+ $('table.listAuthTokens th').css('width', '25%');
+ });
await page.waitFor(100);
expect(await page.screenshotSelector('.admin')).to.matchImage('load_security');
});
diff --git a/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_load_security.png b/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_load_security.png
index e172798e3a..10b507d043 100644
--- a/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_load_security.png
+++ b/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_load_security.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:395855795888f525a788ad22a1b012b83cc5517be54d55758ce6ee6b17702c11
-size 115632
+oid sha256:3fde47fe66f7ecc38eaebaa3b8f99364b89790fc6d53d176b516bf252aed19e6
+size 115625
diff --git a/tests/PHPUnit/Fixtures/UITestFixture.php b/tests/PHPUnit/Fixtures/UITestFixture.php
index 780c469f22..4e55a62a36 100644
--- a/tests/PHPUnit/Fixtures/UITestFixture.php
+++ b/tests/PHPUnit/Fixtures/UITestFixture.php
@@ -217,6 +217,25 @@ class UITestFixture extends SqlDump
"95.81.66.139",
);
+ $userAgents = [
+ 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.136 Mobile Safari/537.36',
+ 'Mozilla/5.0 (Linux; U; Android 2.3.7; fr-fr; HTC Desire Build/GRI40; MildWild CM-8.0 JG Stable) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',
+ 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36',
+ 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6.3; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)',
+ 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; MDDSJS; rv:11.0) like Gecko',
+ 'Mozilla/5.0 (Linux; Android 4.1.1; SGPT13 Build/TJDS0170) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Safari/537.36',
+ 'Mozilla/5.0 (Linux; U; Android 4.3; zh-cn; SM-N9006 Build/JSS15J) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 MQQBrowser/5.0 Mobile Safari/537.36',
+ 'Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9.0.14) Gecko/2009090216 Ubuntu/9.04 (jaunty) Firefox/3.0.14',
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1',
+ 'Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; SCH-I535 Build/KOT49H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
+ 'Mozilla/5.0 (Linux; Android 7.0; SM-G930V Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537.36',
+ 'Mozilla/5.0 (Linux; Android 7.0; SM-A310F Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36 OPR/42.7.2246.114996',
+ 'Opera/9.80 (J2ME/MIDP; Opera Mini/5.1.21214/28.2725; U; ru) Presto/2.8.119 Version/11.10',
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) FxiOS/7.5b3349 Mobile/14F89 Safari/603.2.4',
+ 'Mozilla/5.0 (Android 7.0; Mobile; rv:54.0) Gecko/54.0 Firefox/54.0',
+ 'Mozilla/5.0 (Linux; Android 6.0.1; SM-G920V Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36',
+ ];
+
$date = Date::factory('yesterday');
$t = self::getTracker($idSite = 3, $dateTime = $date->getDatetime(), $defaultInit = true);
$t->enableBulkTracking();
@@ -224,6 +243,7 @@ class UITestFixture extends SqlDump
foreach ($visitProfiles as $visitCount => $visit) {
$t->setNewVisitorId();
$t->setIp($ips[$visitCount]);
+ $t->setUserAgent($userAgents[$visitCount]);
foreach ($visit as $idx => $action) {
$t->setForceVisitDateTime($date->addHour($visitCount)->addHour(0.01 * $idx)->getDatetime());
diff --git a/tests/UI/expected-screenshots/OneClickUpdate_login.png b/tests/UI/expected-screenshots/OneClickUpdate_login.png
index c0f41534c3..915bab1cb3 100644
--- a/tests/UI/expected-screenshots/OneClickUpdate_login.png
+++ b/tests/UI/expected-screenshots/OneClickUpdate_login.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:1053964b638aff9107e69cd0d465a0a72799f3ea9db8884df3117c6d42efc830
-size 268010
+oid sha256:bd758c0b8a5e888a1fa10a6294124a777300d4446310b9462159436d9b2f003a
+size 267909
diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_visitors_realtime_visits.png b/tests/UI/expected-screenshots/UIIntegrationTest_visitors_realtime_visits.png
index eab00ced70..b2106576d8 100644
--- a/tests/UI/expected-screenshots/UIIntegrationTest_visitors_realtime_visits.png
+++ b/tests/UI/expected-screenshots/UIIntegrationTest_visitors_realtime_visits.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:5ea3f2853937346ba2c958359eba9cb52aa57c72c52c252218dd30956680be21
-size 40469
+oid sha256:c673f65851b57ea7ca8c03ada40e2b21b38e344f545d3dff99f5b5873649fa1c
+size 71738
diff --git a/tests/UI/specs/OneClickUpdate_spec.js b/tests/UI/specs/OneClickUpdate_spec.js
index 7ddaa4b934..658ff64ca7 100644
--- a/tests/UI/specs/OneClickUpdate_spec.js
+++ b/tests/UI/specs/OneClickUpdate_spec.js
@@ -75,6 +75,12 @@ describe("OneClickUpdate", function () {
}
}
+ await page.waitFor('#login_form_login', { visible: true });
+
+ await page.type('#login_form_login', 'superUserLogin');
+ await page.type('#login_form_password', 'superUserPass');
+ await page.click('#login_form_submit');
+
await page.waitFor('.site-without-data', { visible: true });
await page.waitForNetworkIdle();
diff --git a/tests/UI/specs/UIIntegration_spec.js b/tests/UI/specs/UIIntegration_spec.js
index 51c4182f31..72cb206829 100644
--- a/tests/UI/specs/UIIntegration_spec.js
+++ b/tests/UI/specs/UIIntegration_spec.js
@@ -12,8 +12,10 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik?
var generalParams = 'idSite=1&period=year&date=2012-08-09',
idSite2Params = 'idSite=2&period=year&date=2012-08-09',
+ idSite3Params = 'idSite=3&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,
+ urlBaseGeneric = 'module=CoreHome&action=index&',
+ urlBase = urlBaseGeneric + generalParams,
widgetizeParams = "module=Widgetize&action=iframe",
segment = encodeURIComponent("browserCode==FF") // from OmniFixture
;
@@ -235,7 +237,7 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik?
});
it('should load the visitors > real-time visits page correctly', async function () {
- await page.goto("?" + urlBase + "#?" + idSite2Params + "&category=General_Visitors&subcategory=General_RealTime");
+ await page.goto("?" + urlBaseGeneric + idSite3Params + "#?" + idSite3Params + "&category=General_Visitors&subcategory=General_RealTime");
await page.mouse.move(-10, -10);
pageWrap = await page.$('.pageWrap');