Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def self.run(params)
axis = status["axis_value"]
Helper.if_need_dir("#{download_dir}/#{axis}")
Helper.copy_from_gcs("#{results_bucket}/#{results_dir}/#{axis}", download_dir)
Helper.set_public("#{results_bucket}/#{results_dir}/#{axis}")
if params[:publish_result]
Helper.set_public("#{results_bucket}/#{results_dir}/#{axis}")
end
end
end

Expand Down Expand Up @@ -236,7 +238,13 @@ def self.available_options
description: "Target directory to download screenshots from firebase",
type: String,
optional: true,
default_value: nil)
default_value: nil),
FastlaneCore::ConfigItem.new(key: :publish_result,
env_name: "PUBLISH_RESULT",
description: "Set result's ACL to public (effective only if download_dir is set)",
type: Boolean,
optional: true,
default_value: true)
]
end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
require 'spec_helper'

describe Fastlane::Actions::FirebaseTestLabAndroidAction do
describe '.run' do
subject { described_class.run(params) }

before do
allow(Fastlane::Helper).to receive(:config)
allow(Fastlane::Helper).to receive(:authenticate)
allow(Fastlane::Helper).to receive(:run_tests)
allow(Fastlane::Helper).to receive(:if_need_dir)
allow(Fastlane::Helper).to receive(:copy_from_gcs)
allow(Fastlane::Helper).to receive(:set_public)
allow(Fastlane::Helper).to receive(:make_slack_text)
allow(Fastlane::Helper).to receive(:make_github_text)
allow(File).to receive(:read).with(params[:console_log_file_name]).and_return json
end

let(:params) do
{
project_id: 'test',
gcloud_service_key_file: 'test.json',
type: 'robo',
devices: [{
model: 'Nexus6',
version: '21',
locale: 'en_US',
orientation: 'portrait'
}],
app_apk: 'test.apk',
timeout: '3m',
use_orchestrator: false,
gcloud_components_channel: 'stable',
console_log_file_name: './console_output.log',
extra_options: '',
download_dir: "download",
publish_result: publish_result,
}
end

let(:json) do
<<~EOF
[
{
"axis_value": "Nexus6P-23-ja_JP-portrait",
"outcome": "Passed",
"test_details": "--"
},
{
"axis_value": "Pixel2-28-en_US-portrait",
"outcome": "Passed",
"test_details": "--"
}
]
EOF
end

context 'with publish_result is true' do
let(:publish_result) { true }

it 'sets the specified GCS object to public-read ACL' do
expect(Fastlane::Helper).to receive(:set_public)
subject
end
end

context 'with publish_result is false' do
let(:publish_result) { false }

it 'does not manipulate ACL of the specified GCS object' do
expect(Fastlane::Helper).not_to receive(:set_public)
subject
end
end
end
end