1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 06:57:53 +00:00
Files
matomo/plugins/Morpheus/tests/UI/Morpheus_spec.js
Michal Kleiner 7f11f3c348 Automatically clear password input fields after 10 minutes (#23356)
* Create 'Auto clear password' functionality for Vue and vanilla JS

* Use auto-clear on password fields within core

* Add password field with auto clear to UI demo

* Add data attribute with snippet ID for easier UI test targetting

* Add UI tests for password auto clear vue directive

* Fix typos in UI demo controller

* Remove vanilla JS version of the auto-clear mechanism in favour of Vue directive

* Apply auto-clear directive to other password fields

* Update auto-clear directive to add data attribute when applied to a field

* Test auto-clear-password directive is applied to password field on the login page

* Update UI test screenshots
2025-06-11 15:09:42 +12:00

44 خطوط
1.6 KiB
JavaScript

/*!
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("Morpheus", function () {
this.timeout(0);
var url = "?module=Morpheus&action=demo";
before(function () {
// Enable development mode
testEnvironment.overrideConfig('Development', 'enabled', true);
testEnvironment.save();
});
it("should show all UI components and CSS classes", async function() {
await page.goto(url);
await page.waitForSelector('.progressbar img');
await page.evaluate(() => {
$('img[src~=loading],.progressbar img').each(function () {
$(this).hide();
});
});
await page.waitForTimeout(500); // wait for rendering
expect(await page.screenshot({ fullPage: true })).to.matchImage('load');
});
it("should keep content in auto-clear password field before auto-clear time", async function() {
const element = await page.$('[data-snippet="form.passwordAutoClear"]');
await page.type('#password_autoclear', 'some password');
await page.waitForTimeout(3000);
expect(await element.screenshot()).to.matchImage('passwordAutoClear_filled');
});
it("should remove content in auto-clear password field after auto-clear time", async function() {
const element = await page.$('[data-snippet="form.passwordAutoClear"]');
await page.waitForTimeout(3000); // there's already 3 seconds wait in the previous test
expect(await element.screenshot()).to.matchImage('passwordAutoClear_cleared');
});
});