Skip to content

Commit

Permalink
Grab test app logs after each scenario (#776)
Browse files Browse the repository at this point in the history
* Add support for retrieving and uploading device logs

* Ensure logs work correctly

* Use proper v8 release
  • Loading branch information
Cawllec authored Mar 1, 2024
1 parent bea3ae5 commit 3551e2d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion features/fixtures/maze_runner/Assets/Scripts/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class Logger : MonoBehaviour
public static void I(string msg)
{
Debug.Log(LOG_PREFIX + msg);
_currentLog = msg + "\n";
_currentLog += msg + "\n";
WriteLogFile();
}

Expand Down
22 changes: 22 additions & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,28 @@
end
end

device_logs = []
After do |scenario|
if Maze.driver && Maze.driver.is_a?(Maze::Driver::Appium)
log_file = Maze::Api::Appium::FileManager.new.read_app_file('mazerunner-unity.log')
device_logs << {
file: log_file,
scenario: scenario.name
}
end
end

AfterAll do
maze_output = File.join(Dir.pwd, 'maze_output')
device_logs_folder = File.join(maze_output, 'device_logs')
FileUtils.makedirs(device_logs_folder)
device_logs.each do |log|
File.open(File.join(device_logs_folder, "#{log[:scenario]}.log"), 'w') do |f|
f.write(log[:file])
end
end
end

AfterAll do
case Maze::Helper.get_current_platform
when 'macos'
Expand Down

0 comments on commit 3551e2d

Please sign in to comment.