1 /* 2 * Copyright (c) 2020-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef GRAPHIC_LITE_AUTO_TEST_H 17 #define GRAPHIC_LITE_AUTO_TEST_H 18 19 #include "components/ui_view.h" 20 #include "compare_tools.h" 21 #include "ui_test_message.h" 22 23 namespace OHOS { 24 constexpr int WAIT_TIME_MUBLITE = 4; 25 constexpr uint16_t DRAGE_DEFAULT_WAIT_TIME = 3000; 26 class UIAutoTest { 27 public: 28 UIAutoTest(); 29 virtual ~UIAutoTest(); 30 31 void ResetMainMenu() const; 32 void Reset(std::string testID) const; 33 34 void RunTest(std::vector<std::shared_ptr<TestMsgInfo>> msgInfo); 35 void TestComplete() const; 36 37 void EnterSubMenu(const char* id) const; 38 void ClickViewById(const char* id) const; 39 void DragViewToHead(const char* id) const; 40 bool CompareByBinary(const char* fileName) const; 41 void DrageToView(const char* id, int16_t x, int16_t y) const; 42 43 private: 44 void OnTest(std::shared_ptr<TestMsgInfo> info); 45 void OnEnterPage(std::vector<std::string> pageNav); 46 void OnTestBySteps(std::vector<TestSteps> steps, std::string className); 47 void OnTestOneStep(TestSteps step, std::string className, size_t stepIndex); 48 void OnSaveFile(std::string className, std::string viewID, size_t stepIndex); 49 void OnCompareFile(std::string fileName) const; 50 std::string OnGetSystemTime() const; 51 52 private: 53 std::vector<std::string> fileNames_; 54 }; 55 } // namespace OHOS 56 #endif // GRAPHIC_LITE_AUTO_TEST_H 57