From 5c194c488860c1e06659e51db08e0c4486a87354 Mon Sep 17 00:00:00 2001 From: Simon Ingeson Date: Thu, 19 Dec 2024 11:03:37 -0500 Subject: [PATCH 1/3] add success check for `duplicate_suite_id` --- fastlane/Fastfile | 2 +- lib/fastlane/plugin/qawolf/helper/qawolf_helper.rb | 14 +++++++++++--- .../actions/notify_deploy_qawolf_action_spec.rb | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index ac02d44..8e7e7d8 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -5,7 +5,7 @@ lane :test do ) notify_deploy_qawolf( deployment_type: "android", - sha: false, + sha: "random_sha", executable_environment_key: "ANDROID_APP", variables: { HELLO: "WORLD" diff --git a/lib/fastlane/plugin/qawolf/helper/qawolf_helper.rb b/lib/fastlane/plugin/qawolf/helper/qawolf_helper.rb index 1710220..ab68726 100644 --- a/lib/fastlane/plugin/qawolf/helper/qawolf_helper.rb +++ b/lib/fastlane/plugin/qawolf/helper/qawolf_helper.rb @@ -84,8 +84,8 @@ def self.process_notify_response(response) results = response_json["results"] - failed_trigger = results.find { |result| result["failure_reason"].nil? == false } - success_trigger = results.find { |result| result["created_suite_id"].nil? == false } + failed_trigger = get_failed_trigger(results) + success_trigger = get_success_trigger(results) if failed_trigger.nil? && success_trigger.nil? raise "no matched trigger, reach out to QA Wolf support" @@ -93,7 +93,15 @@ def self.process_notify_response(response) raise failed_trigger["failure_reason"] end - return success_trigger["created_suite_id"] + return success_trigger["created_suite_id"] || success_trigger["duplicate_suite_id"] + end + + def self.get_failed_trigger(results) + results.find { |result| result["failure_reason"].nil? == false } + end + + def self.get_success_trigger(results) + results.find { |result| result["created_suite_id"].nil? == false || result["duplicate_suite_id"].nil? == false } end # Triggers QA Wolf deploy success webhook to start test runs. diff --git a/spec/fastlane/actions/notify_deploy_qawolf_action_spec.rb b/spec/fastlane/actions/notify_deploy_qawolf_action_spec.rb index 4921a6e..1fb3fec 100644 --- a/spec/fastlane/actions/notify_deploy_qawolf_action_spec.rb +++ b/spec/fastlane/actions/notify_deploy_qawolf_action_spec.rb @@ -68,5 +68,19 @@ end.to raise_error(FastlaneCore::Interface::FastlaneError) end end + + context "with duplicate suite id set" do + let(:deploy_response) do + { + results: [{ duplicate_suite_id: "duplicate_suite_id" }] + } + end + + it "returns the duplicate suite id" do + result = described_class.run(params) + expect(result).to eq(deploy_response[:results][0][:duplicate_suite_id + ]) + end + end end end From 60bc54480acb260c03e301874a5c4b4d7d0687a0 Mon Sep 17 00:00:00 2001 From: Simon Ingeson Date: Thu, 19 Dec 2024 11:04:48 -0500 Subject: [PATCH 2/3] bump version --- lib/fastlane/plugin/qawolf/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fastlane/plugin/qawolf/version.rb b/lib/fastlane/plugin/qawolf/version.rb index 2364ea0..a26d91c 100644 --- a/lib/fastlane/plugin/qawolf/version.rb +++ b/lib/fastlane/plugin/qawolf/version.rb @@ -1,5 +1,5 @@ module Fastlane module Qawolf - VERSION = "0.3.0" + VERSION = "0.3.1" end end From 85880c6d1d5e3582ffa48265a4f2a1be34fda447 Mon Sep 17 00:00:00 2001 From: Simon Ingeson Date: Thu, 19 Dec 2024 11:05:49 -0500 Subject: [PATCH 3/3] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d7ed5f9..b012772 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To ``` # Add this to your Gemfile -gem "fastlane-plugin-qawolf", git: "https://github.com/qawolf/fastlane-plugin-qawolf", tag: "0.3.0" +gem "fastlane-plugin-qawolf", git: "https://github.com/qawolf/fastlane-plugin-qawolf", tag: "0.3.1" ``` ## About qawolf