From a7bec35b15056d69dd73114e923e799b1eac489f Mon Sep 17 00:00:00 2001 From: Rajdeep Varma Date: Sat, 18 Jan 2020 19:48:53 +0000 Subject: [PATCH] implement open_notifications endpoint --- .../lib/handlers/OpenNotifications.kt | 28 +++++++++++++++++++ .../appium/espressoserver/lib/http/Router.kt | 1 + 2 files changed, 29 insertions(+) create mode 100644 espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/OpenNotifications.kt diff --git a/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/OpenNotifications.kt b/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/OpenNotifications.kt new file mode 100644 index 000000000..9ba89d450 --- /dev/null +++ b/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/OpenNotifications.kt @@ -0,0 +1,28 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.espressoserver.lib.handlers + +import io.appium.espressoserver.lib.helpers.InteractionHelper.getUiDevice +import io.appium.espressoserver.lib.model.AppiumParams + +class OpenNotifications : RequestHandler { + override fun handleInternal(params: AppiumParams): Void? { + getUiDevice().openNotification() + return null + } + +} diff --git a/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/http/Router.kt b/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/http/Router.kt index 165a72bc5..fe377792d 100644 --- a/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/http/Router.kt +++ b/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/http/Router.kt @@ -96,6 +96,7 @@ internal class Router { routeMap.addRoute(RouteDefinition(Method.POST, "/session/:sessionId/appium/element/:elementId/replace_value", ElementValue(true), TextValueParams::class.java)) routeMap.addRoute(RouteDefinition(Method.POST, "/session/:sessionId/appium/device/get_clipboard", GetClipboard(), GetClipboardParams::class.java)) routeMap.addRoute(RouteDefinition(Method.POST, "/session/:sessionId/appium/device/set_clipboard", SetClipboard(), SetClipboardParams::class.java)) + routeMap.addRoute(RouteDefinition(Method.POST, "/session/:sessionId/appium/device/open_notifications", OpenNotifications(), AppiumParams::class.java)) // touch events routeMap.addRoute(RouteDefinition(Method.POST, "/session/:sessionId/touch/click", PointerEventHandler(CLICK), MotionEventParams::class.java))