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 Protolog', () => { 21 const viewerSelector = 'viewer-protolog'; 22 const totalEntries = 7295; 23 24 beforeEach(async () => { 25 await E2eTestUtils.beforeEach(1000); 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 'ProtoLog', 33 viewerSelector, 34 ); 35 await E2eTestUtils.checkTotalScrollEntries( 36 viewerSelector, 37 totalEntries, 38 true, 39 ); 40 await E2eTestUtils.checkTimelineTraceSelector({ 41 icon: 'notes', 42 color: 'rgba(52, 168, 83, 1)', 43 }); 44 await E2eTestUtils.checkFinalRealTimestamp('2022-11-21, 18:05:18.259'); 45 await E2eTestUtils.checkInitialRealTimestamp('2022-11-21, 18:05:09.777'); 46 47 await checkSelectFilter( 48 '.source-file', 49 ['com/android/server/wm/ActivityStarter.java'], 50 1, 51 ); 52 await checkSelectFilter( 53 '.source-file', 54 [ 55 'com/android/server/wm/ActivityStarter.java', 56 'com/android/server/wm/ActivityClientController.java', 57 ], 58 4, 59 ); 60 61 await E2eTestUtils.checkTotalScrollEntries( 62 viewerSelector, 63 totalEntries, 64 true, 65 ); 66 await filterByText('FREEZE'); 67 await E2eTestUtils.checkTotalScrollEntries(viewerSelector, 4); 68 }); 69 70 async function checkSelectFilter( 71 filterSelector: string, 72 options: string[], 73 expectedFilteredEntries: number, 74 ) { 75 await E2eTestUtils.toggleSelectFilterOptions( 76 viewerSelector, 77 filterSelector, 78 options, 79 ); 80 await E2eTestUtils.checkTotalScrollEntries( 81 viewerSelector, 82 expectedFilteredEntries, 83 ); 84 85 await E2eTestUtils.toggleSelectFilterOptions( 86 viewerSelector, 87 filterSelector, 88 options, 89 ); 90 await E2eTestUtils.checkTotalScrollEntries( 91 viewerSelector, 92 totalEntries, 93 true, 94 ); 95 } 96 97 async function filterByText(filterString: string) { 98 await E2eTestUtils.updateInputField( 99 `${viewerSelector} .headers .text`, 100 'Search text', 101 filterString, 102 ); 103 } 104}); 105