Skip to content
Snippets Groups Projects
Commit e89269cc authored by Jay McCure's avatar Jay McCure Committed by Ramya Authappan
Browse files

E2E test: add web ide duo chat spec (live envs only)

parent 6c87b95a
No related branches found
No related tags found
1 merge request!144840E2E test: add web ide duo chat spec (live envs only)
......@@ -128,6 +128,14 @@ def within_vscode_editor(&block)
page.within_frame(iframe, &block)
end
def within_vscode_duo_chat(&block)
within_vscode_editor do
within_frame(all(:frame, class: 'webview', visible: false).last) do
within_frame(:frame, &block)
end
end
end
def switch_to_original_window
page.driver.browser.switch_to.window(page.driver.browser.window_handles.first)
end
......@@ -156,7 +164,7 @@ def wait_for_ide_to_load
end
Support::WaitForRequests.wait_for_requests(finish_loading_wait: 30)
Support::Waiter.wait_until(max_duration: 10, reload_page: page, retry_on_exception: true) do
Support::Waiter.wait_until(max_duration: 60, reload_page: page, retry_on_exception: true) do
within_vscode_editor do
# Check for webide file_explorer element
has_file_explorer?
......@@ -304,6 +312,12 @@ def editor_content_lines
end
end
def open_duo_chat
within_vscode_editor do
click_element('a[aria-label="GitLab Duo Chat"]', wait: 60)
end
end
private
def create_item(click_item, item_name)
......
......@@ -19,7 +19,7 @@ module QA
duo_chat.send_duo_chat_prompt('hi')
expect do
duo_chat.latest_response
end.to eventually_match(/Hello! I'm GitLab Duo Chat/).within(max_duration: 30)
end.to eventually_match(/GitLab Duo Chat/).within(max_duration: 30)
end
end
end
......
# frozen_string_literal: true
module QA
# https://docs.gitlab.com/ee/development/ai_features/duo_chat.html
RSpec.describe 'Create', product_group: :ide do
describe 'Duo Chat in Web IDE' do
let(:project) { create(:project, :with_readme, name: 'webide-duo-chat-project') }
before do
Flow::Login.sign_in
project.visit!
Page::Project::Show.perform(&:open_web_ide!)
Page::Project::WebIDE::VSCode.perform(&:wait_for_ide_to_load)
end
context 'when initiating Duo Chat' do
it 'returns a response to a simple request', only: { pipeline: %i[staging staging-canary canary production] },
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/443762' do
Page::Project::WebIDE::VSCode.perform do |ide|
ide.open_duo_chat
ide.within_vscode_duo_chat do
QA::EE::Page::Component::DuoChat.perform do |duo_chat|
duo_chat.clear_chat_history
expect(duo_chat).to be_empty_state
duo_chat.send_duo_chat_prompt('hi')
expect do
duo_chat.latest_response
end.to eventually_match(/GitLab Duo Chat/).within(max_duration: 30)
end
end
end
end
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment