diff --git a/graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets b/graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets index 03703ebd939bc9370b923a16856e71ff8985df3e..8b6ab078ce790343bc02911efe258dcd51091ad3 100644 --- a/graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets +++ b/graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +// @ts-nocheck import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import ohosWindow from '@ohos.window'; import screenManager from '@ohos.screen'; @@ -27,6 +28,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) var commonNUMBERColorArr = ['#00FF0000', '#0000FF00', '#000000FF', '#00FFFFFF', '#00000000', '#00F900E6', '#00666666', '#00FFF700']; var commonKEYColorArr = ['red', 'green', 'blue', 'white', 'black', 'pink', 'grey', 'yellow']; var appWindowTypeArr = []; + var windowTypeArr = []; var appWindowTypeDic = { 'TYPE_BASE': 0, 'TYPE_APP': 0, @@ -70,6 +72,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) console.log('jsunittest beforeall systemWindowTypeDicArr=' + JSON.stringify(systemWindowTypeDicArr) + ' ,length=' + systemWindowTypeDicArr.length); systemWindowValueArr = Object.keys(systemWindowTypeDic); systemWindowTypeArr = Object.keys(systemWindowTypeDic); + for (i in ohosWindow.WindowType) { + console.log('jsunittest beforeall i=' + i); + windowTypeArr.push(ohosWindow.WindowType[i]) + } }) beforeEach(function () { }) @@ -175,22 +181,14 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) let resizeValue = 200; let listenerOnFlag = listenerStatus.ready; console.log(msgStr + 'begin'); - let tempWnd = null; - try { - await ohosWindow.create(context, wndId, baseType).then((data) => { - tempWnd = data - console.log(msgStr + 'ohosWindow.create data:' + JSON.stringify(data)); - }).catch((err) => { - unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); - }); - console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + tempWnd); - expect(!!tempWnd).assertTrue(); - listenerData.on = true; - listenerData.typeStr = 'windowSizeChange'; - } catch (err) { - console.log(msgStr + 'ohosWindow.create catch err:' + JSON.stringify(err)); - } - await tempWnd.on('windowSizeChange', (sizeData) => { + let tempWnd = await ohosWindow.create(context, wndId, baseType).catch((err) => { + unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); + }); + console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + tempWnd); + expect(!!tempWnd).assertTrue(); + listenerData.on = true; + listenerData.typeStr = 'windowSizeChange'; + tempWnd.on('windowSizeChange', (sizeData) => { console.log(msgStr + 'tempWnd.on windowSizeChange, systemBatData : ' + JSON.stringify(sizeData)); if (listenerOnFlag === listenerStatus.pending) { listenerOnFlag = listenerStatus.finished; @@ -278,36 +276,23 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) let changedModel = 102; let listenerOffFlag = listenerStatus.ready; console.log(msgStr + 'begin'); - let createWindowObj = { - name: wndId, windowType: baseType, ctx: context - } - console.log(msgStr + 'ohosWindow.create createWindowObj:' + JSON.stringify(createWindowObj)); - let tempWnd = null; - try { - // await ohosWindow.createWindow(createWindowObj).then((data) => { - await ohosWindow.create(context, wndId, baseType).then((data) => { - console.log(msgStr + 'ohosWindow.create data:' + JSON.stringify(data)); - tempWnd = data - console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + tempWnd); - expect(!!tempWnd).assertTrue(); - listenerData.on = true; - listenerData.typeStr = 'windowSizeChange'; - tempWnd.on('windowSizeChange', (sizeData) => { - console.log(msgStr + 'tempWnd.on windowSizeChange, sizeData : ' + JSON.stringify(sizeData)); - if (listenerOffFlag === listenerStatus.pending) { - listenerOffFlag = listenerStatus.finished; - console.log(msgStr + 'tempWnd.on windowSizeChange, listenerOffFlag === listenerStatus.pending : ' + JSON.stringify(sizeData)); - expect(sizeData.width === 100).assertTrue(); - expect(sizeData.height === 100).assertTrue(); - done(); - } - }) - }).catch((err) => { - unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); - }); - } catch (err) { - } - + let tempWnd = await ohosWindow.create(context, wndId, baseType).catch((err) => { + unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); + }); + console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + tempWnd); + expect(!!tempWnd).assertTrue(); + listenerData.on = true; + listenerData.typeStr = 'windowSizeChange'; + tempWnd.on('windowSizeChange', (sizeData) => { + console.log(msgStr + 'tempWnd.on windowSizeChange, sizeData : ' + JSON.stringify(sizeData)); + if (listenerOffFlag === listenerStatus.pending) { + listenerOffFlag = listenerStatus.finished; + console.log(msgStr + 'tempWnd.on windowSizeChange, listenerOffFlag === listenerStatus.pending : ' + JSON.stringify(sizeData)); + expect(sizeData.width === 100).assertTrue(); + expect(sizeData.height === 100).assertTrue(); + done(); + } + }) await tempWnd.show().catch((err) => { unexpectedError(err, caseName, 'tempWnd.show', done); }); @@ -381,7 +366,11 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) console.log(msgStr + 'tempWnd.getProperties i=' + i + ' , loopCount1.length-1==' + loopCount1.length); done(); } + } else { + unexpectedError(err, caseName, 'tempWnd.getProperties', done); } + } else { + unexpectedError(err, caseName, 'tempWnd.setWindowType', done); } } }) @@ -408,13 +397,17 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) let windowTypeData = await tempWnd.setWindowType(changedWndType).catch((err) => { console.log(msgStr + 'tempWnd.setWindowType err: ' + JSON.stringify(err)); expectedError(err, caseName, 'tempWnd.setWindowType', done, 1003); - done(); }) console.log(msgStr + 'tempWnd.setWindowType windowTypeData' + JSON.stringify(windowTypeData)); console.log(msgStr + 'tempWnd.setWindowType !windowTypeData' + !windowTypeData); if (!!windowTypeData) { - expect(false).assertFail(); + unexpectedError(err, caseName, 'tempWnd.setWindowType', done); + } else { + expect(err.code == 1003).assertTrue(); + done(); } + } else { + unexpectedError(err, caseName, 'ohosWindow.create', done); } }) /** @@ -1007,26 +1000,19 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) let tempType = ohosWindow.WindowType.TYPE_SYSTEM_ALERT; let windId = 'createTest2' + i; console.log(msgStr + 'ohosWindow.create ' + tempType + ' start'); - let createData = null; - try { - await ohosWindow.create(context, windId, tempType).then((data) => { - createData = data - expect(!!createData).assertTrue(); - }).catch((err) => { - console.log(msgStr + 'ohosWindow.create err' + JSON.stringify(err)); - unexpectedError(err, caseName, 'ohosWindow.create ' + tempType, done); - return; - }) - } - catch (err) { - console.log(msgStr + 'ohosWindow.create catch err' + JSON.stringify(err)); - } + let createData = await ohosWindow.create(context, windId, tempType).catch((err) => { + console.log(msgStr + 'ohosWindow.create err' + JSON.stringify(err)); + unexpectedError(err, caseName, 'ohosWindow.create ' + tempType, done); + return; + }) + expect(!!createData).assertTrue(); let tempWnd = createData console.log(msgStr + 'ohosWindow.create ' + tempType + ' wnd: ' + tempWnd); let proData = await tempWnd.getProperties().catch((err) => { console.log(msgStr + 'tempWnd.getProperties err' + JSON.stringify(err)); unexpectedError(err, caseName, 'tempWnd.getProperties', done); console.log(msgStr + 'tempWnd.getProperties err&&err.code' + JSON.stringify(err)); + console.log(msgStr + 'tempWnd.getProperties success, !!data : ' + !!data); }) expect(!!proData).assertTrue(); expect(proData.type == tempType).assertTrue(); @@ -1038,7 +1024,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) if (n === loopCount) { expect(true).assertTrue(); } else { - expect(true).assertFail(); + unexpectedError(err, caseName, 'tempWnd.getProperties', done); } } } @@ -1095,21 +1081,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) let baseWndType = 1; let windowId = 'loadContentTest1'; console.log(msgStr + 'begin'); - let createWindowObj = { - name: windowId, windowType: baseWndType, ctx: context - } - let tempWnd = null; - try { - await ohosWindow.createWindow(createWindowObj).then((data) => { - // await ohosWindow.create(context, wndId, baseType).then((data) => { - tempWnd = data - console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' , wnd: ' + tempWnd); - }).catch((err) => { - unexpectedError(err, caseName, 'ohosWindow.create', done); - }); - } catch (err) { - console.log(msgStr + 'ohosWindow.create catch err:' + JSON.stringify(err)); - } + let tempWnd = await ohosWindow.create(context, windowId, baseWndType).catch((err) => { + unexpectedError(err, caseName, 'ohosWindow.create', done); + }); + console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' , wnd: ' + tempWnd); expect(!!tempWnd).assertTrue(); console.log(msgStr + 'tempWnd.loadContent start'); let load = await tempWnd.loadContent('pages/second/second').catch((err) => { @@ -1132,41 +1107,23 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) let baseWndType = 1; let windowId = 'loadContentTest2'; console.log(msgStr + 'begin'); - let createWindowObj = { - name: windowId, windowType: baseWndType, ctx: context - } - let tempWnd = null; - try { - await ohosWindow.createWindow(createWindowObj).then((data) => { - tempWnd = data - console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' wnd: ' + tempWnd); - expect(!!tempWnd).assertTrue(); - }).catch((err) => { - unexpectedError(err, caseName, 'ohosWindow.create', done); - }); - } - catch (err) { - console.log(msgStr + 'ohosWindow.createWindow catch err:' + JSON.stringify(err)); - } + let tempWnd = await ohosWindow.create(context, windowId, baseWndType).catch((err) => { + unexpectedError(err, caseName, 'ohosWindow.create', done); + }); + console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' wnd: ' + tempWnd); + expect(!!tempWnd).assertTrue(); console.log(msgStr + 'tempWnd.loadContent start'); let errFlag = false; - let loadContentData = null; - try { - await tempWnd.loadContent(null).then((data) => { - loadContentData = data; - }).catch((err) => { - errFlag = true; - expectedError(err, caseName, 'tempWnd.loadContent', done, 1003); - console.log(msgStr + 'tempWnd.loadContent(null)' + JSON.stringify(err)); - }); - console.log(msgStr + 'tempWnd.loadContent loadContentData:' + JSON.stringify(loadContentData)); - if (!errFlag) { - console.log(msgStr + 'should report err'); - expect(TRUE_FLAG).assertFail(); - done(); - } - } catch (err) { - console.log(msgStr + 'tempWnd.loadContent(null) catch err:' + JSON.stringify(err)); + let loadContentData = await tempWnd.loadContent(null).catch((err) => { + errFlag = true; + expectedError(err, caseName, 'tempWnd.loadContent', done, 1003); + console.log(msgStr + 'tempWnd.loadContent(null)' + JSON.stringify(err)); + }); + console.log(msgStr + 'tempWnd.loadContent loadContentData:' + JSON.stringify(loadContentData)); + if (!errFlag) { + console.log(msgStr + 'should report err'); + expect(TRUE_FLAG).assertFail(); + done(); } }) @@ -1245,6 +1202,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) console.log(msgStr + 'tempWnd.loadContent(pages/index/index.ets)' + JSON.stringify(err)); }); expect(!load6).assertTrue(); + console.log(msgStr + 'tempWnd.loadContent end load=' + JSON.stringify(load6)); done(); }) /** @@ -1360,22 +1318,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) let baseWndType = 1; let windowId = 'destroyTest1'; console.log(msgStr + 'begin'); - let createWindowObj = { - name: windowId, windowType: baseWndType, ctx: context - } - let tempWnd = null; - try { - await ohosWindow.createWindow(createWindowObj).then((data) => { - tempWnd = data - console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' wnd: ' + tempWnd); - expect(!!tempWnd).assertTrue(); - console.log(msgStr + 'tempWnd.destroy start'); - }).catch((err) => { - unexpectedError(err, caseName, 'ohosWindow.create', done); - }); - } catch (err) { - console.log(msgStr + 'destroy catch err : ' + JSON.stringify(err)); - } + let tempWnd = await ohosWindow.create(context, windowId, baseWndType).catch((err) => { + unexpectedError(err, caseName, 'ohosWindow.create', done); + }); + console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' wnd: ' + tempWnd); + expect(!!tempWnd).assertTrue(); + console.log(msgStr + 'tempWnd.destroy start'); await tempWnd.destroy().catch((err) => { unexpectedError(err, caseName, 'tempWnd.destroy', done); console.log(msgStr + 'destroy err : ' + JSON.stringify(err)); @@ -1397,23 +1345,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) let caseName = 'setDensityDpiTest1'; let msgStr = 'jsunittest ' + caseName + ' '; console.log(msgStr + 'begin'); - let screens = null; - try { - await screenManager.getAllScreens().then((data) => { - screens = data - console.log(msgStr + 'screenManager.getAllScreen' + JSON.stringify(screens)); - expect(!!screens).assertTrue(); - }).catch(err => { - unexpectedError(err, caseName, 'screenManager.getAllScreen', done); - }) - } - catch (err) { - console.log(msgStr + 'screenManager.getAllScreen catch err:' + JSON.stringify(err)); - } - let currentDeviceDefault = null; - await display.getDefaultDisplay().then((data) => { - currentDeviceDefault = data - }).catch(err => { + let screens = await screenManager.getAllScreens().catch(err => { + unexpectedError(err, caseName, 'screenManager.getAllScreen', done); + }) + console.log(msgStr + 'screenManager.getAllScreen' + JSON.stringify(screens)); + expect(!!screens).assertTrue(); + let currentDeviceDefault = await display.getDefaultDisplay().catch(err => { console.log(msgStr + 'screen.setDensityDpi display.getDefaultDisplay failed current device'); }); console.log(msgStr + 'screen.setDensityDpi display.getDefaultDisplay current device' + JSON.stringify(currentDeviceDefault)); @@ -1423,14 +1360,11 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) await sleep(1000); await screens[0].setDensityDpi(dpiItem[i]).then(async () => { console.log(msgStr + 'screen.setDensityDpi success set DPI ' + dpiItem[i]); - let defaultDpi = null; - display.getDefaultDisplay().then((data) => { - defaultDpi = data - }).catch(err => { + let defaultDpi = await display.getDefaultDisplay().catch(err => { console.log(msgStr + 'screen.setDensityDpi display.getDefaultDisplay failed'); }); console.log(msgStr + 'screen.setDensityDpi display.getDefaultDisplay' + JSON.stringify(defaultDpi)); - let isEqual = Number(defaultDpi.densityDPI) == dpiItem[i] + let isEqual = defaultDpi.densityDPI == parseInt(dpiItem[i]) console.log(msgStr + 'same ? ' + isEqual) expect(isEqual).assertTrue() }).catch(err => { @@ -1454,7 +1388,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) }); console.log(msgStr + 'windowStage.getMainWindow :' + JSON.stringify(mainWin)); expect(!!mainWin).assertTrue(); - let orientationItem = ['UNSPECIFIED', 'PORTRAIT', 'LANDSCAPE']; + let num = 0 + let orientationItem = ['UNSPECIFIED', 'PORTRAIT', 'LANDSCAPE', 'PORTRAIT_INVERTED', + 'LANDSCAPE_INVERTED', 'AUTO_ROTATION', 'AUTO_ROTATION_PORTRAIT', 'AUTO_ROTATION_LANDSCAPE', + 'AUTO_ROTATION_RESTRICTED', 'AUTO_ROTATION_PORTRAIT_RESTRICTED', 'AUTO_ROTATION_LANDSCAPE_RESTRICTED', 'LOCKED', 'UNSPECIFIED']; for (let i = 0;i < orientationItem.length; i++) { await sleep(1000); let orientation = ohosWindow.Orientation[orientationItem[i]] @@ -1462,12 +1399,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) console.log(msgStr + 'i : ' + i + ' ,ohosWindow.Orientation : ' + JSON.stringify(ohosWindow.Orientation)); await mainWin.setPreferredOrientation(orientation).then(() => { console.log(msgStr + 'success set window.setPreferredOrientation : ' + orientation); + num++ + if(num == orientationItem.length) done(); }).catch(err => { console.log(msgStr + 'window.setPreferredOrientation failed set error:' + orientation); }); } - console.log(msgStr + 'done '); - done(); }) /** * @tc.number SUB_WINDOW_SETFORBIDSPLITMOVE_JSAPI_001 @@ -1527,21 +1464,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) let msgStr = 'jsunittest ' + caseName + ' '; console.log(msgStr + 'begin context==' + JSON.stringify(context)); let tempType = ohosWindow.WindowType.TYPE_DIALOG - let dialogTargetTouchTest1Win = null; - let createWindowObj = { - name: 'dialogTargetTouchTest1', windowType: tempType, ctx: context - } - try { - await ohosWindow.createWindow(createWindowObj).then((data) => { - dialogTargetTouchTest1Win = data + let dialogTargetTouchTest1Win = await ohosWindow.create(context, 'dialogTargetTouchTest1', tempType) + .catch((err) => { + unexpectedError(err, caseName, 'ohosWindow.create', done); }) - .catch((err) => { - unexpectedError(err, caseName, 'ohosWindow.create', done); - }) - } - catch (err) { - console.log(msgStr + 'ohosWindow.createWindow catch err' + JSON.stringify(err)); - } expect(!!dialogTargetTouchTest1Win).assertTrue(); dialogTargetTouchTest1Win.destroy(); done(); @@ -1558,21 +1484,11 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) console.log(msgStr + 'begin ohosWindow==' + JSON.stringify(ohosWindow)); let wndId = 'animationForShownTest1'; let baseType = ohosWindow.WindowType.TYPE_SYSTEM_ALERT; - let tempWnd = null; - let createWindowObj = { - name: wndId, windowType: baseType, ctx: context - } - try { - await ohosWindow.createWindow(createWindowObj).then((data) => { - tempWnd = data - console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + tempWnd); - expect(!!tempWnd).assertTrue(); - }).catch((err) => { - unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); - }); - } catch (err) { - console.log(msgStr + 'ohosWindow.createWindow catch err:' + JSON.stringify(err)); - } + let tempWnd = await ohosWindow.create(context, wndId, baseType).catch((err) => { + unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); + }); + console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + tempWnd); + expect(!!tempWnd).assertTrue(); let controller = tempWnd.getTransitionController(); controller.animationForShown = (context: ohosWindow.TransitionContext) => { let toWindow = context.toWindow @@ -1626,24 +1542,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) console.log(msgStr + 'begin context==' + JSON.stringify(context)); let wndId = 'showWithAnimationTest1'; let baseType = ohosWindow.WindowType.TYPE_FLOAT; - let createWindowObj = { - name: wndId, windowType: baseType, ctx: context - } - let tempWnd = null; - try { - await ohosWindow.createWindow(createWindowObj).then((data) => { - tempWnd = data - console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd)); - expect(!!tempWnd).assertTrue(); - console.info('showWithAnimationTest1 ****' + Reflect.has(tempWnd, 'showWithAnimation')) - }).catch((err) => { - unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); - }); - } - catch (err) { - console.log(msgStr + 'ohosWindow.create catch err:' + JSON.stringify(err)); - } - + let tempWnd = await ohosWindow.create(context, wndId, baseType).catch((err) => { + unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); + }); + console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd)); + expect(!!tempWnd).assertTrue(); + console.info('showWithAnimationTest1 ****' + Reflect.has(tempWnd, 'showWithAnimation')) await tempWnd.showWithAnimation().then((data) => { console.info('Succeeded in showing the window with animation. Data: ' + JSON.stringify(data)); done(); @@ -1662,31 +1566,18 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) console.log(msgStr + 'begin context==' + JSON.stringify(context)); let wndId = 'hideWithAnimationTest1'; let baseType = ohosWindow.WindowType.TYPE_FLOAT; - let createWindowObj = { - name: wndId, windowType: baseType, ctx: context - } - let tempWnd = null; - try { - await ohosWindow.createWindow(createWindowObj).then((data) => { - tempWnd = data - console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd)); - expect(!!tempWnd).assertTrue(); - }).catch((err) => { - unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); - }); - } - catch(err) { - console.log(msgStr + 'ohosWindow.create catch err:' + JSON.stringify(err)); - } - - let findWnd = null; - await ohosWindow.find(wndId).then((data) => { - findWnd = data - }).catch((err) => { - unexpectedError(err, caseName, 'ohosWindow.find', done); + let tempWnd = await ohosWindow.create(context, wndId, baseType).catch((err) => { + unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); + }); + console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd)); + expect(!!tempWnd).assertTrue(); + let findWnd = await ohosWindow.find(wndId).catch((err) => { + expectedError(err, caseName, 'ohosWindow.find', done); }); console.log(msgStr + 'find findWnd: ' + JSON.stringify(findWnd)); expect(!!findWnd).assertTrue(); + console.info('hideWithAnimationTest1 ****' + Reflect.has(findWnd, 'hideWithAnimation')) + console.info('hideWithAnimationTest1 ****' + Reflect.has(findWnd, 'destroy')) let promise = findWnd.hideWithAnimation(); promise.then((data) => { console.info('Succeeded in hiding the window with animation. Data: ' + JSON.stringify(data));