Skip to content

Commit fe19fd5

Browse files
author
João Martins Filho
committed
correcoes dos steps, funcionando primeiro teste
1 parent 9d8b046 commit fe19fd5

File tree

8 files changed

+996
-173
lines changed

8 files changed

+996
-173
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Exemplo React Native + Appium + Cucumber
22

3-
Este repositório tem como objetivo demonstrar o funcionamento da ferramenta de teste *end-to-end* DetoxJS para teste em aplicativos mobiles.
3+
Este repositório tem como objetivo demonstrar o funcionamento da ferramenta de teste *end-to-end* Appium + Cucumber para teste em aplicativos mobiles.
44

55
## Configuração do projeto.
66

@@ -97,12 +97,11 @@ O React Native é um projeto desenvolvido pelos engenheiros do Facebook e que co
9797
O stack do React Native é poderoso, pois nos permite utilizar ECMAScript 6, CSS Flexbox, JSX, diversos pacotes do NPM e muito mais. Sem contar que nos permite fazer debug na mesma IDE utilizada para o desenvolvimento nativo com essas plataformas (além de tornar o processo extremamente divertido).
9898

9999

100-
## DetoxJS
100+
## Cucumber
101101

102-
O desenvolvimento mobile, exige que adotemos fluxos de trabalho de integração contínua, na qual tenhamos uma confiança total na qualidade do software que está sendo entregue para o cliente. O Detox testa o aplicativo móvel enquanto ele é executado em dispositivo/simulador, realizando interações com a aplicação como um usuário real.
102+
## Appium
103103

104104
### Referências.
105105

106106
* [React Native](https://facebook.github.io/react-native/docs/getting-started.html).
107-
* [Android Studio](https://developer.android.com/studio/index.html).
108-
* [DetoxJS](https://github.com/wix/Detox).
107+
* [Android Studio](https://developer.android.com/studio/index.html).

android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
buildscript {
44
ext {
5-
buildToolsVersion = "28.0.2"
5+
buildToolsVersion = "28.0.3"
66
minSdkVersion = 16
77
compileSdkVersion = 28
88
targetSdkVersion = 27
@@ -13,7 +13,7 @@ buildscript {
1313
jcenter()
1414
}
1515
dependencies {
16-
classpath 'com.android.tools.build:gradle:3.2.1'
16+
classpath 'com.android.tools.build:gradle:3.3.0'
1717

1818
// NOTE: Do not place your application dependencies here; they belong
1919
// in the individual module build.gradle files
@@ -34,6 +34,6 @@ allprojects {
3434

3535

3636
task wrapper(type: Wrapper) {
37-
gradleVersion = '4.7'
37+
gradleVersion = '4.10'
3838
distributionUrl = distributionUrl.replace("bin", "all")
3939
}

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

features/appium.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ Feature: Appium
22

33
Scenario: Successful render alert
44
Given I am in app home page
5-
When I click on "Pressione" button
6-
Then I see the alert
5+
When I click on "Lets Go!" button
6+
Then I see the home page

features/step_definitions/appium.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const config = {
99
deviceName: 'pixel_2',
1010
app: './android/app/build/outputs/apk/debug/app-debug.apk', // relative to root of project
1111
appPackage: 'com.nativebasekitchensink',
12-
appActivity: 'com.nativebasekitchensink.MainActivity',
12+
appActivity: '.MainActivity',
1313
automationName: 'uiautomator2'
1414
};
1515
const driver = wd.promiseChainRemote('localhost', PORT);
@@ -24,17 +24,17 @@ After(async() => {
2424
});
2525

2626
Given ('I am in app home page', {timeout: 30000}, async () => {
27-
let isWelcomeMessage = await driver.hasElementByAccessibilityId("welcome-message");
27+
let isWelcomeMessage = await driver.hasElementByXPath("//*[@text='App to showcase']");
2828
assert.equal(isWelcomeMessage, true);
2929
});
3030

31-
When ('I click on "Pressione" button', async () => {
32-
let loginButton = await driver.elementByAccessibilityId("press-button");
31+
When ('I click on "Lets Go!" button', async () => {
32+
let loginButton = await driver.elementByAccessibilityId("button-home");
3333
loginButton.click();
3434
});
3535

36-
Then ('I see the alert', {timeout: 2000}, async () => {
37-
await driver.setImplicitWaitTimeout(1500);
38-
let isAlert = await driver.hasElementByXPath("//*[@text='Você apertou o botão']");
36+
Then ('I see the home page', {timeout: 5000}, async () => {
37+
await driver.setImplicitWaitTimeout(5000);
38+
let isAlert = await driver.hasElementByXPath("//*[@text='Header']");
3939
assert.equal(isAlert, true);
4040
});

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "2.12.0",
44
"private": true,
55
"devDependencies": {
6-
"appium": "^1.16.0",
6+
"appium": "^1.17.0",
77
"appium-doctor": "^1.13.0",
88
"babel-eslint": "7.2.3",
99
"cucumber": "^6.0.5",
@@ -48,11 +48,14 @@
4848
"native-base": "2.12.1",
4949
"prop-types": "^15.6.2",
5050
"react": "16.6.3",
51-
"react-native": "0.58.5",
52-
"react-native-gesture-handler": "^1.0.15",
51+
"react-native": "0.59.0",
52+
"react-native-gesture-handler": "^1.3.0",
5353
"react-native-vector-icons": "^6.3.0",
5454
"react-navigation": "3.3.0",
5555
"scheduler": "^0.12.0",
5656
"styled-components": "^3.4.5"
57+
},
58+
"resolutions": {
59+
"metro-config": "bluelovers/metro-config-hotfix-0.56.x"
5760
}
5861
}

src/screens/home/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Home extends Component {
3030
</View>
3131
<View style={{ marginBottom: 80 }}>
3232
<Button
33+
accessibilityLabel="button-home"
3334
style={{ backgroundColor: "#6FAF98", alignSelf: "center" }}
3435
onPress={() => this.props.navigation.openDrawer()}
3536
>

0 commit comments

Comments
 (0)