Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Commit bfa2333

Browse files
committed
Merge pull request #11 from Manabu-GT/develop
Develop
2 parents 6df917a + 00e57bc commit bfa2333

10 files changed

Lines changed: 150 additions & 3 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@ build/
1010
*.iml
1111
.idea
1212

13+
# Python
14+
__pycache__/
15+
*.py[cod]
16+
appium/pytestdebug.log
17+
1318
# Windows thumbnail db
1419
.DS_Store

.travis.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
language: android
2+
3+
android:
4+
components:
5+
# The BuildTools version used by your project
6+
- build-tools-22.0.1
7+
8+
# The SDK version used to compile your project
9+
- android-22
10+
11+
# Additional components
12+
- extra-android-m2repository
13+
14+
# command to install dependencies
15+
install:
16+
- sudo pip install -r requirements.txt
17+
18+
# command to build and run tests
19+
script:
20+
- ./gradlew assembleDebug
21+
- sh run_tests.sh
22+
23+
addons:
24+
sauce_connect: true
25+
26+
env:
27+
global:
28+
- secure: A1jbSplRPc7lRcjT6yY3Z33ynAEmiSzub5ADEXys4VtzjhenRCejkYAyLmNLm4ywbWWhmmZqXT70YPJQTBr5tbZlfHx5P2GRU1MtBvcXSUO+5RJ3swc80UOVvllhfHNuiiraqwSNcWl7skPHxDfBPBe8QOLp4A17JpJEJ8nFqpc=
29+
- secure: fFmQjyp/tTloQmWFnNb7CZQsk92kZV7a78J0y0XW1kW+NPauxQ7MHsI9GAsOrEByyGF4xz2eKq37Z+LoMZtvcCgPWz5mt62QFQ2jXDxXckVeYr6JQW6gnXMcCR96V7RYLPHW9HbfOYcchiS2lu5ytogNh3NU35OgAscOTfO0Gtc=

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
DesignOverlay - for developers and designers [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-DesignOverlay-brightgreen.svg?style=flat)](http://android-arsenal.com/details/3/1654)
1+
DesignOverlay - for developers and designers
22
===============
3+
4+
[![Build Status](https://travis-ci.org/Manabu-GT/DesignOverlay-Android.svg?branch=master)](https://travis-ci.org/Manabu-GT/DesignOverlay-Android)
5+
[![Sauce Test Status](https://saucelabs.com/buildstatus/design-overlay)](https://saucelabs.com/u/design-overlay)
6+
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-DesignOverlay-brightgreen.svg?style=flat)](http://android-arsenal.com/details/3/1654)
7+
38
DesignOverlay is an android app which displays a design image with grid lines to facilitate the tedious layout process.
49
The grid is especially useful to align to baseline grids as described in [Android Design Guidelines][1].
510

app/src/main/res/layout/activity_settings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<Switch android:id="@+id/grid_switch"
2727
android:layout_width="wrap_content"
2828
android:layout_height="wrap_content"
29+
android:contentDescription="Grid Switch"
2930
android:layout_alignBaseline="@id/app_title"
3031
android:layout_alignParentEnd="true"
3132
android:layout_alignParentRight="true"/>

appium/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# DesignOverlay UI Test
2+
3+
## Set up
4+
5+
Install sauce labs client library:
6+
7+
```shell
8+
pip install sauceclient
9+
```
10+
11+
Install appium client library:
12+
13+
```shell
14+
pip install Appium-Python-Client
15+
pip install pytest
16+
```
17+
18+
## how to run (SauceLabs)
19+
To see logging statements as they are executed, pass the -s flag to py.test.
20+
For configuration, look at the config_sauce_labs.json.example.
21+
22+
```shell
23+
py.test -s appium/android_sauce_labs.py
24+
```

appium/android_sauce_labs.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
"""
5+
6+
Author : Manabu Shimobe
7+
8+
"""
9+
__author__ = "Manabu Shimobe"
10+
11+
from appium import webdriver
12+
from appium import SauceTestCase, on_platforms
13+
14+
from time import sleep
15+
from logging import getLogger, StreamHandler, Formatter, DEBUG
16+
import json
17+
18+
# load default platform configurations
19+
json_file = open('appium/config_sauce_labs.json')
20+
platforms = json.load(json_file)
21+
json_file.close()
22+
23+
# set up logger
24+
logger = getLogger(__name__)
25+
logger.setLevel(DEBUG)
26+
handler = StreamHandler()
27+
handler.setFormatter(Formatter('%(asctime)s- %(name)s - %(levelname)s - %(message)s'))
28+
handler.setLevel(DEBUG)
29+
logger.addHandler(handler)
30+
31+
# the emulator is sometimes slow
32+
SLEEP_TIME = 1
33+
34+
@on_platforms(platforms)
35+
class SimpleAndroidSauceTests(SauceTestCase):
36+
37+
def test_settings(self):
38+
sleep(SLEEP_TIME)
39+
40+
# Check if successfully started SettingsActivity
41+
self.assertEqual('.activity.SettingsActivity_', self.driver.current_activity)
42+
43+
el_switch = self.driver.find_element_by_accessibility_id('Grid Switch')
44+
self.assertIsNotNone(el_switch)
45+
46+
# Grid should be shown now
47+
el_switch.click()
48+
logger.info('Clicked Grid Switch')
49+
50+
sleep(SLEEP_TIME)

appium/config_sauce_labs.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[
2+
{
3+
"platformName":"Android",
4+
"platformVersion":"4.4",
5+
"deviceName":"Android Emulator",
6+
"appPackage":"com.ms_square.android.design.overlay",
7+
"appActivity":".activity.SettingsActivity_",
8+
"app":"sauce-storage:design_overlay.apk",
9+
"appiumVersion":"1.3.6"
10+
}
11+
]

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ allprojects {
2222
// http://www.gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html
2323
project.ext {
2424
ANDROID_BUILD_SDK_VERSION = 22
25-
ANDROID_BUILD_TOOLS_VERSION = "22"
25+
ANDROID_BUILD_TOOLS_VERSION = "22.0.1"
2626

2727
ANDROID_BUILD_MIN_SDK_VERSION = 14
2828
ANDROID_BUILD_TARGET_SDK_VERSION = 22
2929

3030
// Google Stuffs
31-
supportPackageVersion = "21.0.3"
31+
supportPackageVersion = "22.0.0"
3232

3333
// APT plugin and Android Annotations
3434
daggerVersion = "1.2.1"

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# requirements.txt for pip install
2+
sauceclient
3+
Appium-Python-Client
4+
pytest

run_tests.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
echo "Uploading debug apk to SauceLabs..."
4+
5+
res=`curl -w %{http_code} --output /dev/null -u $SAUCE_USERNAME:$SAUCE_ACCESS_KEY -X POST "http://saucelabs.com/rest/v1/storage/$SAUCE_USERNAME/design_overlay.apk?overwrite=true" \
6+
-H "Content-Type: application/octet-stream" --data-binary @app/build/outputs/apk/app-debug.apk`
7+
8+
if [ $res -eq 200 ]
9+
then
10+
echo "APK Uploaded..."
11+
else
12+
echo "APK Upload failed..."
13+
exit 1
14+
fi
15+
16+
echo "Starting tests..."
17+
18+
py.test -s appium/android_sauce_labs.py

0 commit comments

Comments
 (0)