1 /* 2 * Copyright (C) 2019 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 17 package android.platform.helpers; 18 19 /** 20 * Helper class for functional tests of Settings facet 21 */ 22 public interface IAutoSettingHelper extends IAppHelper { 23 24 /** 25 * enum for Day/Night mode. 26 * 27 * <p>The values of DAY_MODE(0) and NIGHT_MODE(2) are determined by the returned value of 28 * UiModeManager.getNightMode() 29 */ 30 public enum DayNightMode { 31 DAY_MODE(0), 32 NIGHT_MODE(2); 33 34 private final int value; 35 DayNightMode(int value)36 DayNightMode(int value) { 37 this.value = value; 38 } 39 getValue()40 public int getValue() { 41 return value; 42 } 43 } 44 45 /** 46 * enum for changing(increasing, decreasing) value. 47 */ 48 enum ChangeType{ 49 INCREASE, 50 DECREASE 51 } 52 53 /** 54 * Setup expectations: The app is open and the settings facet is open 55 * 56 * @param setting option to open. 57 */ openSetting(String setting)58 void openSetting(String setting); 59 60 /** 61 * Setup expectations: The app is open 62 * 63 * <p>Open quick settings page 64 */ openQuickSettings()65 void openQuickSettings(); 66 67 /** 68 * Setup expectations: The app is open and wifi setting options is selected 69 * 70 * @param option to turn on/off wifi 71 */ turnOnOffWifi(boolean turnOn)72 void turnOnOffWifi(boolean turnOn); 73 74 /** 75 * Setup expectations: The app is open and bluetooth setting options is selected 76 * 77 * @param option to turn on/off bluetooth 78 */ turnOnOffBluetooth(boolean turnOn)79 void turnOnOffBluetooth(boolean turnOn); 80 81 /** 82 * Setup expectations: The app is open. 83 * 84 * Checks if the wifi is enabled. 85 */ isWifiOn()86 boolean isWifiOn(); 87 88 /** 89 * Setup expectations: The app is open. 90 * 91 * Checks if the bluetooth is enabled. 92 */ isBluetoothOn()93 boolean isBluetoothOn(); 94 95 /** 96 * Setup expectations: The app is open and the settings facet is open 97 */ goBackToSettingsScreen()98 void goBackToSettingsScreen(); 99 100 /** 101 * Force stops the settings application 102 */ stopSettingsApplication()103 void stopSettingsApplication(); 104 105 /** 106 * Setup expectations: settings app is open. 107 * 108 * This method is used to open Settings Menu with menuOptions. 109 * Example - Settings->App info->Calandar->Permissions 110 * openMenuWith("App info", "Calandar", "Permissions"); 111 * 112 * @param - menuOptions used to pass multiple level of menu options in one go. 113 * 114 */ openMenuWith(String... menuOptions)115 void openMenuWith(String... menuOptions); 116 117 /** 118 * Setup expectations: settings app is open and settings menu is selected 119 * 120 * Checks if the toggle switch for the given index is checked. 121 * @param index of toggle switch. 122 * index should be passed as 0 if only one toggle switch is present on screen. 123 */ isToggleSwitchChecked(int index)124 boolean isToggleSwitchChecked(int index); 125 126 /** 127 * Setup expectations: settings app is open and settings menu is selected 128 * 129 * Clicks the toggle switch for the given index 130 * @param index of toggle switch. 131 * index should be passed as 0 if only one toggle switch is present on screen. 132 */ clickToggleSwitch(int index)133 void clickToggleSwitch(int index); 134 135 /** 136 * Setup expectations: settings app is open. 137 * 138 * gets the value of the setting. 139 * @param setting should be passed. example for setting is screen_brightness. 140 */ getValue(String setting)141 int getValue(String setting); 142 143 /** 144 * Setup expectations: settings app is open 145 * 146 * sets the value of the setting. 147 * @param setting should be passed. example for setting is screen_brightness. 148 */ setValue(String setting, int value)149 void setValue(String setting, int value); 150 151 /** 152 * Setup expectations: settings app is open and a seekbar is visible on the screen 153 * 154 * changes setting level of seekbar for the given index. 155 * @param index of seekbar. should be passed as 0 if only one seekbar is present on screen. 156 * @param changeType determines to increase or decrease the value of setting. 157 */ changeSeekbarLevel(int index, ChangeType changeType)158 void changeSeekbarLevel(int index, ChangeType changeType); 159 160 /** 161 * Setup expectations: quick settings facet is open. 162 * 163 * <p>set day/night mode. 164 * 165 * @param mode determines to set day mode or night mode. 166 */ setDayNightMode(DayNightMode mode)167 void setDayNightMode(DayNightMode mode); 168 169 /** 170 * Setup expectations: quick settings facet is open. 171 * 172 * <p>get day/night mode status. 173 */ getDayNightModeStatus()174 DayNightMode getDayNightModeStatus(); 175 } 176