Skip to content

Commit

Permalink
chore(CI): test xcode recording with time profiler instead of cpu pro…
Browse files Browse the repository at this point in the history
…filer
  • Loading branch information
GuillaumeEgret committed Aug 10, 2023
1 parent 2ac80f2 commit a5c6337
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/ios_e2e.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
#!/bin/bash

curl -Ls "https://get.maestro.mobile.dev" | bash
export PATH="$PATH":"$HOME/.maestro/bin"
brew tap facebook/fb
brew install facebook/fb/idb-companion

git clone https://github.com/bamlab/maestro.git
cd maestro
git checkout feat/prevent-driver-uninstall-ios
git submodule update --init
./gradlew distZip && unzip -o maestro-cli/build/distributions/maestro.zip -d dist
cd ..

export PATH=$PATH:$(pwd)/maestro/dist/maestro/bin

yarn tsc --build && yarn workspace @perf-profiler/web-reporter build
npx link-lerna-package-binaries
Expand All @@ -29,8 +22,6 @@ echo $UDID
# Install the app
xcrun simctl install $UDID ./.github/workflows/fakeStore.app

(maestro initDriver && sleep 50) || maestro initDriver

# Launch the app
# xcrun simctl launch $UDID $APPID

Expand Down
12 changes: 6 additions & 6 deletions packages/ios-poc/src/launchIOS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const executeAsyncCommand = (command: string): Promise<void> => {
};

const startRecord = (simulatorId: string, traceFile: string): Promise<void> => {
const templateFilePath = `${__dirname}/../Flashlight.tracetemplate`;
const templateFilePath = `${__dirname}/../tp.tracetemplate`;
return executeAsyncCommand(
`xcrun xctrace record --device ${simulatorId} --template ${templateFilePath} --attach 'fakeStore' --output ${traceFile}`
);
Expand All @@ -56,7 +56,7 @@ const startRecord = (simulatorId: string, traceFile: string): Promise<void> => {
const save = (traceFile: string, resultsFilePath: string) => {
const xmlOutputFile = getTmpFilePath("report.xml");
executeCommand(
`xctrace export --input ${traceFile} --xpath '/trace-toc/run[@number="1"]/data/table[@schema="cpu-profile"]' --output ${xmlOutputFile}`
`xctrace export --input ${traceFile} --xpath '/trace-toc/run[@number="1"]/data/table[@schema="time-profile"]' --output ${xmlOutputFile}`
);
writeReport(xmlOutputFile, resultsFilePath);
};
Expand All @@ -72,22 +72,22 @@ const launchTest = async ({
simulatorId: string;
resultsFilePath: string;
}) => {
const traceFile = getTmpFilePath(`report_${new Date().getTime()}.trace`);
const traceFile = `report_${new Date().getTime()}.trace`;
const lauchAppFile = writeTmpFile(
"./launch.yaml",
`appId: ${appId}
---
- launchApp
`
);
execSync(`maestro test ${lauchAppFile} --no-ansi --skipDriverSetup`, {
execSync(`maestro test ${lauchAppFile} --no-ansi`, {
stdio: "inherit",
});
const recordingPromise = startRecord(simulatorId, traceFile);
execSync(`sleep 2`, {
stdio: "inherit",
});
execSync(`${testCommand} --no-ansi --skipDriverSetup`, {
execSync(`${testCommand} --no-ansi`, {
stdio: "inherit",
});
const stopAppFile = writeTmpFile(
Expand All @@ -97,7 +97,7 @@ const launchTest = async ({
- stopApp
`
);
execSync(`maestro test ${stopAppFile} --no-ansi --skipDriverSetup`, {
execSync(`maestro test ${stopAppFile} --no-ansi`, {
stdio: "inherit",
});
try {
Expand Down
Binary file added packages/ios-poc/tp.tracetemplate
Binary file not shown.

0 comments on commit a5c6337

Please sign in to comment.