2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Projects > Snippets > User comments on a snippet', :js do
|
2020-04-08 14:13:33 +05:30
|
|
|
let_it_be(:project) { create(:project) }
|
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:snippet) { create(:project_snippet, :repository, project: project, author: user) }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
before do
|
2020-01-01 13:55:28 +05:30
|
|
|
stub_feature_flags(snippets_vue: false)
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2018-03-17 18:26:18 +05:30
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit(project_snippet_path(project, snippet))
|
2020-04-22 19:07:51 +05:30
|
|
|
|
|
|
|
# Snippet's content is loaded async, we wait for it before we try to click anything
|
|
|
|
wait_for_requests
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'leaves a comment on a snippet' do
|
|
|
|
page.within('.js-main-target-form') do
|
|
|
|
fill_in('note_note', with: 'Good snippet!')
|
|
|
|
click_button('Comment')
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
expect(page).to have_content('Good snippet!')
|
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
it 'has autocomplete' do
|
2018-10-15 14:42:47 +05:30
|
|
|
find('#note_note').native.send_keys('')
|
|
|
|
fill_in 'note[note]', with: '@'
|
|
|
|
|
|
|
|
expect(page).to have_selector('.atwho-view')
|
|
|
|
end
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
it 'has zen mode' do
|
2020-04-22 19:07:51 +05:30
|
|
|
click_button 'Go full screen'
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(page).to have_selector('.fullscreen')
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|