Commit 6af598fc authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'new-phantomjs-version' into 'master'

Use new PhantomJS version

## What does this MR do?
Makes CI builds to use PhantomJS 2.1.1.

## Are there points in the code the reviewer needs to double check?

## Why was this MR needed?

## What are the relevant issue numbers?

## Screenshots (if relevant)

## Does this MR meet the acceptance criteria?

- [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- Tests
  - [ ] Added for this feature/bug
  - [ ] All builds are passing
- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5740
parents 20f9b8be 501a7e89
...@@ -15,6 +15,7 @@ variables: ...@@ -15,6 +15,7 @@ variables:
USE_DB: "true" USE_DB: "true"
USE_BUNDLE_INSTALL: "true" USE_BUNDLE_INSTALL: "true"
GIT_DEPTH: "20" GIT_DEPTH: "20"
PHANTOMJS_VERSION: "2.1.1"
before_script: before_script:
- source ./scripts/prepare_build.sh - source ./scripts/prepare_build.sh
......
...@@ -5,13 +5,10 @@ ...@@ -5,13 +5,10 @@
this.Issuable = { this.Issuable = {
init: function() { init: function() {
if (!issuable_created) { Issuable.initTemplates();
issuable_created = true; Issuable.initSearch();
Issuable.initTemplates(); Issuable.initChecks();
Issuable.initSearch(); return Issuable.initLabelFilterRemove();
Issuable.initChecks();
return Issuable.initLabelFilterRemove();
}
}, },
initTemplates: function() { initTemplates: function() {
return Issuable.labelRow = _.template('<% _.each(labels, function(label){ %> <span class="label-row btn-group" role="group" aria-label="<%- label.title %>" style="color: <%- label.text_color %>;"> <a href="#" class="btn btn-transparent has-tooltip" style="background-color: <%- label.color %>;" title="<%- label.description %>" data-container="body"> <%- label.title %> </a> <button type="button" class="btn btn-transparent label-remove js-label-filter-remove" style="background-color: <%- label.color %>;" data-label="<%- label.title %>"> <i class="fa fa-times"></i> </button> </span> <% }); %>'); return Issuable.labelRow = _.template('<% _.each(labels, function(label){ %> <span class="label-row btn-group" role="group" aria-label="<%- label.title %>" style="color: <%- label.text_color %>;"> <a href="#" class="btn btn-transparent has-tooltip" style="background-color: <%- label.color %>;" title="<%- label.description %>" data-container="body"> <%- label.title %> </a> <button type="button" class="btn btn-transparent label-remove js-label-filter-remove" style="background-color: <%- label.color %>;" data-label="<%- label.title %>"> <i class="fa fa-times"></i> </button> </span> <% }); %>');
......
...@@ -26,6 +26,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps ...@@ -26,6 +26,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
end end
step 'I see prefilled new Merge Request page' do 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(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("#merge_request_target_project_id").value).to eq @project.id.to_s
expect(find("input#merge_request_source_branch").value).to eq "fix" expect(find("input#merge_request_source_branch").value).to eq "fix"
......
class Spinach::Features::EventFilters < Spinach::FeatureSteps class Spinach::Features::EventFilters < Spinach::FeatureSteps
include WaitForAjax
include SharedAuthentication include SharedAuthentication
include SharedPaths include SharedPaths
include SharedProject include SharedProject
...@@ -72,14 +73,20 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps ...@@ -72,14 +73,20 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps
end end
When 'I click "push" event filter' do When 'I click "push" event filter' do
click_link("push_event_filter") wait_for_ajax
click_link("Push events")
wait_for_ajax
end end
When 'I click "team" event filter' do When 'I click "team" event filter' do
click_link("team_event_filter") wait_for_ajax
click_link("Team")
wait_for_ajax
end end
When 'I click "merge" event filter' do When 'I click "merge" event filter' do
click_link("merged_event_filter") wait_for_ajax
click_link("Merge events")
wait_for_ajax
end end
end end
...@@ -43,9 +43,14 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps ...@@ -43,9 +43,14 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps
step 'I click "All" link' do step 'I click "All" link' do
find(".js-author-search").click find(".js-author-search").click
expect(page).to have_selector(".dropdown-menu-author li a")
find(".dropdown-menu-author li a", match: :first).click 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 find(".js-assignee-search").click
expect(page).to have_selector(".dropdown-menu-assignee li a")
find(".dropdown-menu-assignee li a", match: :first).click find(".dropdown-menu-assignee li a", match: :first).click
expect(page).not_to have_selector(".dropdown-menu-assignee li a")
end end
def should_see(issue) def should_see(issue)
......
...@@ -47,9 +47,14 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps ...@@ -47,9 +47,14 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps
step 'I click "All" link' do step 'I click "All" link' do
find(".js-author-search").click find(".js-author-search").click
expect(page).to have_selector(".dropdown-menu-author li a")
find(".dropdown-menu-author li a", match: :first).click 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 find(".js-assignee-search").click
expect(page).to have_selector(".dropdown-menu-assignee li a")
find(".dropdown-menu-assignee li a", match: :first).click find(".dropdown-menu-assignee li a", match: :first).click
expect(page).not_to have_selector(".dropdown-menu-assignee li a")
end end
def should_see(merge_request) def should_see(merge_request)
......
...@@ -29,6 +29,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps ...@@ -29,6 +29,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
end end
step 'I am redirected to the GitHub import page' do 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 expect(current_path).to eq new_import_github_path
end end
...@@ -47,6 +48,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps ...@@ -47,6 +48,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
end end
step 'I redirected to Google Code import page' do 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 expect(current_path).to eq new_import_google_code_path
end end
end end
...@@ -10,6 +10,7 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps ...@@ -10,6 +10,7 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps
step 'I click artifacts browse button' do step 'I click artifacts browse button' do
click_link 'Browse' click_link 'Browse'
expect(page).not_to have_selector('.build-sidebar')
end end
step 'I should see content of artifacts archive' do step 'I should see content of artifacts archive' do
......
...@@ -34,6 +34,9 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -34,6 +34,9 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
end end
step 'I fill out a "Merge Request On Forked Project" merge request' do 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('.js-source-project').click
first('.dropdown-source-project a', text: @forked_project.path_with_namespace) first('.dropdown-source-project a', text: @forked_project.path_with_namespace)
......
...@@ -354,6 +354,8 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps ...@@ -354,6 +354,8 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end end
def filter_issue(text) def filter_issue(text)
sleep 1
fill_in 'issue_search', with: text fill_in 'issue_search', with: text
sleep 1
end end
end end
...@@ -489,10 +489,12 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -489,10 +489,12 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I fill in merge request search with "Fe"' do step 'I fill in merge request search with "Fe"' do
sleep 1
fill_in 'issue_search', with: "Fe" fill_in 'issue_search', with: "Fe"
end end
step 'I click the "Target branch" dropdown' do step 'I click the "Target branch" dropdown' do
expect(page).to have_content('Target branch')
first('.target_branch').click first('.target_branch').click
end end
......
...@@ -69,6 +69,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps ...@@ -69,6 +69,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end end
step 'I edit code' do step 'I edit code' do
expect(page).to have_selector('.file-editor')
set_new_content set_new_content
end end
...@@ -131,6 +132,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps ...@@ -131,6 +132,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
step 'I click on "New file" link in repo' do step 'I click on "New file" link in repo' do
find('.add-to-tree').click find('.add-to-tree').click
click_link 'New file' click_link 'New file'
expect(page).to have_selector('.file-editor')
end end
step 'I click on "Upload file" link in repo' do step 'I click on "Upload file" link in repo' do
......
...@@ -142,7 +142,9 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps ...@@ -142,7 +142,9 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
end end
step 'I edit the Wiki page with a path' do step 'I edit the Wiki page with a path' do
expect(page).to have_content('three')
click_on 'three' click_on 'three'
expect(find('.nav-text')).to have_content('Three')
click_on 'Edit' click_on 'Edit'
end end
......
...@@ -133,9 +133,7 @@ module SharedIssuable ...@@ -133,9 +133,7 @@ module SharedIssuable
end end
step 'The list should be sorted by "Oldest updated"' do step 'The list should be sorted by "Oldest updated"' do
page.within('.content div.dropdown.inline.prepend-left-10') do expect(find('.issues-filters')).to have_content('Oldest updated')
expect(page.find('button.dropdown-toggle.btn')).to have_content('Oldest updated')
end
end end
step 'I click link "Next" in the sidebar' do step 'I click link "Next" in the sidebar' do
......
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
...@@ -20,10 +20,11 @@ if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then ...@@ -20,10 +20,11 @@ if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then
# Install phantomjs package # Install phantomjs package
pushd vendor/apt pushd vendor/apt
if [ ! -e phantomjs_1.9.8-0jessie_amd64.deb ]; then PHANTOMJS_FILE="phantomjs-$PHANTOMJS_VERSION-linux-x86_64"
wget -q https://gitlab.com/axil/phantomjs-debian/raw/master/phantomjs_1.9.8-0jessie_amd64.deb if [ ! -d "$PHANTOMJS_FILE" ]; then
curl -q -L "https://s3.amazonaws.com/gitlab-build-helpers/$PHANTOMJS_FILE.tar.bz2" | tar jx
fi fi
dpkg -i phantomjs_1.9.8-0jessie_amd64.deb cp "$PHANTOMJS_FILE/bin/phantomjs" "/usr/bin/"
popd popd
# Try to install packages # Try to install packages
......
...@@ -55,7 +55,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do ...@@ -55,7 +55,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do
it 'is "last updated"' do it 'is "last updated"' do
visit_merge_requests_with_state(project, 'merged') 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(first_merge_request).to include(last_updated_issuable.title)
expect(last_merge_request).to include(first_updated_issuable.title) expect(last_merge_request).to include(first_updated_issuable.title)
end end
...@@ -67,7 +67,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do ...@@ -67,7 +67,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do
it 'is "last updated"' do it 'is "last updated"' do
visit_merge_requests_with_state(project, 'closed') 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(first_merge_request).to include(last_updated_issuable.title)
expect(last_merge_request).to include(first_updated_issuable.title) expect(last_merge_request).to include(first_updated_issuable.title)
end end
...@@ -79,7 +79,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do ...@@ -79,7 +79,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do
it 'is "last created"' do it 'is "last created"' do
visit_merge_requests_with_state(project, 'all') 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(first_merge_request).to include(last_created_issuable.title)
expect(last_merge_request).to include(first_created_issuable.title) expect(last_merge_request).to include(first_created_issuable.title)
end end
...@@ -108,7 +108,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do ...@@ -108,7 +108,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do
it 'is "last created"' do it 'is "last created"' do
visit_issues project 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(first_issue).to include(last_created_issuable.title)
expect(last_issue).to include(first_created_issuable.title) expect(last_issue).to include(first_created_issuable.title)
end end
...@@ -120,7 +120,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do ...@@ -120,7 +120,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do
it 'is "last created"' do it 'is "last created"' do
visit_issues_with_state(project, 'open') 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(first_issue).to include(last_created_issuable.title)
expect(last_issue).to include(first_created_issuable.title) expect(last_issue).to include(first_created_issuable.title)
end end
...@@ -132,7 +132,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do ...@@ -132,7 +132,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do
it 'is "last updated"' do it 'is "last updated"' do
visit_issues_with_state(project, 'closed') 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(first_issue).to include(last_updated_issuable.title)
expect(last_issue).to include(first_updated_issuable.title) expect(last_issue).to include(first_updated_issuable.title)
end end
...@@ -144,7 +144,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do ...@@ -144,7 +144,7 @@ describe 'Projects > Issuables > Default sort order', feature: true do
it 'is "last created"' do it 'is "last created"' do
visit_issues_with_state(project, 'all') 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(first_issue).to include(last_created_issuable.title)
expect(last_issue).to include(first_created_issuable.title) expect(last_issue).to include(first_created_issuable.title)
end end
......
...@@ -117,7 +117,7 @@ describe 'Filter issues', feature: true do ...@@ -117,7 +117,7 @@ describe 'Filter issues', feature: true do
find('.dropdown-menu-user-link', text: user.username).click 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 find('.js-label-select').click
......
...@@ -13,6 +13,8 @@ feature 'Create New Merge Request', feature: true, js: true do ...@@ -13,6 +13,8 @@ feature 'Create New Merge Request', feature: true, js: true do
it 'generates a diff for an orphaned branch' do it 'generates a diff for an orphaned branch' do
click_link 'New Merge Request' 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('.js-source-branch').click
first('.dropdown-source-branch .dropdown-content a', text: 'orphaned-branch').click first('.dropdown-source-branch .dropdown-content a', text: 'orphaned-branch').click
......
...@@ -68,10 +68,14 @@ describe 'Profile > Preferences', feature: true do ...@@ -68,10 +68,14 @@ describe 'Profile > Preferences', feature: true do
allowing_for_delay do allowing_for_delay do
find('#logo').click 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 expect(page.current_path).to eq starred_dashboard_projects_path
end end
click_link 'Your Projects' 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 expect(page.current_path).to eq dashboard_projects_path
end end
end end
......
...@@ -39,6 +39,7 @@ feature 'project owner creates a license file', feature: true, js: true do ...@@ -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 scenario 'project master creates a license file from the "Add license" link' do
click_link 'Add License' click_link 'Add License'
expect(page).to have_content('New File')
expect(current_path).to eq( expect(current_path).to eq(
namespace_project_new_blob_path(project.namespace, project, 'master')) namespace_project_new_blob_path(project.namespace, project, 'master'))
expect(find('#file_name').value).to eq('LICENSE') expect(find('#file_name').value).to eq('LICENSE')
......
...@@ -14,6 +14,7 @@ feature 'project owner sees a link to create a license file in empty project', f ...@@ -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) visit namespace_project_path(project.namespace, project)
click_link 'Create empty bare repository' click_link 'Create empty bare repository'
click_on 'LICENSE' click_on 'LICENSE'
expect(page).to have_content('New File')
expect(current_path).to eq( expect(current_path).to eq(
namespace_project_new_blob_path(project.namespace, project, 'master')) namespace_project_new_blob_path(project.namespace, project, 'master'))
......
require 'spec_helper' require 'spec_helper'
feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: true, js: true do 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) } 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) def register_u2f_device(u2f_device = nil)
u2f_device ||= FakeU2fDevice.new(page) u2f_device ||= FakeU2fDevice.new(page)
u2f_device.respond_to_u2f_registration u2f_device.respond_to_u2f_registration
...@@ -34,7 +42,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: ...@@ -34,7 +42,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
describe 'when 2FA via OTP is enabled' do describe 'when 2FA via OTP is enabled' do
it 'allows registering a new device' do it 'allows registering a new device' do
visit profile_account_path 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") expect(page.body).to match("You've already enabled two-factor authentication using mobile")
register_u2f_device register_u2f_device
...@@ -46,15 +54,15 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: ...@@ -46,15 +54,15 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
visit profile_account_path visit profile_account_path
# First device # First device
click_on 'Manage Two-Factor Authentication' manage_two_factor_authentication
register_u2f_device register_u2f_device
expect(page.body).to match('Your U2F device was registered') expect(page.body).to match('Your U2F device was registered')
# Second device # Second device
click_on 'Manage Two-Factor Authentication' manage_two_factor_authentication
register_u2f_device register_u2f_device
expect(page.body).to match('Your U2F device was registered') 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') expect(page.body).to match('You have 2 U2F devices registered')
end end
end end
...@@ -62,7 +70,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: ...@@ -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 it 'allows the same device to be registered for multiple users' do
# First user # First user
visit profile_account_path visit profile_account_path
click_on 'Manage Two-Factor Authentication' manage_two_factor_authentication
u2f_device = register_u2f_device u2f_device = register_u2f_device
expect(page.body).to match('Your U2F device was registered') expect(page.body).to match('Your U2F device was registered')
logout logout
...@@ -71,7 +79,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: ...@@ -71,7 +79,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
user = login_as(:user) user = login_as(:user)
user.update_attribute(:otp_required_for_login, true) user.update_attribute(:otp_required_for_login, true)
visit profile_account_path visit profile_account_path
click_on 'Manage Two-Factor Authentication' manage_two_factor_authentication
register_u2f_device(u2f_device) register_u2f_device(u2f_device)
expect(page.body).to match('Your U2F device was registered') expect(page.body).to match('Your U2F device was registered')
...@@ -81,7 +89,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: ...@@ -81,7 +89,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
context "when there are form errors" do context "when there are form errors" do
it "doesn't register the device if there are errors" do it "doesn't register the device if there are errors" do
visit profile_account_path visit profile_account_path
click_on 'Manage Two-Factor Authentication' manage_two_factor_authentication
# Have the "u2f device" respond with bad data # Have the "u2f device" respond with bad data
page.execute_script("u2f.register = function(_,_,_,callback) { callback('bad response'); };") page.execute_script("u2f.register = function(_,_,_,callback) { callback('bad response'); };")
...@@ -96,7 +104,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: ...@@ -96,7 +104,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
it "allows retrying registration" do it "allows retrying registration" do
visit profile_account_path visit profile_account_path
click_on 'Manage Two-Factor Authentication' manage_two_factor_authentication
# Failed registration # Failed registration
page.execute_script("u2f.register = function(_,_,_,callback) { callback('bad response'); };") page.execute_script("u2f.register = function(_,_,_,callback) { callback('bad response'); };")
...@@ -122,7 +130,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: ...@@ -122,7 +130,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
login_as(user) login_as(user)
user.update_attribute(:otp_required_for_login, true) user.update_attribute(:otp_required_for_login, true)
visit profile_account_path visit profile_account_path
click_on 'Manage Two-Factor Authentication' manage_two_factor_authentication
@u2f_device = register_u2f_device @u2f_device = register_u2f_device
logout logout
end end
...@@ -161,7 +169,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: ...@@ -161,7 +169,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
current_user = login_as(:user) current_user = login_as(:user)
current_user.update_attribute(:otp_required_for_login, true) current_user.update_attribute(:otp_required_for_login, true)
visit profile_account_path visit profile_account_path
click_on 'Manage Two-Factor Authentication' manage_two_factor_authentication
register_u2f_device register_u2f_device
logout logout
...@@ -182,7 +190,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: ...@@ -182,7 +190,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
current_user = login_as(:user) current_user = login_as(:user)
current_user.update_attribute(:otp_required_for_login, true) current_user.update_attribute(:otp_required_for_login, true)
visit profile_account_path visit profile_account_path
click_on 'Manage Two-Factor Authentication' manage_two_factor_authentication
register_u2f_device(@u2f_device) register_u2f_device(@u2f_device)
logout logout
...@@ -248,7 +256,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature: ...@@ -248,7 +256,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
user = login_as(:user) user = login_as(:user)
user.update_attribute(:otp_required_for_login, true) user.update_attribute(:otp_required_for_login, true)
visit profile_account_path 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.") expect(page).to have_content("Your U2F device needs to be set up.")
register_u2f_device register_u2f_device
end end
......
...@@ -42,6 +42,7 @@ describe 'Project variables', js: true do ...@@ -42,6 +42,7 @@ describe 'Project variables', js: true do
find('.btn-variable-edit').click find('.btn-variable-edit').click
end end
expect(page).to have_content('Update variable')
fill_in('variable_key', with: 'key') fill_in('variable_key', with: 'key')
fill_in('variable_value', with: 'key value') fill_in('variable_value', with: 'key value')
click_button('Save variable') click_button('Save variable')
......
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