webdriver-image-comparison
Advanced tools
Comparing version 0.14.0 to 0.14.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function getIosStatusAddressToolBarHeight(iosOffsets) { | ||
var match = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/); | ||
var match = (navigator.appVersion).match(/(?:OS |Version\/)(\d+)(?:_|\.)(\d+)(?:_|\.)?(\d+)?/); | ||
var majorVersion = parseInt(match[1], 10); | ||
@@ -6,0 +6,0 @@ var versionOffsets = iosOffsets[majorVersion]; |
@@ -19,7 +19,7 @@ "use strict"; | ||
it('should get the correct status, address and toolbar height for an iPhone with iOS 10', function () { | ||
setEnvironment(10, 'IPHONE'); | ||
setEnvironment('IOS', 10, 'IPHONE'); | ||
expect(getIosStatusAddressToolBarHeight_1.default(constants_1.OFFSETS.IOS)).toMatchSnapshot(); | ||
}); | ||
it('should get the correct toolbar height for an iPhone with iOS 12 that has been scrolled', function () { | ||
setEnvironment(12, 'IPHONE'); | ||
setEnvironment('IOS', 12, 'IPHONE'); | ||
Object.defineProperty(window, 'innerHeight', __assign({ value: 598 }, mocks_1.CONFIGURABLE)); | ||
@@ -29,7 +29,7 @@ expect(getIosStatusAddressToolBarHeight_1.default(constants_1.OFFSETS.IOS)).toMatchSnapshot(); | ||
it('should get the correct status, address and toolbar height for an iPhone X with iOS 11', function () { | ||
setEnvironment(11, 'IPHONE_X'); | ||
setEnvironment('IOS', 11, 'IPHONE_X'); | ||
expect(getIosStatusAddressToolBarHeight_1.default(constants_1.OFFSETS.IOS)).toMatchSnapshot(); | ||
}); | ||
it('should get the correct homebar as toolbar height for an iPhone X with iOS 12 that has been scrolled', function () { | ||
setEnvironment(12, 'IPHONE_X'); | ||
setEnvironment('IOS', 12, 'IPHONE_X'); | ||
Object.defineProperty(window, 'innerHeight', __assign({ value: 718 }, mocks_1.CONFIGURABLE)); | ||
@@ -39,7 +39,7 @@ expect(getIosStatusAddressToolBarHeight_1.default(constants_1.OFFSETS.IOS)).toMatchSnapshot(); | ||
it('should get the correct status, address and toolbar height for an iPhone XS Max with iOS 12', function () { | ||
setEnvironment(12, 'IPHONE_XS_MAX'); | ||
setEnvironment('IOS', 12, 'IPHONE_XS_MAX'); | ||
expect(getIosStatusAddressToolBarHeight_1.default(constants_1.OFFSETS.IOS)).toMatchSnapshot(); | ||
}); | ||
it('should get the correct homebar as toolbar height for an iPhone XS MAx with iOS 12 that has been scrolled', function () { | ||
setEnvironment(12, 'IPHONE_XS_MAX'); | ||
setEnvironment('IOS', 12, 'IPHONE_XS_MAX'); | ||
Object.defineProperty(window, 'innerHeight', __assign({ value: 802 }, mocks_1.CONFIGURABLE)); | ||
@@ -49,12 +49,16 @@ expect(getIosStatusAddressToolBarHeight_1.default(constants_1.OFFSETS.IOS)).toMatchSnapshot(); | ||
it('should get the correct status, address and toolbar height for an iPad with iOS 12', function () { | ||
setEnvironment(12, 'IPAD'); | ||
setEnvironment('IOS', 12, 'IPAD'); | ||
expect(getIosStatusAddressToolBarHeight_1.default(constants_1.OFFSETS.IOS)).toMatchSnapshot(); | ||
}); | ||
it('should get the correct status, address and toolbar height for an iPad with iPadOS 13', function () { | ||
setEnvironment('IPADOS', 13, 'IPAD'); | ||
expect(getIosStatusAddressToolBarHeight_1.default(constants_1.OFFSETS.IOS)).toMatchSnapshot(); | ||
}); | ||
it('should get the correct status, address and toolbar height for an iPad Pro with to touch id and with iOS 12', function () { | ||
setEnvironment(12, 'IPAD_NO_TOUCH'); | ||
setEnvironment('IOS', 12, 'IPAD_NO_TOUCH'); | ||
expect(getIosStatusAddressToolBarHeight_1.default(constants_1.OFFSETS.IOS)).toMatchSnapshot(); | ||
}); | ||
}); | ||
function setEnvironment(ios, phone) { | ||
Object.defineProperty(navigator, 'appVersion', __assign({ value: mocks_1.NAVIGATOR_APP_VERSIONS.IOS[ios] }, mocks_1.CONFIGURABLE)); | ||
function setEnvironment(os, version, phone) { | ||
Object.defineProperty(navigator, 'appVersion', __assign({ value: mocks_1.NAVIGATOR_APP_VERSIONS[os][version] }, mocks_1.CONFIGURABLE)); | ||
Object.defineProperty(window.screen, 'width', __assign({ value: mocks_1.IOS_DEVICES[phone].width }, mocks_1.CONFIGURABLE)); | ||
@@ -61,0 +65,0 @@ Object.defineProperty(window.screen, 'height', __assign({ value: mocks_1.IOS_DEVICES[phone].height }, mocks_1.CONFIGURABLE)); |
{ | ||
"name": "webdriver-image-comparison", | ||
"version": "0.14.0", | ||
"version": "0.14.1", | ||
"description": "An image compare module that can be used for different NodeJS Test automation frameworks that support the webdriver protocol", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
776936
6973