{"id":15137936,"url":"https://github.com/tobyselway/bevy-autoplay","last_synced_at":"2025-10-23T13:30:57.459Z","repository":{"id":243445172,"uuid":"811110091","full_name":"tobyselway/bevy-autoplay","owner":"tobyselway","description":"Automated integration testing based on recorded play-testing sessions","archived":false,"fork":false,"pushed_at":"2024-06-09T00:38:20.000Z","size":108,"stargazers_count":25,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-30T18:48:23.433Z","etag":null,"topics":["automated-testing","bevy","bevy-engine","game-development","gamedev","integration-testing","playtesting"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/bevy-autoplay","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tobyselway.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-06T00:33:58.000Z","updated_at":"2025-01-21T05:07:34.000Z","dependencies_parsed_at":"2024-06-12T04:04:02.466Z","dependency_job_id":null,"html_url":"https://github.com/tobyselway/bevy-autoplay","commit_stats":null,"previous_names":["tobyselway/bevy-autoplay"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyselway%2Fbevy-autoplay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyselway%2Fbevy-autoplay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyselway%2Fbevy-autoplay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyselway%2Fbevy-autoplay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobyselway","download_url":"https://codeload.github.com/tobyselway/bevy-autoplay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237834669,"owners_count":19373766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automated-testing","bevy","bevy-engine","game-development","gamedev","integration-testing","playtesting"],"created_at":"2024-09-26T07:03:40.186Z","updated_at":"2025-10-23T13:30:57.123Z","avatar_url":"https://github.com/tobyselway.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bevy-autoplay\n\n![crates.io](https://img.shields.io/crates/v/bevy-autoplay.svg)\n\nAutomated integration testing based on recorded play-testing sessions.\n\n## Recording Sessions\n\n```rust\nuse bevy::{input::InputSystem, prelude::*};\nuse bevy_autoplay::{AutoplayPlugin, AutoplayState, AutoplaySystem, SaveToFile};\n\nfn main() {\n    App::new()\n        .add_plugins((DefaultPlugins, AutoplayPlugin)) // Register the AutoplayPlugin\n        .add_systems(\n            PreUpdate,\n            toggle_record.before(AutoplaySystem).after(InputSystem),\n        )\n        .add_systems(OnExit(AutoplayState::Recording), after_recording)\n        .run();\n}\n\n// After recording finished, save the session to a file\nfn after_recording(mut ev_save: EventWriter\u003cSaveToFile\u003e) {\n    ev_save.send(SaveToFile(\"tests/sessions/my_session.gsi\".into()));\n}\n\n// When F12 pressed, start/stop recording\nfn toggle_record(\n    mut keyboard_input: ResMut\u003cButtonInput\u003cKeyCode\u003e\u003e,\n    autoplay_state: Res\u003cState\u003cAutoplayState\u003e\u003e,\n    mut next_autoplay_state: ResMut\u003cNextState\u003cAutoplayState\u003e\u003e,\n) {\n    // Clear in order to avoid the F12 keypress passing through to the recording\n    keyboard_input.clear_just_released(KeyCode::F12);\n    if !keyboard_input.clear_just_pressed(KeyCode::F12) {\n        return;\n    }\n\n    // If stopped then record, and vice-versa\n    if *autoplay_state.get() == AutoplayState::Stopped {\n        next_autoplay_state.set(AutoplayState::Recording);\n    } else {\n        next_autoplay_state.set(AutoplayState::Stopped);\n    }\n}\n```\n\n## Writing Tests\n\n```rust\nuse bevy::{\n    app::{App, Update},\n    prelude::*,\n};\nuse bevy_autoplay::testing::{AutoplayTestPlugin, TestResult};\n\n#[test]\nfn player_must_press_f_key() {\n    fn f_pressed(mut result: EventWriter\u003cTestResult\u003e, keyboard_input: Res\u003cButtonInput\u003cKeyCode\u003e\u003e) {\n        if keyboard_input.just_pressed(KeyCode::KeyF) { // When F key pressed\n            result.send(TestResult::Success); // End test with success\n        }\n    }\n\n    App::new()\n        // Load recorded session\n        .add_plugins(AutoplayTestPlugin(\"tests/sessions/press_f.gsi\".into()))\n        .add_systems(Update, f_pressed)\n        .run();\n}\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobyselway%2Fbevy-autoplay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobyselway%2Fbevy-autoplay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobyselway%2Fbevy-autoplay/lists"}