From d18fe2094b42ccf2ee23b01c4cdcf58dc42aaf03 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 9 Aug 2016 20:19:14 +0200 Subject: Use new PhantomJS version --- .gitlab-ci.yml | 1 + scripts/prepare_build.sh | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e8d54e768d3..34ab1f90fca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,6 +15,7 @@ variables: USE_DB: "true" USE_BUNDLE_INSTALL: "true" GIT_DEPTH: "20" + PHANTOMJS_DEB: "phantomjs_2.1.1+dfsg-2_amd64.deb" before_script: - source ./scripts/prepare_build.sh diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 7e71a030901..9c5a9713189 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -20,10 +20,10 @@ if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then # Install phantomjs package pushd vendor/apt - if [ ! -e phantomjs_1.9.8-0jessie_amd64.deb ]; then - wget -q https://gitlab.com/axil/phantomjs-debian/raw/master/phantomjs_1.9.8-0jessie_amd64.deb + if [ ! -e "$PHANTOMJS_DEB" ]; then + wget -q "http://ftp.us.debian.org/debian/pool/main/p/phantomjs/$PHANTOMJS_DEB" fi - dpkg -i phantomjs_1.9.8-0jessie_amd64.deb + dpkg -i "$PHANTOMJS_DEB" popd # Try to install packages -- cgit v1.2.1 From e6173e056756cb65c60c16b02e3a36f84222b6e3 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 9 Aug 2016 20:25:11 +0200 Subject: Install latest stable phantomjs --- .gitlab-ci.yml | 2 +- scripts/prepare_build.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 34ab1f90fca..be5614520a5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,7 @@ variables: USE_DB: "true" USE_BUNDLE_INSTALL: "true" GIT_DEPTH: "20" - PHANTOMJS_DEB: "phantomjs_2.1.1+dfsg-2_amd64.deb" + PHANTOMJS_VERSION: "2.1.1" before_script: - source ./scripts/prepare_build.sh diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 9c5a9713189..bfca5d76391 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -20,10 +20,11 @@ if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then # Install phantomjs package pushd vendor/apt - if [ ! -e "$PHANTOMJS_DEB" ]; then - wget -q "http://ftp.us.debian.org/debian/pool/main/p/phantomjs/$PHANTOMJS_DEB" + PHANTOMJS_FILE="phantomjs-$PHANTOMJS_VERSION-linux-x86_64" + if [ ! -d "$PHANTOMJS_FILE" ]; then + curl -q "https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOMJS_FILE.tar.bz2" | tar jx fi - dpkg -i "$PHANTOMJS_DEB" + cp "$PHANTOMJS_FILE/bin/phantomjs" "/usr/bin/" popd # Try to install packages -- cgit v1.2.1 From 65572b3b9658667962df27376d01d1c55d7d9270 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 9 Aug 2016 20:29:53 +0200 Subject: Fix file downloading --- scripts/prepare_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index bfca5d76391..e6a673c94e9 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -22,7 +22,7 @@ if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then pushd vendor/apt PHANTOMJS_FILE="phantomjs-$PHANTOMJS_VERSION-linux-x86_64" if [ ! -d "$PHANTOMJS_FILE" ]; then - curl -q "https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOMJS_FILE.tar.bz2" | tar jx + curl -q -L "https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOMJS_FILE.tar.bz2" | tar jx fi cp "$PHANTOMJS_FILE/bin/phantomjs" "/usr/bin/" popd -- cgit v1.2.1 From 2675c9d632c9560a94e98cd3830e2dfdfbbc2bd4 Mon Sep 17 00:00:00 2001 From: Timothy Andrew Date: Thu, 11 Aug 2016 11:05:36 +0530 Subject: Fix `U2fSpec` for PhantomJS versions > 2. - We weren't explicilty waiting for the page to load while navigating to the "Manage two-factor authentication" page. This was probably incidentally working for PhantomJS 1.x versions. --- spec/features/u2f_spec.rb | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/spec/features/u2f_spec.rb b/spec/features/u2f_spec.rb index 9335f5bf120..d370f90f7d9 100644 --- a/spec/features/u2f_spec.rb +++ b/spec/features/u2f_spec.rb @@ -1,8 +1,16 @@ require 'spec_helper' feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: true, js: true do + include WaitForAjax + before { allow_any_instance_of(U2fHelper).to receive(:inject_u2f_api?).and_return(true) } + def manage_two_factor_authentication + click_on 'Manage Two-Factor Authentication' + expect(page).to have_content("Setup New U2F Device") + wait_for_ajax + end + def register_u2f_device(u2f_device = nil) u2f_device ||= FakeU2fDevice.new(page) u2f_device.respond_to_u2f_registration @@ -34,7 +42,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: describe 'when 2FA via OTP is enabled' do it 'allows registering a new device' do visit profile_account_path - click_on 'Manage Two-Factor Authentication' + manage_two_factor_authentication expect(page.body).to match("You've already enabled two-factor authentication using mobile") register_u2f_device @@ -46,15 +54,15 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: visit profile_account_path # First device - click_on 'Manage Two-Factor Authentication' + manage_two_factor_authentication register_u2f_device expect(page.body).to match('Your U2F device was registered') # Second device - click_on 'Manage Two-Factor Authentication' + manage_two_factor_authentication register_u2f_device expect(page.body).to match('Your U2F device was registered') - click_on 'Manage Two-Factor Authentication' + manage_two_factor_authentication expect(page.body).to match('You have 2 U2F devices registered') end end @@ -62,7 +70,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: it 'allows the same device to be registered for multiple users' do # First user visit profile_account_path - click_on 'Manage Two-Factor Authentication' + manage_two_factor_authentication u2f_device = register_u2f_device expect(page.body).to match('Your U2F device was registered') logout @@ -71,7 +79,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: user = login_as(:user) user.update_attribute(:otp_required_for_login, true) visit profile_account_path - click_on 'Manage Two-Factor Authentication' + manage_two_factor_authentication register_u2f_device(u2f_device) expect(page.body).to match('Your U2F device was registered') @@ -81,7 +89,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: context "when there are form errors" do it "doesn't register the device if there are errors" do visit profile_account_path - click_on 'Manage Two-Factor Authentication' + manage_two_factor_authentication # Have the "u2f device" respond with bad data page.execute_script("u2f.register = function(_,_,_,callback) { callback('bad response'); };") @@ -96,7 +104,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: it "allows retrying registration" do visit profile_account_path - click_on 'Manage Two-Factor Authentication' + manage_two_factor_authentication # Failed registration page.execute_script("u2f.register = function(_,_,_,callback) { callback('bad response'); };") @@ -122,7 +130,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: login_as(user) user.update_attribute(:otp_required_for_login, true) visit profile_account_path - click_on 'Manage Two-Factor Authentication' + manage_two_factor_authentication @u2f_device = register_u2f_device logout end @@ -161,7 +169,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: current_user = login_as(:user) current_user.update_attribute(:otp_required_for_login, true) visit profile_account_path - click_on 'Manage Two-Factor Authentication' + manage_two_factor_authentication register_u2f_device logout @@ -182,7 +190,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: current_user = login_as(:user) current_user.update_attribute(:otp_required_for_login, true) visit profile_account_path - click_on 'Manage Two-Factor Authentication' + manage_two_factor_authentication register_u2f_device(@u2f_device) logout @@ -248,7 +256,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: user = login_as(:user) user.update_attribute(:otp_required_for_login, true) visit profile_account_path - click_on 'Manage Two-Factor Authentication' + manage_two_factor_authentication expect(page).to have_content("Your U2F device needs to be set up.") register_u2f_device end -- cgit v1.2.1 From f668da11cb225a9b2c2f1d3ba9d1e9fb2797d4f9 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 11 Aug 2016 17:48:32 +0100 Subject: Updated tests --- features/steps/dashboard/event_filters.rb | 6 ++++++ features/steps/dashboard/issues.rb | 5 +++++ features/steps/dashboard/merge_requests.rb | 5 +++++ features/steps/dashboard/new_project.rb | 2 ++ features/steps/project/builds/artifacts.rb | 1 + features/steps/project/forked_merge_requests.rb | 3 +++ features/steps/project/issues/issues.rb | 1 + features/steps/project/merge_requests.rb | 2 ++ features/steps/project/source/browse_files.rb | 1 + features/steps/project/wiki.rb | 2 ++ features/steps/shared/issuable.rb | 4 +--- spec/features/issuables/default_sort_order_spec.rb | 14 +++++++------- spec/features/issues/filter_issues_spec.rb | 2 +- spec/features/merge_requests/create_new_mr_spec.rb | 2 ++ spec/features/profiles/preferences_spec.rb | 4 ++++ .../files/project_owner_creates_license_file_spec.rb | 1 + ...es_link_to_create_license_file_in_empty_project_spec.rb | 1 + spec/features/variables_spec.rb | 1 + 18 files changed, 46 insertions(+), 11 deletions(-) diff --git a/features/steps/dashboard/event_filters.rb b/features/steps/dashboard/event_filters.rb index 726b37cfde5..97b17abb470 100644 --- a/features/steps/dashboard/event_filters.rb +++ b/features/steps/dashboard/event_filters.rb @@ -4,26 +4,32 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps include SharedProject step 'I should see push event' do + sleep 1 expect(page).to have_selector('span.pushed') end step 'I should not see push event' do + sleep 1 expect(page).not_to have_selector('span.pushed') end step 'I should see new member event' do + sleep 1 expect(page).to have_selector('span.joined') end step 'I should not see new member event' do + sleep 1 expect(page).not_to have_selector('span.joined') end step 'I should see merge request event' do + sleep 1 expect(page).to have_selector('span.accepted') end step 'I should not see merge request event' do + sleep 1 expect(page).not_to have_selector('span.accepted') end diff --git a/features/steps/dashboard/issues.rb b/features/steps/dashboard/issues.rb index 8706f0e8e78..39c65bb6cde 100644 --- a/features/steps/dashboard/issues.rb +++ b/features/steps/dashboard/issues.rb @@ -43,9 +43,14 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps step 'I click "All" link' do find(".js-author-search").click + expect(page).to have_selector(".dropdown-menu-author li a") find(".dropdown-menu-author li a", match: :first).click + expect(page).not_to have_selector(".dropdown-menu-author li a") + find(".js-assignee-search").click + expect(page).to have_selector(".dropdown-menu-assignee li a") find(".dropdown-menu-assignee li a", match: :first).click + expect(page).not_to have_selector(".dropdown-menu-assignee li a") end def should_see(issue) diff --git a/features/steps/dashboard/merge_requests.rb b/features/steps/dashboard/merge_requests.rb index 06db36c7014..6777101fb15 100644 --- a/features/steps/dashboard/merge_requests.rb +++ b/features/steps/dashboard/merge_requests.rb @@ -47,9 +47,14 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps step 'I click "All" link' do find(".js-author-search").click + expect(page).to have_selector(".dropdown-menu-author li a") find(".dropdown-menu-author li a", match: :first).click + expect(page).not_to have_selector(".dropdown-menu-author li a") + find(".js-assignee-search").click + expect(page).to have_selector(".dropdown-menu-assignee li a") find(".dropdown-menu-assignee li a", match: :first).click + expect(page).not_to have_selector(".dropdown-menu-assignee li a") end def should_see(merge_request) diff --git a/features/steps/dashboard/new_project.rb b/features/steps/dashboard/new_project.rb index 727a6a71373..dcfa88f69fc 100644 --- a/features/steps/dashboard/new_project.rb +++ b/features/steps/dashboard/new_project.rb @@ -29,6 +29,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps end step 'I am redirected to the GitHub import page' do + expect(page).to have_content('Import Projects from GitHub') expect(current_path).to eq new_import_github_path end @@ -47,6 +48,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps end step 'I redirected to Google Code import page' do + expect(page).to have_content('Import projects from Google Code') expect(current_path).to eq new_import_google_code_path end end diff --git a/features/steps/project/builds/artifacts.rb b/features/steps/project/builds/artifacts.rb index b4a32ed2e38..055fca036d3 100644 --- a/features/steps/project/builds/artifacts.rb +++ b/features/steps/project/builds/artifacts.rb @@ -10,6 +10,7 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps step 'I click artifacts browse button' do click_link 'Browse' + expect(page).not_to have_selector('.build-sidebar') end step 'I should see content of artifacts archive' do diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb index 6b56a77b832..dacab6c7977 100644 --- a/features/steps/project/forked_merge_requests.rb +++ b/features/steps/project/forked_merge_requests.rb @@ -34,6 +34,9 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps end step 'I fill out a "Merge Request On Forked Project" merge request' do + expect(page).to have_content('Source branch') + expect(page).to have_content('Target branch') + first('.js-source-project').click first('.dropdown-source-project a', text: @forked_project.path_with_namespace) diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb index 35f166c7c08..c1592e1d142 100644 --- a/features/steps/project/issues/issues.rb +++ b/features/steps/project/issues/issues.rb @@ -355,5 +355,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps def filter_issue(text) fill_in 'issue_search', with: text + find('#issue_search').native.send_keys(:return) end end diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index a02a54923a5..53d1aedf27f 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -489,10 +489,12 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I fill in merge request search with "Fe"' do + sleep 1 fill_in 'issue_search', with: "Fe" end step 'I click the "Target branch" dropdown' do + expect(page).to have_content('Target branch') first('.target_branch').click end diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 9a8896acb15..2b74e964ca1 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -69,6 +69,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I edit code' do + expect(page).to have_selector('.file-editor') set_new_content end diff --git a/features/steps/project/wiki.rb b/features/steps/project/wiki.rb index 732dc5d0b93..07a955b1a14 100644 --- a/features/steps/project/wiki.rb +++ b/features/steps/project/wiki.rb @@ -142,7 +142,9 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'I edit the Wiki page with a path' do + expect(page).to have_content('three') click_on 'three' + expect(find('.nav-text')).to have_content('Three') click_on 'Edit' end diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb index b5fd24d246f..aa666a954bc 100644 --- a/features/steps/shared/issuable.rb +++ b/features/steps/shared/issuable.rb @@ -133,9 +133,7 @@ module SharedIssuable end step 'The list should be sorted by "Oldest updated"' do - page.within('.content div.dropdown.inline.prepend-left-10') do - expect(page.find('button.dropdown-toggle.btn')).to have_content('Oldest updated') - end + expect(find('.issues-filters')).to have_content('Oldest updated') end step 'I click link "Next" in the sidebar' do diff --git a/spec/features/issuables/default_sort_order_spec.rb b/spec/features/issuables/default_sort_order_spec.rb index 0d495cd04aa..9114f751b55 100644 --- a/spec/features/issuables/default_sort_order_spec.rb +++ b/spec/features/issuables/default_sort_order_spec.rb @@ -55,7 +55,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do it 'is "last updated"' do visit_merge_requests_with_state(project, 'merged') - expect(selected_sort_order).to eq('last updated') + expect(find('.issues-other-filters')).to have_content('Last updated') expect(first_merge_request).to include(last_updated_issuable.title) expect(last_merge_request).to include(first_updated_issuable.title) end @@ -67,7 +67,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do it 'is "last updated"' do visit_merge_requests_with_state(project, 'closed') - expect(selected_sort_order).to eq('last updated') + expect(find('.issues-other-filters')).to have_content('Last updated') expect(first_merge_request).to include(last_updated_issuable.title) expect(last_merge_request).to include(first_updated_issuable.title) end @@ -79,7 +79,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do it 'is "last created"' do visit_merge_requests_with_state(project, 'all') - expect(selected_sort_order).to eq('last created') + expect(find('.issues-other-filters')).to have_content('Last created') expect(first_merge_request).to include(last_created_issuable.title) expect(last_merge_request).to include(first_created_issuable.title) end @@ -108,7 +108,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do it 'is "last created"' do visit_issues project - expect(selected_sort_order).to eq('last created') + expect(find('.issues-other-filters')).to have_content('Last created') expect(first_issue).to include(last_created_issuable.title) expect(last_issue).to include(first_created_issuable.title) end @@ -120,7 +120,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do it 'is "last created"' do visit_issues_with_state(project, 'open') - expect(selected_sort_order).to eq('last created') + expect(find('.issues-other-filters')).to have_content('Last created') expect(first_issue).to include(last_created_issuable.title) expect(last_issue).to include(first_created_issuable.title) end @@ -132,7 +132,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do it 'is "last updated"' do visit_issues_with_state(project, 'closed') - expect(selected_sort_order).to eq('last updated') + expect(find('.issues-other-filters')).to have_content('Last updated') expect(first_issue).to include(last_updated_issuable.title) expect(last_issue).to include(first_updated_issuable.title) end @@ -144,7 +144,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do it 'is "last created"' do visit_issues_with_state(project, 'all') - expect(selected_sort_order).to eq('last created') + expect(find('.issues-other-filters')).to have_content('Last created') expect(first_issue).to include(last_created_issuable.title) expect(last_issue).to include(first_created_issuable.title) end diff --git a/spec/features/issues/filter_issues_spec.rb b/spec/features/issues/filter_issues_spec.rb index ea81ee54c90..e262f285868 100644 --- a/spec/features/issues/filter_issues_spec.rb +++ b/spec/features/issues/filter_issues_spec.rb @@ -117,7 +117,7 @@ describe 'Filter issues', feature: true do find('.dropdown-menu-user-link', text: user.username).click - wait_for_ajax + expect(page).not_to have_selector('.issues-list .issue') find('.js-label-select').click diff --git a/spec/features/merge_requests/create_new_mr_spec.rb b/spec/features/merge_requests/create_new_mr_spec.rb index e296078bad8..11c9de3c4bf 100644 --- a/spec/features/merge_requests/create_new_mr_spec.rb +++ b/spec/features/merge_requests/create_new_mr_spec.rb @@ -13,6 +13,8 @@ feature 'Create New Merge Request', feature: true, js: true do it 'generates a diff for an orphaned branch' do click_link 'New Merge Request' + expect(page).to have_content('Source branch') + expect(page).to have_content('Target branch') first('.js-source-branch').click first('.dropdown-source-branch .dropdown-content a', text: 'orphaned-branch').click diff --git a/spec/features/profiles/preferences_spec.rb b/spec/features/profiles/preferences_spec.rb index 787bf42d048..259ed7531d8 100644 --- a/spec/features/profiles/preferences_spec.rb +++ b/spec/features/profiles/preferences_spec.rb @@ -68,10 +68,14 @@ describe 'Profile > Preferences', feature: true do allowing_for_delay do find('#logo').click + + expect(page).to have_content('You don\'t have starred projects yet') expect(page.current_path).to eq starred_dashboard_projects_path end click_link 'Your Projects' + + expect(page).not_to have_content('You don\'t have starred projects yet') expect(page.current_path).to eq dashboard_projects_path end end diff --git a/spec/features/projects/files/project_owner_creates_license_file_spec.rb b/spec/features/projects/files/project_owner_creates_license_file_spec.rb index e1e105e6bbe..dbd07464444 100644 --- a/spec/features/projects/files/project_owner_creates_license_file_spec.rb +++ b/spec/features/projects/files/project_owner_creates_license_file_spec.rb @@ -39,6 +39,7 @@ feature 'project owner creates a license file', feature: true, js: true do scenario 'project master creates a license file from the "Add license" link' do click_link 'Add License' + expect(page).to have_content('New File') expect(current_path).to eq( namespace_project_new_blob_path(project.namespace, project, 'master')) expect(find('#file_name').value).to eq('LICENSE') diff --git a/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb b/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb index 67aac25e427..45bf0c0d038 100644 --- a/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb +++ b/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb @@ -14,6 +14,7 @@ feature 'project owner sees a link to create a license file in empty project', f visit namespace_project_path(project.namespace, project) click_link 'Create empty bare repository' click_on 'LICENSE' + expect(page).to have_content('New File') expect(current_path).to eq( namespace_project_new_blob_path(project.namespace, project, 'master')) diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb index 61f2bc61e0c..d7880d5778f 100644 --- a/spec/features/variables_spec.rb +++ b/spec/features/variables_spec.rb @@ -42,6 +42,7 @@ describe 'Project variables', js: true do find('.btn-variable-edit').click end + expect(page).to have_content('Update variable') fill_in('variable_key', with: 'key') fill_in('variable_value', with: 'key value') click_button('Save variable') -- cgit v1.2.1 From 59955fbbbd5f807654e0861f49b182f27654d4cc Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 11 Aug 2016 18:09:17 +0100 Subject: Used mirrored version on GitLab --- scripts/prepare_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index e6a673c94e9..c1ee808e75d 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -22,7 +22,7 @@ if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then pushd vendor/apt PHANTOMJS_FILE="phantomjs-$PHANTOMJS_VERSION-linux-x86_64" if [ ! -d "$PHANTOMJS_FILE" ]; then - curl -q -L "https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOMJS_FILE.tar.bz2" | tar jx + curl -q -L "https://gitlab.com/iamphill/phantomjs/raw/master/$PHANTOMJS_FILE.tar.bz2" | tar jx fi cp "$PHANTOMJS_FILE/bin/phantomjs" "/usr/bin/" popd -- cgit v1.2.1 From 61bdc80dbad253f6532a83ae2554de82deb40e5f Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 12 Aug 2016 10:10:59 +0100 Subject: Updated failing tests --- app/assets/javascripts/issuable.js | 11 ++++------- features/steps/dashboard/dashboard.rb | 1 + features/steps/dashboard/event_filters.rb | 10 ++++++++++ features/steps/project/source/browse_files.rb | 1 + features/support/wait_for_ajax.rb | 11 +++++++++++ 5 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 features/support/wait_for_ajax.rb diff --git a/app/assets/javascripts/issuable.js b/app/assets/javascripts/issuable.js index f27f1bad1f7..d0305c6c6a1 100644 --- a/app/assets/javascripts/issuable.js +++ b/app/assets/javascripts/issuable.js @@ -5,13 +5,10 @@ this.Issuable = { init: function() { - if (!issuable_created) { - issuable_created = true; - Issuable.initTemplates(); - Issuable.initSearch(); - Issuable.initChecks(); - return Issuable.initLabelFilterRemove(); - } + Issuable.initTemplates(); + Issuable.initSearch(); + Issuable.initChecks(); + return Issuable.initLabelFilterRemove(); }, initTemplates: function() { return Issuable.labelRow = _.template('<% _.each(labels, function(label){ %> <%- label.title %> <% }); %>'); diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb index 80ed4c6d64c..a7d61bc28e0 100644 --- a/features/steps/dashboard/dashboard.rb +++ b/features/steps/dashboard/dashboard.rb @@ -26,6 +26,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps end step 'I see prefilled new Merge Request page' do + expect(page).to have_selector('.merge-request-form') expect(current_path).to eq new_namespace_project_merge_request_path(@project.namespace, @project) expect(find("#merge_request_target_project_id").value).to eq @project.id.to_s expect(find("input#merge_request_source_branch").value).to eq "fix" diff --git a/features/steps/dashboard/event_filters.rb b/features/steps/dashboard/event_filters.rb index 97b17abb470..1806bb138eb 100644 --- a/features/steps/dashboard/event_filters.rb +++ b/features/steps/dashboard/event_filters.rb @@ -1,34 +1,44 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps + include WaitForAjax include SharedAuthentication include SharedPaths include SharedProject step 'I should see push event' do + wait_for_ajax sleep 1 expect(page).to have_selector('span.pushed') end step 'I should not see push event' do + wait_for_ajax + save_and_open_screenshot sleep 1 + save_and_open_screenshot expect(page).not_to have_selector('span.pushed') + save_and_open_screenshot end step 'I should see new member event' do + wait_for_ajax sleep 1 expect(page).to have_selector('span.joined') end step 'I should not see new member event' do + wait_for_ajax sleep 1 expect(page).not_to have_selector('span.joined') end step 'I should see merge request event' do + wait_for_ajax sleep 1 expect(page).to have_selector('span.accepted') end step 'I should not see merge request event' do + wait_for_ajax sleep 1 expect(page).not_to have_selector('span.accepted') end diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 2b74e964ca1..841d191d55b 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -132,6 +132,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps step 'I click on "New file" link in repo' do find('.add-to-tree').click click_link 'New file' + expect(page).to have_selector('.file-editor') end step 'I click on "Upload file" link in repo' do diff --git a/features/support/wait_for_ajax.rb b/features/support/wait_for_ajax.rb new file mode 100644 index 00000000000..b90fc112671 --- /dev/null +++ b/features/support/wait_for_ajax.rb @@ -0,0 +1,11 @@ +module WaitForAjax + def wait_for_ajax + Timeout.timeout(Capybara.default_max_wait_time) do + loop until finished_all_ajax_requests? + end + end + + def finished_all_ajax_requests? + page.evaluate_script('jQuery.active').zero? + end +end -- cgit v1.2.1 From a0cd87d175a2e2c7a19595f7fa4d250309850a35 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 12 Aug 2016 10:41:17 +0100 Subject: Removed screenshot command :poop: --- features/steps/dashboard/event_filters.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/features/steps/dashboard/event_filters.rb b/features/steps/dashboard/event_filters.rb index 1806bb138eb..c9896cbc24a 100644 --- a/features/steps/dashboard/event_filters.rb +++ b/features/steps/dashboard/event_filters.rb @@ -12,11 +12,8 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps step 'I should not see push event' do wait_for_ajax - save_and_open_screenshot sleep 1 - save_and_open_screenshot expect(page).not_to have_selector('span.pushed') - save_and_open_screenshot end step 'I should see new member event' do -- cgit v1.2.1 From c617cbfcd66a5ded22041e06b5e68454c7145029 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 12 Aug 2016 12:47:17 +0100 Subject: Fixed filtering tests --- features/steps/dashboard/event_filters.rb | 15 +++------------ features/steps/project/issues/issues.rb | 3 ++- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/features/steps/dashboard/event_filters.rb b/features/steps/dashboard/event_filters.rb index c9896cbc24a..2708e191f75 100644 --- a/features/steps/dashboard/event_filters.rb +++ b/features/steps/dashboard/event_filters.rb @@ -5,38 +5,26 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps include SharedProject step 'I should see push event' do - wait_for_ajax - sleep 1 expect(page).to have_selector('span.pushed') end step 'I should not see push event' do - wait_for_ajax - sleep 1 expect(page).not_to have_selector('span.pushed') end step 'I should see new member event' do - wait_for_ajax - sleep 1 expect(page).to have_selector('span.joined') end step 'I should not see new member event' do - wait_for_ajax - sleep 1 expect(page).not_to have_selector('span.joined') end step 'I should see merge request event' do - wait_for_ajax - sleep 1 expect(page).to have_selector('span.accepted') end step 'I should not see merge request event' do - wait_for_ajax - sleep 1 expect(page).not_to have_selector('span.accepted') end @@ -86,13 +74,16 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps When 'I click "push" event filter' do click_link("push_event_filter") + sleep 1 end When 'I click "team" event filter' do click_link("team_event_filter") + sleep 1 end When 'I click "merge" event filter' do click_link("merged_event_filter") + sleep 1 end end diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb index c1592e1d142..daee90b3767 100644 --- a/features/steps/project/issues/issues.rb +++ b/features/steps/project/issues/issues.rb @@ -354,7 +354,8 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end def filter_issue(text) + sleep 1 fill_in 'issue_search', with: text - find('#issue_search').native.send_keys(:return) + sleep 1 end end -- cgit v1.2.1 From 5d8ad797503c76ab9818584cf3b2e945ff8cfd68 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 12 Aug 2016 13:39:29 +0100 Subject: Filters test fix --- features/steps/dashboard/event_filters.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/features/steps/dashboard/event_filters.rb b/features/steps/dashboard/event_filters.rb index 2708e191f75..3ff260c0027 100644 --- a/features/steps/dashboard/event_filters.rb +++ b/features/steps/dashboard/event_filters.rb @@ -73,17 +73,20 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps end When 'I click "push" event filter' do - click_link("push_event_filter") sleep 1 + click_link("Push events") + sleep 2 end When 'I click "team" event filter' do - click_link("team_event_filter") sleep 1 + click_link("Team") + sleep 2 end When 'I click "merge" event filter' do - click_link("merged_event_filter") sleep 1 + click_link("Merge events") + sleep 2 end end -- cgit v1.2.1 From 1392cad8956c490b5ba6106678ab16d790662148 Mon Sep 17 00:00:00 2001 From: Connor Shea Date: Fri, 12 Aug 2016 11:44:43 -0600 Subject: Remove sleeping and replace escaped text. --- features/steps/dashboard/event_filters.rb | 12 ++++++------ spec/features/profiles/preferences_spec.rb | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/features/steps/dashboard/event_filters.rb b/features/steps/dashboard/event_filters.rb index 3ff260c0027..ca3cd0ecc4e 100644 --- a/features/steps/dashboard/event_filters.rb +++ b/features/steps/dashboard/event_filters.rb @@ -73,20 +73,20 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps end When 'I click "push" event filter' do - sleep 1 + wait_for_ajax click_link("Push events") - sleep 2 + wait_for_ajax end When 'I click "team" event filter' do - sleep 1 + wait_for_ajax click_link("Team") - sleep 2 + wait_for_ajax end When 'I click "merge" event filter' do - sleep 1 + wait_for_ajax click_link("Merge events") - sleep 2 + wait_for_ajax end end diff --git a/spec/features/profiles/preferences_spec.rb b/spec/features/profiles/preferences_spec.rb index 259ed7531d8..d14a1158b67 100644 --- a/spec/features/profiles/preferences_spec.rb +++ b/spec/features/profiles/preferences_spec.rb @@ -69,13 +69,13 @@ describe 'Profile > Preferences', feature: true do allowing_for_delay do find('#logo').click - expect(page).to have_content('You don\'t have starred projects yet') + expect(page).to have_content("You don't have starred projects yet") expect(page.current_path).to eq starred_dashboard_projects_path end click_link 'Your Projects' - expect(page).not_to have_content('You don\'t have starred projects yet') + expect(page).not_to have_content("You don't have starred projects yet") expect(page.current_path).to eq dashboard_projects_path end end -- cgit v1.2.1 From 2cf3c1c31a80d2827c179535362de111ffa72404 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Fri, 12 Aug 2016 15:29:39 -0500 Subject: Update phantomjs link --- scripts/prepare_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index c1ee808e75d..388c1a4dafb 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -22,7 +22,7 @@ if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then pushd vendor/apt PHANTOMJS_FILE="phantomjs-$PHANTOMJS_VERSION-linux-x86_64" if [ ! -d "$PHANTOMJS_FILE" ]; then - curl -q -L "https://gitlab.com/iamphill/phantomjs/raw/master/$PHANTOMJS_FILE.tar.bz2" | tar jx + curl -q -L "https://s3.amazonaws.com/gitlab-build-helpers/phantomjs-2.1.1-linux-x86_64.tar.bz2" | tar jx fi cp "$PHANTOMJS_FILE/bin/phantomjs" "/usr/bin/" popd -- cgit v1.2.1 From 501a7e89978a03e7e10f497c5ad0d4f87319dbe5 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Mon, 15 Aug 2016 11:43:23 +0100 Subject: Used phantomjs variable --- scripts/prepare_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 388c1a4dafb..76b2178c79c 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -22,7 +22,7 @@ if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then pushd vendor/apt PHANTOMJS_FILE="phantomjs-$PHANTOMJS_VERSION-linux-x86_64" if [ ! -d "$PHANTOMJS_FILE" ]; then - curl -q -L "https://s3.amazonaws.com/gitlab-build-helpers/phantomjs-2.1.1-linux-x86_64.tar.bz2" | tar jx + curl -q -L "https://s3.amazonaws.com/gitlab-build-helpers/$PHANTOMJS_FILE.tar.bz2" | tar jx fi cp "$PHANTOMJS_FILE/bin/phantomjs" "/usr/bin/" popd -- cgit v1.2.1