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

E2E test workflow #166

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
53 changes: 53 additions & 0 deletions .github/workflows/e2eios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

name: Expo e2e ios tests

on:
push :
branches : [master]

jobs:
ios-e2e-tests:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- uses: actions/[email protected]
with:
java-version: '9.0.4' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- uses: sinoru/[email protected]
with:
xcode-version: '11.2.1' # Exact version of a Xcode version to use
apple-id: ${{ secrets.EXPO_APPLE_ID }} # Apple ID to download from Apple Developer when Xcode not available in local
apple-id-password: ${{ secrets.EXPO_APPLE_PASSWORD }}
- uses: expo/expo-github-action@v5
with:
expo-version: 3.x
expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
- name: Install deps
run: yarn install
- name: Build iOS app
run: expo build:ios --type simulator
env:
EXPO_APPLE_ID: ${{secrets.EXPO_APPLE_ID}}
EXPO_APPLE_ID_PASSWORD: ${{secrets.EXPO_APPLE_PASSWORD}}
- name: Create artifacts folder
run: mkdir -p ipas
- name: Save artifacts
run: curl "$(expo url:ipa --non-interactive)" -o ipas/ci-proto.tar.gz
- name: Unizip ipa
run: tar -xvzf ipas/ci-proto.tar.gz -C ./ipas
- uses: actions/upload-artifact@v2
with:
name: ios-builds
path: ipas/
- name: Install appium
run: npm install -g appium appium-doctor
# - name: Run apium checks
# run: appium-doctor --ios
- name: Run appium tests
run: yarn e2e:ios:run:ci
4 changes: 3 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
"supportsTablet": true,
"bundleIdentifier": "com.nearform.polaris",
"buildNumber": "1.0.0"
},
"android": {
"useNextNotificationsApi": true
Expand Down
18 changes: 18 additions & 0 deletions e2e/config.ios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

const path = require('path');

const iosAppAbsPath = path.normalize(`${__dirname}/../ipas/ci-proto.app`);
const simulator = 'iPhone 11';

const configuration = {
path: '/wd/hub',
port: 4723,
capabilities: {
platformName: 'iOS',
automationName: 'XCUITest',
deviceName: simulator,
app: iosAppAbsPath
}
};

module.exports = configuration;
25 changes: 25 additions & 0 deletions e2e/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const wdio = require("webdriverio");

const args = process.argv.slice(2);

config = require("./config.ios");

function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}

const test = async () => {
//TODO: Needs an imporvement, wait appium is started
await sleep(10000);
const client = await wdio.remote(config);
await client.pause(3000);

const welcomeMessageText = await client.$("~welcome");

console.log(`Message: <${await welcomeMessageText.getValue()}>`);
await client.deleteSession();
};

test();
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"e2e:web:open": "cypress open",
"e2e:web:run": "cypress run",
"e2e:web:run:ci": "wait-on http://localhost:19006 && npm run e2e:web:run -- --config video=false",
"e2e:ios:run": "node e2e/index",
"e2e:ios:run:ci": "concurrently \"appium\" \"npm:e2e-t\"",
"create:env": "node -r fs -e \"fs.copyFileSync('.env.sample', '.env', fs.constants.COPYFILE_EXCL)\"",
"push:generate:web": "web-push generate-vapid-keys",
"push:server:start": "node server.js"
Expand Down Expand Up @@ -151,6 +153,8 @@
"react-native-storybook-loader": "^2.0.2",
"react-native-svg-transformer": "^0.14.3",
"react-test-renderer": "^16.13.1",
"wait-on": "^5.0.1"
"wait-on": "^5.0.1",
"concurrently": "^6.0.0",
"webdriverio": "^7.1.1"
}
}
4 changes: 3 additions & 1 deletion src/components/views/home/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { Platform } from 'react-native'
import { Platform, Text } from 'react-native'
import { useTranslation } from 'react-i18next'
import styled, { useTheme } from 'styled-components'
import NearformLogo from 'assets/logos/nearform.svg'
Expand All @@ -22,6 +22,7 @@ export const HomeScreen = () => {
fill={theme.colors.primary}
title="Nearform logo"
/>

<StyledLinkButton title={t('home:simpleButton')} path="/simple" />
<StyledLinkButton title={t('home:listViewButton')} path="/listView" />
{Platform.OS !== 'web' && (
Expand All @@ -39,6 +40,7 @@ export const HomeScreen = () => {
<StyledLinkButton title={t('home:mapButton')} path="/map" />
</>
)}
<Text testID="welcome">Text for tests</Text>
</Container>
)
}