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, by, element} from 'protractor'; 18import {E2eTestUtils} from './utils'; 19 20describe('Viewer Surface Flinger', () => { 21 const viewerSelector = 'viewer-surface-flinger'; 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 loadTraces(); 31 await E2eTestUtils.checkTimelineTraceSelector({ 32 icon: 'layers', 33 color: 'rgba(78, 205, 230, 1)', 34 }); 35 await E2eTestUtils.checkInitialRealTimestamp('2022-11-21, 18:05:09.780'); 36 await E2eTestUtils.checkFinalRealTimestamp('2022-11-21, 18:05:18.607'); 37 38 await E2eTestUtils.changeRealTimestampInWinscope( 39 '2022-11-21, 18:05:11.314', 40 ); 41 await E2eTestUtils.checkWinscopeRealTimestamp('18:05:11.314'); 42 await E2eTestUtils.filterHierarchy( 43 viewerSelector, 44 'ConversationListActivity#632', 45 ); 46 await E2eTestUtils.selectItemInHierarchy( 47 viewerSelector, 48 'com.google.android.apps.messaging/com.google.android.apps.messaging.ui.ConversationListActivity#632', 49 ); 50 await checkLayerProperties(); 51 }); 52 53 async function loadTraces() { 54 await E2eTestUtils.loadTraceAndCheckViewer( 55 'traces/deployment_full_trace_phone.zip', 56 'Surface Flinger', 57 viewerSelector, 58 ); 59 } 60 61 async function checkLayerProperties() { 62 const curatedProperties = element( 63 by.css('surface-flinger-property-groups'), 64 ); 65 const isPresent = await curatedProperties.isPresent(); 66 expect(isPresent).toBeTruthy(); 67 68 const finalBounds = curatedProperties.element(by.css('.final-bounds')); 69 const finalBoundsText = await finalBounds.getText(); 70 expect(finalBoundsText).toEqual( 71 'Final Bounds: (162.418, 346.428) - (917.582, 1982.619)', 72 ); 73 74 const transform = curatedProperties.element( 75 by.css('.geometry .left-column transform-matrix'), 76 ); 77 const transformText = await transform.getText(); 78 expect(transformText).toEqual( 79 '0.699\n0\n162.418\n0\n0.699\n346.428\n0\n0\n1', 80 ); 81 82 const flags = curatedProperties.element(by.css('.flags')); 83 const flagsText = await flags.getText(); 84 expect(flagsText).toEqual('Flags: OPAQUE|ENABLE_BACKPRESSURE (0x102)'); 85 86 const destinationFrame = curatedProperties.element(by.css('.dest-frame')); 87 const destinationFrameText = await destinationFrame.getText(); 88 expect(destinationFrameText).toEqual( 89 'Destination Frame: (0, 0) - (1080, 2340)', 90 ); 91 } 92}); 93