diff --git a/.travis.yml b/.travis.yml index e234f3c6..6f22f042 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/SampleApps/DetoxApp/e2e/firstTest.e2e.js b/SampleApps/DetoxApp/e2e/firstTest.e2e.js index 8030315f..40fa42a8 100644 --- a/SampleApps/DetoxApp/e2e/firstTest.e2e.js +++ b/SampleApps/DetoxApp/e2e/firstTest.e2e.js @@ -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); }); });