-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c673c2
commit 95b6648
Showing
28 changed files
with
1,762 additions
and
1,042 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** @type {Detox.DetoxConfig} */ | ||
module.exports = { | ||
testRunner: { | ||
args: { | ||
'$0': 'jest', | ||
config: 'e2e/jest.config.js' | ||
}, | ||
jest: { | ||
setupTimeout: 120000 | ||
} | ||
}, | ||
apps: { | ||
'ios.debug': { | ||
type: 'ios.app', | ||
binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/ImageMarkerExample.app', | ||
build: 'xcodebuild -workspace ios/ImageMarkerExample.xcworkspace -scheme ImageMarkerExample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build' | ||
}, | ||
'ios.release': { | ||
type: 'ios.app', | ||
binaryPath: 'ios/build/Build/Products/Release-iphonesimulator/ImageMarkerExample.app', | ||
build: 'xcodebuild -workspace ios/ImageMarkerExample.xcworkspace -scheme ImageMarkerExample -configuration Release -sdk iphonesimulator -derivedDataPath ios/build' | ||
}, | ||
'android.debug': { | ||
type: 'android.apk', | ||
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk', | ||
build: 'cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug', | ||
reversePorts: [ | ||
8081 | ||
] | ||
}, | ||
'android.release': { | ||
type: 'android.apk', | ||
binaryPath: 'android/app/build/outputs/apk/release/app-release.apk', | ||
build: 'cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release' | ||
} | ||
}, | ||
devices: { | ||
simulator: { | ||
type: 'ios.simulator', | ||
device: { | ||
type: 'iPhone 15' | ||
} | ||
}, | ||
attached: { | ||
type: 'android.attached', | ||
device: { | ||
adbName: '.*' | ||
} | ||
}, | ||
emulator: { | ||
type: 'android.emulator', | ||
device: { | ||
avdName: 'Pixel_XL_API_34' | ||
} | ||
} | ||
}, | ||
configurations: { | ||
'ios.sim.debug': { | ||
device: 'simulator', | ||
app: 'ios.debug' | ||
}, | ||
'ios.sim.release': { | ||
device: 'simulator', | ||
app: 'ios.release' | ||
}, | ||
'android.att.debug': { | ||
device: 'attached', | ||
app: 'android.debug' | ||
}, | ||
'android.att.release': { | ||
device: 'attached', | ||
app: 'android.release' | ||
}, | ||
'android.emu.debug': { | ||
device: 'emulator', | ||
app: 'android.debug' | ||
}, | ||
'android.emu.release': { | ||
device: 'emulator', | ||
app: 'android.release' | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
example/android/app/src/androidTest/java/com/imagemarkerexample/DetoxTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.imagemarkerexample; | ||
|
||
import com.wix.detox.Detox; | ||
import com.wix.detox.config.DetoxConfig; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
import androidx.test.filters.LargeTest; | ||
import androidx.test.rule.ActivityTestRule; | ||
|
||
@RunWith(AndroidJUnit4.class) | ||
@LargeTest | ||
public class DetoxTest { | ||
@Rule // (2) | ||
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false); | ||
|
||
@Test | ||
public void runDetoxTests() { | ||
DetoxConfig detoxConfig = new DetoxConfig(); | ||
detoxConfig.idlePolicyConfig.masterTimeoutSec = 90; | ||
detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60; | ||
detoxConfig.rnContextLoadTimeoutSec = (BuildConfig.DEBUG ? 180 : 60); | ||
|
||
Detox.runTests(mActivityRule, detoxConfig); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
example/android/app/src/main/res/xml/network_security_config.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<network-security-config> | ||
<domain-config cleartextTrafficPermitted="true"> | ||
<domain includeSubdomains="true">10.0.2.2</domain> | ||
<domain includeSubdomains="true">localhost</domain> | ||
</domain-config> | ||
</network-security-config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,9 @@ module.exports = { | |
}, | ||
], | ||
], | ||
env: { | ||
production: { | ||
plugins: ['react-native-paper/babel'], | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { device, element, by, waitFor } from 'detox'; | ||
import assert from 'power-assert'; | ||
|
||
describe('e2e/App.test.js', () => { | ||
beforeAll(async () => { | ||
await device.launchApp(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await device.reloadReactNative(); | ||
}); | ||
|
||
it('should display correctly', async () => { | ||
await expect(element(by.id('backgroundImageFormatLabel'))).toBeVisible(); | ||
await expect(element(by.id('backgroundImageFormatLabel'))).toHaveText( | ||
'background image format:' | ||
); | ||
|
||
await expect(element(by.id('backgroundImageFormatBtn'))).toBeVisible(); | ||
await expect(element(by.id('backgroundImageFormatBtn'))).toHaveLabel( | ||
'image' | ||
); | ||
|
||
await expect(element(by.id('watermarkTypeLabel'))).toBeVisible(); | ||
await expect(element(by.id('watermarkTypeLabel'))).toHaveText( | ||
'watermark type:' | ||
); | ||
|
||
await expect(element(by.id('watermarkTypeBtn'))).toBeVisible(); | ||
await expect(element(by.id('watermarkTypeBtn'))).toHaveLabel('text'); | ||
|
||
await expect(element(by.id('exportResultFormatLabel'))).toBeVisible(); | ||
await expect(element(by.id('exportResultFormatLabel'))).toHaveText( | ||
'export result format:' | ||
); | ||
|
||
await expect(element(by.id('exportResultFormatBtn'))).toBeVisible(); | ||
await expect(element(by.id('exportResultFormatBtn'))).toHaveLabel('png'); | ||
|
||
await expect(element(by.id('selectBgBtn'))).toBeVisible(); | ||
await expect(element(by.id('selectBgBtn'))).toHaveLabel('select bg'); | ||
|
||
// await expect(element(by.id('selectWatermarkBtn'))).toBeVisible(); | ||
// await expect(element(by.id('selectWatermarkBtn'))).toHaveLabel( | ||
// 'select watermark' | ||
// ); | ||
|
||
await expect(element(by.id('resultFileSizeLabel'))).toBeVisible(); | ||
await expect(element(by.id('resultFilePathLabel'))).toBeVisible(); | ||
if (device.getPlatform() === 'ios') { | ||
const resultFileSizeLabel = await element( | ||
by.id('resultFileSizeLabel') | ||
).getAttributes('text'); | ||
|
||
assert.ok( | ||
/^result file size:\d+(.\d+)?\s(KB|MB)$/.test(resultFileSizeLabel.text) | ||
); | ||
const resultFilePathLabel = await element( | ||
by.id('resultFilePathLabel') | ||
).getAttributes('text'); | ||
assert.ok(/^file path:.*\.png$/.test(resultFilePathLabel.text)); | ||
} else { | ||
await expect(element(by.id('resultFileSizeLabel'))).toHaveLabel( | ||
/^result file size:\d+(\.\d+)?\s(KB|MB)$/ | ||
); | ||
await expect(element(by.id('resultFilePathLabel'))).toBeVisible(); | ||
await expect(element(by.id('resultFilePathLabel'))).toHaveText( | ||
/^file path:.*\.png$/ | ||
); | ||
} | ||
|
||
await expect(element(by.id('resultImage'))).toBeVisible(); | ||
}); | ||
|
||
describe('when click backgroundImageFormatBtn', () => { | ||
it('should display correctly', async () => { | ||
await expect(element(by.id('backgroundImageFormatBtn'))).toHaveLabel( | ||
'image' | ||
); | ||
await element(by.id('backgroundImageFormatBtn')).tap(); | ||
await waitFor(element(by.type('RCTModalHostView'))) | ||
.toBeVisible() | ||
.withTimeout(2000); | ||
await element(by.label('base64')).tap(); | ||
await expect(element(by.id('backgroundImageFormatBtn'))).toHaveLabel( | ||
'base64' | ||
); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.