-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Add Detox e2e tests. #340
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a6d0def
chore: Installed detox and added initial config.
yusinto 040c5d4
chore: Configured detox to work with typescript.
yusinto c81c900
chore: add detox e2e tests.
yusinto d114dd9
Merge branch 'main' into yus/add-detox-e2e
yusinto 9aa005d
fix: update release please to publish sdk-client and rn.
yusinto 550b7fe
Update release-please-config.json
yusinto 3343fdf
chore: Improve detox instructions. Update flag keys to be consistent …
yusinto 068e19f
chore: Ensure ios folder exists by running prebuild for detox to run …
yusinto 542a97f
Update README.md
yusinto 17090ad
Merge branch 'main' into yus/add-detox-e2e
yusinto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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/reactnativeexample.app', | ||
build: | ||
'xcodebuild -workspace ios/reactnativeexample.xcworkspace -scheme reactnativeexample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build', | ||
}, | ||
'ios.release': { | ||
type: 'ios.app', | ||
binaryPath: 'ios/build/Build/Products/Release-iphonesimulator/reactnativeexample.app', | ||
build: | ||
'xcodebuild -workspace ios/reactnativeexample.xcworkspace -scheme reactnativeexample -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_3a_API_33_arm64-v8a', | ||
}, | ||
}, | ||
}, | ||
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
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,13 @@ | ||
/** @type {import('@jest/types').Config.InitialOptions} */ | ||
module.exports = { | ||
preset: 'react-native', | ||
rootDir: '..', | ||
testMatch: ['<rootDir>/e2e/**/*.test.ts'], | ||
testTimeout: 120000, | ||
maxWorkers: 1, | ||
globalSetup: 'detox/runners/jest/globalSetup', | ||
globalTeardown: 'detox/runners/jest/globalTeardown', | ||
reporters: ['detox/runners/jest/reporter'], | ||
testEnvironment: 'detox/runners/jest/testEnvironment', | ||
verbose: true, | ||
}; |
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,40 @@ | ||
import { by, device, element, expect, waitFor } from 'detox'; | ||
|
||
describe('Example', () => { | ||
beforeAll(async () => { | ||
await device.launchApp({ | ||
newInstance: true, | ||
launchArgs: { | ||
detoxURLBlacklistRegex: '\\("^https://clientstream.launchdarkly.com/meval"\\)', | ||
}, | ||
}); | ||
}); | ||
|
||
// For speed, all tests are sequential and dependent. | ||
// beforeEach(async () => { | ||
// await device.reloadReactNative(); | ||
// }); | ||
|
||
test('app loads and renders correctly', async () => { | ||
await expect(element(by.text(/welcome to launchdarkly/i))).toBeVisible(); | ||
await expect(element(by.text(/my-boolean-flag-1: false/i))).toBeVisible(); | ||
}); | ||
|
||
test('identify', async () => { | ||
await element(by.id('userKey')).typeText('test-user'); | ||
await element(by.text(/identify/i)).tap(); | ||
|
||
await waitFor(element(by.text(/my-boolean-flag-1: true/i))) | ||
.toBeVisible() | ||
.withTimeout(2000); | ||
}); | ||
|
||
test('variation', async () => { | ||
await element(by.id('flagKey')).replaceText('my-boolean-flag-2'); | ||
await element(by.text(/get flag value/i)).tap(); | ||
|
||
await waitFor(element(by.text(/my-boolean-flag-2: true/i))) | ||
.toBeVisible() | ||
.withTimeout(2000); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bug in the existing config. This step id should say release-sdk-server, but it says release-common instead. I think it's an artifact of copy pasting. The other packages suffer from the same bug and I've fixed them all too.