Skip to content

Instantly share code, notes, and snippets.

test('appium button click', async () => {
expect(await driver.hasElementByAccessibilityId('button')).toBe(true);
await driver.elementByAccessibilityId('button')
.click()
.click();
const counter = await driver.elementByAccessibilityId('counter').text();
expect(counter).toBe('2');
});
render() {
return (
<View style={styles.container} accessibilityLabel="testview">
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
...
)
}
import wd from 'wd';
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
const PORT = 4723;
const config = {
platformName: 'Android',
deviceName: 'Android Emulator',
app: './android/app/build/outputs/apk/app-debug.apk' // relative to root of project
};
const driver = wd.promiseChainRemote('localhost', PORT);
{
"name": "appiumTutorial",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "source venv/bin/activate && LOCATION='local' py.test && deactivate",
"appium": "appium",
"appium:doctor": "appium-doctor"
},
export default ({ body, title }) => (`
<!DOCTYLE html>
<html>
<head>
<title>${title}</title>
</head>
<body>
<div id="root">${body}</div>
</body>
import express from 'express';
import webpack from 'webpack';
import webpackConfig from '../webpack/webpack.config.dev-client';
const render = require('../dist/assets/SSR');
const app = express();
const compiler = webpack(webpackConfig);
app.use(require('webpack-dev-middleware')(compiler, {
noInfo: true,
const { publicPath, assetsPath, commonLoaders } = require('./common.config');
const path = require('path');
const nodeExternals = require('webpack-node-externals');
module.exports = {
name: 'SSR',
context: path.join(__dirname, '..', 'app'),
entry: './SSR.js',
output: {
path: assetsPath,
const { publicPath, assetsPath, commonLoaders } = require('./common.config');
const webpack = require('webpack');
const path = require('path');
module.exports = {
devtool: 'eval',
name: 'client',
context: path.join(__dirname, '..', 'app'),
entry: './client.js',
output: {
const path = require('path');
module.exports = {
publicPath: '/assets/',
assetsPath: path.join(__dirname, '..', 'dist', 'assets'),
commonLoaders: [
{
test: /\.js$/,
loader: 'babel',
include: path.join(__dirname, '..', 'app'),
import React, { Component } from 'react';
import styles from './App.css'
export default class App extends Component {
render() {
return (
<div className={styles.wrapper}>
Hello world!
</div>
);