BigW Consortium Gitlab

Commit 5048c8d5 by Rémy Coutable

Merge branch 'move-spintach-project-network-graph-to-rspec' into 'master'

Move spinach project network graph tests to RSpec See merge request gitlab-org/gitlab-ce!17171
parents 7f5d984d 092c5601
Feature: Project Network Graph
Background:
Given I sign in as a user
And I own project "Shop"
And I visit project "Shop" network page
@javascript
Scenario: I should see project network
Then page should have network graph
And page should select "master" in select box
And page should have "master" on graph
@javascript
Scenario: I should see project network with 'test' branch
When I visit project network page on branch 'test'
Then page should have 'test' on graph
@javascript
Scenario: I should switch "branch" and "tag"
When I switch ref to "feature"
Then page should select "feature" in select box
And page should have "feature" on graph
When I switch ref to "v1.0.0"
Then page should select "v1.0.0" in select box
And page should have "v1.0.0" on graph
@javascript
Scenario: I should looking for a commit by SHA
When I looking for a commit by SHA of "v1.0.0"
Then page should have network graph
And page should select "master" in select box
And page should have "v1.0.0" on graph
@javascript
Scenario: I should filter selected tag
When I switch ref to "v1.0.0"
Then page should have "v1.0.0" in title
Then page should have content not containing "v1.0.0"
When click "Show only selected branch" checkbox
Then page should only have content from "v1.0.0"
When click "Show only selected branch" checkbox
Then page should have content not containing "v1.0.0"
Scenario: I should fail to look for a commit
When I look for a commit by ";"
Then I should see non-existent git revision error message
class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps require 'spec_helper'
include SharedAuthentication
include SharedPaths
include SharedProject
step 'page should have network graph' do describe 'Project Network Graph', :js do
expect(page).to have_selector ".network-graph" let(:user) { create :user }
end let(:project) { create :project, :repository, namespace: user.namespace }
When 'I visit project "Shop" network page' do before do
# Stub Graph max_size to speed up test (10 commits vs. 650) sign_in(user)
Network::Graph.stub(max_count: 10)
@project = Project.find_by(name: "Shop") # Stub Graph max_size to speed up test (10 commits vs. 650)
visit project_network_path(@project, "master") allow(Network::Graph).to receive(:max_count).and_return(10)
end end
step "I visit project network page on branch 'test'" do context 'when branch is master' do
visit project_network_path(@project, "'test'") def switch_ref_to(ref_name)
end first('.js-project-refs-dropdown').click
step 'page should select "master" in select box' do page.within '.project-refs-form' do
expect(page).to have_selector '.dropdown-menu-toggle', text: "master" click_link ref_name
end end
end
step 'page should select "v1.0.0" in select box' do def click_show_only_selected_branch_checkbox
expect(page).to have_selector '.dropdown-menu-toggle', text: "v1.0.0" find('#filter_ref').click
end end
step 'page should have "master" on graph' do before do
page.within '.network-graph' do visit project_network_path(project, 'master')
expect(page).to have_content 'master'
end end
end
step "page should have 'test' on graph" do it 'renders project network' do
page.within '.network-graph' do expect(page).to have_selector ".network-graph"
expect(page).to have_content "'test'" expect(page).to have_selector '.dropdown-menu-toggle', text: "master"
page.within '.network-graph' do
expect(page).to have_content 'master'
end
end end
end
When 'I switch ref to "feature"' do it 'switches ref to branch' do
first('.js-project-refs-dropdown').click switch_ref_to('feature')
page.within '.project-refs-form' do expect(page).to have_selector '.dropdown-menu-toggle', text: 'feature'
click_link 'feature' page.within '.network-graph' do
expect(page).to have_content 'feature'
end
end end
end
When 'I switch ref to "v1.0.0"' do it 'switches ref to tag' do
first('.js-project-refs-dropdown').click switch_ref_to('v1.0.0')
page.within '.project-refs-form' do expect(page).to have_selector '.dropdown-menu-toggle', text: 'v1.0.0'
click_link 'v1.0.0' page.within '.network-graph' do
expect(page).to have_content 'v1.0.0'
end
end end
end
When 'click "Show only selected branch" checkbox' do
find('#filter_ref').click
end
step 'page should have content not containing "v1.0.0"' do it 'renders by commit sha of "v1.0.0"' do
page.within '.network-graph' do page.within ".network-form" do
expect(page).to have_content 'Change some files' fill_in 'extended_sha1', with: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9'
find('button').click
end
expect(page).to have_selector ".network-graph"
expect(page).to have_selector '.dropdown-menu-toggle', text: "master"
page.within '.network-graph' do
expect(page).to have_content 'v1.0.0'
end
end end
end
step 'page should have "v1.0.0" in title' do it 'filters select tag' do
expect(page).to have_css 'title', text: 'Graph · v1.0.0', visible: false switch_ref_to('v1.0.0')
end
step 'page should only have content from "v1.0.0"' do expect(page).to have_css 'title', text: 'Graph · v1.0.0', visible: false
page.within '.network-graph' do page.within '.network-graph' do
expect(page).not_to have_content 'Change some files' expect(page).to have_content 'Change some files'
end end
end
step 'page should select "feature" in select box' do click_show_only_selected_branch_checkbox
expect(page).to have_selector '.dropdown-menu-toggle', text: "feature"
end
step 'page should select "v1.0.0" in select box' do page.within '.network-graph' do
expect(page).to have_selector '.dropdown-menu-toggle', text: "v1.0.0" expect(page).not_to have_content 'Change some files'
end end
step 'page should have "feature" on graph' do click_show_only_selected_branch_checkbox
page.within '.network-graph' do
expect(page).to have_content 'feature'
end
end
When 'I looking for a commit by SHA of "v1.0.0"' do page.within '.network-graph' do
page.within ".network-form" do expect(page).to have_content 'Change some files'
fill_in 'extended_sha1', with: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9' end
find('button').click
end end
sleep 2
end
step 'page should have "v1.0.0" on graph' do it 'renders error message when sha commit not exists' do
page.within '.network-graph' do page.within ".network-form" do
expect(page).to have_content 'v1.0.0' fill_in 'extended_sha1', with: ';'
end find('button').click
end end
When 'I look for a commit by ";"' do expect(page).to have_selector '.flash-alert', text: "Git revision ';' does not exist."
page.within ".network-form" do
fill_in 'extended_sha1', with: ';'
find('button').click
end end
end end
step 'I should see non-existent git revision error message' do it 'renders project network with test branch' do
expect(page).to have_selector '.flash-alert', text: "Git revision ';' does not exist." visit project_network_path(project, "'test'")
page.within '.network-graph' do
expect(page).to have_content "'test'"
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment