From 7c28e86d96d88c4f16e39d852c2374c20cc166f6 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Mon, 6 Apr 2026 22:21:50 +0200 Subject: [PATCH] Add UI smoke test for search and playback on basic-auth Invidious Exercises the read path end-to-end against an Invidious instance fronted by an HTTP Basic Auth reverse proxy: adds the instance via the new basic-auth-aware add helper, navigates to Search, runs a query, taps the first result, waits for the player to expand and start playback, then closes the player. Confirms that ContentService's per-instance HTTPClient (with the basic-auth Authorization header baked in via setDefaultHeaders) is wired correctly through search, video metadata fetch, and stream loading. Skips cleanly when INVIDIOUS_BASIC_AUTH_USERNAME / _PASSWORD are not set. --- .../invidious_basic_auth_search_play_spec.rb | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 spec/ui/smoke/invidious_basic_auth_search_play_spec.rb diff --git a/spec/ui/smoke/invidious_basic_auth_search_play_spec.rb b/spec/ui/smoke/invidious_basic_auth_search_play_spec.rb new file mode 100644 index 00000000..dbb4d304 --- /dev/null +++ b/spec/ui/smoke/invidious_basic_auth_search_play_spec.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +require_relative '../spec_helper' + +RSpec.describe 'Search and play on basic-auth Invidious', :smoke do + before(:all) do + skip 'INVIDIOUS_BASIC_AUTH_USERNAME / _PASSWORD not set' unless UITest::Config.invidious_basic_auth_credentials? + + # Boot simulator + @udid = UITest::Simulator.boot(UITest::Config.device) + + # Build app (unless skipped) + UITest::App.build( + device: UITest::Config.device, + skip: UITest::Config.skip_build? + ) + + # Install and launch + UITest::App.install(udid: @udid) + UITest::App.launch(udid: @udid) + + # Wait for app to stabilize + sleep UITest::Config.app_launch_wait + + # Initialize helpers + @axe = UITest::Axe.new(@udid) + @instance_setup = UITest::InstanceSetup.new(@axe) + @search_helper = UITest::SearchHelper.new(@axe) + @player_helper = UITest::PlayerHelper.new(@axe) + + # Make the basic-auth Invidious instance the only Invidious-compatible source + # so search and playback route through the reverse proxy. + @instance_setup.remove_yattee_server(UITest::Config.yattee_server_host) + @instance_setup.remove_and_add_invidious_with_basic_auth( + UITest::Config.invidious_basic_auth_url, + username: UITest::Config.invidious_basic_auth_username, + password: UITest::Config.invidious_basic_auth_password + ) + end + + after(:all) do + UITest::App.terminate(udid: @udid, silent: true) if @udid + UITest::Simulator.shutdown(@udid) if @udid && !UITest::Config.keep_simulator? + end + + describe 'searching and playing a video through the basic-auth proxy' do + it 'searches, taps a video, plays it, and closes the player' do + video_id = 'XfELJU1mRMg' + + # Navigate to Search and run a query for the known video + @search_helper.navigate_to_search + expect(@search_helper.search_visible?).to be true + + @search_helper.search(video_id) + @search_helper.wait_for_results + + expect(@search_helper.results_visible?).to be true + + # Tap the first result thumbnail to start playback directly + @search_helper.tap_first_result_thumbnail + + # Wait for the player to expand and start playback + @player_helper.wait_for_player_expanded + @player_helper.wait_for_playback_started + + @axe.screenshot('invidious_basic_auth_playback_playing') + + # Close the player + @player_helper.close_player + + @axe.screenshot('invidious_basic_auth_playback_after_close') + end + end +end