feat(tests): add api e2e tests (#3617)

* feat(tests): add api e2e tests

* lockfile

* mobile

* try linux fix [skip ci]

* ios fix

* fix test on windows

* improve cache

* fix pnpm audit [skip ci]
This commit is contained in:
Lucas Fernandes Nogueira
2026-09-22 18:58:14 -03:00
committed by GitHub
parent 7f87091288
commit 684feb2510
47 changed files with 10292 additions and 107 deletions
+10
View File
@@ -40,6 +40,12 @@ tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.3.6" }
tauri-plugin-store = { path = "../../../plugins/store", version = "2.4.5" }
tauri-plugin-upload = { path = "../../../plugins/upload", version = "2.3.0" }
# WebDriver automation bridge, used by the plugins e2e suite (packages/api-e2e).
# Desktop-only and behind the off-by-default `automation` feature so it never ships in a
# regular build.
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
tauri-plugin-automation = { version = "0.1.4", optional = true }
[dependencies.tauri]
workspace = true
features = [
@@ -66,3 +72,7 @@ tauri-plugin-nfc = { path = "../../../plugins/nfc", version = "2.3.6" }
tauri-plugin-biometric = { path = "../../../plugins/biometric/", version = "2.3.3" }
tauri-plugin-geolocation = { path = "../../../plugins/geolocation/", version = "2.3.3" }
tauri-plugin-haptics = { path = "../../../plugins/haptics/", version = "2.3.3" }
[features]
# Enables the WebDriver automation bridge; set by the e2e suite's build (packages/api-e2e).
automation = ["dep:tauri-plugin-automation"]
+38 -1
View File
@@ -18,10 +18,13 @@
"core:app:allow-set-app-theme",
"core:window:allow-minimize",
"core:window:allow-toggle-maximize",
"core:window:allow-set-size",
"core:window:allow-close",
"core:webview:allow-create-webview-window",
"core:window:allow-start-dragging",
"notification:default",
"os:allow-platform",
"os:default",
"os:allow-hostname",
"dialog:default",
{
"identifier": "shell:allow-spawn",
@@ -48,6 +51,31 @@
}
]
},
{
"identifier": "shell:allow-execute",
"allow": [
{
"name": "sh",
"cmd": "sh",
"args": [
"-c",
{
"validator": ".+"
}
]
},
{
"name": "cmd",
"cmd": "cmd",
"args": [
"/C",
{
"validator": ".+"
}
]
}
]
},
"shell:default",
"shell:allow-kill",
"shell:allow-stdin-write",
@@ -57,6 +85,8 @@
"clipboard-manager:allow-write-text",
"clipboard-manager:allow-read-image",
"clipboard-manager:allow-write-image",
"clipboard-manager:allow-write-html",
"clipboard-manager:allow-clear",
"fs:default",
"fs:read-meta",
"fs:allow-open",
@@ -66,6 +96,13 @@
"fs:allow-mkdir",
"fs:allow-remove",
"fs:allow-write-text-file",
"fs:allow-write-file",
"fs:allow-create",
"fs:allow-copy-file",
"fs:allow-seek",
"fs:allow-truncate",
"fs:allow-ftruncate",
"fs:allow-unwatch",
"fs:scope-download-recursive",
"fs:scope-resource-recursive",
{
@@ -10,6 +10,8 @@
"global-shortcut:allow-unregister",
"global-shortcut:allow-register",
"global-shortcut:allow-unregister-all",
"global-shortcut:allow-is-registered",
"window-state:default",
{ "identifier": "fs:allow-watch", "allow": ["*", "**/*"] }
]
}
+1 -1
View File
@@ -1,7 +1,7 @@
# Uncomment the next line to define a global platform for your project
target 'api_iOS' do
platform :ios, '14.0'
platform :ios, '15.0'
# Pods for api_iOS
end
@@ -304,7 +304,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -366,7 +366,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
@@ -400,8 +400,8 @@
"$(inherited)",
"@executable_path/Frameworks",
);
"LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
"LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
"LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME) $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)";
"LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME) $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)";
PRODUCT_BUNDLE_IDENTIFIER = com.tauri.api;
PRODUCT_NAME = "Tauri API";
SDKROOT = iphoneos;
@@ -432,8 +432,8 @@
"$(inherited)",
"@executable_path/Frameworks",
);
"LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
"LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
"LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME) $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)";
"LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME) $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)";
PRODUCT_BUNDLE_IDENTIFIER = com.tauri.api;
PRODUCT_NAME = "Tauri API";
SDKROOT = iphoneos;
+3 -3
View File
@@ -2,7 +2,7 @@ name: api
options:
bundleIdPrefix: com.tauri.api
deploymentTarget:
iOS: 14.0
iOS: 15.0
fileGroups: [../../src]
configs:
debug: debug
@@ -65,8 +65,8 @@ targets:
ENABLE_BITCODE: false
ARCHS: [arm64]
VALID_ARCHS: arm64
LIBRARY_SEARCH_PATHS[arch=x86_64]: $(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
LIBRARY_SEARCH_PATHS[arch=arm64]: $(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
LIBRARY_SEARCH_PATHS[arch=x86_64]: $(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME) $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)
LIBRARY_SEARCH_PATHS[arch=arm64]: $(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME) $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: true
EXCLUDED_ARCHS[sdk=iphoneos*]: x86_64
groups: [app]
+17 -5
View File
@@ -23,10 +23,25 @@ pub type OnEvent = Box<dyn FnMut(&AppHandle, RunEvent)>;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
#[allow(unused_mut)]
let mut builder = tauri::Builder::default()
let mut builder = tauri::Builder::default();
// WebDriver automation bridge for the plugins e2e suite (packages/api-e2e).
// Registered as early as possible per the plugin's docs, behind the
// off-by-default `automation` feature.
#[cfg(all(desktop, feature = "automation"))]
{
builder = builder.plugin(tauri_plugin_automation::init());
}
#[allow(unused_mut)]
let mut builder = builder
.plugin(
tauri_plugin_log::Builder::default()
.level(log::LevelFilter::Info)
// forward records to the webview so `attachLogger`/`attachConsole` work
.target(tauri_plugin_log::Target::new(
tauri_plugin_log::TargetKind::Webview,
))
.build(),
)
.plugin(tauri_plugin_fs::init())
@@ -86,10 +101,7 @@ pub fn run() {
webview_window_builder = webview_window_builder.transparent(true);
}
let webview = webview_window_builder.build().unwrap();
#[cfg(debug_assertions)]
webview.open_devtools();
let _webview = webview_window_builder.build().unwrap();
std::thread::spawn(|| {
let server = match tiny_http::Server::http("localhost:3003") {
+1 -1
View File
@@ -107,7 +107,7 @@
}
},
"iOS": {
"minimumSystemVersion": "14.0"
"minimumSystemVersion": "15.0"
}
}
}