-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds UI tests for Custom Logos (#13311)
- Loading branch information
Showing
10 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/*! | ||
* Matomo - free/libre analytics platform | ||
* | ||
* @link https://matomo.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
*/ | ||
|
||
var fs = require('fs'), | ||
path = require('../../../../tests/lib/screenshot-testing/support/path'); | ||
|
||
describe("CustomLogo", function () { | ||
this.timeout(0); | ||
|
||
before(function () { | ||
testEnvironment.optionsOverride = { | ||
branding_use_custom_logo: '1' | ||
}; | ||
testEnvironment.save(); | ||
}); | ||
|
||
afterEach(function () { | ||
[ | ||
path.join(PIWIK_INCLUDE_PATH, "/misc/user/logo.png"), | ||
path.join(PIWIK_INCLUDE_PATH, "/misc/user/logo-header.png"), | ||
path.join(PIWIK_INCLUDE_PATH, "/misc/user/logo.svg") | ||
].forEach(function(file) { | ||
if (fs.exists(file)) { | ||
fs.remove(file); | ||
} | ||
}); | ||
testEnvironment.testUseMockAuth = 1; | ||
testEnvironment.save(); | ||
}); | ||
|
||
var copyLogo = function(svg) { | ||
fs.copy(path.join(PIWIK_INCLUDE_PATH, "/tests/resources/customlogo/logo.png"), path.join(PIWIK_INCLUDE_PATH, "/misc/user/logo.png")); | ||
fs.copy(path.join(PIWIK_INCLUDE_PATH, "/tests/resources/customlogo/logo-header.png"), path.join(PIWIK_INCLUDE_PATH, "/misc/user/logo-header.png")); | ||
|
||
if (svg) { | ||
fs.copy(path.join(PIWIK_INCLUDE_PATH, "/tests/resources/customlogo/logo.svg"), path.join(PIWIK_INCLUDE_PATH, "/misc/user/logo.svg")); | ||
} | ||
}; | ||
|
||
[true, false].forEach(function (useSvg) { | ||
|
||
var appendName = useSvg ? '_svg' : ''; | ||
var appendTitle = useSvg ? ' SVG' : ''; | ||
|
||
it('should show the custom'+appendTitle+' logo in admin header', function (done) { | ||
expect.screenshot('admin'+appendName).to.be.captureSelector('.nav-wrapper', function (page) { | ||
copyLogo(useSvg); | ||
page.load("?idSite=1&period=year&date=2012-08-09&module=CoreAdminHome&action=index"); | ||
}, done); | ||
}); | ||
|
||
it('should show the custom'+appendTitle+' logo in login header', function (done) { | ||
testEnvironment.testUseMockAuth = 0; | ||
testEnvironment.save(); | ||
|
||
expect.screenshot('login'+appendName).to.be.captureSelector('.nav-wrapper', function (page) { | ||
copyLogo(useSvg); | ||
page.load(""); | ||
}, done); | ||
}); | ||
|
||
it('should show the custom'+appendTitle+' logo in unsubscribe email header', function (done) { | ||
expect.screenshot('unsubscribe'+appendName).to.be.captureSelector('.nav-wrapper', function (page) { | ||
copyLogo(useSvg); | ||
page.load("?module=ScheduledReports&action=unsubscribe&token="); | ||
}, done); | ||
}); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
plugins/CoreAdminHome/tests/UI/expected-screenshots/CustomLogo_admin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
plugins/CoreAdminHome/tests/UI/expected-screenshots/CustomLogo_admin_svg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
plugins/CoreAdminHome/tests/UI/expected-screenshots/CustomLogo_login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
plugins/CoreAdminHome/tests/UI/expected-screenshots/CustomLogo_login_svg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
plugins/CoreAdminHome/tests/UI/expected-screenshots/CustomLogo_unsubscribe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
plugins/CoreAdminHome/tests/UI/expected-screenshots/CustomLogo_unsubscribe_svg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.