Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszm22 committed Nov 17, 2022
1 parent 192ae42 commit ee7fbb9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 deletions.
4 changes: 0 additions & 4 deletions packages/rn-tester/e2e/.eslintrc.js

This file was deleted.

3 changes: 1 addition & 2 deletions packages/rn-tester/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"ios": "E2E_DEVICE=\"ios\" npm run test"
},
"dependencies": {
"@types/jest": "^29.2.1",
"react-native": "^0.70.6"
"@types/jest": "^29.2.1"
}
}
4 changes: 4 additions & 0 deletions packages/rn-tester/e2e/test/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ class Utils {
return driver.$(locator).getText();
}


platformSelect(platforms) {
return platforms[process.env.E2E_DEVICE];
}
}
module.exports = new Utils();
31 changes: 15 additions & 16 deletions packages/rn-tester/e2e/test/screenObjects/buttonComponent.screen.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
const Utils = require('../helpers/utils');
import { Platform } from 'react-native';
import Utils from '../helpers/utils';

class ButtonComponentScreen {

buttonScreenElement = Platform.select({
buttonScreenElement = Utils.platformSelect({
ios: '[label="Button"]',
android: '//android.view.ViewGroup/android.widget.TextView[@text="Button"]',
})
});

btnSubmitElement = Platform.select({
btnSubmitElement = Utils.platformSelect({
ios: '[label="Press to submit your application!"]',
android: '//android.widget.Button[@resource-id="button_default_styling"]',
})
});

inputSearchElement = Platform.select({
inputSearchElement = Utils.platformSelect({
ios: '[name="example_search"]',
android: '//android.widget.EditText[@resource-id="example_search"]',
})
});

btnOKElement = Platform.select({
btnOKElement = Utils.platformSelect({
ios: '[label="OK"]',
android: '//android.widget.Button[@text="OK"]',
})
});

btnCancelElement = Platform.select({
btnCancelElement = Utils.platformSelect({
ios: '[label="Press to cancel your application!"]',
android: '//android.widget.Button[@resource-id="cancel_button"]',
})
});

submitAlertBoxElement = Platform.select({
submitAlertBoxElement = Utils.platformSelect({
ios: '[label="Your application has been submitted!"]',
android: '//android.widget.TextView[@resource-id="android:id/alertTitle"]',
})
});

cancelAlertBoxElement = Platform.select({
cancelAlertBoxElement = Utils.platformSelect({
ios: '[label="Your application has been cancelled!"]',
android: '//android.widget.TextView[@resource-id="android:id/alertTitle"]',
})
});



Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const Utils = require('../helpers/utils');
import { Platform } from 'react-native';
import Utils from '../helpers/utils';

class ComponentsScreen {

buttonComponentElement = Platform.select({
buttonComponentElement = Utils.platformSelect({
ios: '[label="Button Simple React Native button component."]',
android: '~Button Simple React Native button component.',
})
});


async checkButtonComponentIsDisplayed() {
Expand Down

0 comments on commit ee7fbb9

Please sign in to comment.