Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

merge ios automation to develop #171

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ jobs:
curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
- attach_workspace:
at: ~/uport-mobile
- run:
name: Install appium server
command: |
npm install -g appium
npm install wd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a global package or local? If local, why isn't it in package.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m going to check if I can add installation of appium server to package.json

As for running tests locally, you have to install appium:
npm install -g appium
npm install wd
pip install Appium-Python-Client

Then launch appium in terminal by running “appium”
And in a separate terminal run the tests from repo “python testsuites/test.py”

pip install Appium-Python-Client
- restore_cache:
keys:
- bundle-{{ arch }}-v4-ios-{{ checksum "Gemfile.lock" }}
Expand All @@ -198,6 +204,17 @@ jobs:
- run:
name: Fastlane
command: cd ~/uport-mobile/ios && bundle exec fastlane buildTheApp
- run:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should run bundle exec fastlane buildTheApp only if appium tests pass?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point.

name: Build debug version of app
command: |
yarn global add react-native-cli
yarn
react-native run-ios
- run:
command: |
./testsuites/terminal.scpt
sleep 5
python testsuites/test.py
- persist_to_workspace:
root: ~/uport-mobile
paths:
Expand Down
Empty file added testsuites/support/__init__.py
Empty file.
Binary file added testsuites/support/__init__.pyc
Binary file not shown.
23 changes: 23 additions & 0 deletions testsuites/support/common_methods.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from os import getcwd, chdir
import glob
import os

def select_element(driverinfo, elem):

return driverinfo.find_element_by_id(elem)



def find_uportapp():
folder = 'Debug-*'
current_dir = os.path.abspath(os.path.dirname(__file__))
direct = os.path.join(os.path.abspath(current_dir + "/../../"),"ios", "build", "Build", "Products")
saved = getcwd()
chdir(direct)
it = glob.glob(folder)
chdir(saved)
return (" ".join(it))




3 changes: 3 additions & 0 deletions testsuites/terminal.scpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
osascript -e 'tell app "Terminal"
do script "appium"
end tell'
83 changes: 83 additions & 0 deletions testsuites/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from appium import webdriver
from appium.webdriver.common.touch_action import TouchAction
from support.common_methods import select_element, find_uportapp
from os.path import expanduser

import unittest
import os
import glob
import shutil


class identityTests(unittest.TestCase):

def test_createIdentity(self):
this_dir = os.path.abspath(os.path.dirname(__file__))
print this_dir + " **file directory"
#uportapp = find_uportapp()
desired_caps = {}
desired_caps['platformName'] = 'iOS'
desired_caps['platformVersion'] = '12.1'
desired_caps['deviceName'] = 'iPhone XR' # Run on simulator
cwd = os.getcwd()
print cwd + " **current directory"
current_dir = os.path.abspath(os.path.dirname(__file__))
desired_caps['app'] = os.path.join(os.path.abspath(current_dir + "/../"),"ios", "build", "uPortMobile", "Build", "Products", "Debug-iphonesimulator", "uPort.app")

#desired_caps['fullReset'] = 'true'
desired_caps['automationName'] = "XCUITest"
self.wd = webdriver.Remote('http://0.0.0.0:4723/wd/hub', desired_caps)

self.wd.implicitly_wait(10)
#screenshot
directory = '%s/' % os.getcwd()
file_name = 'screenshot.png'
self.wd.save_screenshot(directory + file_name)

self.assertTrue(select_element(self.wd, "Dismiss All").is_displayed()) #dismiss
select_element(self.wd, "Dismiss All").click()

self.assertTrue(select_element(self.wd, "ONBOARDING_GET_STARTED").is_displayed()) #select onboarding
select_element(self.wd, "ONBOARDING_GET_STARTED").click()

self.assertTrue(select_element(self.wd, "ONBOARDING_LEARN_CONTINUE").is_displayed()) #select onboarding
select_element(self.wd, "ONBOARDING_LEARN_CONTINUE").click()

#type in uport user and press enter ("\n")
self.wd.find_element_by_id("Enter name or username").send_keys('Sanaa'+"\n")

self.wd.implicitly_wait(5)

self.assertTrue(select_element(self.wd, "ONBOARDING_TERMS_RADIO").is_displayed()) #terms
select_element(self.wd, "ONBOARDING_TERMS_RADIO").click()


self.assertTrue(select_element(self.wd, "ONBOARDING_PRIVACY_RADIO").is_displayed()) #terms
select_element(self.wd, "ONBOARDING_PRIVACY_RADIO").click()

self.assertTrue(select_element(self.wd, "ONBOARDING_CREATE_IDENTITY").is_displayed()) #create identity
select_element(self.wd, "ONBOARDING_CREATE_IDENTITY").click()


# notifications permissions
self.assertTrue(select_element(self.wd, "Allow").is_displayed())
select_element(self.wd, "Allow").click()

#verify did is created
#self.assertTrue(select_element(self.wd, "uPort ID ").is_displayed())
#select_element(self.wd, "uPort ID ").click()

#self.assertTrue(select_element(self.wd, "DID did:ethr:0x6...").is_displayed())
#select_element(self.wd, "DID did:ethr:0x6...").click()







if __name__ == '__main__':
unittest.main()