2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe 'IDE', :js, feature_category: :web_ide do
|
2023-01-13 00:05:48 +05:30
|
|
|
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
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
context 'with vscode feature flag off' do
|
2018-05-09 12:01:36 +05:30
|
|
|
before do
|
2023-01-13 00:05:48 +05:30
|
|
|
ide_visit(project)
|
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
it_behaves_like 'legacy Web IDE'
|
|
|
|
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) }
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
before do
|
|
|
|
ide_visit(project)
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
it_behaves_like 'legacy Web IDE'
|
|
|
|
end
|
2022-10-11 01:57:18 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
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) }
|
2022-10-11 01:57:18 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
let(:project) { subgroup_project }
|
2022-10-11 01:57:18 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
before do
|
|
|
|
ide_visit(project)
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
2023-01-13 00:05:48 +05:30
|
|
|
|
|
|
|
it_behaves_like 'legacy Web IDE'
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|