Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 14 additions & 87 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ serde = { version = "1.0.209", features = ["derive"] }
serde-enum-str = "0.4.0"
serde_json = "1.0.127"
serde_yaml = "0.9.33"
serde_with = "3.6.0"
simple_logger = "4.3.3"
serde_with = "3.17.0"
simple_logger = "5.2.0"
shellexpand = "3.1.0"
tempfile = "3.9.0"
# Reqwest pulls in dependency on openssl which we replace with rustls, hence disabling default features
Expand All @@ -37,7 +37,7 @@ reqwest = { version = "0.13", default-features = false, features = [
"stream",
"rustls",
] }
time = { version = "0.3.36", features = ["serde-well-known"] }
time = { version = "0.3.47", features = ["serde-well-known"] }
tokio = { version = "1.40.0", features = ["full"] }
tokio-util = "0.7.11"
futures = "0.3"
Expand Down
9 changes: 8 additions & 1 deletion src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use tokio::io;

use crate::{
bundle::{ApplicationBundleReference, LibraryBundleReference},
cli::model::LocalFileReference,
cli::model::{BatchIsolation, LocalFileReference},
errors::{ApiError, EnvArgError, InputError},
filtering::model::SparseMarathonfile,
pull::PullFileConfig,
Expand Down Expand Up @@ -63,6 +63,7 @@ pub trait RapiClient {
application_bundle: Option<Vec<ApplicationBundleReference>>,
library_bundle: Option<Vec<LibraryBundleReference>>,
granted_permission: Option<Vec<String>>,
batch_isolation: Option<BatchIsolation>,
) -> Result<String>;
async fn get_run(&self, id: &str) -> Result<TestRun>;

Expand Down Expand Up @@ -162,6 +163,7 @@ impl RapiClient for RapiReqwestClient {
application_bundle: Option<Vec<ApplicationBundleReference>>,
library_bundle: Option<Vec<LibraryBundleReference>>,
granted_permission: Option<Vec<String>>,
batch_isolation: Option<BatchIsolation>,
) -> Result<String> {
let url = format!("{}/v2/run", self.base_url);
let params = [("api_key", self.api_key.clone())];
Expand Down Expand Up @@ -258,6 +260,8 @@ impl RapiClient for RapiReqwestClient {
let env_args_map = vec_to_hashmap(env_args)?;
let test_env_args_map = vec_to_hashmap(test_env_args)?;

let app_uninstall = batch_isolation.map(|x| x == BatchIsolation::UninstallApp);

let create_request = CreateRunRequest {
s3_test_app_path: s3_test_app_path.clone(),
test_app_md5: test_app.clone().map(|s| s.md5),
Expand Down Expand Up @@ -294,6 +298,7 @@ impl RapiClient for RapiReqwestClient {
test_env_args: test_env_args_map,
bundles,
granted_permission: granted_permission.clone(),
app_uninstall,
};

let response = self.client.post(url).json(&create_request).send().await?;
Expand Down Expand Up @@ -675,6 +680,8 @@ struct CreateRunRequest {
bundles: Option<Vec<CreateRunBundle>>,
#[serde(rename = "granted_permission", default)]
granted_permission: Option<Vec<String>>,
#[serde(rename = "app_uninstall", default)]
app_uninstall: Option<bool>,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down
1 change: 1 addition & 0 deletions src/cli/android/maestro/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ pub(crate) async fn run(
None,
None,
None,
None,
formatter,
)
.await
Expand Down
1 change: 1 addition & 0 deletions src/cli/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ If you are interesting in library testing then please use advance mode with --li
application_bundle,
library_bundle,
None,
None,
formatter,
)
.await
Expand Down
1 change: 1 addition & 0 deletions src/cli/ios/maestro/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ pub(crate) async fn run(
None,
None,
None,
None,
formatter,
)
.await
Expand Down
3 changes: 3 additions & 0 deletions src/cli/ios/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use anyhow::Result;
use indicatif::{ProgressBar, ProgressStyle};
use std::collections::HashSet;

use crate::cli::model::BatchIsolation;
use crate::cli::validate;
use crate::formatter::Formatter;
use crate::{
Expand Down Expand Up @@ -218,6 +219,7 @@ pub(crate) async fn run(
test_timeout_default: Option<u32>,
test_timeout_max: Option<u32>,
granted_permission: Option<Vec<String>>,
batch_isolation: Option<BatchIsolation>,
) -> Result<bool> {
let (device, os_version) = match validate_device_configuration(os_version, device).await {
Ok(value) => value,
Expand Down Expand Up @@ -380,6 +382,7 @@ pub(crate) async fn run(
None,
None,
granted_permission,
batch_isolation,
formatter,
)
.await
Expand Down
10 changes: 10 additions & 0 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use clap::CommandFactory;
use clap::{Args, Parser, Subcommand};
use std::path::PathBuf;

use crate::cli::model::BatchIsolation;
use crate::errors::default_error_handler;
use crate::interactor::{DownloadArtifactsInteractor, GetDeviceCatalogInteractor};

Expand Down Expand Up @@ -97,6 +98,7 @@ impl Cli {
test_timeout_default,
test_timeout_max,
granted_permission,
batch_isolation,
} => {
ios::run(
application,
Expand All @@ -115,6 +117,7 @@ impl Cli {
test_timeout_default,
test_timeout_max,
granted_permission,
batch_isolation,
)
.await
}
Expand Down Expand Up @@ -586,6 +589,13 @@ Example: '--library-bundle apks/library1-debug-androidTest.apk --library-bundle
#[command(flatten)]
analytics_args: AnalyticsArgs,

#[arg(
value_enum,
long,
help = "Batch isolation mode. Use app uninstall if you want to uninstall app between test batches"
)]
batch_isolation: Option<BatchIsolation>,

#[arg(
long,
help = "xctestrun environment variable (EnvironmentVariables item), example FOO=BAR"
Expand Down
8 changes: 8 additions & 0 deletions src/cli/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ pub struct LocalFileReference {
pub path: PathBuf,
pub md5: String,
}

#[derive(Debug, clap::ValueEnum, Clone, PartialEq, Eq)]
pub enum BatchIsolation {
#[clap(name = "default")]
Default,
#[clap(name = "uninstall_app")]
UninstallApp,
}
Loading