diff --git a/example/.owl/.gitignore b/example/.owl/.gitignore new file mode 100644 index 00000000..75573e62 --- /dev/null +++ b/example/.owl/.gitignore @@ -0,0 +1,2 @@ +diff/ +latest/ diff --git a/example/.owl/baseline/android/screen.png b/example/.owl/baseline/android/screen.png index f741132a..dbb613f3 100644 Binary files a/example/.owl/baseline/android/screen.png and b/example/.owl/baseline/android/screen.png differ diff --git a/example/.owl/baseline/ios/screen.png b/example/.owl/baseline/ios/screen.png index 70c54809..06f9eb10 100644 Binary files a/example/.owl/baseline/ios/screen.png and b/example/.owl/baseline/ios/screen.png differ diff --git a/src/cli/run.test.ts b/src/cli/run.test.ts index cdf13788..76b77921 100644 --- a/src/cli/run.test.ts +++ b/src/cli/run.test.ts @@ -53,12 +53,18 @@ describe('run.ts', () => { expect(execMock).toHaveBeenNthCalledWith( 1, - 'xcrun simctl install iPhone\\ Simulator RNDemo.app', + 'xcrun simctl status_bar iPhone\\ Simulator override --time 9:41', { cwd, stdio: 'ignore' } ); expect(execMock).toHaveBeenNthCalledWith( 2, + 'xcrun simctl install iPhone\\ Simulator RNDemo.app', + { cwd, stdio: 'ignore' } + ); + + expect(execMock).toHaveBeenNthCalledWith( + 3, `xcrun simctl launch iPhone\\ Simulator ${bundleIdIOS}`, { stdio: 'ignore' } ); @@ -86,12 +92,18 @@ describe('run.ts', () => { expect(execMock).toHaveBeenNthCalledWith( 1, - 'xcrun simctl install iPhone\\ Simulator RNDemo.app', + 'xcrun simctl status_bar iPhone\\ Simulator override --time 9:41', { cwd, stdio: 'ignore' } ); expect(execMock).toHaveBeenNthCalledWith( 2, + 'xcrun simctl install iPhone\\ Simulator RNDemo.app', + { cwd, stdio: 'ignore' } + ); + + expect(execMock).toHaveBeenNthCalledWith( + 3, `xcrun simctl launch iPhone\\ Simulator ${bundleIdIOS}`, { stdio: 'ignore' } ); @@ -123,12 +135,16 @@ describe('run.ts', () => { await run.runAndroid(config, logger); - expect(execMock).toHaveBeenNthCalledWith(1, `adb install -r ${appPath}`, { + expect(execMock).toHaveBeenNthCalledWith(1, `adb shell date 01010941`, { + stdio: 'ignore', + }); + + expect(execMock).toHaveBeenNthCalledWith(2, `adb install -r ${appPath}`, { stdio: 'ignore', }); expect(execMock).toHaveBeenNthCalledWith( - 2, + 3, `adb shell monkey -p \"com.rndemo\" -c android.intent.category.LAUNCHER 1`, { stdio: 'ignore' } ); @@ -147,8 +163,12 @@ describe('run.ts', () => { await run.runAndroid(config, logger); + expect(execMock).toHaveBeenNthCalledWith(1, `adb shell date 01010941`, { + stdio: 'ignore', + }); + expect(execMock).toHaveBeenNthCalledWith( - 1, + 2, `adb install -r ${binaryPath}`, { stdio: 'ignore', @@ -156,7 +176,7 @@ describe('run.ts', () => { ); expect(execMock).toHaveBeenNthCalledWith( - 2, + 3, `adb shell monkey -p \"com.rndemo\" -c android.intent.category.LAUNCHER 1`, { stdio: 'ignore' } ); diff --git a/src/cli/run.ts b/src/cli/run.ts index 31514e5a..aaafba26 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -26,6 +26,10 @@ export const runIOS = async (config: Config, logger: Logger) => { const bundleId = getIOSBundleIdentifier(appPath); const simulator = config.ios!.device.replace(/([ /])/g, '\\$1'); + const SIMULATOR_TIME = '9:41'; + const setTimeCommand = `xcrun simctl status_bar ${simulator} override --time ${SIMULATOR_TIME}`; + await execa.command(setTimeCommand, { stdio, cwd }); + const installCommand = `xcrun simctl install ${simulator} ${appFilename}`; await execa.command(installCommand, { stdio, cwd }); @@ -46,6 +50,10 @@ export const runAndroid = async (config: Config, logger: Logger) => { const appPath = path.join(cwd, appFilename); const { packageName } = config.android!; + const SIMULATOR_TIME = '0941'; + const setTimeCommand = `adb shell date 0101${SIMULATOR_TIME}`; + await execa.command(setTimeCommand, { stdio }); + const installCommand = `adb install -r ${appPath}`; await execa.command(installCommand, { stdio });