1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17import {browser} from 'protractor'; 18import {E2eTestUtils} from './utils'; 19 20describe('Viewer Window Manager', () => { 21 const viewerSelector = 'viewer-window-manager'; 22 23 beforeEach(async () => { 24 browser.manage().timeouts().implicitlyWait(1000); 25 await E2eTestUtils.checkServerIsUp('Winscope', E2eTestUtils.WINSCOPE_URL); 26 await browser.get(E2eTestUtils.WINSCOPE_URL); 27 }); 28 29 it('processes trace from zip and navigates correctly', async () => { 30 await E2eTestUtils.loadTraceAndCheckViewer( 31 'traces/deployment_full_trace_phone.zip', 32 'Window Manager', 33 viewerSelector, 34 ); 35 await E2eTestUtils.checkTimelineTraceSelector({ 36 icon: 'web', 37 color: 'rgba(175, 92, 247, 1)', 38 }); 39 await E2eTestUtils.checkInitialRealTimestamp('2022-11-21, 18:05:09.753'); 40 await E2eTestUtils.checkFinalRealTimestamp('2022-11-21, 18:05:18.269'); 41 42 await E2eTestUtils.changeRealTimestampInWinscope( 43 '2022-11-21, 18:05:09.753', 44 ); 45 await E2eTestUtils.checkWinscopeRealTimestamp('18:05:09.753'); 46 await E2eTestUtils.selectItemInHierarchy(viewerSelector, 'root'); 47 await checkRootProperties(); 48 49 await E2eTestUtils.changeRealTimestampInWinscope( 50 '2022-11-21, 18:05:14.544', 51 ); 52 await E2eTestUtils.checkWinscopeRealTimestamp('18:05:14.544'); 53 await E2eTestUtils.filterHierarchy(viewerSelector, 'InputMethod'); 54 await E2eTestUtils.selectItemInHierarchy(viewerSelector, 'InputMethod'); 55 await checkInputMethodWindowProperties(); 56 }); 57 58 async function checkRootProperties() { 59 await E2eTestUtils.checkItemInPropertiesTree( 60 viewerSelector, 61 'focusedApp', 62 'focusedApp:\ncom.google.android.apps.messaging/.ui.ConversationListActivity', 63 ); 64 await E2eTestUtils.checkRectLabel( 65 viewerSelector, 66 'com.google.android.apps.messaging/com.google.android.apps.messaging.ui.ConversationListActivity', 67 ); 68 } 69 70 async function checkInputMethodWindowProperties() { 71 await E2eTestUtils.checkItemInPropertiesTree( 72 viewerSelector, 73 'fitInsetsTypes', 74 'fitInsetsTypes:\nNAVIGATION_BARS | STATUS_BARS', 75 ); 76 77 await E2eTestUtils.checkItemInPropertiesTree( 78 viewerSelector, 79 'flags', 80 'flags:\nFLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS | FLAG_HARDWARE_ACCELERATED | FLAG_SPLIT_TOUCH | FLAG_LAYOUT_IN_SCREEN | FLAG_NOT_FOCUSABLE', 81 ); 82 83 await E2eTestUtils.checkItemInPropertiesTree( 84 viewerSelector, 85 'compatFrame', 86 'compatFrame:\n(136, 74) - (2340, 1080)', 87 ); 88 } 89}); 90