mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2025-02-23 08:32:51 +08:00
test: let Jasmine handle promises (#57)
* test: let Jasmine handle promises Last in line for apache/cordova#169 * lock in portrait mode to avoid trouble on CI cordova-paramedic runs the SauceLabs CI tests in portrait mode. For the Android 7.0 target, it seemed as our locking to landscape interferes with the Appium driver trying to set the app to portrait orientation. The result is a failure to connect to the device and finally a timeout. To avoid that, we are locking the app into portrait mode instead. * test: verify orientation after locking
This commit is contained in:
parent
8d76ec1b00
commit
464ab8541c
@ -117,25 +117,11 @@ exports.defineAutoTests = function() {
|
|||||||
// test onchange works
|
// test onchange works
|
||||||
describe('window.screen.orientation', function() {
|
describe('window.screen.orientation', function() {
|
||||||
|
|
||||||
it('should successfully lock and unlock screen orientation, lock should return a promise', function(done) {
|
it('should successfully lock and unlock screen orientation', function() {
|
||||||
|
return window.screen.orientation.lock('portrait').then(function() {
|
||||||
try {
|
expect(window.screen.orientation.type).toMatch(/^portrait-/);
|
||||||
var promise = window.screen.orientation.lock('landscape');
|
expect(window.screen.orientation.unlock).not.toThrow();
|
||||||
expect(promise).toBeDefined();
|
});
|
||||||
expect(typeof promise.then).toBe('function');
|
|
||||||
promise.then(function() {
|
|
||||||
expect(window.screen.orientation.unlock).not.toThrow();
|
|
||||||
done();
|
|
||||||
}, function(err) {
|
|
||||||
expect(err).toBeDefined();
|
|
||||||
fail(err);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
fail(err);
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user