diff --git a/.buildkite/full/react-native-android-pipeline.full.yml b/.buildkite/full/react-native-android-pipeline.full.yml index 22cbbc3ec..305390b4d 100644 --- a/.buildkite/full/react-native-android-pipeline.full.yml +++ b/.buildkite/full/react-native-android-pipeline.full.yml @@ -145,46 +145,6 @@ steps: - "0.72" - "0.73" - - label: ":android: Build react-navigation 0.69 apk" - key: "react-navigation-0-69-apk" - depends_on: - - "android-builder-image-java-11-node-16" - timeout_in_minutes: 60 - env: - REACT_NATIVE_VERSION: "rn0.69" - JS_SOURCE_DIR: "react_navigation_js" - ARTEFACT_NAME: "r_navigation_0.69" - plugins: - - docker-compose#v4.12.0: - pull: react-native-android-builder-java-11-node-16 - run: react-native-android-builder-java-11-node-16 - artifact_paths: - - build/r_navigation_0.69.apk - retry: - automatic: - - exit_status: "*" - limit: 1 - - - label: ":android: Build react-native-navigation 0.66 apk" - key: "react-native-navigation-0-66-apk" - depends_on: - - "android-builder-image-java-11-node-16" - timeout_in_minutes: 60 - env: - REACT_NATIVE_VERSION: "rn0.66" - JS_SOURCE_DIR: "react_native_navigation_js" - ARTEFACT_NAME: "r_native_navigation_0.66" - plugins: - - docker-compose#v4.12.0: - pull: react-native-android-builder-java-11-node-16 - run: react-native-android-builder-java-11-node-16 - artifact_paths: - - build/r_native_navigation_0.66.apk - retry: - automatic: - - exit_status: "*" - limit: 1 - - label: ':android: Build react-native-navigation {{matrix}} test fixture APK (Old Arch)' key: "build-react-native-navigation-android-fixture-old-arch" timeout_in_minutes: 30 diff --git a/.buildkite/full/react-native-ios-pipeline.full.yml b/.buildkite/full/react-native-ios-pipeline.full.yml index b8edb81ee..3717555d0 100644 --- a/.buildkite/full/react-native-ios-pipeline.full.yml +++ b/.buildkite/full/react-native-ios-pipeline.full.yml @@ -124,46 +124,6 @@ steps: - exit_status: "*" limit: 1 - - label: ":ios: Build react-navigation 0.69 ipa" - key: "react-navigation-0-69-ipa" - timeout_in_minutes: 60 - agents: - queue: "macos-12-arm" - env: - REACT_NATIVE_VERSION: rn0.69 - JS_SOURCE_DIR: "react_navigation_js" - ARTEFACT_NAME: "r_navigation_0.69" - LANG: "en_US.UTF-8" - DEVELOPER_DIR: "/Applications/Xcode14.app" - artifact_paths: build/r_navigation_0.69.ipa - commands: - - npm run test:build-react-native-ios - retry: - automatic: - - exit_status: "*" - limit: 1 - - # See: PLAT-5173 - - label: ":ios: Build react-native-navigation 0.66 ipa" - skip: "See PLAT-5173" - key: "react-native-navigation-0-66-ipa" - timeout_in_minutes: 60 - agents: - queue: "macos-12-arm" - env: - REACT_NATIVE_VERSION: rn0.66 - JS_SOURCE_DIR: "react_native_navigation_js" - ARTEFACT_NAME: "r_native_navigation_0.66" - LANG: "en_US.UTF-8" - DEVELOPER_DIR: "/Applications/Xcode14.app" - artifact_paths: build/r_native_navigation_0.66.ipa - commands: - - npm run test:build-react-native-ios - retry: - automatic: - - exit_status: "*" - limit: 1 - - label: ':mac: Build react-native-navigation {{matrix}} test fixture ipa (Old Arch)' key: "build-react-native-navigation-ios-fixture-old-arch" timeout_in_minutes: 30 diff --git a/test/react-native/features/fixtures/app/react_native_navigation_js/Scenarios.js b/test/react-native/features/fixtures/app/react_native_navigation_js/Scenarios.js deleted file mode 100644 index 563083106..000000000 --- a/test/react-native/features/fixtures/app/react_native_navigation_js/Scenarios.js +++ /dev/null @@ -1,3 +0,0 @@ -// react-native-navigation.feature -export { ReactNativeNavigationBreadcrumbsEnabledScenario } from './scenarios/ReactNativeNavigationBreadcrumbsEnabledScenario' -export { ReactNativeNavigationBreadcrumbsDisabledScenario } from './scenarios/ReactNativeNavigationBreadcrumbsDisabledScenario' diff --git a/test/react-native/features/fixtures/app/react_native_navigation_js/index.js b/test/react-native/features/fixtures/app/react_native_navigation_js/index.js deleted file mode 100644 index c46700b6c..000000000 --- a/test/react-native/features/fixtures/app/react_native_navigation_js/index.js +++ /dev/null @@ -1,47 +0,0 @@ -import { Navigation } from 'react-native-navigation' -import HomeScreen from './screens/Home' -import DetailsScreen from './screens/Details' -import { View, Text, SafeAreaView, StyleSheet } from 'react-native' -import React, { useEffect } from 'react' -import { launchScenario } from './lib/ScenarioLauncher' - -console.reportErrorsAsExceptions = false - -export const AppScreen = () => { - useEffect(() => { - launchScenario() - }, []) - - return ( - - - React Native Navigation Test App - - - ) -} - -Navigation.registerComponent('App', () => AppScreen) -Navigation.registerComponent('Home', () => HomeScreen) -Navigation.registerComponent('Details', () => DetailsScreen) -Navigation.events().registerAppLaunchedListener(async () => { - Navigation.setRoot({ - root: { - stack: { - children: [ - { - component: { - name: 'App' - } - } - ] - } - } - }) -}) - -const styles = StyleSheet.create({ - container: { - flex: 1 - } -}) diff --git a/test/react-native/features/fixtures/app/react_native_navigation_js/install.sh b/test/react-native/features/fixtures/app/react_native_navigation_js/install.sh deleted file mode 100755 index 76eff4af1..000000000 --- a/test/react-native/features/fixtures/app/react_native_navigation_js/install.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -npm i @bugsnag/plugin-react-native-navigation@$BUGSNAG_VERSION --legacy-peer-deps --registry=$REGISTRY_URL - -if [ "$REACT_NATIVE_VERSION" == "rn0.60" ]; then - npm i react-native-navigation@7.0.0 --legacy-peer-deps -elif [ "$REACT_NATIVE_VERSION" == "rn0.66" ]; then - npm i react-native-navigation@7.29.1 --legacy-peer-deps -else - npm i react-native-navigation@^7.30.0 --legacy-peer-deps -fi - -npx rnn-link diff --git a/test/react-native/features/fixtures/app/react_native_navigation_js/lib/CommandRunner.js b/test/react-native/features/fixtures/app/react_native_navigation_js/lib/CommandRunner.js deleted file mode 100644 index c1a217cfd..000000000 --- a/test/react-native/features/fixtures/app/react_native_navigation_js/lib/CommandRunner.js +++ /dev/null @@ -1,38 +0,0 @@ -import { getMazeRunnerAddress } from './ConfigFileReader' - -const INTERVAL = 500 - -let mazeAddress - -const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) - -export async function getCurrentCommand () { - if (!mazeAddress) { - mazeAddress = await getMazeRunnerAddress() - } - - const url = `http://${mazeAddress}/command` - console.error(`[Bugsnag CommandRunner] Fetching command from ${url}`) - - while (true) { - try { - // eslint-disable-next-line no-undef - const response = await fetch(url) - const text = await response.text() - console.error(`[Bugsnag CommandRunner] Response from maze runner: ${text}`) - - const command = JSON.parse(text) - - // keep polling until a scenario command is received - if (command.action !== 'noop') { - console.error(`[Bugsnag CommandRunner] Received command from maze runner: ${JSON.stringify(command)}`) - - return command - } - } catch (err) { - console.error(`[Bugsnag CommandRunner] Error fetching command from maze runner: ${err.message}`, err) - } - - await delay(INTERVAL) - } -} diff --git a/test/react-native/features/fixtures/app/react_native_navigation_js/lib/ConfigFileReader.js b/test/react-native/features/fixtures/app/react_native_navigation_js/lib/ConfigFileReader.js deleted file mode 100644 index b41f83a2a..000000000 --- a/test/react-native/features/fixtures/app/react_native_navigation_js/lib/ConfigFileReader.js +++ /dev/null @@ -1,32 +0,0 @@ -import { Platform } from 'react-native' -import { Dirs, FileSystem } from 'react-native-file-access' - -const TIMEOUT = 60000 - -const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) - -const getMazeRunnerAddress = async () => { - let configFilePath - const startTime = Date.now() - - // poll for the config file to exist - while (Date.now() - startTime < TIMEOUT) { - const configFileDir = Platform.OS === 'android' ? '/data/local/tmp' : Dirs.DocumentDir - configFilePath = `${configFileDir}/fixture_config.json` - const configFileExists = await FileSystem.exists(configFilePath) - - if (configFileExists) { - const configFile = await FileSystem.readFile(configFilePath) - console.error(`[Bugsnag ConfigFileReader] found config file at '${configFilePath}'. contents: ${configFile}`) - const config = JSON.parse(configFile) - return `${config.maze_address}` - } - - await delay(500) - } - - console.error(`[Bugsnag ConfigFileReader] no config file found at ${configFilePath}, falling back to 'localhost:9339'`) - return 'localhost:9339' -} - -module.exports.getMazeRunnerAddress = getMazeRunnerAddress diff --git a/test/react-native/features/fixtures/app/react_native_navigation_js/lib/ScenarioLauncher.js b/test/react-native/features/fixtures/app/react_native_navigation_js/lib/ScenarioLauncher.js deleted file mode 100644 index 36fa4075e..000000000 --- a/test/react-native/features/fixtures/app/react_native_navigation_js/lib/ScenarioLauncher.js +++ /dev/null @@ -1,99 +0,0 @@ -import * as Scenarios from '../Scenarios' -import { getCurrentCommand } from './CommandRunner' -import { NativeModules } from 'react-native' -import Bugsnag from '@bugsnag/react-native' - -async function runScenario (scenarioName, apiKey, notifyEndpoint, sessionEndpoint, scenarioData, setScenario) { - console.error(`[Bugsnag ScenarioLauncher] running scenario: ${scenarioName}`) - - const nativeConfig = { - apiKey, - autoTrackSessions: false, - endpoints: { - notify: notifyEndpoint, - sessions: sessionEndpoint - } - } - - const jsConfig = {} - - // create the scenario and allow it to modify the configuration - const scenario = new Scenarios[scenarioName](nativeConfig, jsConfig, scenarioData) - - // clear persistent data - console.error('[Bugsnag ScenarioLauncher] clearing persistent data') - NativeModules.BugsnagTestInterface.clearPersistentData() - - // start the native client - console.error('[Bugsnag ScenarioLauncher] starting native Bugsnag') - await NativeModules.BugsnagTestInterface.startBugsnag(nativeConfig) - - // start the js client - console.error('[Bugsnag ScenarioLauncher] starting js Bugsnag') - Bugsnag.start(jsConfig) - - // run the scenario - console.error('launching scenario') - setTimeout(() => { - scenario.run() - if (typeof setScenario === 'function') setScenario(scenario) - }, 1) -} - -async function startBugsnag (scenarioName, apiKey, notifyEndpoint, sessionEndpoint, scenarioData) { - console.error(`[Bugsnag ScenarioLauncher] starting Bugsnag for scenario: ${scenarioName}`) - const nativeConfig = { - apiKey, - autoTrackSessions: false, - endpoints: { - notify: notifyEndpoint, - sessions: sessionEndpoint - } - } - - const jsConfig = {} - - // create the scenario and allow it to modify the configuration - // eslint-disable-next-line no-unused-vars - const scenario = new Scenarios[scenarioName](nativeConfig, jsConfig, scenarioData) - - console.error(`[Bugsnag ScenarioLauncher] with config: ${JSON.stringify(nativeConfig)} (native) and ${JSON.stringify(jsConfig)} (js)`) - - // start the native client - console.error('[Bugsnag ScenarioLauncher] starting native Bugsnag') - await NativeModules.BugsnagTestInterface.startBugsnag(nativeConfig) - - // start the js client - console.error('[Bugsnag ScenarioLauncher] starting js Bugsnag') - Bugsnag.start(jsConfig) -} - -export async function launchScenario (setScenario) { - const command = await getCurrentCommand() - - switch (command.action) { - case 'run-scenario': - // eslint-disable-next-line no-return-await - return await runScenario( - command.scenario_name, - command.api_key, - command.notify, - command.sessions, - command.scenario_data, - setScenario - ) - - case 'start-bugsnag': - // eslint-disable-next-line no-return-await - return await startBugsnag( - command.scenario_name, - command.api_key, - command.notify, - command.sessions, - command.scenario_data - ) - - default: - throw new Error(`Unknown action '${command.action}'`) - } -} diff --git a/test/react-native/features/fixtures/app/react_native_navigation_js/scenarios/ReactNativeNavigationBreadcrumbsDisabledScenario.js b/test/react-native/features/fixtures/app/react_native_navigation_js/scenarios/ReactNativeNavigationBreadcrumbsDisabledScenario.js deleted file mode 100644 index 338825b3d..000000000 --- a/test/react-native/features/fixtures/app/react_native_navigation_js/scenarios/ReactNativeNavigationBreadcrumbsDisabledScenario.js +++ /dev/null @@ -1,27 +0,0 @@ -import Scenario from './Scenario' -import { Navigation } from 'react-native-navigation' -import BugsnagReactNativeNavigation from '@bugsnag/plugin-react-native-navigation' - -export class ReactNativeNavigationBreadcrumbsDisabledScenario extends Scenario { - constructor (configuration, jsConfig) { - super() - configuration.enabledBreadcrumbTypes = [] - jsConfig.plugins = [new BugsnagReactNativeNavigation(Navigation)] - } - - run () { - Navigation.setRoot({ - root: { - stack: { - children: [ - { - component: { - name: 'Home' - } - } - ] - } - } - }) - } -} diff --git a/test/react-native/features/fixtures/app/react_native_navigation_js/scenarios/ReactNativeNavigationBreadcrumbsEnabledScenario.js b/test/react-native/features/fixtures/app/react_native_navigation_js/scenarios/ReactNativeNavigationBreadcrumbsEnabledScenario.js deleted file mode 100644 index bec24454d..000000000 --- a/test/react-native/features/fixtures/app/react_native_navigation_js/scenarios/ReactNativeNavigationBreadcrumbsEnabledScenario.js +++ /dev/null @@ -1,26 +0,0 @@ -import Scenario from './Scenario' -import BugsnagReactNativeNavigation from '@bugsnag/plugin-react-native-navigation' -import { Navigation } from 'react-native-navigation' - -export class ReactNativeNavigationBreadcrumbsEnabledScenario extends Scenario { - constructor (configuration, jsConfig) { - super() - jsConfig.plugins = [new BugsnagReactNativeNavigation(Navigation)] - } - - run () { - Navigation.setRoot({ - root: { - stack: { - children: [ - { - component: { - name: 'Home' - } - } - ] - } - } - }) - } -} diff --git a/test/react-native/features/fixtures/app/react_native_navigation_js/scenarios/Scenario.js b/test/react-native/features/fixtures/app/react_native_navigation_js/scenarios/Scenario.js deleted file mode 100644 index 7b61ba40c..000000000 --- a/test/react-native/features/fixtures/app/react_native_navigation_js/scenarios/Scenario.js +++ /dev/null @@ -1,8 +0,0 @@ -export default class Scenario { - run () { - } - - timeout (ms) { - return new Promise(resolve => setTimeout(resolve, ms)) - } -} diff --git a/test/react-native/features/fixtures/app/react_native_navigation_js/screens/Details.js b/test/react-native/features/fixtures/app/react_native_navigation_js/screens/Details.js deleted file mode 100644 index e9d71672b..000000000 --- a/test/react-native/features/fixtures/app/react_native_navigation_js/screens/Details.js +++ /dev/null @@ -1,24 +0,0 @@ -import * as React from 'react' -import { View, Text } from 'react-native' -import Bugsnag from '@bugsnag/react-native' - -const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) - -const DetailsScreen = (props) => { - React.useEffect(() => { - (async () => { - await delay(100) - Bugsnag.notify(new Error('DetailsNavigationError')) - await delay(250) - throw new Error('DetailsNavigationUnhandledError') - })() - }, []) - - return ( - - Details Screen - - ) -} - -export default DetailsScreen diff --git a/test/react-native/features/fixtures/app/react_native_navigation_js/screens/Home.js b/test/react-native/features/fixtures/app/react_native_navigation_js/screens/Home.js deleted file mode 100644 index 871007324..000000000 --- a/test/react-native/features/fixtures/app/react_native_navigation_js/screens/Home.js +++ /dev/null @@ -1,29 +0,0 @@ -import * as React from 'react' -import { View, Text } from 'react-native' -import { Navigation } from 'react-native-navigation' -import Bugsnag from '@bugsnag/react-native' - -const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) - -const HomeScreen = (props) => { - React.useEffect(() => { - (async () => { - await delay(100) - Bugsnag.notify(new Error('HomeNavigationError')) - await delay(250) - Navigation.push(props.componentId, { - component: { - name: 'Details' - } - }) - })() - }, []) - - return ( - - Home Screen - - ) -} - -export default HomeScreen diff --git a/test/react-native/features/fixtures/app/react_navigation_js/app/App.js b/test/react-native/features/fixtures/app/react_navigation_js/app/App.js deleted file mode 100644 index bba10b57d..000000000 --- a/test/react-native/features/fixtures/app/react_navigation_js/app/App.js +++ /dev/null @@ -1,35 +0,0 @@ -import React, { useState, useEffect } from 'react' -import { - View, - Text, - StyleSheet, - SafeAreaView -} from 'react-native' - -import { launchScenario } from './lib/ScenarioLauncher' - -const App = () => { - const [scenario, setScenario] = useState(null) - - useEffect(() => { - launchScenario(setScenario) - }, []) - - return ( - scenario !== null ? scenario.view() : ( - - - React Navigation Test App - - - ) - ) -} - -const styles = StyleSheet.create({ - container: { - flex: 1 - } -}) - -export default App diff --git a/test/react-native/features/fixtures/app/react_navigation_js/app/Scenarios.js b/test/react-native/features/fixtures/app/react_navigation_js/app/Scenarios.js deleted file mode 100644 index a79cdcdad..000000000 --- a/test/react-native/features/fixtures/app/react_navigation_js/app/Scenarios.js +++ /dev/null @@ -1,3 +0,0 @@ -// react-navigation.feature -export { ReactNavigationBreadcrumbsEnabledScenario } from './scenarios/ReactNavigationBreadcrumbsEnabledScenario' -export { ReactNavigationBreadcrumbsDisabledScenario } from './scenarios/ReactNavigationBreadcrumbsDisabledScenario' diff --git a/test/react-native/features/fixtures/app/react_navigation_js/app/lib/CommandRunner.js b/test/react-native/features/fixtures/app/react_navigation_js/app/lib/CommandRunner.js deleted file mode 100644 index c1a217cfd..000000000 --- a/test/react-native/features/fixtures/app/react_navigation_js/app/lib/CommandRunner.js +++ /dev/null @@ -1,38 +0,0 @@ -import { getMazeRunnerAddress } from './ConfigFileReader' - -const INTERVAL = 500 - -let mazeAddress - -const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) - -export async function getCurrentCommand () { - if (!mazeAddress) { - mazeAddress = await getMazeRunnerAddress() - } - - const url = `http://${mazeAddress}/command` - console.error(`[Bugsnag CommandRunner] Fetching command from ${url}`) - - while (true) { - try { - // eslint-disable-next-line no-undef - const response = await fetch(url) - const text = await response.text() - console.error(`[Bugsnag CommandRunner] Response from maze runner: ${text}`) - - const command = JSON.parse(text) - - // keep polling until a scenario command is received - if (command.action !== 'noop') { - console.error(`[Bugsnag CommandRunner] Received command from maze runner: ${JSON.stringify(command)}`) - - return command - } - } catch (err) { - console.error(`[Bugsnag CommandRunner] Error fetching command from maze runner: ${err.message}`, err) - } - - await delay(INTERVAL) - } -} diff --git a/test/react-native/features/fixtures/app/react_navigation_js/app/lib/ConfigFileReader.js b/test/react-native/features/fixtures/app/react_navigation_js/app/lib/ConfigFileReader.js deleted file mode 100644 index b41f83a2a..000000000 --- a/test/react-native/features/fixtures/app/react_navigation_js/app/lib/ConfigFileReader.js +++ /dev/null @@ -1,32 +0,0 @@ -import { Platform } from 'react-native' -import { Dirs, FileSystem } from 'react-native-file-access' - -const TIMEOUT = 60000 - -const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) - -const getMazeRunnerAddress = async () => { - let configFilePath - const startTime = Date.now() - - // poll for the config file to exist - while (Date.now() - startTime < TIMEOUT) { - const configFileDir = Platform.OS === 'android' ? '/data/local/tmp' : Dirs.DocumentDir - configFilePath = `${configFileDir}/fixture_config.json` - const configFileExists = await FileSystem.exists(configFilePath) - - if (configFileExists) { - const configFile = await FileSystem.readFile(configFilePath) - console.error(`[Bugsnag ConfigFileReader] found config file at '${configFilePath}'. contents: ${configFile}`) - const config = JSON.parse(configFile) - return `${config.maze_address}` - } - - await delay(500) - } - - console.error(`[Bugsnag ConfigFileReader] no config file found at ${configFilePath}, falling back to 'localhost:9339'`) - return 'localhost:9339' -} - -module.exports.getMazeRunnerAddress = getMazeRunnerAddress diff --git a/test/react-native/features/fixtures/app/react_navigation_js/app/lib/ScenarioLauncher.js b/test/react-native/features/fixtures/app/react_navigation_js/app/lib/ScenarioLauncher.js deleted file mode 100644 index 36fa4075e..000000000 --- a/test/react-native/features/fixtures/app/react_navigation_js/app/lib/ScenarioLauncher.js +++ /dev/null @@ -1,99 +0,0 @@ -import * as Scenarios from '../Scenarios' -import { getCurrentCommand } from './CommandRunner' -import { NativeModules } from 'react-native' -import Bugsnag from '@bugsnag/react-native' - -async function runScenario (scenarioName, apiKey, notifyEndpoint, sessionEndpoint, scenarioData, setScenario) { - console.error(`[Bugsnag ScenarioLauncher] running scenario: ${scenarioName}`) - - const nativeConfig = { - apiKey, - autoTrackSessions: false, - endpoints: { - notify: notifyEndpoint, - sessions: sessionEndpoint - } - } - - const jsConfig = {} - - // create the scenario and allow it to modify the configuration - const scenario = new Scenarios[scenarioName](nativeConfig, jsConfig, scenarioData) - - // clear persistent data - console.error('[Bugsnag ScenarioLauncher] clearing persistent data') - NativeModules.BugsnagTestInterface.clearPersistentData() - - // start the native client - console.error('[Bugsnag ScenarioLauncher] starting native Bugsnag') - await NativeModules.BugsnagTestInterface.startBugsnag(nativeConfig) - - // start the js client - console.error('[Bugsnag ScenarioLauncher] starting js Bugsnag') - Bugsnag.start(jsConfig) - - // run the scenario - console.error('launching scenario') - setTimeout(() => { - scenario.run() - if (typeof setScenario === 'function') setScenario(scenario) - }, 1) -} - -async function startBugsnag (scenarioName, apiKey, notifyEndpoint, sessionEndpoint, scenarioData) { - console.error(`[Bugsnag ScenarioLauncher] starting Bugsnag for scenario: ${scenarioName}`) - const nativeConfig = { - apiKey, - autoTrackSessions: false, - endpoints: { - notify: notifyEndpoint, - sessions: sessionEndpoint - } - } - - const jsConfig = {} - - // create the scenario and allow it to modify the configuration - // eslint-disable-next-line no-unused-vars - const scenario = new Scenarios[scenarioName](nativeConfig, jsConfig, scenarioData) - - console.error(`[Bugsnag ScenarioLauncher] with config: ${JSON.stringify(nativeConfig)} (native) and ${JSON.stringify(jsConfig)} (js)`) - - // start the native client - console.error('[Bugsnag ScenarioLauncher] starting native Bugsnag') - await NativeModules.BugsnagTestInterface.startBugsnag(nativeConfig) - - // start the js client - console.error('[Bugsnag ScenarioLauncher] starting js Bugsnag') - Bugsnag.start(jsConfig) -} - -export async function launchScenario (setScenario) { - const command = await getCurrentCommand() - - switch (command.action) { - case 'run-scenario': - // eslint-disable-next-line no-return-await - return await runScenario( - command.scenario_name, - command.api_key, - command.notify, - command.sessions, - command.scenario_data, - setScenario - ) - - case 'start-bugsnag': - // eslint-disable-next-line no-return-await - return await startBugsnag( - command.scenario_name, - command.api_key, - command.notify, - command.sessions, - command.scenario_data - ) - - default: - throw new Error(`Unknown action '${command.action}'`) - } -} diff --git a/test/react-native/features/fixtures/app/react_navigation_js/app/scenarios/ReactNavigationBreadcrumbsDisabledScenario.js b/test/react-native/features/fixtures/app/react_navigation_js/app/scenarios/ReactNavigationBreadcrumbsDisabledScenario.js deleted file mode 100644 index 6d13ee45f..000000000 --- a/test/react-native/features/fixtures/app/react_navigation_js/app/scenarios/ReactNavigationBreadcrumbsDisabledScenario.js +++ /dev/null @@ -1,73 +0,0 @@ -import Scenario from './Scenario' -import Bugsnag from '@bugsnag/react-native' -import BugsnagPluginReactNavigation from '@bugsnag/plugin-react-navigation' -import * as React from 'react' -import { View, Text } from 'react-native' -import { createStackNavigator } from '@react-navigation/stack' -import { NavigationContainer } from '@react-navigation/native' - -const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) - -export class ReactNavigationBreadcrumbsDisabledScenario extends Scenario { - constructor (configuration, jsConfig) { - super() - configuration.enabledBreadcrumbTypes = ['process', 'request', 'log'] - jsConfig.plugins = [new BugsnagPluginReactNavigation()] - } - - view () { - const BugsnagNavigationContainer = Bugsnag.getPlugin('reactNavigation').createNavigationContainer(NavigationContainer) - const Stack = createStackNavigator() - return ( - - - - - - - ) - } - - run () { - } -} - -function HomeScreen ({ navigation }) { - React.useEffect(() => { - (async () => { - await delay(100) - Bugsnag.notify(new Error('HomeNavigationError')) - await delay(250) - navigation.navigate('Details') - })() - }, []) - - return ( - - Home Screen - - ) -} - -function DetailsScreen ({ navigation }) { - React.useEffect(() => { - (async () => { - await delay(100) - Bugsnag.notify(new Error('DetailsNavigationError')) - await delay(250) - throw new Error('DetailsNavigationUnhandledError') - })() - }, []) - - return ( - - Details Screen - - ) -} diff --git a/test/react-native/features/fixtures/app/react_navigation_js/app/scenarios/ReactNavigationBreadcrumbsEnabledScenario.js b/test/react-native/features/fixtures/app/react_navigation_js/app/scenarios/ReactNavigationBreadcrumbsEnabledScenario.js deleted file mode 100644 index 8d2bd4ec5..000000000 --- a/test/react-native/features/fixtures/app/react_navigation_js/app/scenarios/ReactNavigationBreadcrumbsEnabledScenario.js +++ /dev/null @@ -1,72 +0,0 @@ -import Scenario from './Scenario' -import Bugsnag from '@bugsnag/react-native' -import BugsnagPluginReactNavigation from '@bugsnag/plugin-react-navigation' -import * as React from 'react' -import { View, Text } from 'react-native' -import { createStackNavigator } from '@react-navigation/stack' -import { NavigationContainer } from '@react-navigation/native' - -const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) - -export class ReactNavigationBreadcrumbsEnabledScenario extends Scenario { - constructor (_configuration, jsConfig) { - super() - jsConfig.plugins = [new BugsnagPluginReactNavigation()] - } - - view () { - const BugsnagNavigationContainer = Bugsnag.getPlugin('reactNavigation').createNavigationContainer(NavigationContainer) - const Stack = createStackNavigator() - return ( - - - - - - - ) - } - - run () { - } -} - -function HomeScreen ({ navigation }) { - React.useEffect(() => { - (async () => { - await delay(100) - Bugsnag.notify(new Error('HomeNavigationError')) - await delay(250) - navigation.navigate('Details') - })() - }, []) - - return ( - - Home Screen - - ) -} - -function DetailsScreen ({ navigation }) { - React.useEffect(() => { - (async () => { - await delay(100) - Bugsnag.notify(new Error('DetailsNavigationError')) - await delay(250) - throw new Error('DetailsNavigationUnhandledError') - })() - }, []) - - return ( - - Details Screen - - ) -} diff --git a/test/react-native/features/fixtures/app/react_navigation_js/app/scenarios/Scenario.js b/test/react-native/features/fixtures/app/react_navigation_js/app/scenarios/Scenario.js deleted file mode 100644 index 7b61ba40c..000000000 --- a/test/react-native/features/fixtures/app/react_navigation_js/app/scenarios/Scenario.js +++ /dev/null @@ -1,8 +0,0 @@ -export default class Scenario { - run () { - } - - timeout (ms) { - return new Promise(resolve => setTimeout(resolve, ms)) - } -} diff --git a/test/react-native/features/fixtures/app/react_navigation_js/index.js b/test/react-native/features/fixtures/app/react_navigation_js/index.js deleted file mode 100644 index 7539d9ce3..000000000 --- a/test/react-native/features/fixtures/app/react_navigation_js/index.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @format - */ - -import 'react-native-gesture-handler' -import { AppRegistry } from 'react-native' -import App from './app/App' -import { name as appName } from './app.json' - -console.reportErrorsAsExceptions = false - -AppRegistry.registerComponent(appName, () => App) diff --git a/test/react-native/features/fixtures/app/react_navigation_js/install.sh b/test/react-native/features/fixtures/app/react_navigation_js/install.sh deleted file mode 100755 index 35eebe4ef..000000000 --- a/test/react-native/features/fixtures/app/react_navigation_js/install.sh +++ /dev/null @@ -1,29 +0,0 @@ -npm install @bugsnag/plugin-react-navigation@$BUGSNAG_VERSION --legacy-peer-deps --registry=$REGISTRY_URL - -if [ "$REACT_NATIVE_VERSION" = "rn0.60" ]; then - npm install @react-native-community/masked-view@^0.1 --legacy-peer-deps --registry=$REGISTRY_URL - npm install @react-navigation/native@^5.9 --legacy-peer-deps --registry=$REGISTRY_URL - npm install @react-navigation/stack@^5.14 --legacy-peer-deps --registry=$REGISTRY_URL - npm install react-native-gesture-handler@^1.10 --legacy-peer-deps --registry=$REGISTRY_URL - npm install react-native-reanimated@^1.13 --legacy-peer-deps --registry=$REGISTRY_URL - npm install react-native-safe-area-context@^3.1 --legacy-peer-deps --registry=$REGISTRY_URL - npm install react-native-screens@^2.18 --legacy-peer-deps --registry=$REGISTRY_URL -elif [ "$REACT_NATIVE_VERSION" = "rn0.66" ] || [ "$REACT_NATIVE_VERSION" = "rn0.67" ] || [ "$REACT_NATIVE_VERSION" = "rn0.68-hermes" ]; then - npm install @react-native-community/masked-view@^0.1 --legacy-peer-deps --registry=$REGISTRY_URL - npm install @react-navigation/native@^6.0 --legacy-peer-deps --registry=$REGISTRY_URL - npm install @react-navigation/stack@^6.0 --legacy-peer-deps --registry=$REGISTRY_URL - # gesture-handler locked to avoid Kotlin version conflicts, see "Important changes" at: - # https://github.com/software-mansion/react-native-gesture-handler/releases/tag/2.7.0 - npm install react-native-gesture-handler@2.6.2 --legacy-peer-deps --registry=$REGISTRY_URL - npm install react-native-reanimated@^1.13 --legacy-peer-deps --registry=$REGISTRY_URL - npm install react-native-safe-area-context@3.3 --legacy-peer-deps --registry=$REGISTRY_URL - npm install react-native-screens@3.10 --legacy-peer-deps --registry=$REGISTRY_URL -else - npm install @react-native-community/masked-view@^0.1 --legacy-peer-deps --registry=$REGISTRY_URL - npm install @react-navigation/native@^6.0 --legacy-peer-deps --registry=$REGISTRY_URL - npm install @react-navigation/stack@^6.0 --legacy-peer-deps --registry=$REGISTRY_URL - npm install react-native-gesture-handler@2.18.1 --legacy-peer-deps --registry=$REGISTRY_URL - npm install react-native-reanimated@^1.13 --legacy-peer-deps --registry=$REGISTRY_URL - npm install react-native-safe-area-context@3.3 --legacy-peer-deps --registry=$REGISTRY_URL - npm install react-native-screens@3.10 --legacy-peer-deps --registry=$REGISTRY_URL -fi