Skip to content

Commit

Permalink
new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-kremer93 committed Apr 29, 2021
1 parent a1b86ab commit 5b8ced1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ matrix:
before_script:
- export WORK_BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
- PLUGIN_INSTALL_CMD='npm install git://github.com/AppsFlyerSDK/appsflyer-react-native-plugin.git#${WORK_BRANCH} --save'
- CONFIG_PLUGIN_INSTALL='npm install react-native-config --save'
- CONFIG_PLUGIN_INSTALL='npm install react-native-config --save --force'
before_install:
- gem install cocoapods
- gem update concurrent-ruby
Expand Down
44 changes: 36 additions & 8 deletions SampleApps/DetoxApp/e2e/firstTest.e2e.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,53 @@
describe('React-Native AppsFlyer Plugin', () => {
jestExpect = require('expect');
const deepLinkData = '{"status":"success","type":"onAppOpenAttribution","data":{"c":"firstCampign","campaign":"firstCampign","af_dp":"rnoaoaautomation://","link":"https://rnautomated.onelink.me/lraA/mySMScampign","deep_link_value":"OAOA","media_source":"SMS","af_sub1":"lala","pid":"SMS"}}';
describe('Organic install', () => {
beforeAll(async () => {
await device.launchApp();
});

beforeEach(async () => {
// await device.reloadReactNative();
// await device.launchApp();
});

afterAll(async () => {
afterEach(async () => {
// await device.terminateApp();
});

it('initSdk should return Success', async () => {
await expect(element(by.id('successInitButton'))).toBeVisible();
await element(by.id('successInitButton')).tap();
await expect(element(by.id('successInitResult'))).toHaveText('Success');
afterAll(async () => {
await device.terminateApp();
await device.uninstallApp();
});

it('initSdk should return \'No \'devKey\' found or its empty\'', async () => {
await expect(element(by.id('noDevKeyButton'))).toBeVisible();
await element(by.id('noDevKeyButton')).tap();
await expect(element(by.id('noDevKeyInitResult'))).toHaveText('No \'devKey\' found or its empty');
await expect(element(by.id('testResult'))).toHaveText('No \'devKey\' found or its empty');
});

it('initSdk should return Success organic GCD', async () => {
await expect(element(by.id('successOrganicGCDButton'))).toBeVisible();
await element(by.id('successOrganicGCDButton')).tap();
const gcdAttr = await element(by.id('testResult')).getAttributes();
jestExpect(gcdAttr.text).toContain('\"status\":\"success\"');
jestExpect(gcdAttr.text).toContain('\"type\":\"onInstallConversionDataLoaded\"');
jestExpect(gcdAttr.text).toContain('\"data\"');
jestExpect(gcdAttr.text).toContain('\"is_first_launch\":true');
jestExpect(gcdAttr.text).toContain('\"af_status\":\"Organic\"');
});

it('logEvent should return Success', async () => {
await expect(element(by.id('logEventSuccessButton'))).toBeVisible();
await element(by.id('logEventSuccessButton')).tap();
await waitFor(element(by.text('Alert'))).toBeVisible().withTimeout(3000);
await expect(element(by.text('Success'))).toHaveText('Success');
await element(by.text('OK')).tap();
});

it('App goes to background and opens via deep link', async () => {
await device.sendToHome();
await device.launchApp({newInstance: false, url: 'https://rnautomated.onelink.me/lraA/mySMScampign'});
await waitFor(element(by.text('Alert'))).toBeVisible().withTimeout(3000);
await waitFor(element(by.text(`${deepLinkData}`))).toBeVisible().withTimeout(3000);
await expect(element(by.text(`${deepLinkData}`))).toHaveText(deepLinkData);
});
});

0 comments on commit 5b8ced1

Please sign in to comment.