• Stars
    star
    233
  • Rank 172,230 (Top 4 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Swift implementation of WebDriver server for iOS that runs on Simulator/iOS devices.

XCTestWD


NPM version node version npm download CircleCI

Swift implementation of WebDriver server for iOS that runs on Simulator/iOS devices.

Contributors


SamuelZhaoY


xudafeng


paradite


holy-lousie


adudurant


Chan-Chun


gurisxie


xqin


butterflyingdog


donlinglok


Nicolasyy


fengguochao

This project follows the git-contributor spec, auto updated at Wed Apr 15 2020 13:12:56 GMT+0800.

1. Requirements

  • XCode version > 10.1
  • iOS version 11.0 and above. (there is significant change on XCUITest interfaces and system private headers, hence we decide to support newest OS version only)

1.1. Carthage

Using Carthage with Xcode 12

https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md

carthage.sh can be found at the root of the project

./carthage.sh bootstrap --platform iOS --cache-builds

2. Starting XCTestWD

XCTestWD can be either started with XCode IDE or via simple xcodebuild command line. By default, the webdriver agent occupies port 8001. You can override the default port in XCode by searching XCTESTWD_PORT under project build settings. Alternatively, it can also be overrided when you execute command line method as specified in 2.2. Using Xcodebuild

2.1. Using Xcode

Download the project and open the XCode project, checkout the scheme XCTestWDUITests and run the test case XCTextWDRunner

2.2. Using XcodeBuild

Open the terminal, go to the directory where contains XCTestWD.xcodeproj file and execute the following command:

#
# Change the port number to override the default port
#
xcodebuild -project XCTestWD.xcodeproj \
  -scheme XCTestWDUITests \
  -destination 'platform=iOS Simulator,name=iPhone 6' \
  XCTESTWD_PORT=8001 \
  clean test

To execute for iOS device, run the following command:

#
# Change the port number to override the default port
# Specify the device name
#
xcodebuild -project XCTestWD.xcodeproj \
  -scheme XCTestWDUITests \
  -destination 'platform=iOS,name=(your device name)' \
  XCTESTWD_PORT=8001 \
  clean test

Note: For versions above wxtestwd 2.0.0, please install ideviceinstaller for supporting real device testing

3. Element Types

In the current protocol, element strings for each XCUIElementType are generated based on the existing mapping in reference/xctest/xcuielementtype

4. Common Issues

4.1 Socket hangup error

Socket Hangup Error happens in the following two scenarios:

  • Case 1
    Issue:
    When you have some existing XCTestWD instances running and creating new ones.
    Solution:
    verify whether ideviceinstaller and xcrun is properly working on your device and simulator.
    Hint:
    libimobiledevice/ideviceinstaller#48

  • Case 2
    Issue:
    When you have started the XCTestWD instance properly but fails in middle of a testing process.
    Solution:
    See the Macaca Service log to checkout which command leads the error. With detailed and comprehensive log information, please submit an issue to us.
    Optional:
    If you cannot get anything from macaca server log, open the XCTestWD in your node installation path and attatch for debugging on process 'XCTRunnerUITests-Runner'.

Additional Info
The project path is at

cd "$(npm root -g)/macaca-ios/node_modules/xctestwd"

Set up the linebreak for swift error and exceptions:

2017-12-14 10 56 33

Run your command regularly, once the driver has been initialized, attach the process:

2017-12-14 10 55 14

4.2 Swift modules fails to compile

Check carthage installation

4.3 Debug info

Now XCTestWD supports gathering debug log into log files which is stored in "Your-App-Sandbox-Root"/Documents/Logs dir. For real devices, you can connect to itunes and choose backup for XCTestWDUITests and get the debug log. For iOS simulators, the log file is in your computer's simulator app directory like:

"/Users/${user-name}/Library/Developer/CoreSimulator/Devices \
/${device-id}/data/Containers/Data/Application/${app-id}/Documents/Logs"

You can use xcrun simctl list to get the id of the booted device.

4.4

user PATH variable MACACA_XCTESTWD_ROOT_PATH to override the default one.

MACACA_XCTESTWD_ROOT_PATH=/path/to/macaca_xctest app-inspector -u xxx --verbose

4.5

We update dependencies by using other npm packages, because the XCode upgrade swift syntax is often not backward compatible.

package XCode version notes
xctestwd-frameworks 11.2.1

More Repositories

1

macaca-datahub

Continuous data provider for development, testing, staging and production. Just enjoy the data out-of-the-box.📦
JavaScript
475
star
2

macaca-cli

Macaca command-line interface
JavaScript
465
star
3

app-inspector

App-inspector is a mobile UI viewer in browser.
JavaScript
390
star
4

reliable

⌛Testing management suite with continuous delivery support.
JavaScript
272
star
5

NoSmoke

A cross platform UI crawler which scans view trees then generate and execute UI test cases.
JavaScript
197
star
6

awesome-macaca

🐒 A curated list of awesome things regarding Macaca ecosystem.
101
star
7

nodecv

Node.js binding to OpenCV
C++
55
star
8

macaca-ios

Macaca iOS driver
JavaScript
54
star
9

macaca-android

🤖 Macaca Android driver
JavaScript
52
star
10

UIAutomatorWD

Node.js wrapper for Android UIAutomator.
Java
49
star
11

iosHookViewId

A solution for ios hook view id(给iOS应用自动生成控件id)
Objective-C
47
star
12

macaca-puppeteer

Macaca puppeteer driver
JavaScript
42
star
13

macaca-docker-images

Macaca Docker Image
Dockerfile
41
star
14

macaca-wd

wd.js - Node.js WebDriver Client for Macaca
JavaScript
39
star
15

torchjs

Test framework to light up the world.
JavaScript
39
star
16

macaca-adb

Node.js wrapper for ADB.
JavaScript
36
star
17

macaca-macos

Integrate robotjs, osascript and shell of the operating system to automatically control the MacOS, such as controlling the mouse, keyboard, window operation, etc.
TypeScript
34
star
18

wd.py

Python Client binding for Macaca
Python
33
star
19

macaca-electron

:electron: Macaca Electron driver
JavaScript
31
star
20

wd.java

Java Client binding for Macaca
Java
30
star
21

dom-event-simulate

simulate user interaction with DOM events.
JavaScript
30
star
22

macaca-chromedriver

Node.js wrapper for the selenium chromedriver.
JavaScript
26
star
23

uitest

Run mocha in a browser environment.
JavaScript
24
star
24

android-unicode

Android unicode UTF-7 input apk
Java
23
star
25

macacajs.github.io

Official Site of Macaca :octocat:
JavaScript
19
star
26

macaca-playwright

🚀 Macaca Playwright driver
JavaScript
18
star
27

nodecv-server

nodecv server side
JavaScript
17
star
28

ios-simulator

Node.js wrapper for ios simulator
JavaScript
16
star
29

macaca-ai

WIP: Macaca Artificial Intelligence, but still in lab phase
JavaScript
13
star
30

webdriver-server

Webdriver Server for Macaca
JavaScript
11
star
31

macaca-coverage

Macaca coverage tool
HTML
10
star
32

macaca-reporter-java-plugin

Macaca Reporter Plugin For Java
Java
8
star
33

macaca-autobash-ios

ios automation scripts
Shell
8
star
34

macaca-chrome

Macaca Chrome driver
JavaScript
8
star
35

macaca-recorder

浏览器插件,自动生成用例代码。
TypeScript
7
star
36

macaca-bot

:octocat: bot to resolve the issues and PR of Macaca 🐒
JavaScript
6
star
37

macaca-reporter

Reporter used for mocha and other frameworks.
JavaScript
5
star
38

node-ios-webkit-debug-proxy

Node.js wrapper for Google ios-webkit-debug-proxy
JavaScript
5
star
39

unlock-apk

An android apk to make sure test device is unlocked while running Macaca.
Java
4
star
40

macaca-utils

utils for Macaca
JavaScript
4
star
41

remote-debugger

Node.js remote debugger based on webkit
JavaScript
3
star
42

ios-utils

ios utils
JavaScript
3
star
43

macaca-ecosystem

Macaca ecosystem and community tools
JavaScript
3
star
44

macaca-simple-reportor

macaca simple reportor
JavaScript
3
star
45

driver-base

Macaca driver base
JavaScript
2
star
46

macaca-reporter-jest

Macaca reporter used for jest.
JavaScript
2
star
47

macaca-istanbul

JavaScript
2
star
48

webdriver-dfn-error-code

dfn error code for webdriver
JavaScript
1
star