This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33675 from snowmantw/bug1235105
Bug 1235105 - Add integration test: |lockscreen_unlock_handler_test.js| to see if the slider will reset to default after the relocking
- Loading branch information
Showing
1 changed file
with
110 additions
and
0 deletions.
There are no files selected for viewing
110 changes: 110 additions & 0 deletions
110
apps/system/test/marionette/lockscreen_unlock_handler_test.js
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,110 @@ | ||
|
||
'use strict'; | ||
|
||
var dirapps = require('path').resolve(__dirname + '/../../../'); | ||
var Settings = require(dirapps + '/settings/test/marionette/app/app'), | ||
LockScreen = require('./lib/lockscreen'), | ||
Promise = require('es6-promise').Promise, // jshint ignore:line | ||
assert = require('assert'); | ||
|
||
marionette('LockScreen > ', function() { | ||
var client = marionette.client({ | ||
desiredCapabilities: { raisesAccessibilityExceptions: false } | ||
}); | ||
var system; | ||
var settingsApp; | ||
var screenLockPanel; | ||
var lockScreen; | ||
|
||
setup(function() { | ||
system = client.loader.getAppClass('system'); | ||
lockScreen = (new LockScreen()).start(client); | ||
settingsApp = new Settings(client); | ||
settingsApp.launch(); | ||
// Navigate to the ScreenLock menu | ||
screenLockPanel = settingsApp.screenLockPanel; | ||
screenLockPanel.setupScreenLock(); | ||
screenLockPanel.toggleScreenLock(); | ||
}); | ||
|
||
var setupPasscode = function() { | ||
screenLockPanel.togglePasscodeLock(); | ||
screenLockPanel.typePasscode('1234', '1234'); | ||
screenLockPanel.tapCreatePasscode(); | ||
settingsApp.close(); | ||
lockScreen.lock(); | ||
}; | ||
|
||
var setupWithoutPasscode = function() { | ||
settingsApp.close(); | ||
lockScreen.lock(); | ||
}; | ||
|
||
test('slide to the unlock handler without the passcode, and then check ' + | ||
'if the slider will reset after lock it again', | ||
function(done) { | ||
setupWithoutPasscode(); | ||
client.switchToFrame(); | ||
new Promise(function(resolve) { | ||
lockScreen.slideToUnlock(resolve); | ||
}) | ||
.then(function() { | ||
client.executeScript(function() { | ||
window.wrappedJSObject.Service.request('turnScreenOff', true); | ||
window.wrappedJSObject.Service.request('turnScreenOn', true); | ||
}); | ||
|
||
client.waitFor(function() { | ||
return client.findElement('#lockscreen').displayed(); | ||
}); | ||
|
||
// From UI to check if it's back to the original style. | ||
// We cannot check if the canvas 'element' is streched or not. | ||
// If it's not reset the class `dark` will not attach on it. | ||
assert.ok(client.executeScript(function() { | ||
return document.querySelector('#lockscreen-area-unlock') | ||
.classList.contains('dark'); | ||
})); | ||
}) | ||
.then(done) | ||
.catch(done); | ||
}); | ||
|
||
test('slide to the unlock handler with the passcode, and then check ' + | ||
'if the slider will reset after lock it again', | ||
function(done) { | ||
setupPasscode(); | ||
client.switchToFrame(); | ||
new Promise(function(resolve) { | ||
lockScreen.slideToUnlock(resolve); | ||
}) | ||
.then(function() { | ||
// Wait for the panel rising. | ||
client.waitFor(function() { | ||
return client.findElement('#lockscreen-passcode-code').displayed(); | ||
}); | ||
|
||
client.executeScript(function() { | ||
window.wrappedJSObject.Service.request('turnScreenOff', true); | ||
window.wrappedJSObject.Service.request('turnScreenOn', true); | ||
}); | ||
|
||
client.waitFor(function() { | ||
return client.findElement('#lockscreen').displayed(); | ||
}); | ||
|
||
assert.ok(!client.findElement('#lockscreen-passcode-pad').displayed()); | ||
|
||
// From UI to check if it's back to the original style. | ||
// We cannot check if the canvas 'element' is streched or not. | ||
// If it's not reset the class `dark` will not attach on it. | ||
assert.ok(client.executeScript(function() { | ||
return document.querySelector('#lockscreen-area-unlock') | ||
.classList.contains('dark'); | ||
})); | ||
}) | ||
.then(done) | ||
.catch(done); | ||
}); | ||
|
||
}); |