diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-16 12:09:12 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-16 12:09:12 +0000 |
commit | cbfe03ae04a52d9825ff7cbeccdfe5d313adf6a2 (patch) | |
tree | e4879b35d019d3bbba1689f3ac4c48b81bf7b451 /spec/features | |
parent | 3fd97b4bba24ca412112aad025a38a32c7a6cf8c (diff) | |
download | gitlab-ce-cbfe03ae04a52d9825ff7cbeccdfe5d313adf6a2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/markdown/mermaid_spec.rb | 40 | ||||
-rw-r--r-- | spec/features/profiles/user_edit_profile_spec.rb | 52 | ||||
-rw-r--r-- | spec/features/users/show_spec.rb | 28 |
3 files changed, 111 insertions, 9 deletions
diff --git a/spec/features/markdown/mermaid_spec.rb b/spec/features/markdown/mermaid_spec.rb index 1cd5760c30e..4bf7edf98ca 100644 --- a/spec/features/markdown/mermaid_spec.rb +++ b/spec/features/markdown/mermaid_spec.rb @@ -38,7 +38,9 @@ describe 'Mermaid rendering', :js do visit project_issue_path(project, issue) - expected = '<text><tspan xml:space="preserve" dy="1em" x="1">Line 1</tspan><tspan xml:space="preserve" dy="1em" x="1">Line 2</tspan></text>' + wait_for_requests + + expected = '<text style=""><tspan xml:space="preserve" dy="1em" x="1">Line 1</tspan><tspan xml:space="preserve" dy="1em" x="1">Line 2</tspan></text>' expect(page.html.scan(expected).count).to be(4) end @@ -121,4 +123,40 @@ describe 'Mermaid rendering', :js do expect(svg[:width].to_i).to eq(100) expect(svg[:height].to_i).to eq(0) end + + it 'display button when diagram exceeds length', :js do + graph_edges = "A-->B;B-->A;" * 420 + + description = <<~MERMAID + ```mermaid + graph LR + #{graph_edges} + ``` + MERMAID + + project = create(:project, :public) + issue = create(:issue, project: project, description: description) + + visit project_issue_path(project, issue) + + page.within('.description') do + expect(page).not_to have_selector('svg') + + expect(page).to have_selector('pre.mermaid') + + expect(page).to have_selector('.lazy-alert-shown') + + expect(page).to have_selector('.js-lazy-render-mermaid-container') + end + + wait_for_requests + + find('.js-lazy-render-mermaid').click + + page.within('.description') do + expect(page).to have_selector('svg') + + expect(page).not_to have_selector('.js-lazy-render-mermaid-container') + end + end end diff --git a/spec/features/profiles/user_edit_profile_spec.rb b/spec/features/profiles/user_edit_profile_spec.rb index 9839b3d6c80..171dfb353f0 100644 --- a/spec/features/profiles/user_edit_profile_spec.rb +++ b/spec/features/profiles/user_edit_profile_spec.rb @@ -15,6 +15,11 @@ describe 'User edit profile' do wait_for_requests if respond_to?(:wait_for_requests) end + def visit_user + visit user_path(user) + wait_for_requests + end + it 'changes user profile' do fill_in 'user_skype', with: 'testskype' fill_in 'user_linkedin', with: 'testlinkedin' @@ -22,8 +27,8 @@ describe 'User edit profile' do fill_in 'user_website_url', with: 'testurl' fill_in 'user_location', with: 'Ukraine' fill_in 'user_bio', with: 'I <3 GitLab' + fill_in 'user_job_title', with: 'Frontend Engineer' fill_in 'user_organization', with: 'GitLab' - select 'Data Analyst', from: 'user_role' submit_settings expect(user.reload).to have_attributes( @@ -32,8 +37,8 @@ describe 'User edit profile' do twitter: 'testtwitter', website_url: 'testurl', bio: 'I <3 GitLab', - organization: 'GitLab', - role: 'data_analyst' + job_title: 'Frontend Engineer', + organization: 'GitLab' ) expect(find('#user_location').value).to eq 'Ukraine' @@ -94,11 +99,6 @@ describe 'User edit profile' do end context 'user status', :js do - def visit_user - visit user_path(user) - wait_for_requests - end - def select_emoji(emoji_name, is_modal = false) emoji_menu_class = is_modal ? '.js-modal-status-emoji-menu' : '.js-status-emoji-menu' toggle_button = find('.js-toggle-emoji-menu') @@ -381,4 +381,40 @@ describe 'User edit profile' do end end end + + context 'work information', :js do + context 'when job title and organziation are entered' do + it "shows job title and organzation on user's profile" do + fill_in 'user_job_title', with: 'Frontend Engineer' + fill_in 'user_organization', with: 'GitLab - work info test' + submit_settings + + visit_user + + expect(page).to have_content('Frontend Engineer at GitLab - work info test') + end + end + + context 'when only job title is entered' do + it "shows only job title on user's profile" do + fill_in 'user_job_title', with: 'Frontend Engineer - work info test' + submit_settings + + visit_user + + expect(page).to have_content('Frontend Engineer - work info test') + end + end + + context 'when only organization is entered' do + it "shows only organization on user's profile" do + fill_in 'user_organization', with: 'GitLab - work info test' + submit_settings + + visit_user + + expect(page).to have_content('GitLab - work info test') + end + end + end end diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb index 8c2b555305a..a45389a7ed5 100644 --- a/spec/features/users/show_spec.rb +++ b/spec/features/users/show_spec.rb @@ -26,6 +26,34 @@ describe 'User page' do expect(page).not_to have_content("This user has a private profile") end + + context 'work information' do + subject { visit(user_path(user)) } + + it 'shows job title and organization details' do + user.update(organization: 'GitLab - work info test', job_title: 'Frontend Engineer') + + subject + + expect(page).to have_content('Frontend Engineer at GitLab - work info test') + end + + it 'shows job title' do + user.update(organization: nil, job_title: 'Frontend Engineer - work info test') + + subject + + expect(page).to have_content('Frontend Engineer - work info test') + end + + it 'shows organization details' do + user.update(organization: 'GitLab - work info test', job_title: '') + + subject + + expect(page).to have_content('GitLab - work info test') + end + end end context 'with private profile' do |