diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/features/ide_spec.rb | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/features/ide_spec.rb')
-rw-r--r-- | spec/features/ide_spec.rb | 95 |
1 files changed, 69 insertions, 26 deletions
diff --git a/spec/features/ide_spec.rb b/spec/features/ide_spec.rb index c7c740c2293..1f6d34efc0f 100644 --- a/spec/features/ide_spec.rb +++ b/spec/features/ide_spec.rb @@ -3,47 +3,90 @@ require 'spec_helper' RSpec.describe 'IDE', :js do - describe 'sub-groups' do - let(:ide_iframe_selector) { '#ide iframe' } - let(:user) { create(:user) } - let(:group) { create(:group) } - let(:subgroup) { create(:group, parent: group) } - let(:subgroup_project) { create(:project, :repository, namespace: subgroup) } + include WebIdeSpecHelpers + + let_it_be(:ide_iframe_selector) { '#ide iframe' } + let_it_be(:normal_project) { create(:project, :repository) } + + let(:project) { normal_project } + let(:vscode_ff) { false } + let(:user) { create(:user) } + + before do + project.add_maintainer(user) + stub_feature_flags(vscode_web_ide: vscode_ff) + + sign_in(user) + end + + shared_examples "legacy Web IDE" do + it 'loads legacy Web IDE', :aggregate_failures do + expect(page).to have_selector('.context-header', text: project.name) + + # Assert new Web IDE is not loaded + expect(page).not_to have_selector(ide_iframe_selector) + end + end + + shared_examples "new Web IDE" do + it 'loads new Web IDE', :aggregate_failures do + expect(page).not_to have_selector('.context-header') + + iframe = find(ide_iframe_selector) + + page.within_frame(iframe) do + expect(page).to have_selector('.title', text: project.name.upcase) + end + end + end + context 'with vscode feature flag off' do before do - stub_feature_flags(vscode_web_ide: vscode_ff) - subgroup_project.add_maintainer(user) - sign_in(user) + ide_visit(project) + end - visit project_path(subgroup_project) + it_behaves_like 'legacy Web IDE' - click_link('Web IDE') + it 'does not show switch button' do + expect(page).not_to have_button('Switch to new Web IDE') + end + end + + context 'with vscode feature flag on and use_legacy_web_ide=true' do + let(:vscode_ff) { true } + let(:user) { create(:user, use_legacy_web_ide: true) } - wait_for_requests + before do + ide_visit(project) end - context 'with vscode feature flag on' do - let(:vscode_ff) { true } + it_behaves_like 'legacy Web IDE' - it 'loads project in Web IDE' do - iframe = find(ide_iframe_selector) + describe 'when user switches to new Web IDE' do + before do + click_button('Switch to new Web IDE') - page.within_frame(iframe) do - expect(page).to have_selector('.title', text: subgroup_project.name.upcase) + # Confirm modal + page.within('#confirmationModal') do + click_button('Switch editors') end end + + it_behaves_like 'new Web IDE' end + end - context 'with vscode feature flag off' do - let(:vscode_ff) { false } + describe 'sub-groups' do + let_it_be(:group) { create(:group) } + let_it_be(:subgroup) { create(:group, parent: group) } + let_it_be(:subgroup_project) { create(:project, :repository, namespace: subgroup) } - it 'loads project in legacy Web IDE' do - expect(page).to have_selector('.context-header', text: subgroup_project.name) - end + let(:project) { subgroup_project } - it 'does not load new Web IDE' do - expect(page).not_to have_selector(ide_iframe_selector) - end + before do + ide_visit(project) end + + it_behaves_like 'legacy Web IDE' end end |