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 Transactions', () => { 21 const viewerSelector = 'viewer-transactions'; 22 const totalEntries = 9534; 23 24 beforeEach(async () => { 25 jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000; 26 await E2eTestUtils.beforeEach(2000); 27 await browser.get(E2eTestUtils.WINSCOPE_URL); 28 }); 29 30 it('processes trace from zip and navigates correctly', async () => { 31 await E2eTestUtils.loadTraceAndCheckViewer( 32 'traces/deployment_full_trace_phone.zip', 33 'Transactions', 34 viewerSelector, 35 ); 36 await E2eTestUtils.checkScrollPresent(viewerSelector); 37 await E2eTestUtils.checkTotalScrollEntries( 38 viewerSelector, 39 totalEntries, 40 true, 41 ); 42 await E2eTestUtils.checkTimelineTraceSelector({ 43 icon: 'show_chart', 44 color: 'rgba(13, 101, 45, 1)', 45 }); 46 await E2eTestUtils.checkFinalRealTimestamp('2022-11-21, 18:05:19.592'); 47 await E2eTestUtils.checkInitialRealTimestamp('2022-11-21, 11:36:19.513'); 48 49 await E2eTestUtils.changeRealTimestampInWinscope( 50 '2022-11-21, 18:05:17.505', 51 ); 52 await E2eTestUtils.checkWinscopeRealTimestamp('18:05:17.505'); 53 await checkSelectedEntry(); 54 await E2eTestUtils.checkSelectFilter( 55 viewerSelector, 56 '.pid', 57 ['6914'], 58 2, 59 totalEntries, 60 ); 61 await E2eTestUtils.checkSelectFilter( 62 viewerSelector, 63 '.uid', 64 ['10161'], 65 16, 66 totalEntries, 67 ); 68 await E2eTestUtils.checkSelectFilter( 69 viewerSelector, 70 '.flags', 71 ['eBackgroundBlurRadiusChanged'], 72 10, 73 totalEntries, 74 ); 75 }); 76 77 async function checkSelectedEntry() { 78 const selectedEntry = element(by.css(`${viewerSelector} .scroll .current`)); 79 expect(await selectedEntry.isPresent()).toBeTruthy(); 80 81 const transactionId = selectedEntry.element(by.css('.transaction-id')); 82 expect(await transactionId.getText()).toEqual('7975754272149'); 83 84 const vsyncId = selectedEntry.element(by.css('.vsyncid')); 85 expect(await vsyncId.getText()).toEqual('93389'); 86 87 const pid = selectedEntry.element(by.css('.pid')); 88 expect(await pid.getText()).toEqual('1857'); 89 90 const uid = selectedEntry.element(by.css('.uid')); 91 expect(await uid.getText()).toEqual('1000'); 92 93 const type = selectedEntry.element(by.css('.transaction-type')); 94 expect(await type.getText()).toEqual('LAYER_CHANGED'); 95 96 const layerOrDisplayId = selectedEntry.element( 97 by.css('.layer-or-display-id'), 98 ); 99 expect(await layerOrDisplayId.getText()).toEqual('798'); 100 101 const whatString = 102 'eLayerChanged | eAlphaChanged | eFlagsChanged | eReparent | eColorChanged | eHasListenerCallbacksChanged'; 103 const what = selectedEntry.element(by.css('.flags')); 104 expect(await what.getText()).toEqual(whatString); 105 106 await E2eTestUtils.checkItemInPropertiesTree( 107 viewerSelector, 108 'what', 109 'what:\n' + whatString, 110 ); 111 await E2eTestUtils.checkItemInPropertiesTree( 112 viewerSelector, 113 'color', 114 'color:\n(0.106, 0.106, 0.106)', 115 ); 116 } 117}); 118