OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Standalone CI docker container (#8943)
Cyril Rohrb4086b2968b1
diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.ymlnew file mode 100644index 00000000000..1898cf55302--- /dev/null+++ b/.github/workflows/test-core.yml@@ -0,0 +1,60 @@+name: Core/Test+on:+ push:++jobs:+ units:+ name: Units+ if: github.repository == 'opf/openproject'+ runs-on: [self-hosted,public]+ timeout-minutes: 30+ env:+ CI_CACHE_PATH: "/tmp/${{ github.sha }}/"+ CI_JOBS: 16+ CI_RETRY_COUNT: 3+ LOCAL_DEV_CHECK: 1+ steps:+ - uses: actions/checkout@v2+ - name: cache+ uses: actions/cache@v2+ with:+ path: /tmp/${{ github.sha }}+ key: ${{ runner.os }}-core-tests+ - name: test+ run: |+ cp .env.example .env+ docker-compose -f docker-compose.ci.yml build ci+ docker-compose -f docker-compose.ci.yml run ci setup-tests run-units+ - name: cleanup+ if: ${{ always() }}+ run: |+ docker-compose -f docker-compose.ci.yml down --remove-orphans -t 10+ sudo chown -R $(whoami):$(id -ng) $CI_CACHE_PATH+ features:+ needs: units+ name: Features+ if: github.repository == 'opf/openproject'+ runs-on: [self-hosted,public]+ timeout-minutes: 200+ env:+ CI_JOBS: 16+ CI_CACHE_PATH: "/tmp/${{ github.sha }}/"+ LOCAL_DEV_CHECK: 1+ CI_RETRY_COUNT: 3+ steps:+ - uses: actions/checkout@v2+ - name: cache+ uses: actions/cache@v2+ with:+ path: /tmp/${{ github.sha }}+ key: ${{ runner.os }}-core-tests+ - name: test+ run: |+ cp .env.example .env+ docker-compose -f docker-compose.ci.yml build ci+ docker-compose -f docker-compose.ci.yml run ci setup-tests run-features+ - name: cleanup+ if: ${{ always() }}+ run: |+ docker-compose -f docker-compose.ci.yml down --remove-orphans -t 10+ sudo chown -R $(whoami):$(id -ng) $CI_CACHE_PATHdiff --git a/.rspec_parallel b/.rspec_parallelnew file mode 100644index 00000000000..aaff198a32c--- /dev/null+++ b/.rspec_parallel@@ -0,0 +1,2 @@+--format progress+--format ParallelTests::RSpec::RuntimeLogger --out tmp/parallel_runtime_rspec.logdiff --git a/config/application.rb b/config/application.rbindex 2f7e275ce3c..8709e2e541f 100644--- a/config/application.rb+++ b/config/application.rb@@ -34,7 +34,10 @@ require 'active_support'require 'active_support/dependencies'require 'core_extensions'-ActiveSupport::Deprecation.silenced = Rails.env.production? && !ENV['OPENPROJECT_SHOW_DEPRECATIONS']+# Silence deprecations early on for testing on CI and production+ActiveSupport::Deprecation.silenced =+ (Rails.env.production? && !ENV['OPENPROJECT_SHOW_DEPRECATIONS']) ||+ (Rails.env.test? && ENV['CI'])if defined?(Bundler)# lib directory has to be added to the load path so thatdiff --git a/config/environments/test.rb b/config/environments/test.rbindex f81579b4fc1..00465982f4c 100644--- a/config/environments/test.rb+++ b/config/environments/test.rb@@ -66,7 +66,12 @@ OpenProject::Application.configure doconfig.action_mailer.delivery_method = :test# Print deprecation notices to the stderr.- config.active_support.deprecation = :stderr+ config.active_support.deprecation =+ if ENV['CI']+ :silence+ else+ :stderr+ end# Disable asset digestsconfig.assets.compile = truediff --git a/docker-compose.ci.yml b/docker-compose.ci.ymlnew file mode 100644index 00000000000..b2519f67a7c--- /dev/null+++ b/docker-compose.ci.yml@@ -0,0 +1,21 @@+version: "3.7"++networks:+ testing:++services:+ ci:+ build:+ context: ./docker/ci/+ dockerfile: Dockerfile+ environment:+ RSPEC_RETRY_RETRY_COUNT: "${CI_RETRY_COUNT:-3}"+ JOBS: "${CI_JOBS:-8}"+ tmpfs:+ - "/tmp"+ volumes:+ - ".:/home/dev/openproject"+ - "${CI_CACHE_PATH:-/tmp/}op-bundle:/usr/local/bundle"+ - "${CI_CACHE_PATH:-/tmp/}op-node:/home/dev/openproject/frontend/node_modules"+ networks:+ - testingdiff --git a/docker-compose.yml b/docker-compose.ymlindex c0ebe2c4338..4536dc0bdfc 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -5,10 +5,12 @@ networks:testing:volumes:+ downloads-test:pgdata:tmp:opdata:bundle:+ npm:pgdata-test:tmp-test:fedata-test:@@ -150,10 +152,13 @@ services:- "bundle:/usr/local/bundle"- "tmp-test:/home/dev/openproject/tmp"+ # https://vitobotta.com/2019/09/04/rails-parallel-system-tests-selenium-docker/selenium-hub:image: selenium/hub:latestcontainer_name: selenium-hubhostname: selenium-hub+ environment:+ GRID_MAX_SESSION: "${CI_JOBS:-4}"depends_on:- chrome- firefox@@ -167,41 +172,52 @@ services:image: selenium/node-chrome-debug:latestvolumes:- /dev/shm:/dev/shm+ - "downloads-test:/home/seluser/Downloads"networks:- testingports:- - 5900:5900+ - "5900-5915:5900"environment:HUB_HOST: selenium-hubHUB_PORT: 4444SCREEN_WIDTH: 1920SCREEN_HEIGHT: 1080+ # in case we want multiple sessions per container+ NODE_MAX_INSTANCES: "${CI_JOBS:-4}"+ NODE_MAX_SESSION: "${CI_JOBS:-4}"firefox:image: selenium/node-firefox-debug:latestvolumes:- /dev/shm:/dev/shm+ - "downloads-test:/home/seluser/Downloads"networks:- testingports:- - 5901:5900+ - "5916-5931:5900"environment:HUB_HOST: selenium-hubHUB_PORT: 4444SCREEN_WIDTH: 1920SCREEN_HEIGHT: 1080+ # in case we want multiple sessions per container+ NODE_MAX_INSTANCES: "${CI_JOBS:-4}"+ NODE_MAX_SESSION: "${CI_JOBS:-4}"opera:image: selenium/node-opera-debug:latestvolumes:- /dev/shm:/dev/shm+ - "downloads-test:/home/seluser/Downloads"networks:- testingports:- - 5902:5900+ - "5932-5957:5900"environment:HUB_HOST: selenium-hubHUB_PORT: 4444SCREEN_WIDTH: 1920SCREEN_HEIGHT: 1080-+ # in case we want multiple sessions per container+ NODE_MAX_INSTANCES: "${CI_JOBS:-4}"+ NODE_MAX_SESSION: "${CI_JOBS:-4}"diff --git a/docker/ci/Dockerfile b/docker/ci/Dockerfilenew file mode 100644index 00000000000..368bbb2dba1--- /dev/null+++ b/docker/ci/Dockerfile@@ -0,0 +1,47 @@+FROM ruby:2.7.2-buster+MAINTAINER [email protected]++ENV USER=dev+RUN useradd -d /home/$USER -m $USER -s /bin/bash+WORKDIR /home/$USER++RUN wget --quiet -O- https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -+RUN echo "deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list++RUN apt-get update -qq && \+ DEBIAN_FRONTEND=noninteractive apt-get install -y \+ postgresql-9.6 postgresql-client-9.6 time pandoc imagemagick libpq-dev default-jre-headless firefox-esr++ENV CI=true+ENV RAILS_ENV=test+ENV NODE_VERSION="12.18.3"+ENV BUNDLER_VERSION="2.1.4"+ENV BUNDLE_WITHOUT="development:production:docker"+ENV OPENPROJECT_DISABLE_DEV_ASSET_PROXY=1+ENV CAPYBARA_DYNAMIC_HOSTNAME=0+ENV CAPYBARA_DOWNLOADED_FILE_DIR=/tmp+# disable deprecations and other warnings in output+ENV RUBYOPT="-W0"+ENV DATABASE_URL=postgres://app:[email protected]/app+ENV CHROME_SOURCE_URL=https://dl.google.com/dl/linux/direct/google-chrome-stable_current_amd64.deb+ENV JOBS=4++RUN wget --no-verbose -O /tmp/$(basename $CHROME_SOURCE_URL) $CHROME_SOURCE_URL && \+ apt install -y /tmp/$(basename $CHROME_SOURCE_URL) && rm -f /tmp/$(basename $CHROME_SOURCE_URL)++RUN curl -s https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz | tar xzf - -C /usr/local --strip-components=1+RUN gem install bundler --version "$BUNDLER_VERSION" --no-document++COPY ./entrypoint.sh /usr/sbin/entrypoint.sh++VOLUME [ "/usr/local/bundle", "/home/$USER/openproject", "/home/$USER/openproject/tmp" ]++WORKDIR /home/$USER/openproject++ENTRYPOINT [ "/usr/sbin/entrypoint.sh" ]+CMD ["setup-tests", "bash"]++# ruby servers+EXPOSE 3000-3016+# billy proxy servers+EXPOSE 4000-4016diff --git a/docker/ci/database.yml b/docker/ci/database.ymlnew file mode 100644index 00000000000..9f73d26f8fc--- /dev/null+++ b/docker/ci/database.yml@@ -0,0 +1,2 @@+test:+ url: <%= ENV['DATABASE_URL'].sub(/\/app$/, "/app#{ENV['TEST_ENV_NUMBER']}") %>diff --git a/docker/ci/entrypoint.sh b/docker/ci/entrypoint.shnew file mode 100755index 00000000000..76182df34c1--- /dev/null+++ b/docker/ci/entrypoint.sh@@ -0,0 +1,69 @@+#!/bin/bash+set -e++export PGBIN="$(pg_config --bindir)"+# for parallel rspec+export PARALLEL_TEST_PROCESSORS=$JOBS++# if from within docker+if [ $(id -u) -eq 0 ]; then+ if [ ! -d "/tmp/nulldb" ]; then+ su - postgres -c "$PGBIN/initdb -E UTF8 -D /tmp/nulldb"+ su - postgres -c "$PGBIN/pg_ctl -D /tmp/nulldb -l /dev/null -w start"+ echo "create database app; create user app with superuser encrypted password 'p4ssw0rd'; grant all privileges on database app to app;" | su - postgres -c psql+ fi++ mkdir -p /usr/local/bundle+ mkdir -p /home/$USER/openproject/frontend/node_modules+ mkdir -p /home/$USER/openproject/tmp+ chown $USER:$USER /usr/local/bundle+ chown $USER:$USER /home/$USER/openproject/frontend/node_modules+ chown $USER:$USER /home/$USER/openproject/tmp+fi+++execute() {+ if [ $(id -u) -eq 0 ]; then+ su $USER -c "$@"+ else+ bash -c "$@"+ fi+}++if [ "$1" == "setup-tests" ]; then+ echo "Preparing environment for running tests..."+ shift++ execute "cp docker/ci/database.yml config/"++ for i in $(seq 0 $JOBS); do+ folder="$CAPYBARA_DOWNLOADED_FILE_DIR/$i"+ echo "Creating folder $folder..."+ rm -rf "$folder"+ mkdir -p "$folder"+ chmod 1777 "$folder"+ done++ execute "time bundle install -j$JOBS"+ execute "TEST_ENV_NUMBER=0 time bundle exec rake db:create db:migrate webdrivers:chromedriver:update webdrivers:geckodriver:update"+ execute "time bundle exec rake parallel:setup"+fi++if [ "$1" == "run-units" ]; then+ shift+ execute "cd frontend && npm install && npm run test"+ execute "time bundle exec rspec -I spec_legacy spec_legacy"+ execute "time bundle exec rake parallel:units"+fi++if [ "$1" == "run-features" ]; then+ shift+ execute "cd frontend; npm install ; cd -"+ execute "bundle exec rake assets:precompile assets:clean"+ execute "cp -rp config/frontend_assets.manifest.json public/assets/frontend_assets.manifest.json"+ execute "time bundle exec rake parallel:features"+fi++if [ ! -z "$1" ] ; then+ exec "$@"+fidiff --git a/frontend/karma.conf.js b/frontend/karma.conf.jsindex 32fe1979069..32f9e06779f 100644--- a/frontend/karma.conf.js+++ b/frontend/karma.conf.js@@ -35,7 +35,13 @@ module.exports = function (config) {failOnEmptyTestSuite: true,logLevel: config.LOG_INFO,autoWatch: true,- browsers: ['ChromeHeadless'],+ browsers: ['ChromeHeadlessNoSandbox'],+ customLaunchers: {+ ChromeHeadlessNoSandbox: {+ base: 'ChromeHeadless',+ flags: ['--no-sandbox']+ }+ },singleRun: false});};diff --git a/frontend/npm-shrinkwrap.json b/frontend/npm-shrinkwrap.jsonindex 8308380348f..8dd3e198e20 100644--- a/frontend/npm-shrinkwrap.json+++ b/frontend/npm-shrinkwrap.json@@ -3423,6 +3423,15 @@"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz","integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ=="},+ "bindings": {+ "version": "1.5.0",+ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",+ "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",+ "optional": true,+ "requires": {+ "file-uri-to-path": "1.0.0"+ }+ },"blob": {"version": "0.0.5","resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz",@@ -6281,6 +6290,12 @@}}},+ "file-uri-to-path": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",+ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",+ "optional": true+ },"fill-range": {"version": "7.0.1","resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",@@ -14084,6 +14099,7 @@"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==","optional": true,"requires": {+ "bindings": "^1.5.0","nan": "^2.12.1"}},@@ -14654,6 +14670,7 @@"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==","optional": true,"requires": {+ "bindings": "^1.5.0","nan": "^2.12.1"}},diff --git a/lib/tasks/parallel_testing.rake b/lib/tasks/parallel_testing.rakeindex 42a02c64169..b35b9c7c214 100644--- a/lib/tasks/parallel_testing.rake+++ b/lib/tasks/parallel_testing.rake@@ -50,12 +50,15 @@ namespace :parallel doclass ParallelParserdef self.with_args(args, allow_seed = true)options = {}- OptionParser.new do |opts|- opts.banner = "Usage: rails #{args[0]} -- [options]"- opts.on("-n ARG", "--group-number ARG", Integer) { |num_cpus| options[:num_cpus] = num_cpus || ENV['GROUP'] }- opts.on("-o ARG", "--only-group ARG", Integer) { |group_number| options[:group] = group_number || ENV['GROUP_SIZE'] }- opts.on("-s ARG", "--seed ARG", Integer) { |seed| options[:seed] = seed || ENV['CI_SEED'] } if allow_seed- end.parse!(args[2..-1])+ parseable_args = args[2..-1]+ if parseable_args+ OptionParser.new do |opts|+ opts.banner = "Usage: rails #{args[0]} -- [options]"+ opts.on("-n ARG", "--group-number ARG", Integer) { |num_cpus| options[:num_cpus] = num_cpus || ENV['GROUP'] }+ opts.on("-o ARG", "--only-group ARG", Integer) { |group_number| options[:group] = group_number || ENV['GROUP_SIZE'] }+ opts.on("-s ARG", "--seed ARG", Integer) { |seed| options[:seed] = seed || ENV['CI_SEED'] } if allow_seed+ end.parse!(parseable_args)+ endyield optionsenddiff --git a/modules/avatars/spec/features/shared_avatar_examples.rb b/modules/avatars/spec/features/shared_avatar_examples.rbindex 101b4a11429..ba7f3226976 100644--- a/modules/avatars/spec/features/shared_avatar_examples.rb+++ b/modules/avatars/spec/features/shared_avatar_examples.rb@@ -45,7 +45,7 @@ shared_examples 'avatar management' doexpect(page).to have_no_selector('.form--fieldset-legend', text: 'GRAVATAR')# Attach a new invalid image- find('#avatar_file_input').set File.join(image_base_path, 'invalid.txt')+ find('#avatar_file_input').set ::UploadedFile.load_from(File.join(image_base_path, 'invalid.txt')).path# Expect errorexpect(page).to have_selector('.form--label.-error')@@ -54,7 +54,7 @@ shared_examples 'avatar management' do# Attach new imagevisit avatar_management_pathexpect(page).to have_selector('.avatars--current-local-avatar', text: 'none')- find('#avatar_file_input').set File.join(image_base_path, 'too_big.jpg')+ find('#avatar_file_input').set ::UploadedFile.load_from(File.join(image_base_path, 'too_big.jpg')).path# Expect not error, since ng-file-upload resizes the imageexpect(page).to have_no_selector('.form--label.-error')diff --git a/modules/backlogs/spec/features/stories_in_backlog_spec.rb b/modules/backlogs/spec/features/stories_in_backlog_spec.rbindex 7ec71d44d99..d8ef8d2c5c7 100644--- a/modules/backlogs/spec/features/stories_in_backlog_spec.rb+++ b/modules/backlogs/spec/features/stories_in_backlog_spec.rb@@ -180,10 +180,12 @@ describe 'Stories in backlog',backlogs_page.expect_velocity(sprint, 30)+ SeleniumHubWaiter.wait# Creating a storybacklogs_page.click_in_backlog_menu(sprint, 'New Story')+ SeleniumHubWaiter.waitbacklogs_page.edit_new_story(subject: 'New story',story_points: 10)@@ -206,6 +208,7 @@ describe 'Stories in backlog',# Editing in a sprint+ SeleniumHubWaiter.waitbacklogs_page.edit_story(sprint_story1,subject: 'Altered story1',@@ -223,12 +226,11 @@ describe 'Stories in backlog',backlogs_page.expect_velocity(sprint, 45)+ SeleniumHubWaiter.wait# Moving a story to topbacklogs_page.drag_in_sprint(sprint_story1, new_story)- sleep(0.5)-backlogs_page.expect_stories_in_order(sprint, sprint_story1, new_story, sprint_story2)@@ -249,11 +251,10 @@ describe 'Stories in backlog',# Moving a story to from the backlog to the sprint (3nd position)+ SeleniumHubWaiter.waitbacklogs_page.drag_in_sprint(backlog_story1, sprint_story2, before: false)- sleep(0.5)-backlogs_page.expect_stories_in_order(sprint, new_story, sprint_story2, backlog_story1, sprint_story1)@@ -271,6 +272,7 @@ describe 'Stories in backlog',.expect_status_options(backlog_story1,[default_status, other_status])+ SeleniumHubWaiter.waitbacklogs_page.alter_attributes_in_edit_story_mode(backlog_story1,subject: 'Altered backlog story1',@@ -291,6 +293,7 @@ describe 'Stories in backlog',subject: 'Altered backlog story1',status: other_status.name)+ SeleniumHubWaiter.waitbacklogs_page.enter_edit_story_mode(backlog_story1)@@ -314,6 +317,7 @@ describe 'Stories in backlog',type: other_story.name)# The pdf export is reachable via the menu+ SeleniumHubWaiter.waitbacklogs_page.click_in_backlog_menu(sprint, 'Export')# Will download something that is currently not speceddiff --git a/modules/bim/spec/features/bcf/direct_ifc_upload_spec.rb b/modules/bim/spec/features/bcf/direct_ifc_upload_spec.rbindex f1e86883e26..9c6ec13a036 100644--- a/modules/bim/spec/features/bcf/direct_ifc_upload_spec.rb+++ b/modules/bim/spec/features/bcf/direct_ifc_upload_spec.rb@@ -31,7 +31,7 @@ require 'spec_helper'describe 'direct IFC upload', type: :feature, js: true, with_direct_uploads: :redirect, with_config: { edition: 'bim' } dolet(:user) { FactoryBot.create :admin }let(:project) { FactoryBot.create :project, enabled_module_names: %i[bim] }- let(:ifc_fixture) { Rails.root.join('modules/bim/spec/fixtures/files/minimal.ifc') }+ let(:ifc_fixture) { ::UploadedFile.load_from('modules/bim/spec/fixtures/files/minimal.ifc') }before dologin_as user@@ -42,7 +42,7 @@ describe 'direct IFC upload', type: :feature, js: true, with_direct_uploads: :reit 'should work' dovisit new_bcf_project_ifc_model_path(project_id: project.identifier)- page.attach_file("file", ifc_fixture, visible: :all)+ page.attach_file("file", ifc_fixture.path, visible: :all)click_on "Create"diff --git a/modules/bim/spec/features/bcf/export_spec.rb b/modules/bim/spec/features/bcf/export_spec.rbindex 9f6387051c3..da5e7619a0f 100644--- a/modules/bim/spec/features/bcf/export_spec.rb+++ b/modules/bim/spec/features/bcf/export_spec.rb@@ -69,14 +69,15 @@ describe 'bcf export',before dologin_as current_user+ @download_list = DownloadList.newendafter do- DownloadedFile::clear_downloads+ DownloadList.clearenddef export_into_bcf_extractor- ::DownloadedFile::clear_downloads+ DownloadList.clearpage.find('.export-bcf-button').click# Expect to get a response regarding queuing@@ -84,17 +85,16 @@ describe 'bcf export',wait: 10perform_enqueued_jobs-- # Wait for the file to download- ::DownloadedFile.wait_for_download- ::DownloadedFile.wait_for_download_content+ expect(page).to have_text("completed successfully")# Close the modalpage.find('.op-modal--modal-close-button').click+ @download_list.refresh_from(page)+# Check the downloaded fileOpenProject::Bim::BcfXml::Importer.new(- ::DownloadedFile.download,+ @download_list.latest_download,project,current_user: current_user).extractor_list@@ -111,6 +111,7 @@ describe 'bcf export',expect(extractor_list.length).to eq 1expect(extractor_list.first[:title]).to eq 'Open WP'+ model_page.visit!# Change the query to show all statusesfilters.openfilters.remove_filter 'status'diff --git a/modules/bim/spec/features/viewer/show_viewpoint_spec.rb b/modules/bim/spec/features/viewer/show_viewpoint_spec.rbindex bbad62b5703..d09955fd79d 100644--- a/modules/bim/spec/features/viewer/show_viewpoint_spec.rb+++ b/modules/bim/spec/features/viewer/show_viewpoint_spec.rb@@ -63,9 +63,9 @@ describe 'Show viewpoint in model viewer',model_tree.expect_checked 'minimal'model_tree.all_checkboxes.each do |label, checkbox|if label.text == 'minimal' || label.text == 'LUB_Segment_new:S_WHG_Ess:7243035'- expect(checkbox.checked?).to eq(true)+ expect(checkbox).to be_checkedelse- expect(checkbox.checked?).to eq(false)+ expect(checkbox).to_not be_checkedendendenddiff --git a/modules/budgets/spec/features/budgets/attachment_upload_spec.rb b/modules/budgets/spec/features/budgets/attachment_upload_spec.rbindex ef35acb2bc9..e4634d7300f 100644--- a/modules/budgets/spec/features/budgets/attachment_upload_spec.rb+++ b/modules/budgets/spec/features/budgets/attachment_upload_spec.rb@@ -40,7 +40,7 @@ describe 'Upload attachment to budget', js: true doendlet(:project) { FactoryBot.create(:project) }let(:attachments) { ::Components::Attachments.new }- let(:image_fixture) { Rails.root.join('spec/fixtures/files/image.png') }+ let(:image_fixture) { ::UploadedFile.load_from('spec/fixtures/files/image.png') }let(:editor) { ::Components::WysiwygEditor.new }before do@@ -57,7 +57,7 @@ describe 'Upload attachment to budget', js: true dofill_in "Subject", with: 'New budget'# adding an image- editor.drag_attachment image_fixture, 'Image uploaded on creation'+ editor.drag_attachment image_fixture.path, 'Image uploaded on creation'expect(page).to have_selector('attachment-list-item', text: 'image.png')@@ -71,7 +71,7 @@ describe 'Upload attachment to budget', js: true doclick_on "Update"end- editor.drag_attachment image_fixture, 'Image uploaded the second time'+ editor.drag_attachment image_fixture.path, 'Image uploaded the second time'expect(page).to have_selector('attachment-list-item', text: 'image.png', count: 2)diff --git a/modules/costs/spec/features/add_cost_entry_spec.rb b/modules/costs/spec/features/add_cost_entry_spec.rbindex a83a042f8cb..009f4c62ace 100644--- a/modules/costs/spec/features/add_cost_entry_spec.rb+++ b/modules/costs/spec/features/add_cost_entry_spec.rb@@ -66,18 +66,18 @@ describe 'Work Package cost fields', type: :feature, js: true doit 'does not show read-only fields' dofull_view.visit!# Go to add cost entry page+ SeleniumHubWaiter.waitfind('#action-show-more-dropdown-menu .button').clickfind('.menu-item', text: 'Log unit costs').click+ SeleniumHubWaiter.wait# Set single value, should update suffixselect 'A', from: 'cost_entry_cost_type_id'fill_in 'cost_entry_units', with: '1'- sleep 1expect(page).to have_selector('#cost_entry_unit_name', text: 'A single')expect(page).to have_selector('#cost_entry_costs', text: '1.00 EUR')fill_in 'cost_entry_units', with: '2'- sleep 1expect(page).to have_selector('#cost_entry_unit_name', text: 'A plural')expect(page).to have_selector('#cost_entry_costs', text: '2.00 EUR')@@ -88,6 +88,7 @@ describe 'Work Package cost fields', type: :feature, js: true do# Override costsfind('#cost_entry_costs').click+ SeleniumHubWaiter.waitfill_in 'cost_entry_costs_edit', with: '15.52'click_on 'Save'@@ -112,9 +113,11 @@ describe 'Work Package cost fields', type: :feature, js: true dofull_view.visit!# Go to add cost entry page+ SeleniumHubWaiter.waitfind('#action-show-more-dropdown-menu .button').clickfind('.menu-item', text: I18n.t(:button_log_costs)).click+ SeleniumHubWaiter.waitfill_in 'cost_entry_units', with: '1,42'select 'B', from: 'cost_entry_cost_type_id'expect(page).to have_selector('#cost_entry_unit_name', text: 'B plural')@@ -122,6 +125,7 @@ describe 'Work Package cost fields', type: :feature, js: true do# Override costsfind('#cost_entry_costs').click+ SeleniumHubWaiter.waitfill_in 'cost_entry_costs_edit', with: '1.350,25'click_on I18n.t(:button_save)@@ -139,9 +143,11 @@ describe 'Work Package cost fields', type: :feature, js: true doexpect(page).to have_selector('#cost_entry_costs', text: '1.350,25 EUR')# Toggle the cost button+ SeleniumHubWaiter.waitfind('#cost_entry_costs').click# Update the costs in german locale+ SeleniumHubWaiter.waitfill_in 'cost_entry_costs_edit', with: '55.000,55'click_on I18n.t(:button_save)diff --git a/modules/costs/spec/features/cost_types/delete_cost_type_spec.rb b/modules/costs/spec/features/cost_types/delete_cost_type_spec.rbindex 6ff5c82c3f9..d09c8da3a32 100644--- a/modules/costs/spec/features/cost_types/delete_cost_type_spec.rb+++ b/modules/costs/spec/features/cost_types/delete_cost_type_spec.rb@@ -51,6 +51,7 @@ describe 'deleting a cost type', type: :feature, js: true doexpect_angular_frontend_initializedexpect(page).to have_selector '.generic-table--no-results-container', wait: 10+ SeleniumHubWaiter.wait# Show lockedfind('#include_deleted').set trueclick_on 'Apply'diff --git a/modules/costs/spec/features/destroy_work_package_with_cost_entries_spec.rb b/modules/costs/spec/features/destroy_work_package_with_cost_entries_spec.rbindex 17d6c9f31b8..ad201151615 100644--- a/modules/costs/spec/features/destroy_work_package_with_cost_entries_spec.rb+++ b/modules/costs/spec/features/destroy_work_package_with_cost_entries_spec.rb@@ -74,6 +74,7 @@ describe 'Deleting time entries', type: :feature, js: true dowp_page = Pages::FullWorkPackage.new(work_package)wp_page.visit!+ SeleniumHubWaiter.waitfind('#action-show-more-dropdown-menu').clickclick_link(I18n.t('js.button_delete'))@@ -81,8 +82,8 @@ describe 'Deleting time entries', type: :feature, js: true dodestroy_modal.expect_listed(work_package)destroy_modal.confirm_deletion+ SeleniumHubWaiter.waitchoose 'to_do_action_reassign'- sleep 1fill_in 'to_do_reassign_to_id', with: other_work_package.idclick_button(I18n.t('button_delete'))diff --git a/modules/costs/spec/features/members_hourly_rates_spec.rb b/modules/costs/spec/features/members_hourly_rates_spec.rbindex b674de50d24..6a39a2b6b99 100644--- a/modules/costs/spec/features/members_hourly_rates_spec.rb+++ b/modules/costs/spec/features/members_hourly_rates_spec.rb@@ -79,6 +79,7 @@ describe 'hourly rates on a member', type: :feature, js: true doexpect_current_rate_in_members_table('0.00 EUR')click_link('0.00 EUR')+ SeleniumHubWaiter.waitadd_rate(date: Date.today, rate: 10)@@ -86,6 +87,7 @@ describe 'hourly rates on a member', type: :feature, js: true doexpect_current_rate_in_members_table('10.00 EUR')+ SeleniumHubWaiter.waitclick_link('10.00 EUR')add_rate(date: 3.days.ago, rate: 20)@@ -94,6 +96,7 @@ describe 'hourly rates on a member', type: :feature, js: true doexpect_current_rate_in_members_table('10.00 EUR')+ SeleniumHubWaiter.waitclick_link('10.00 EUR')change_rate_date(from: Date.today, to: 5.days.ago)diff --git a/modules/costs/spec/features/users_hourly_rates_spec.rb b/modules/costs/spec/features/users_hourly_rates_spec.rbindex 7dc44769ff3..9f2ad0048be 100644--- a/modules/costs/spec/features/users_hourly_rates_spec.rb+++ b/modules/costs/spec/features/users_hourly_rates_spec.rb@@ -63,6 +63,7 @@ describe 'hourly rates on user edit', type: :feature, js: true dodescribe 'deleting all rates' dobefore doclick_link 'Update' # go to update view for rates+ SeleniumHubWaiter.waitfind('.icon-delete').click # delete last existing rateclick_on 'Save' # save changeend@@ -72,7 +73,7 @@ describe 'hourly rates on user edit', type: :feature, js: true doexpect(page).to have_text /rate history/iexpect(page).to have_text I18n.t('no_results_title_text')- expect(page).not_to have_text 'Current rate'+ expect(page).to have_no_text 'Current rate'endendenddiff --git a/modules/dashboards/spec/features/custom_text_spec.rb b/modules/dashboards/spec/features/custom_text_spec.rbindex 8e99ee987b8..2169b2e0a4d 100644--- a/modules/dashboards/spec/features/custom_text_spec.rb+++ b/modules/dashboards/spec/features/custom_text_spec.rb@@ -50,7 +50,7 @@ describe 'Project description widget on dashboard', type: :feature, js: true dolet(:dashboard_page) doPages::Dashboard.new(project)end- let(:image_fixture) { Rails.root.join('spec/fixtures/files/image.png') }+ let(:image_fixture) { ::UploadedFile.load_from('spec/fixtures/files/image.png') }let(:editor) { ::Components::WysiwygEditor.new 'body' }let(:field) { TextEditorField.new(page, 'description', selector: '.inline-edit--active-field') }@@ -104,7 +104,7 @@ describe 'Project description widget on dashboard', type: :feature, js: true do# The drag_attachment is written in a way that it requires to be executed with page on body# so we cannot have it wrapped in the within block.- editor.drag_attachment image_fixture, 'Image uploaded'+ editor.drag_attachment image_fixture.path, 'Image uploaded'within custom_text_widget.area doexpect(page).to have_selector('attachment-list-item', text: 'image.png')diff --git a/modules/dashboards/spec/features/work_package_table_spec.rb b/modules/dashboards/spec/features/work_package_table_spec.rbindex 2d74c277d08..683214a1ce6 100644--- a/modules/dashboards/spec/features/work_package_table_spec.rb+++ b/modules/dashboards/spec/features/work_package_table_spec.rb@@ -96,8 +96,6 @@ describe 'Arbitrary WorkPackage query table widget dashboard', type: :feature, jit 'can add the widget and see the work packages of the filtered for types' dodashboard_page.add_widget(1, 1, :row, "Work packages table")- sleep(0.2)-filter_area = Components::Grids::GridArea.new('.grid--area.-widgeted:nth-of-type(2)')filter_area.expect_to_span(1, 1, 2, 3)diff --git a/modules/documents/spec/features/attachment_upload_spec.rb b/modules/documents/spec/features/attachment_upload_spec.rbindex b896a28186b..59fd234953e 100644--- a/modules/documents/spec/features/attachment_upload_spec.rb+++ b/modules/documents/spec/features/attachment_upload_spec.rb@@ -41,7 +41,7 @@ describe 'Upload attachment to documents', js: true doendlet(:project) { FactoryBot.create(:project) }let(:attachments) { ::Components::Attachments.new }- let(:image_fixture) { Rails.root.join('spec/fixtures/files/image.png') }+ let(:image_fixture) { ::UploadedFile.load_from('spec/fixtures/files/image.png') }let(:editor) { ::Components::WysiwygEditor.new }before do@@ -53,11 +53,12 @@ describe 'Upload attachment to documents', js: true dovisit new_project_document_path(project)expect(page).to have_selector('#new_document', wait: 10)+ SeleniumHubWaiter.waitselect(category.name, from: 'Category')fill_in "Title", with: 'New documentation'# adding an image- editor.drag_attachment image_fixture, 'Image uploaded on creation'+ editor.drag_attachment image_fixture.path, 'Image uploaded on creation'expect(page).to have_selector('attachment-list-item', text: 'image.png')click_on 'Create'@@ -71,6 +72,7 @@ describe 'Upload attachment to documents', js: true doexpect(document.title).to eq 'New documentation'# Expect it to be present on the show page+ SeleniumHubWaiter.waitfind('.document-category-elements--header a', text: 'New documentation').clickexpect(page).to have_current_path "/documents/#{document.id}", wait: 10expect(page).to have_selector('#content img', count: 1)@@ -78,10 +80,12 @@ describe 'Upload attachment to documents', js: true do# Adding a second image# We should be using the 'Edit' button at the top but that leads to flickering specs+ # FIXME: yes indeedvisit edit_document_path(document)#editor.click_and_type_slowly 'abc'- editor.drag_attachment image_fixture, 'Image uploaded the second time'+ SeleniumHubWaiter.wait+ editor.drag_attachment image_fixture.path, 'Image uploaded the second time'expect(page).to have_selector('attachment-list-item', text: 'image.png', count: 2)click_on 'Save'@@ -96,7 +100,7 @@ describe 'Upload attachment to documents', js: true docontext 'with direct uploads (Regression #34285)', with_direct_uploads: true dobefore do- allow_any_instance_of(Attachment).to receive(:diskfile).and_return Struct.new(:path).new(image_fixture.to_s)+ allow_any_instance_of(Attachment).to receive(:diskfile).and_return image_fixtureendit_behaves_like 'can upload an image'diff --git a/modules/grids/spec/support/pages/grid.rb b/modules/grids/spec/support/pages/grid.rbindex d3c6e15f7a5..b3ade0d72b5 100644--- a/modules/grids/spec/support/pages/grid.rb+++ b/modules/grids/spec/support/pages/grid.rb@@ -35,6 +35,7 @@ module Pagesexpect(page).to have_content(I18n.t('js.grid.add_widget'))+ SeleniumHubWaiter.waitpage.find('.grid--addable-widget', text: Regexp.new("^#{name}$")).clickendenddiff --git a/modules/ldap_groups/spec/features/administration_spec.rb b/modules/ldap_groups/spec/features/administration_spec.rbindex 87ec9436af9..c986331de5c 100644--- a/modules/ldap_groups/spec/features/administration_spec.rb+++ b/modules/ldap_groups/spec/features/administration_spec.rb@@ -23,6 +23,7 @@ describe 'LDAP group sync administration spec', type: :feature, js: true do# Create groupfind('.button', text: I18n.t('ldap_groups.synchronized_groups.singular')).click+ SeleniumHubWaiter.waitselect 'ldap', from: 'synchronized_group_auth_source_id'select 'foo', from: 'synchronized_group_group_id'@@ -36,6 +37,7 @@ describe 'LDAP group sync administration spec', type: :feature, js: true doexpect(page).to have_selector('td.users', text: '0')# Show entry+ SeleniumHubWaiter.waitfind('td.dn a').clickexpect(page).to have_selector '.generic-table--empty-row'@@ -54,11 +56,12 @@ describe 'LDAP group sync administration spec', type: :feature, js: true dovisit ldap_groups_synchronized_groups_pathexpect_angular_frontend_initialized-find('.buttons a', text: 'Delete').click++ SeleniumHubWaiter.waitfind('.danger-zone--verification input').set 'cn=foo,ou=groups,dc=example,dc=com'- sleep 2+ SeleniumHubWaiter.waitclick_on 'Delete'expect(page).to have_selector('.flash.notice', text: I18n.t(:notice_successful_delete))@@ -67,4 +70,4 @@ describe 'LDAP group sync administration spec', type: :feature, js: true doexpect(::LdapGroups::Membership.where(id: memberships)).to be_emptyendend-end\ No newline at end of file+enddiff --git a/modules/ldap_groups/spec/lib/synchronization_spec.rb b/modules/ldap_groups/spec/lib/synchronization_spec.rbindex 2454a1e5a5a..c1cc0c8d863 100644--- a/modules/ldap_groups/spec/lib/synchronization_spec.rb+++ b/modules/ldap_groups/spec/lib/synchronization_spec.rb@@ -8,7 +8,7 @@ describe OpenProject::LdapGroups::Synchronization, with_ee: %i[ldap_groups] dobefore(:all) doldif = Rails.root.join('spec/fixtures/ldap/users.ldif')- @ldap_server = Ladle::Server.new(quiet: false, port: '12389', domain: 'dc=example,dc=com', ldif: ldif).start+ @ldap_server = Ladle::Server.new(quiet: false, port: ParallelHelper.port_for_ldap.to_s, domain: 'dc=example,dc=com', ldif: ldif).startendafter(:all) do@@ -20,7 +20,7 @@ describe OpenProject::LdapGroups::Synchronization, with_ee: %i[ldap_groups] do# two groups foo (aa729), bar(aa729, bb459, cc414)let(:auth_source) doFactoryBot.create :ldap_auth_source,- port: '12389',+ port: ParallelHelper.port_for_ldap.to_s,account: 'uid=admin,ou=system',account_password: 'secret',base_dn: 'ou=people,dc=example,dc=com',diff --git a/modules/ldap_groups/spec/lib/synchronize_filter_spec.rb b/modules/ldap_groups/spec/lib/synchronize_filter_spec.rbindex 82d18a5720d..02f5c527a54 100644--- a/modules/ldap_groups/spec/lib/synchronize_filter_spec.rb+++ b/modules/ldap_groups/spec/lib/synchronize_filter_spec.rb@@ -4,7 +4,7 @@ require 'ladle'describe OpenProject::LdapGroups::SynchronizeFilter, with_ee: %i[ldap_groups] dobefore(:all) doldif = Rails.root.join('spec/fixtures/ldap/users.ldif')- @ldap_server = Ladle::Server.new(quiet: false, port: '12389', domain: 'dc=example,dc=com', ldif: ldif).start+ @ldap_server = Ladle::Server.new(quiet: false, port: ParallelHelper.port_for_ldap.to_s, domain: 'dc=example,dc=com', ldif: ldif).startendafter(:all) do@@ -16,7 +16,7 @@ describe OpenProject::LdapGroups::SynchronizeFilter, with_ee: %i[ldap_groups] do# two groups foo (aa729), bar(aa729, bb459, cc414)let(:auth_source) doFactoryBot.create :ldap_auth_source,- port: '12389',+ port: ParallelHelper.port_for_ldap.to_s,account: 'uid=admin,ou=system',account_password: 'secret',base_dn: 'dc=example,dc=com',diff --git a/modules/meeting/spec/features/meetings_attachments_spec.rb b/modules/meeting/spec/features/meetings_attachments_spec.rbindex 847b4b650ff..a5f6b71bd3a 100644--- a/modules/meeting/spec/features/meetings_attachments_spec.rb+++ b/modules/meeting/spec/features/meetings_attachments_spec.rb@@ -22,7 +22,7 @@ describe 'Add an attachment to a meeting (agenda)', js: true doendlet(:attachments) { ::Components::Attachments.new }- let(:image_fixture) { Rails.root.join('spec/fixtures/files/image.png') }+ let(:image_fixture) { UploadedFile.load_from('spec/fixtures/files/image.png') }let(:editor) { Components::WysiwygEditor.new }before do@@ -42,7 +42,7 @@ describe 'Add an attachment to a meeting (agenda)', js: true doeditor.expect_button 'Insert image'- editor.drag_attachment image_fixture, 'Some image caption'+ editor.drag_attachment image_fixture.path, 'Some image caption'click_on "Save"@@ -64,13 +64,13 @@ describe 'Add an attachment to a meeting (agenda)', js: true do### Attach file manuallyexpect(page).to have_no_selector('.work-package--attachments--filename')- attachments.attach_file_on_input(image_fixture)+ attachments.attach_file_on_input(image_fixture.path)expect(page).not_to have_selector('notification-upload-progress')expect(page).to have_selector('.work-package--attachments--filename', text: 'image.png', wait: 5)### and via drag & drop- attachments.drag_and_drop_file(container, Rails.root.join('spec/fixtures/files/image.png'))+ attachments.drag_and_drop_file(container, image_fixture.path)expect(page).not_to have_selector('notification-upload-progress')expect(page).to have_selector('.work-package--attachments--filename', text: 'image.png', count: 2, wait: 5)enddiff --git a/modules/meeting/spec/features/meetings_close_spec.rb b/modules/meeting/spec/features/meetings_close_spec.rbindex 8ad38ce1c50..744a868ab62 100644--- a/modules/meeting/spec/features/meetings_close_spec.rb+++ b/modules/meeting/spec/features/meetings_close_spec.rb@@ -57,12 +57,15 @@ describe 'Meetings close', type: :feature doclick_link meeting.title# Go to minutes, expect uneditable+ SeleniumHubWaiter.waitfind('.tabrow a', text: 'MINUTES').clickexpect(page).to have_selector('.button', text: 'Close the agenda to begin the Minutes')# Close the meeting+ SeleniumHubWaiter.waitfind('.tabrow a', text: 'AGENDA').click+ SeleniumHubWaiter.waitfind('.button', text: 'Close').clickpage.accept_confirm@@ -73,7 +76,9 @@ describe 'Meetings close', type: :feature doexpect(page).to have_selector('#meeting_minutes-text', text: 'asdf')# Go back to agenda, expect we can open it again+ SeleniumHubWaiter.waitfind('.tabrow a', text: 'AGENDA').click+ SeleniumHubWaiter.waitfind('.button', text: 'Open').clickpage.accept_confirmexpect(page).to have_selector('.button', text: 'Close')diff --git a/modules/meeting/spec/features/meetings_copy_spec.rb b/modules/meeting/spec/features/meetings_copy_spec.rbindex 8f4e3d06577..6ea790824ff 100644--- a/modules/meeting/spec/features/meetings_copy_spec.rb+++ b/modules/meeting/spec/features/meetings_copy_spec.rb@@ -73,6 +73,7 @@ describe 'Meetings copy', type: :feature, js: true doexpect(page).to have_link 'Copy'+ SeleniumHubWaiter.waitclick_link 'Copy'end@@ -87,6 +88,7 @@ describe 'Meetings copy', type: :feature, js: true doexpect(page).to have_field 'Time', with: "18:55"+ SeleniumHubWaiter.waitclick_button "Create"# Be on the new meeting's page with copied over attributes@@ -115,12 +117,14 @@ describe 'Meetings copy', type: :feature, js: true do.to have_content "Attendees:"# Copies the agenda+ SeleniumHubWaiter.waitclick_link "Agenda"expect(page).to have_content agenda_text# Adds an entry to the history+ SeleniumHubWaiter.waitclick_link "History"expect(page)diff --git a/modules/meeting/spec/features/meetings_delete_spec.rb b/modules/meeting/spec/features/meetings_delete_spec.rbindex c9b0925d18f..0d3c061c638 100644--- a/modules/meeting/spec/features/meetings_delete_spec.rb+++ b/modules/meeting/spec/features/meetings_delete_spec.rb@@ -54,7 +54,9 @@ describe 'Meetings deletion', type: :feature doit 'can delete own and other`s meetings' dovisit meetings_path(project)+ SeleniumHubWaiter.waitclick_link meeting.title+ SeleniumHubWaiter.waitclick_link "Delete"page.accept_confirm@@ -62,7 +64,9 @@ describe 'Meetings deletion', type: :feature doexpect(page).to have_current_path meetings_path(project)+ SeleniumHubWaiter.waitclick_link other_meeting.title+ SeleniumHubWaiter.waitclick_link "Delete"page.accept_confirmdiff --git a/modules/meeting/spec/features/meetings_locking_spec.rb b/modules/meeting/spec/features/meetings_locking_spec.rbindex 2c708480a69..c2db89ddb2e 100644--- a/modules/meeting/spec/features/meetings_locking_spec.rb+++ b/modules/meeting/spec/features/meetings_locking_spec.rb@@ -46,6 +46,7 @@ describe 'Meetings locking', type: :feature, js: true dowithin '#tab-content-agenda' dofind('.button--edit-agenda').click+ SeleniumHubWaiter.waitagenda.text = 'blabla'agenda.save!diff --git a/modules/meeting/spec/features/meetings_show_spec.rb b/modules/meeting/spec/features/meetings_show_spec.rbindex e9fe0bc4d81..7098cc2ce00 100644--- a/modules/meeting/spec/features/meetings_show_spec.rb+++ b/modules/meeting/spec/features/meetings_show_spec.rb@@ -72,7 +72,9 @@ describe 'Meetings', type: :feature, js: true doagenda_updatevisit meeting_path(meeting)+click_on 'History'+ SeleniumHubWaiter.waitfind('#version-1').clickexpect(page).to have_selector('.meeting_agenda', text: 'foo')diff --git a/modules/my_page/spec/features/my/custom_text_spec.rb b/modules/my_page/spec/features/my/custom_text_spec.rbindex 30c61a0ddbb..3e968134eb2 100644--- a/modules/my_page/spec/features/my/custom_text_spec.rb+++ b/modules/my_page/spec/features/my/custom_text_spec.rb@@ -49,7 +49,7 @@ describe 'Custom text widget on my page', type: :feature, js: true dolet(:my_page) doPages::My::Page.newend- let(:image_fixture) { Rails.root.join('spec/fixtures/files/image.png') }+ let(:image_fixture) { ::UploadedFile.load_from('spec/fixtures/files/image.png') }let(:editor) { ::Components::WysiwygEditor.new 'body' }let(:field) { TextEditorField.new(page, 'description', selector: '.inline-edit--active-field') }@@ -94,7 +94,7 @@ describe 'Custom text widget on my page', type: :feature, js: true do# The drag_attachment is written in a way that it requires to be executed with page on body# so we cannot have it wrapped in the within block.- editor.drag_attachment image_fixture, 'Image uploaded'+ editor.drag_attachment image_fixture.path, 'Image uploaded'within custom_text_widget.area doexpect(page).to have_selector('attachment-list-item', text: 'image.png')diff --git a/modules/pdf_export/spec/features/export_card_configurations_admin_spec.rb b/modules/pdf_export/spec/features/export_card_configurations_admin_spec.rbindex c76dbfe8bf3..27fa8d81403 100644--- a/modules/pdf_export/spec/features/export_card_configurations_admin_spec.rb+++ b/modules/pdf_export/spec/features/export_card_configurations_admin_spec.rb@@ -47,6 +47,7 @@ describe "export card configurations Admin", type: :feature, js: true do# CREATEclick_on 'New Export Card Config'+ SeleniumHubWaiter.waitfill_in 'export_card_configuration_name', with: 'New config'fill_in 'export_card_configuration_per_page', with: '5'select 'landscape', from: 'export_card_configuration_orientation'@@ -56,7 +57,9 @@ describe "export card configurations Admin", type: :feature, js: true doexpect(page).to have_text 'Successful creation.'# EDIT+ SeleniumHubWaiter.waitpage.first('a', text: 'Config 1').click+ SeleniumHubWaiter.waitfill_in 'export_card_configuration_name', with: 'New name'fill_in 'export_card_configuration_per_page', with: '5'select 'portrait', from: 'export_card_configuration_orientation'@@ -68,11 +71,13 @@ describe "export card configurations Admin", type: :feature, js: true doexpect(config1.reload).to be_portrait# DEACTIVATE+ SeleniumHubWaiter.waitpage.first('a', text: 'De-activate').clickexpect(page).to have_text 'Config succesfully de-activated'# ACTIVATE+ SeleniumHubWaiter.waitpage.first('a', text: 'Activate').clickexpect(page).to have_text 'Config succesfully activated'end-end\ No newline at end of file+enddiff --git a/modules/reporting/spec/features/support/components/cost_reports_base_table.rb b/modules/reporting/spec/features/support/components/cost_reports_base_table.rbindex 5a5b2d64bec..ffe40e1ad0e 100644--- a/modules/reporting/spec/features/support/components/cost_reports_base_table.rb+++ b/modules/reporting/spec/features/support/components/cost_reports_base_table.rb@@ -55,6 +55,7 @@ module Componentsenddef edit_time_entry(new_value, row)+ SeleniumHubWaiter.waitpage.find("#{row_selector(row)} .icon-edit").clicktime_logging_modal.is_visible true@@ -62,31 +63,29 @@ module Componentstime_logging_modal.work_package_is_missing falsetime_logging_modal.perform_action 'Save'-- sleep(3)+ SeleniumHubWaiter.waitexpect_action_icon 'edit', rowexpect_value new_value, rowenddef edit_cost_entry(new_value, row, cost_entry_id)+ SeleniumHubWaiter.waitpage.find("#{row_selector(row)} .icon-edit").clickexpect(page).to have_current_path('/cost_entries/' + cost_entry_id + '/edit')+ SeleniumHubWaiter.waitfill_in('cost_entry_units', with: new_value)click_button 'Save'expect(page).to have_selector('.flash.notice')-- sleep(3)enddef delete_entry(row)+ SeleniumHubWaiter.waitpage.find("#{row_selector(row)} .icon-delete").clickpage.driver.browser.switch_to.alert.accept-- sleep(3)endprivatediff --git a/modules/reporting/spec/features/update_cost_report_spec.rb b/modules/reporting/spec/features/update_cost_report_spec.rbindex c276db36ae7..c49bc74ad5b 100644--- a/modules/reporting/spec/features/update_cost_report_spec.rb+++ b/modules/reporting/spec/features/update_cost_report_spec.rb@@ -54,16 +54,11 @@ describe "updating a cost report's cost type", type: :feature, js: true doit 'works' doreport_page.visit!report_page.save(as: 'My Query', public: true)-+ SeleniumHubWaiter.waitreport_page.switch_to_type cost_type.name-click_on "Save"click_on "My Query"-- option = all("[name=unit]").last-- expect(option).to be_checked- expect(option.value).to eq cost_type.id.to_s+ expect(page).to have_field(cost_type.name, checked: true)endenddiff --git a/modules/two_factor_authentication/spec/features/account_activation_spec.rb b/modules/two_factor_authentication/spec/features/account_activation_spec.rbindex e0592a19b8f..9c723ada07c 100644--- a/modules/two_factor_authentication/spec/features/account_activation_spec.rb+++ b/modules/two_factor_authentication/spec/features/account_activation_spec.rb@@ -51,6 +51,7 @@ describe 'activating an invited account',expect(page).to have_selector('.flash.notice', text: 'Developer strategy generated the following one-time password:')+ SeleniumHubWaiter.waitfill_in I18n.t(:field_otp), with: sms_tokenclick_button I18n.t(:button_login)diff --git a/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rbindex 6bb04ec4c64..d5f0d23918a 100644--- a/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb+++ b/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb@@ -39,12 +39,15 @@ describe 'Admin 2FA management', with_2fa_ee: true, type: :feature,# Visit inline createfind('.button', text: I18n.t('two_factor_authentication.admin.button_register_mobile_phone_for_user')).click+ SeleniumHubWaiter.wait# Try to save with invalid phone numberfill_in 'device_phone_number', with: 'invalid!'click_button I18n.t(:button_continue)# Enter valid phone numberexpect(page).to have_selector('#errorExplanation', text: 'Phone number must be of format +XX XXXXXXXXX')++ SeleniumHubWaiter.waitfill_in 'device_phone_number', with: '+49 123456789'click_button I18n.t(:button_continue)@@ -52,6 +55,7 @@ describe 'Admin 2FA management', with_2fa_ee: true, type: :feature,expect(page).to have_selector('.mobile-otp--two-factor-device-row td .icon-yes', count: 2)expect(page).to have_selector('.on-off-status.-enabled')+ SeleniumHubWaiter.wait# Delete the onefind('.two-factor--delete-button').clickdialog.confirm_flow_with user_password, should_fail: falsediff --git a/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb b/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rbindex 793d09f5e53..cf8fb8f89fe 100644--- a/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb+++ b/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb@@ -40,12 +40,13 @@ describe 'Login with 2FA backup code', with_2fa_ee: true, type: :feature,# Open other options# This may fail on the first request when the assets aren't ready yet- retry_block do- find('#toggle_resend_form').click- find('a', text: I18n.t('two_factor_authentication.login.enter_backup_code_title'), wait: 10).click- end+ SeleniumHubWaiter.wait+ find('#toggle_resend_form').click+ SeleniumHubWaiter.wait+ find('a', text: I18n.t('two_factor_authentication.login.enter_backup_code_title'), wait: 2).clickexpect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.login.enter_backup_code_title'))+ SeleniumHubWaiter.waitfill_in 'backup_code', with: 'whatever'click_on 'Submit'@@ -55,10 +56,13 @@ describe 'Login with 2FA backup code', with_2fa_ee: true, type: :feature,# Try again!first_login_step+ SeleniumHubWaiter.waitfind('#toggle_resend_form').click+ SeleniumHubWaiter.waitfind('a', text: I18n.t('two_factor_authentication.login.enter_backup_code_title')).clickexpect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.login.enter_backup_code_title'))+ SeleniumHubWaiter.waitfill_in 'backup_code', with: valid_backup_codes.firstclick_on 'Submit'diff --git a/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb b/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rbindex 713e1a806eb..20dceb9ff99 100644--- a/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb+++ b/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb@@ -22,8 +22,11 @@ describe 'Login by switching 2FA device', with_2fa_ee: true, type: :feature,expect(page).to have_selector('input#otp')+ SeleniumHubWaiter.wait# Toggle device to TOTPfind('#toggle_resend_form').click++ SeleniumHubWaiter.waitfind(".button--link[value='#{device2.redacted_identifier}']").clickexpect(page).to have_selector('input#otp')diff --git a/modules/two_factor_authentication/spec/features/password_change_spec.rb b/modules/two_factor_authentication/spec/features/password_change_spec.rbindex e2f93c8332d..5df2c602231 100644--- a/modules/two_factor_authentication/spec/features/password_change_spec.rb+++ b/modules/two_factor_authentication/spec/features/password_change_spec.rb@@ -31,6 +31,7 @@ describe 'Password change with OTP', with_2fa_ee: true, type: :feature,expect(page).to have_selector('h2', text: I18n.t(:button_change_password))within('#content') do+ SeleniumHubWaiter.waitfill_in('password', with: user_password)fill_in('new_password', with: new_user_password)fill_in('new_password_confirmation', with: new_user_password)@@ -39,6 +40,7 @@ describe 'Password change with OTP', with_2fa_ee: true, type: :feature,if requires_otpexpect(page).to have_selector('input#otp')+ SeleniumHubWaiter.waitfill_in 'otp', with: sms_tokenclick_button I18n.t(:button_login)enddiff --git a/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb b/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rbindex 08880c83207..c12a638fd1f 100644--- a/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb+++ b/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb@@ -27,6 +27,7 @@ describe 'Login with 2FA remember cookie',first_login_stepexpect(page).to have_selector('input#remember_me')+ SeleniumHubWaiter.waitcheck 'remember_me'two_factor_step sms_tokendiff --git a/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb b/modules/two_factor_authentication/spec/features/shared_2fa_examples.rbindex 29ddc57974c..d30ba8e9235 100644--- a/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb+++ b/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb@@ -1,5 +1,6 @@def first_login_stepvisit signin_path+ SeleniumHubWaiter.waitwithin('#login-form') dofill_in('username', with: user.login)fill_in('password', with: user_password)@@ -9,12 +10,14 @@ enddef two_factor_step(token)expect(page).to have_selector('input#otp')+ SeleniumHubWaiter.waitfill_in 'otp', with: tokenclick_button I18n.t(:button_login)enddef expect_logged_invisit my_account_path+ SeleniumHubWaiter.waitexpect(page).to have_selector('.form--field-container', text: user.login)end@@ -34,14 +37,18 @@ shared_examples 'create enforced sms device' doit doexpect(page).to have_selector('.flash.info', text: I18n.t('two_factor_authentication.forced_registration.required_to_add_device'))+ SeleniumHubWaiter.wait# Create SMS devicefind('.mobile-otp-new-device-sms .button--tiny').click+ SeleniumHubWaiter.waitfill_in 'device_phone_number', with: 'invalid'click_on 'Continue'# Expect error on invalid phoneexpect(page).to have_selector('#errorExplanation', text: 'Phone number must be of format +XX XXXXXXXXX')++ SeleniumHubWaiter.waitfill_in 'device_phone_number', with: '+49 123456789'click_on 'Continue'@@ -49,6 +56,7 @@ shared_examples 'create enforced sms device' doexpect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.devices.confirm_device'))expect(page).to have_selector('input#otp')+ SeleniumHubWaiter.wait# Fill in wrong tokenfill_in 'otp', with: 'whatever'@@ -65,6 +73,7 @@ shared_examples 'create enforced sms device' doexpect(page).to have_selector('input#otp')expect(page).to have_selector('.flash.error', text: I18n.t('two_factor_authentication.devices.registration_failed_token_invalid'))+ SeleniumHubWaiter.wait# Fill in wrong tokenfill_in 'otp', with: sms_tokenclick_button I18n.t(:button_continue)@@ -72,4 +81,4 @@ shared_examples 'create enforced sms device' do# Expected logged in after correct registrationexpect_logged_inend-end\ No newline at end of file+enddiff --git a/modules/webhooks/spec/features/manage_webhooks_spec.rb b/modules/webhooks/spec/features/manage_webhooks_spec.rbindex dfcebf4f6fe..9ef0faae448 100644--- a/modules/webhooks/spec/features/manage_webhooks_spec.rb+++ b/modules/webhooks/spec/features/manage_webhooks_spec.rb@@ -24,6 +24,7 @@ describe 'Manage webhooks through UI', type: :feature, js: true do# Visit inline createfind('.wp-inline-create--add-link').click+ SeleniumHubWaiter.wait# Fill in elementsfill_in 'webhook_name', with: 'My webhook'@@ -50,9 +51,11 @@ describe 'Manage webhooks through UI', type: :feature, js: true doexpect(page).to have_selector('.webhooks--outgoing-webhook-row .events', text: 'Work packages')expect(page).to have_selector('.webhooks--outgoing-webhook-row .description', text: webhook.description)+ SeleniumHubWaiter.wait# Edit this webhookfind(".webhooks--outgoing-webhook-row-#{webhook.id} .icon-edit").click+ SeleniumHubWaiter.wait# Check the other eventfind('.form--check-box[value="work_package:created"]').set falsefind('.form--check-box[value="work_package:updated"]').set true@@ -69,6 +72,7 @@ describe 'Manage webhooks through UI', type: :feature, js: true doexpect(webhook.projects.all).to eq [project]expect(webhook.all_projects).to be_falsey+ SeleniumHubWaiter.wait# Delete webhookfind(".webhooks--outgoing-webhook-row-#{webhook.id} .icon-delete").clickpage.driver.browser.switch_to.alert.accept@@ -83,6 +87,7 @@ describe 'Manage webhooks through UI', type: :feature, js: true doit 'shows the delivery' dovisit admin_outgoing_webhooks_path+ SeleniumHubWaiter.waitfind('.webhooks--outgoing-webhook-row .name a', text: 'testing').clickexpect(page).to have_selector('.on-off-status.-enabled')@@ -90,6 +95,7 @@ describe 'Manage webhooks through UI', type: :feature, js: true doexpect(page).to have_selector('td.response_code', text: '200')# Open modal+ SeleniumHubWaiter.waitfind('td.response_body a', text: 'Show').clickpage.within('.webhooks--response-body-modal') dodiff --git a/script/ci/cache_prepare.sh b/script/ci/cache_prepare.shindex 752dc311cbc..fd1672b7861 100644--- a/script/ci/cache_prepare.sh+++ b/script/ci/cache_prepare.sh@@ -38,9 +38,9 @@ run() {eval $2;}-run "bundle exec rake db:migrate webdrivers:chromedriver:update webdrivers:geckodriver:update"+run "bundle exec rake db:create db:migrate webdrivers:chromedriver:update webdrivers:geckodriver:update"-run "for i in {1..3}; do (cd frontend; npm install && break || sleep 15;) done"+run "cd frontend; npm install ; cd -"run "bundle exec rake assets:precompile assets:clean"diff --git a/spec/features/activities/wiki_activity_spec.rb b/spec/features/activities/wiki_activity_spec.rbindex cacc0893ec4..02a02d3b4b3 100644--- a/spec/features/activities/wiki_activity_spec.rb+++ b/spec/features/activities/wiki_activity_spec.rb@@ -53,13 +53,16 @@ feature 'Wiki activities' doeditor.set_markdown('First content')click_button 'Save'+ expect(page).to have_text("Successful creation")# alter the page+ SeleniumHubWaiter.waitclick_link 'Edit'editor.set_markdown('Second content')click_button 'Save'+ expect(page).to have_text("Successful update")# After creating and altering the page, there# will be two activities to seediff --git a/spec/features/admin/attribute_help_texts_spec.rb b/spec/features/admin/attribute_help_texts_spec.rbindex 05d6d30128e..31a6d757a4c 100644--- a/spec/features/admin/attribute_help_texts_spec.rb+++ b/spec/features/admin/attribute_help_texts_spec.rb@@ -34,8 +34,7 @@ describe 'Attribute help texts', js: true dolet(:instance) { AttributeHelpText.last }let(:modal) { Components::AttributeHelpTextModal.new(instance) }let(:editor) { Components::WysiwygEditor.new }- let(:image_fixture) { Rails.root.join('spec/fixtures/files/image.png') }-+ let(:image_fixture) { UploadedFile.load_from('spec/fixtures/files/image.png') }let(:relation_columns_allowed) { true }describe 'Work package help texts' do@@ -48,7 +47,7 @@ describe 'Attribute help texts', js: true docontext 'with direct uploads (Regression #34285)', with_direct_uploads: true dobefore do- allow_any_instance_of(Attachment).to receive(:diskfile).and_return Struct.new(:path).new(image_fixture.to_s)+ allow_any_instance_of(Attachment).to receive(:diskfile).and_return image_fixtureendit 'can upload an image' do@@ -56,7 +55,7 @@ describe 'Attribute help texts', js: true doselect 'Status', from: 'attribute_help_text_attribute_name'editor.set_markdown('My attribute help text')- editor.drag_attachment image_fixture, 'Image uploaded on creation'+ editor.drag_attachment image_fixture.path, 'Image uploaded on creation'expect(page).to have_selector('attachment-list-item', text: 'image.png')click_button 'Save'@@ -81,7 +80,7 @@ describe 'Attribute help texts', js: true do# Add an image# adding an image- editor.drag_attachment image_fixture, 'Image uploaded on creation'+ editor.drag_attachment image_fixture.path, 'Image uploaded on creation'expect(page).to have_selector('attachment-list-item', text: 'image.png')click_button 'Save'@@ -105,13 +104,16 @@ describe 'Attribute help texts', js: true domodal.close!# -> edit+ SeleniumHubWaiter.waitpage.find('.attribute-help-text--entry td a', text: 'Status').click+ SeleniumHubWaiter.waitexpect(page).to have_selector('#attribute_help_text_attribute_name[disabled]')editor.set_markdown(' ')click_button 'Save'# Handle errorsexpect(page).to have_selector('#errorExplanation', text: "Help text can't be blank.")+ SeleniumHubWaiter.waiteditor.set_markdown('New**help**text')click_button 'Save'diff --git a/spec/features/admin/custom_fields/multi_value_custom_fields_spec.rb b/spec/features/admin/custom_fields/multi_value_custom_fields_spec.rbindex d86215314f2..5ba02d030d7 100644--- a/spec/features/admin/custom_fields/multi_value_custom_fields_spec.rb+++ b/spec/features/admin/custom_fields/multi_value_custom_fields_spec.rb@@ -60,6 +60,7 @@ describe 'Multi-value custom fields creation', type: :feature, js: true do# Create CFclick_on 'Create a new custom field'+ SeleniumHubWaiter.waitfill_in 'custom_field_name', with: 'My List CF'select 'List', from: 'custom_field_field_format'@@ -68,17 +69,20 @@ describe 'Multi-value custom fields creation', type: :feature, js: true do# Add new rowfind('#add-custom-option').click+ SeleniumHubWaiter.waitexpect(page).to have_selector('input#custom_field_custom_options_attributes_1_value')fill_in 'custom_field_custom_options_attributes_1_value', with: 'B'# Add new rowfind('#add-custom-option').click+ SeleniumHubWaiter.waitexpect(page).to have_selector('input#custom_field_custom_options_attributes_2_value')fill_in 'custom_field_custom_options_attributes_2_value', with: 'C'click_on 'Save'# Edit again+ SeleniumHubWaiter.waitpage.find('a', text: 'My List CF').clickexpect(page).to have_selector('input#custom_field_custom_options_attributes_0_value[value=A]')expect(page).to have_selector('input#custom_field_custom_options_attributes_1_value[value=B]')diff --git a/spec/features/admin/enterprise/enterprise_spec.rb b/spec/features/admin/enterprise/enterprise_spec.rbindex 31c05d76e1b..61b3baf242d 100644--- a/spec/features/admin/enterprise/enterprise_spec.rb+++ b/spec/features/admin/enterprise/enterprise_spec.rb@@ -92,9 +92,9 @@ describe 'Enterprise token', type: :feature, js: true doRequestStore.clear!expect(EnterpriseToken.current.encoded_token).to eq('foobar')- # Replace token- find('.collapsible-section--toggle-link').click- textarea.set 'blabla'+ expect(page).to have_text("Successful update")+ click_on "Replace your current support token"+ fill_in 'enterprise_token_encoded_token', with: "blabla"submit_button.clickexpect(page).to have_selector('.flash.notice', text: I18n.t(:notice_successful_update))@@ -103,7 +103,8 @@ describe 'Enterprise token', type: :feature, js: true doexpect(EnterpriseToken.current.encoded_token).to eq('blabla')# Remove token- find('.button.icon-delete', text: I18n.t(:button_delete)).click+ SeleniumHubWaiter.wait+ click_on "Delete"# Expect modalfind('.confirm-form-submit--continue').clickdiff --git a/spec/features/admin/enterprise/enterprise_trial_spec.rb b/spec/features/admin/enterprise/enterprise_trial_spec.rbindex 0428f048c65..400df7d9ac6 100644--- a/spec/features/admin/enterprise/enterprise_trial_spec.rb+++ b/spec/features/admin/enterprise/enterprise_trial_spec.rb@@ -30,7 +30,7 @@ require 'spec_helper'describe 'Enterprise trial management',type: :feature,- driver: :firefox_billy do+ driver: :chrome_billy dolet(:admin) { FactoryBot.create(:admin) }diff --git a/spec/features/admin/oauth/oauth_applications_management_spec.rb b/spec/features/admin/oauth/oauth_applications_management_spec.rbindex d0c03c28fc9..8cda42cfd96 100644--- a/spec/features/admin/oauth/oauth_applications_management_spec.rb+++ b/spec/features/admin/oauth/oauth_applications_management_spec.rb@@ -42,6 +42,8 @@ describe 'OAuth applications management', type: :feature, js: true do# Create applicationfind('.button', text: 'Add').click++ SeleniumHubWaiter.waitfill_in 'application_name', with: 'My API application'# Fill invalid redirect_urifill_in 'application_redirect_uri', with: "not a url!"@@ -50,6 +52,7 @@ describe 'OAuth applications management', type: :feature, js: true doexpect(page).to have_selector('.errorExplanation', text: 'Redirect URI must be an absolute URI.')# Can create localhost without https (https://community.openproject.com/wp/34025)+ SeleniumHubWaiter.waitfill_in 'application_redirect_uri', with: "urn:ietf:wg:oauth:2.0:oob\nhttp://localhost/my/callback"click_on 'Create'@@ -63,12 +66,15 @@ describe 'OAuth applications management', type: :feature, js: true doexpect(page.first('.attributes-key-value--value code').text).to match /\w+/# Edit again+ SeleniumHubWaiter.waitclick_on 'Edit'+ SeleniumHubWaiter.waitfill_in 'application_redirect_uri', with: "urn:ietf:wg:oauth:2.0:oob"click_on 'Save'# Show application+ SeleniumHubWaiter.waitfind('td a', text: 'My API application').clickexpect(page).to have_no_selector('.attributes-key-value--key', text: 'Client secret')@@ -76,6 +82,7 @@ describe 'OAuth applications management', type: :feature, js: true doexpect(page).to have_selector('.attributes-key-value--key', text: 'Client ID')expect(page).to have_selector('.attributes-key-value--value', text: "urn:ietf:wg:oauth:2.0:oob")+ SeleniumHubWaiter.waitclick_on 'Delete'page.driver.browser.switch_to.alert.acceptdiff --git a/spec/features/auth/consent_auth_stage_spec.rb b/spec/features/auth/consent_auth_stage_spec.rbindex 12cf6d8824b..2b7cb2bbb84 100644--- a/spec/features/auth/consent_auth_stage_spec.rb+++ b/spec/features/auth/consent_auth_stage_spec.rb@@ -135,6 +135,7 @@ describe 'Authentication Stages', type: :feature doexpect(page).to have_selector('.account-consent')expect(page).to have_selector('h1', text: 'Consent header')+ SeleniumHubWaiter.wait# Confirm consentcheck 'consent_check'click_on I18n.t(:button_continue)@@ -164,6 +165,7 @@ describe 'Authentication Stages', type: :feature dovisit signout_pathlogin_with user.login, user_password+ SeleniumHubWaiter.wait# Confirm consentcheck 'consent_check'click_on I18n.t(:button_continue)@@ -215,6 +217,7 @@ describe 'Authentication Stages', type: :feature doexpect(page).to have_selector('h2', text: 'Consent')# Confirm consent+ SeleniumHubWaiter.waitcheck 'consent_check'click_on I18n.t(:button_continue)diff --git a/spec/features/auth/omniauth_spec.rb b/spec/features/auth/omniauth_spec.rbindex 145df48bf57..e0aef9d220d 100644--- a/spec/features/auth/omniauth_spec.rb+++ b/spec/features/auth/omniauth_spec.rb@@ -71,6 +71,8 @@ describe 'Omniauth authentication', type: :feature doit 'should redirect to back url' dovisit account_lost_password_pathclick_link("Omniauth Developer", match: :first, visible: :all)++ SeleniumHubWaiter.waitfill_in('first_name', with: user.firstname)fill_in('last_name', with: user.lastname)fill_in('email', with: user.mail)@@ -81,6 +83,8 @@ describe 'Omniauth authentication', type: :feature doit 'should sign in user' dovisit '/auth/developer'++ SeleniumHubWaiter.waitfill_in('first_name', with: user.firstname)fill_in('last_name', with: user.lastname)fill_in('email', with: user.mail)@@ -97,6 +101,7 @@ describe 'Omniauth authentication', type: :feature dovisit my_account_path# requires login, redirects to developer login which is why we see the login form now+ SeleniumHubWaiter.waitfill_in('first_name', with: user.firstname)fill_in('last_name', with: user.lastname)fill_in('email', with: user.mail)@@ -125,6 +130,7 @@ describe 'Omniauth authentication', type: :feature doclick_on 'here'+ SeleniumHubWaiter.waitfill_in('first_name', with: user.firstname)fill_in('last_name', with: user.lastname)fill_in('email', with: user.mail)@@ -139,6 +145,7 @@ describe 'Omniauth authentication', type: :feature dovisit '/'click_link("Omniauth Developer", :match => :first)+ SeleniumHubWaiter.wait# login form developer strategyfill_in('first_name', with: user.firstname)# intentionally do not supply last_name@@ -148,6 +155,7 @@ describe 'Omniauth authentication', type: :feature doexpect(page).to have_content "Last name can't be blank"# on register form, we are prompted for a last namewithin('#content') do+ SeleniumHubWaiter.waitfill_in('user_lastname', with: user.lastname)click_link_or_button 'Create'end@@ -179,6 +187,7 @@ describe 'Omniauth authentication', type: :feature dovisit account_lost_password_pathclick_link("Omniauth Developer", :match => :first)+ SeleniumHubWaiter.wait# login form developer strategyfill_in('first_name', with: user.firstname)# intentionally do not supply last_name@@ -187,6 +196,7 @@ describe 'Omniauth authentication', type: :feature do# on register form, we are prompted for a last namewithin('#content') do+ SeleniumHubWaiter.waitfill_in('user_lastname', with: user.lastname)click_link_or_button 'Create'end@@ -211,6 +221,7 @@ describe 'Omniauth authentication', type: :feature doit 'shows a note explaining that the account has to be activated' dovisit login_path+ SeleniumHubWaiter.wait# login form developer strategyfill_in 'first_name', with: 'Ifor'fill_in 'last_name', with: 'McAlistar'@@ -254,6 +265,11 @@ describe 'Omniauth authentication', type: :feature do# to a symbol will force omniauth to fail /auth/failureOmniAuth.config.test_mode = trueOmniAuth.config.mock_auth[:developer] = :invalid_credentials+ # seems like this default behaviour is removed when running the full+ # test suite, so let's set it back when running this test+ OmniAuth.config.on_failure = Proc.new { |env|+ OmniAuth::FailureEndpoint.new(env).redirect_to_failure+ }visit login_pathexpect(page).to have_content(I18n.t(:error_external_authentication_failed))diff --git a/spec/features/custom_fields/create_float_spec.rb b/spec/features/custom_fields/create_float_spec.rbindex b49fbf28249..630bc73c32e 100644--- a/spec/features/custom_fields/create_float_spec.rb+++ b/spec/features/custom_fields/create_float_spec.rb@@ -14,6 +14,7 @@ describe 'custom fields', js: true docf_page.visit!click_on "Create a new custom field"+ SeleniumHubWaiter.waitendit "creates a new float custom field" dodiff --git a/spec/features/custom_fields/custom_fields_spec.rb b/spec/features/custom_fields/custom_fields_spec.rbindex 49ee3f2133d..c697edf65a7 100644--- a/spec/features/custom_fields/custom_fields_spec.rb+++ b/spec/features/custom_fields/custom_fields_spec.rb@@ -48,20 +48,17 @@ describe 'custom fields', js: true doexpect(page).to have_text("Successful creation")+ SeleniumHubWaiter.waitclick_on "Operating System"expect(page).to have_selector('.custom-option-row', count: 3)- values = all(".custom-option-value input")+ expect(page).to have_field("custom_field_custom_options_attributes_0_value", with: "Solaris")+ expect(page).to have_field("custom_field_custom_options_attributes_1_value", with: "Windows")+ expect(page).to have_field("custom_field_custom_options_attributes_2_value", with: "Linux")- expect(values[0].value).to eql("Solaris")- expect(values[1].value).to eql("Windows")- expect(values[2].value).to eql("Linux")-- defaults = all(".custom-option-default-value input")-- expect(defaults[0]).not_to be_checked- expect(defaults[1]).to be_checked- expect(defaults[2]).not_to be_checked+ expect(page).to have_field("custom_field_custom_options_attributes_0_default_value", checked: false)+ expect(page).to have_field("custom_field_custom_options_attributes_1_default_value", checked: true)+ expect(page).to have_field("custom_field_custom_options_attributes_2_default_value", checked: false)endend@@ -79,13 +76,16 @@ describe 'custom fields', js: true docf_page.visit!expect_angular_frontend_initialized+ SeleniumHubWaiter.waitclick_on custom_field.nameexpect_angular_frontend_initialized+ SeleniumHubWaiter.waitendit "adds new options" doclick_on "add-custom-option"+ SeleniumHubWaiter.waitexpect(page).to have_selector('.custom-option-row', count: 5)within all(".custom-option-row").last do@@ -93,6 +93,7 @@ describe 'custom fields', js: true doendclick_on "add-custom-option"+ SeleniumHubWaiter.waitexpect(page).to have_selector('.custom-option-row', count: 6)within all(".custom-option-row").last do@@ -105,55 +106,40 @@ describe 'custom fields', js: true doexpect(page).to have_text("Platform")expect(page).to have_selector('.custom-option-row', count: 6)- values = all(".custom-option-value input").map(&:value)-- expect(values).to eq ["Playstation", "Xbox", "Nintendo", "PC", "Sega", "Atari"]+ ["Playstation", "Xbox", "Nintendo", "PC", "Sega", "Atari"].each_with_index do |value, i|+ expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)+ endendit "updates the values and orders of the custom options" doexpect(page).to have_text("Platform")expect(page).to have_selector('.custom-option-row', count: 4)- rows = all(".custom-option-value input")-- expect(rows[0].value).to eql("Playstation")- expect(rows[1].value).to eql("Xbox")- expect(rows[2].value).to eql("Nintendo")- expect(rows[3].value).to eql("PC")-- rows[1].set "Sega"-- find("#custom_field_multi_value").set true-- defaults = all(".custom-option-default-value input")-- defaults[0].set true- defaults[2].set true+ ["Playstation", "Xbox", "Nintendo", "PC"].each_with_index do |value, i|+ expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)+ end+ fill_in("custom_field_custom_options_attributes_1_value", with: "Sega")+ check("custom_field_multi_value")+ check("custom_field_custom_options_attributes_0_default_value")+ check("custom_field_custom_options_attributes_2_default_value")within all(".custom-option-row").first doclick_on "Move to bottom"end-click_on "Save"expect(page).to have_text("Successful update")expect(page).to have_text("Platform")+ expect(page).to have_field("custom_field_multi_value", checked: true)- expect(find("#custom_field_multi_value")).to be_checked-- new_rows = all(".custom-option-value input")-- expect(new_rows[0].value).to eql("Sega")- expect(new_rows[1].value).to eql("Nintendo")- expect(new_rows[2].value).to eql("PC")- expect(new_rows[3].value).to eql("Playstation")-- new_defaults = all(".custom-option-default-value input")+ ["Sega", "Nintendo", "PC", "Playstation"].each_with_index do |value, i|+ expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)+ end- expect(new_defaults[0]).not_to be_checked- expect(new_defaults[1]).to be_checked- expect(new_defaults[2]).not_to be_checked- expect(new_defaults[3]).to be_checked+ expect(page).to have_field("custom_field_custom_options_attributes_0_default_value", checked: false)+ expect(page).to have_field("custom_field_custom_options_attributes_1_default_value", checked: true)+ expect(page).to have_field("custom_field_custom_options_attributes_2_default_value", checked: false)+ expect(page).to have_field("custom_field_custom_options_attributes_3_default_value", checked: true)endcontext "with work packages using the options" dodiff --git a/spec/features/forums/attachment_upload_spec.rb b/spec/features/forums/attachment_upload_spec.rbindex f42521434e8..5c5845a7ada 100644--- a/spec/features/forums/attachment_upload_spec.rb+++ b/spec/features/forums/attachment_upload_spec.rb@@ -42,7 +42,7 @@ describe 'Upload attachment to forum message', js: true doendlet(:project) { forum.project }let(:attachments) { ::Components::Attachments.new }- let(:image_fixture) { Rails.root.join('spec/fixtures/files/image.png') }+ let(:image_fixture) { UploadedFile.load_from('spec/fixtures/files/image.png') }let(:editor) { ::Components::WysiwygEditor.new }let(:index_page) { Pages::Messages::Index.new(forum.project) }@@ -58,7 +58,7 @@ describe 'Upload attachment to forum message', js: true docreate_page.set_subject 'A new message'# adding an image- editor.drag_attachment image_fixture, 'Image uploaded on creation'+ editor.drag_attachment image_fixture.path, 'Image uploaded on creation'expect(page).to have_selector('attachment-list-item', text: 'image.png')expect(page).not_to have_selector('notification-upload-progress')@@ -78,7 +78,7 @@ describe 'Upload attachment to forum message', js: true doeditor.type_slowly("A spacer text")- editor.drag_attachment image_fixture, 'Image uploaded the second time'+ editor.drag_attachment image_fixture.path, 'Image uploaded the second time'expect(page).to have_selector('attachment-list-item', text: 'image.png', count: 2)expect(page).not_to have_selector('notification-upload-progress')diff --git a/spec/features/forums/message_spec.rb b/spec/features/forums/message_spec.rbindex b4948d7da0b..949b87ad394 100644--- a/spec/features/forums/message_spec.rb+++ b/spec/features/forums/message_spec.rb@@ -55,10 +55,12 @@ describe 'messages', type: :feature, js: true docreate_page = index_page.click_create_message+ SeleniumHubWaiter.waitcreate_page.set_subject 'The message is'create_page.click_savecreate_page.expect_notification(type: :error, message: 'Content can\'t be blank')+ SeleniumHubWaiter.waitcreate_page.add_text 'There is no message here'show_page = create_page.click_savediff --git a/spec/features/global_roles/global_role_assignment_spec.rb b/spec/features/global_roles/global_role_assignment_spec.rbindex e874e5b9d17..fb90214f11a 100644--- a/spec/features/global_roles/global_role_assignment_spec.rb+++ b/spec/features/global_roles/global_role_assignment_spec.rb@@ -64,16 +64,12 @@ describe 'Global role: Global role assignment', type: :feature, js: true doexpect(page).to have_text 'global_role2'end+ SeleniumHubWaiter.wait# And I select the available global role "global_role"check 'global_role2'# And I press "Add"click_on 'Add'- # Then I should see "global_role" within "#table_principal_roles"- page.within('#available_principal_roles') do- expect(page).to have_no_text 'global_role1'- expect(page).to have_no_text 'global_role2'- end# And I should not see "global_role" within "#available_principal_roles"# And I should see "There is currently nothing to display"page.within('#table_principal_roles') do@@ -81,15 +77,22 @@ describe 'Global role: Global role assignment', type: :feature, js: true doexpect(page).to have_text 'global_role2'end+ # Then I should see "global_role" within "#table_principal_roles"+ page.within('#available_principal_roles') do+ expect(page).to have_no_text 'global_role1'+ expect(page).to have_no_text 'global_role2'+ end+# And I delete the assigned role "global_role"page.within("#assigned_global_role_#{global_role1.id}") do+ SeleniumHubWaiter.waitpage.find('.buttons a.icon-delete').clickend# Then I should see "global_role" within "#table_principal_roles"page.within('#available_principal_roles') do- expect(page).to have_text 'global_role1'expect(page).to have_no_text 'global_role2'+ expect(page).to have_text 'global_role1'end# And I should not see "global_role" within "#available_principal_roles"# And I should see "There is currently nothing to display"diff --git a/spec/features/groups/group_memberships_spec.rb b/spec/features/groups/group_memberships_spec.rbindex 6e8c425d5e2..9ae864ed4b2 100644--- a/spec/features/groups/group_memberships_spec.rb+++ b/spec/features/groups/group_memberships_spec.rb@@ -53,9 +53,12 @@ feature 'group memberships through groups page', type: :feature, js: true doexpect(members_page).not_to have_user 'Hannibal Smith'group_page.visit!++ SeleniumHubWaiter.waitgroup_page.add_to_project! 'Project 1', as: 'Manager'expect(page).to have_text 'Successful update'+ SeleniumHubWaiter.waitgroup_page.add_user! 'Hannibal'members_page.visit!@@ -75,6 +78,7 @@ feature 'group memberships through groups page', type: :feature, js: true doexpect(members_page).to have_user 'Hannibal Smith'group_page.visit!+ SeleniumHubWaiter.waitgroup_page.remove_user! 'Hannibal Smith'members_page.visit!diff --git a/spec/features/groups/membership_spec.rb b/spec/features/groups/membership_spec.rbindex f3a8fce17c3..bf6f04d9c92 100644--- a/spec/features/groups/membership_spec.rb+++ b/spec/features/groups/membership_spec.rb@@ -116,6 +116,7 @@ feature 'group memberships through project members page', type: :feature doexpect(members_page).to have_user('group1') # the group is already there thoughgroups_page.visit!+ SeleniumHubWaiter.waitgroups_page.add_user_to_group! 'Alice Wonderland', 'group1'members_page.visit!diff --git a/spec/features/members/membership_spec.rb b/spec/features/members/membership_spec.rbindex c0c063734b1..4b8a3a872ce 100644--- a/spec/features/members/membership_spec.rb+++ b/spec/features/members/membership_spec.rb@@ -54,10 +54,12 @@ feature 'group memberships through groups page', type: :feature, js: true doshared_examples 'adding and removing principals' doscenario 'Adding and Removing a Group as Member' domembers_page.visit!+ SeleniumHubWaiter.waitmembers_page.add_user! 'A-Team', as: 'Manager'expect(members_page).to have_added_group('A-Team')+ SeleniumHubWaiter.waitmembers_page.remove_group! 'A-Team'expect(page).to have_text 'Removed A-Team from project'expect(page).to have_text 'There are currently no members part of this project.'@@ -65,10 +67,12 @@ feature 'group memberships through groups page', type: :feature, js: true doscenario 'Adding and removing a User as Member' domembers_page.visit!+ SeleniumHubWaiter.waitmembers_page.add_user! 'Hannibal Smith', as: 'Manager'expect(members_page).to have_added_user 'Hannibal Smith'+ SeleniumHubWaiter.waitmembers_page.remove_user! 'Hannibal Smith'expect(page).to have_text 'Removed Hannibal Smith from project'expect(page).to have_text 'There are currently no members part of this project.'@@ -76,23 +80,29 @@ feature 'group memberships through groups page', type: :feature, js: true doscenario 'Entering a Username as Member in firstname, lastname order' domembers_page.visit!+ SeleniumHubWaiter.waitmembers_page.open_new_member!+ SeleniumHubWaiter.waitmembers_page.search_principal! 'Hannibal S'expect(members_page).to have_search_result 'Hannibal Smith'endscenario 'Entering a Username as Member in lastname, firstname order' domembers_page.visit!+ SeleniumHubWaiter.waitmembers_page.open_new_member!+ SeleniumHubWaiter.waitmembers_page.search_principal! 'Smith, H'expect(members_page).to have_search_result 'Hannibal Smith'endscenario 'Escaping should work properly when entering a name' domembers_page.visit!+ SeleniumHubWaiter.waitmembers_page.open_new_member!+ SeleniumHubWaiter.waitmembers_page.search_principal! 'script'expect(members_page).not_to have_alert_dialog@@ -108,19 +118,23 @@ feature 'group memberships through groups page', type: :feature, js: true doscenario 'sorting the page' domembers_page.visit!+ SeleniumHubWaiter.waitmembers_page.sort_by 'last name'members_page.expect_sorted_by 'last name'expect(members_page.contents('lastname')).to eq ['', peter.lastname, hannibal.lastname]+ SeleniumHubWaiter.waitmembers_page.sort_by 'last name'members_page.expect_sorted_by 'last name', desc: trueexpect(members_page.contents('lastname')).to eq [hannibal.lastname, peter.lastname, '']+ SeleniumHubWaiter.waitmembers_page.sort_by 'first name'members_page.expect_sorted_by 'first name'expect(members_page.contents('firstname')).to eq ['', hannibal.firstname, peter.firstname]+ SeleniumHubWaiter.waitmembers_page.sort_by 'email'members_page.expect_sorted_by 'email'expect(members_page.contents('email')).to eq ['', hannibal.mail, peter.mail]diff --git a/spec/features/members/pagination_spec.rb b/spec/features/members/pagination_spec.rbindex 5e9f3fd7aa8..9d7ec47349a 100644--- a/spec/features/members/pagination_spec.rb+++ b/spec/features/members/pagination_spec.rb@@ -52,8 +52,10 @@ feature 'members pagination', type: :feature, js: true domembers_page.set_items_per_page! 2members_page.visit!+ SeleniumHubWaiter.waitmembers_page.add_user! 'Peter Pan', as: 'Manager'+ SeleniumHubWaiter.waitmembers_page.go_to_page! 2expect(members_page).to have_user 'Alice Alison' # members are sorted by last name descend@@ -63,9 +65,11 @@ feature 'members pagination', type: :feature, js: true domembers_page.set_items_per_page! 1members_page.visit!+ SeleniumHubWaiter.waitmembers_page.remove_user! 'Peter Pan'expect(members_page).to have_user 'Bob Bobbit'+ SeleniumHubWaiter.waitmembers_page.go_to_page! 2expect(members_page).to have_user 'Alice Alison'end@@ -74,10 +78,12 @@ feature 'members pagination', type: :feature, js: true domembers_page.set_items_per_page! 1members_page.visit!+ SeleniumHubWaiter.waitmembers_page.edit_user! 'Bob Bobbit', add_roles: ['Developer']expect(page).to have_text 'Successful update'expect(members_page).to have_user 'Bob Bobbit', roles: ['Developer', 'Manager']+ SeleniumHubWaiter.waitmembers_page.go_to_page! 2expect(members_page).to have_user 'Alice Alison'enddiff --git a/spec/features/menu_items/wiki_menu_item_spec.rb b/spec/features/menu_items/wiki_menu_item_spec.rbindex bcb7c9f347d..c5f41ae5d17 100644--- a/spec/features/menu_items/wiki_menu_item_spec.rb+++ b/spec/features/menu_items/wiki_menu_item_spec.rb@@ -92,9 +92,11 @@ feature 'Wiki menu items' dovisit project_wiki_path(project, wiki_page)# creating the menu item with the pages name for the menu item+ SeleniumHubWaiter.waitclick_link 'More'click_link 'Configure menu item'+ SeleniumHubWaiter.waitchoose "Show as menu item in project navigation"click_button "Save"@@ -102,12 +104,14 @@ feature 'Wiki menu items' doexpect(page).to have_selector('.main-menu--children-menu-header', text: wiki_page.title)+ SeleniumHubWaiter.waitfind('.main-menu--arrow-left-to-project').clickexpect(page).to have_selector('.main-item-wrapper', text: wiki_page.title)# clicking the menu item leads to the page+ SeleniumHubWaiter.waitclick_link wiki_page.titleexpect(page)@@ -115,9 +119,11 @@ feature 'Wiki menu items' do# modifying the menu item to a different name and to be a subpage+ SeleniumHubWaiter.waitclick_link 'More'click_link 'Configure menu item'+ SeleniumHubWaiter.waitfill_in 'Name of menu item', with: 'Custom page name'choose "Show as submenu item of"@@ -133,12 +139,14 @@ feature 'Wiki menu items' doexpect(page).to have_selector('.wiki-menu--sub-item', text: 'Custom page name')+ SeleniumHubWaiter.waitclick_link 'Custom page name'expect(page).to have_current_path(project_wiki_path(project, wiki_page))# the submenu item is not visible on top level+ SeleniumHubWaiter.waitfind('.main-menu--arrow-left-to-project').clickexpect(page)@@ -169,6 +177,7 @@ feature 'Wiki menu items' doclick_button 'Save'# Because it is the last wiki menu item, the user is prompted to select another menu item+ SeleniumHubWaiter.waitselect another_wiki_page.title, from: 'main-menu-item-select'click_button 'Save'diff --git a/spec/features/my/my_notifications_spec.rb b/spec/features/my/my_notifications_spec.rbindex d02a5b42e88..faf97b10732 100644--- a/spec/features/my/my_notifications_spec.rb+++ b/spec/features/my/my_notifications_spec.rb@@ -43,6 +43,7 @@ describe 'My notifications spec', type: :feature, js: true dovisit my_account_pathclick_on 'Email notifications'+ SeleniumHubWaiter.waitendit 'allows to select a project to receive notifications for (Regression #28519)' do@@ -53,6 +54,8 @@ describe 'My notifications spec', type: :feature, js: true dofind("#notified_project_ids_#{project.id}", wait: 5).set trueclick_on 'Save'+ SeleniumHubWaiter.wait+expect(page).to have_selector('.flash.notice')user.reloaddiff --git a/spec/features/oauth/authorization_code_flow_spec.rb b/spec/features/oauth/authorization_code_flow_spec.rbindex 3c23333ae98..7bd3b0ee8cb 100644--- a/spec/features/oauth/authorization_code_flow_spec.rb+++ b/spec/features/oauth/authorization_code_flow_spec.rb@@ -68,6 +68,7 @@ describe 'OAuth authorization code flow',formsend+ SeleniumHubWaiter.wait# Authorizefind('input.button[value="Authorize"]').click@@ -105,6 +106,7 @@ describe 'OAuth authorization code flow',# Revoke the applicationwithin("#oauth-application-grant-#{app.id}") do+ SeleniumHubWaiter.waitclick_on 'Revoke'enddiff --git a/spec/features/onboarding/onboarding_tour_spec.rb b/spec/features/onboarding/onboarding_tour_spec.rbindex 8cfc0c6bc22..8d5fb576adc 100644--- a/spec/features/onboarding/onboarding_tour_spec.rb+++ b/spec/features/onboarding/onboarding_tour_spec.rb@@ -47,6 +47,7 @@ describe 'onboarding tour for new users', js: true dovisit home_path first_time_user: trueexpect(page).to have_text 'Please select your language'+ # SeleniumHubWaiter.waitselect 'Deutsch', :from => 'user_language'click_button 'Save'@@ -58,13 +59,14 @@ describe 'onboarding tour for new users', js: true doallow(Setting).to receive(:welcome_text).and_return("<a> #{project.name} </a>")visit home_path first_time_user: true+ # SeleniumHubWaiter.waitselect 'English', :from => 'user_language'click_button 'Save'endit 'when the welcome block does not include the demo projects' do- expect(page).not_to have_text 'Take a three minutes introduction tour to learn the most important features.'- expect(page).not_to have_selector '.enjoyhint_next_btn'+ expect(page).to have_no_text 'Take a three minutes introduction tour to learn the most important features.'+ expect(page).to have_no_selector '.enjoyhint_next_btn'endend@@ -73,8 +75,10 @@ describe 'onboarding tour for new users', js: true doallow(Setting).to receive(:welcome_text).and_return("<a href=/projects/#{project.identifier}> #{project.name} </a><a href=/projects/#{scrum_project.identifier}> #{scrum_project.name} </a>")visit home_path first_time_user: true+ # SeleniumHubWaiter.waitselect 'English', :from => 'user_language'click_button 'Save'+ SeleniumHubWaiter.waitendafter do@@ -92,20 +96,21 @@ describe 'onboarding tour for new users', js: true dofind('.enjoyhint_skip_btn').click# The tutorial disappears- expect(page).not_to have_text 'Take a three minutes introduction tour to learn the most important features.'- expect(page).not_to have_selector '.enjoyhint_next_btn'+ expect(page).to have_no_text 'Take a three minutes introduction tour to learn the most important features.'+ expect(page).to have_no_selector '.enjoyhint_next_btn'page.driver.browser.navigate.refresh# The tutorial did not start again- expect(page).not_to have_text 'Take a three minutes introduction tour to learn the most important features.'- expect(page).not_to have_selector '.enjoyhint_next_btn'+ expect(page).to have_no_text 'Take a three minutes introduction tour to learn the most important features.'+ expect(page).to have_no_selector '.enjoyhint_next_btn'endit 'and I continue the tutorial' donext_button.clickexpect(page).to have_text 'Please click on one of the projects with useful demo data to get started'+ # SeleniumHubWaiter.waitfind('.welcome').click_link 'Demo project'expect(page).to have_current_path "/projects/#{project.identifier}/work_packages?start_onboarding_tour=true"diff --git a/spec/features/projects/projects_index_spec.rb b/spec/features/projects/projects_index_spec.rbindex b3fdafd3f80..af417764c06 100644--- a/spec/features/projects/projects_index_spec.rb+++ b/spec/features/projects/projects_index_spec.rb@@ -251,6 +251,7 @@ describe 'Projects index page',scenario 'it keeps applying filters and order' doload_and_open_filters admin+ SeleniumHubWaiter.waitprojects_page.set_filter('name_and_identifier','Name or identifier','doesn\'t contain',@@ -259,43 +260,48 @@ describe 'Projects index page',click_on 'Apply'# Sorts ASC by name+ SeleniumHubWaiter.waitclick_on 'Sort by "Name"'# Results should be filtered and ordered ASC by nameexpect(page).to have_text(development_project.name)- expect(page).to_not have_text(project.name) # as it filtered away+ expect(page).to have_no_text(project.name) # as it filtered awayexpect(page).to have_text('Next') # as the result set is larger than 1- expect(page).to_not have_text(public_project.name) # as it is on the second page+ expect(page).to have_no_text(public_project.name) # as it is on the second page# Changing the page size to 5 and back to 1 should not change the filters (which we test later on the second page)+ SeleniumHubWaiter.waitfind('.pagination--options .pagination--item', text: '5').click # click page size '5'+ SeleniumHubWaiter.waitfind('.pagination--options .pagination--item', text: '1').click # return back to page size '1'-+ SeleniumHubWaiter.waitclick_on '2' # Go to pagination page 2# On page 2 you should see the second page of the filtered set ordered ASC by nameexpect(page).to have_text(public_project.name)- expect(page).to_not have_text(project.name) # Filtered away- expect(page).to_not have_text('Next') # Filters kept active, so there is no third page.- expect(page).to_not have_text(development_project.name) # That one should be on page 1+ expect(page).to have_no_text(project.name) # Filtered away+ expect(page).to have_no_text('Next') # Filters kept active, so there is no third page.+ expect(page).to have_no_text(development_project.name) # That one should be on page 1# Sorts DESC by name+ SeleniumHubWaiter.waitclick_on 'Ascending sorted by "Name"'# On page 2 the same filters should still be intact but the order should be DESC on nameexpect(page).to have_text(development_project.name)- expect(page).to_not have_text(project.name) # Filtered away- expect(page).to_not have_text('Next') # Filters kept active, so there is no third page.- expect(page).to_not have_text(public_project.name) # That one should be on page 1+ expect(page).to have_no_text(project.name) # Filtered away+ expect(page).to have_no_text('Next') # Filters kept active, so there is no third page.+ expect(page).to have_no_text(public_project.name) # That one should be on page 1# Sending the filter form again what implies to compose the request freshly+ SeleniumHubWaiter.waitclick_on 'Apply'# We should see page 1, resetting pagination, as it is a new filter, but keeping the DESC order on the project# nameexpect(page).to have_text(public_project.name)- expect(page).to_not have_text(development_project.name) # as it is on the second page- expect(page).to_not have_text(project.name) # as it filtered away+ expect(page).to have_no_text(development_project.name) # as it is on the second page+ expect(page).to have_no_text(project.name) # as it filtered awayexpect(page).to have_text('Next') # as the result set is larger than 1endend@@ -305,6 +311,7 @@ describe 'Projects index page',load_and_open_filters admin# Filter on model attribute 'name'+ SeleniumHubWaiter.waitprojects_page.set_filter('name_and_identifier','Name or identifier','doesn\'t contain',@@ -314,9 +321,10 @@ describe 'Projects index page',expect(page).to have_text(development_project.name)expect(page).to have_text(public_project.name)- expect(page).to_not have_text(project.name)+ expect(page).to have_no_text(project.name)# Filter on model attribute 'identifier'+ SeleniumHubWaiter.waitremove_filter('name_and_identifier')projects_page.set_filter('name_and_identifier',@@ -327,8 +335,8 @@ describe 'Projects index page',click_on 'Apply'expect(page).to have_text(project.name)- expect(page).to_not have_text(development_project.name)- expect(page).to_not have_text(public_project.name)+ expect(page).to have_no_text(development_project.name)+ expect(page).to have_no_text(public_project.name)endfeature 'Active or archived' do@@ -356,6 +364,7 @@ describe 'Projects index page',expect(page).to have_text('Development project')expect(page).to have_text('Public project')+ SeleniumHubWaiter.waitprojects_page.click_menu_item_of('Archive', parent_project)projects_page.accept_alert_dialog!@@ -375,6 +384,7 @@ describe 'Projects index page',load_and_open_filters admin+ SeleniumHubWaiter.waitprojects_page.filter_by_active('no')expect(page).to have_text("ARCHIVED #{parent_project.name}")@@ -389,6 +399,7 @@ describe 'Projects index page',expect(menu).to_not have_text('Settings')expect(menu).to_not have_text('New subproject')+ SeleniumHubWaiter.waitclick_link('Unarchive')end@@ -401,6 +412,7 @@ describe 'Projects index page',load_and_open_filters admin+ SeleniumHubWaiter.waitprojects_page.filter_by_active('yes')expect(page).to have_text(parent_project.name)@@ -435,16 +447,19 @@ describe 'Projects index page',login_as(admin)projects_page.visit!+ SeleniumHubWaiter.waitclick_link('Sort by "Status"')expect_project_at_place(green_project, 1)expect(page).to have_text('(1 - 8/8)')+ SeleniumHubWaiter.waitclick_link('Ascending sorted by "Status"')expect_project_at_place(green_project, 8)expect(page).to have_text('(1 - 8/8)')+ SeleniumHubWaiter.waitprojects_page.open_filtersprojects_page.set_filter('project_status_code',@@ -458,6 +473,7 @@ describe 'Projects index page',expect(page).to_not have_text(gray_project.name)expect(page).to_not have_text(no_status_project.name)+ SeleniumHubWaiter.waitprojects_page.set_filter('project_status_code','Project status','all',@@ -469,6 +485,7 @@ describe 'Projects index page',expect(page).to_not have_text(gray_project.name)expect(page).to_not have_text(no_status_project.name)+ SeleniumHubWaiter.waitprojects_page.set_filter('project_status_code','Project status','none',@@ -540,6 +557,7 @@ describe 'Projects index page',allow_enterprise_editionproject_created_on_todayload_and_open_filters admin+ SeleniumHubWaiter.waitendscenario 'selecting operator' do@@ -555,6 +573,7 @@ describe 'Projects index page',expect(page).to_not have_text(project_created_on_fixed_date.name)# created on 'this week' shows projects that were created within the last seven days+ SeleniumHubWaiter.waitremove_filter('created_at')projects_page.set_filter('created_at',@@ -568,6 +587,7 @@ describe 'Projects index page',expect(page).to_not have_text(project_created_on_fixed_date.name)# created on 'on' shows projects that were created within the last seven days+ SeleniumHubWaiter.waitremove_filter('created_at')projects_page.set_filter('created_at',@@ -582,6 +602,7 @@ describe 'Projects index page',expect(page).to_not have_text(project_created_on_this_week.name)# created on 'less than days ago'+ SeleniumHubWaiter.waitremove_filter('created_at')projects_page.set_filter('created_at',@@ -595,6 +616,7 @@ describe 'Projects index page',expect(page).to_not have_text(project_created_on_fixed_date.name)# created on 'more than days ago'+ SeleniumHubWaiter.waitremove_filter('created_at')projects_page.set_filter('created_at',@@ -608,6 +630,7 @@ describe 'Projects index page',expect(page).to_not have_text(project_created_on_today.name)# created on 'between'+ SeleniumHubWaiter.waitremove_filter('created_at')projects_page.set_filter('created_at',@@ -621,6 +644,7 @@ describe 'Projects index page',expect(page).to_not have_text(project_created_on_today.name)# Latest activity at 'today'. This spot check would fail if the data does not get collected from multiple tables+ SeleniumHubWaiter.waitremove_filter('created_at')projects_page.set_filter('latest_activity_at',@@ -633,6 +657,7 @@ describe 'Projects index page',expect(page).to_not have_text(project_created_on_fixed_date.name)# CF List+ SeleniumHubWaiter.waitremove_filter('latest_activity_at')projects_page.set_filter("cf_#{list_custom_field.id}",@@ -650,11 +675,13 @@ describe 'Projects index page',within(cf_filter) do# Initial filter is a 'single select'expect(cf_filter.find(:select, 'value')).not_to be_multiple+ SeleniumHubWaiter.waitclick_on 'Toggle multiselect'# switching to multiselect keeps the current selectionexpect(cf_filter.find(:select, 'value')).to be_multipleexpect(cf_filter).to have_select('value', selected: list_custom_field.possible_values[2].value)+ SeleniumHubWaiter.waitselect list_custom_field.possible_values[3].value, from: 'value'end@@ -670,6 +697,7 @@ describe 'Projects index page',list_custom_field.possible_values[3].value])# switching to single select keeps the first selection+ SeleniumHubWaiter.waitselect list_custom_field.possible_values[1].value, from: 'value'unselect list_custom_field.possible_values[2].value, from: 'value'@@ -688,6 +716,7 @@ describe 'Projects index page',end# CF date filter work (at least for one operator)+ SeleniumHubWaiter.waitremove_filter("cf_#{list_custom_field.id}")projects_page.set_filter("cf_#{date_custom_field.id}",@@ -695,10 +724,11 @@ describe 'Projects index page','on',['2011-11-11'])+ SeleniumHubWaiter.waitclick_on 'Apply'expect(page).to have_text(project_created_on_today.name)- expect(page).to_not have_text(project_created_on_fixed_date.name)+ expect(page).to have_no_text(project_created_on_fixed_date.name)endpending "NOT WORKING YET: Date vs. DateTime issue: Selecting same date for from and to value shows projects of that date"@@ -862,6 +892,7 @@ describe 'Projects index page',child_project_z,public_project)+ SeleniumHubWaiter.waitclick_link('Name')# Projects ordered by name asc@@ -872,6 +903,7 @@ describe 'Projects index page',public_project,child_project_z)+ SeleniumHubWaiter.waitclick_link('Name')# Projects ordered by name desc@@ -882,6 +914,7 @@ describe 'Projects index page',development_project,child_project_a)+ SeleniumHubWaiter.waitclick_link(integer_custom_field.name)# Projects ordered by cf asc first then project name desc@@ -892,6 +925,7 @@ describe 'Projects index page',child_project_m,child_project_a)+ SeleniumHubWaiter.waitclick_link('Sort by "Project hierarchy"')# again ordered by name asc on each hierarchical leveldiff --git a/spec/features/projects/projects_spec.rb b/spec/features/projects/projects_spec.rbindex e0443331ecc..65e2e99170a 100644--- a/spec/features/projects/projects_spec.rb+++ b/spec/features/projects/projects_spec.rb@@ -76,7 +76,9 @@ describe 'Projects', type: :feature doit 'can create a subproject' doclick_on 'Foo project'+ SeleniumHubWaiter.waitclick_on 'Project settings'+ SeleniumHubWaiter.waitclick_on 'New subproject'fill_in 'project[name]', with: 'Foo child'@@ -152,7 +154,9 @@ describe 'Projects', type: :feature doit 'updates the project identifier' dovisit projects_pathclick_on project.name+ SeleniumHubWaiter.waitclick_on 'Project settings'+ SeleniumHubWaiter.waitclick_on 'Edit'expect(page).to have_content "CHANGE THE PROJECT'S IDENTIFIER"diff --git a/spec/features/repositories/create_repository_spec.rb b/spec/features/repositories/create_repository_spec.rbindex 6680f3582c1..639fc2b6837 100644--- a/spec/features/repositories/create_repository_spec.rb+++ b/spec/features/repositories/create_repository_spec.rb@@ -79,7 +79,9 @@ describe 'Create repository', type: :feature, js: true, selenium: true dodescribe 'with submitted vendor form' dobefore dosettings_page.visit_repository_settings+ SeleniumHubWaiter.waitfind("option[value='#{vendor}']").select_option+ SeleniumHubWaiter.waitendshared_examples 'has only the type which is selected' do |type, vendor|diff --git a/spec/features/repositories/repository_settings_spec.rb b/spec/features/repositories/repository_settings_spec.rbindex ae6eaa07ec6..6befb377dda 100644--- a/spec/features/repositories/repository_settings_spec.rb+++ b/spec/features/repositories/repository_settings_spec.rb@@ -63,6 +63,7 @@ describe 'Repository Settings', type: :feature, js: true doexpect(Repository.exists?(repository.id)).to be trueif type == 'managed'+ SeleniumHubWaiter.waitfind('a.icon-delete', text: I18n.t(:button_delete)).clickdangerzone = DangerZone.new(page)@@ -70,16 +71,21 @@ describe 'Repository Settings', type: :feature, js: true doexpect(page).to have_selector(dangerzone.container_selector)expect(dangerzone.disabled?).to be true+ SeleniumHubWaiter.waitdangerzone.confirm_with('definitely not the correct value')expect(dangerzone.disabled?).to be true+ SeleniumHubWaiter.waitdangerzone.confirm_with(project.identifier)expect(dangerzone.disabled?).to be false+ SeleniumHubWaiter.waitdangerzone.danger_button.clickelse+ SeleniumHubWaiter.waitfind('a.icon-remove', text: I18n.t(:button_remove)).clickexpect(page).to have_selector('.notification-box.-warning')+ SeleniumHubWaiter.waitfind('a', text: I18n.t(:button_remove)).clickenddiff --git a/spec/features/roles/create_spec.rb b/spec/features/roles/create_spec.rbindex f22dba10e2a..00d51a6060d 100644--- a/spec/features/roles/create_spec.rb+++ b/spec/features/roles/create_spec.rb@@ -48,6 +48,7 @@ describe 'Role creation', type: :feature, js: true doclick_link 'Role'end+ SeleniumHubWaiter.waitfill_in 'Name', with: existing_role.nameselect existing_role.name, from: 'Copy workflow from'check 'Edit work packages'@@ -58,6 +59,7 @@ describe 'Role creation', type: :feature, js: true doexpect(page).to have_selector('.errorExplanation', text: 'Name has already been taken')+ SeleniumHubWaiter.waitfill_in 'Name', with: 'New role name'# This will lead to an error as manage versions requires view versions@@ -69,6 +71,7 @@ describe 'Role creation', type: :feature, js: true do.to have_selector('.errorExplanation',text: "Permissions need to also include 'View members' as 'Manage members' is selected.")+ SeleniumHubWaiter.waitcheck 'View members'select existing_role.name, from: 'Copy workflow from'@@ -83,6 +86,7 @@ describe 'Role creation', type: :feature, js: true doexpect(page).to have_selector('table td', text: 'New role name')+ SeleniumHubWaiter.waitclick_link 'New role name'expect(page)@@ -109,6 +113,7 @@ describe 'Role creation', type: :feature, js: true do# Workflow routes are not resource-oriented.visit(url_for(controller: :workflows, action: :edit, only_path: true))+ SeleniumHubWaiter.waitselect 'New role name', from: 'Role'select type.name, from: 'Type'click_button 'Edit'@@ -116,9 +121,6 @@ describe 'Role creation', type: :feature, js: true dofrom_id = existing_workflow.old_status_idto_id = existing_workflow.new_status_id- checkbox = page.find("input.old-status-#{from_id}.new-status-#{to_id}[value=always]")-- expect(checkbox)- .to be_checked+ expect(page).to have_field("status_#{from_id}_#{to_id}_", checked: true)endenddiff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rbindex 1eddcfac92a..8223f809f51 100644--- a/spec/features/search_spec.rb+++ b/spec/features/search_spec.rb@@ -304,8 +304,8 @@ describe 'Search', type: :feature, js: true, with_settings: { per_page_options:table.expect_work_package_subject(work_packages[0].subject)# ... for type: stringglobal_search.search custom_field_string_value, submit: true- table.ensure_work_package_not_listed! work_packages[0]table.expect_work_package_subject(work_packages[1].subject)+ table.ensure_work_package_not_listed! work_packages[0]# Change to project scope to include subprojectsglobal_search.search other_work_package.subject@@ -420,23 +420,23 @@ describe 'Search', type: :feature, js: true, with_settings: { per_page_options:global_search.expect_global_scope_markedglobal_search.submit_in_global_scope- table.ensure_work_package_not_listed! wp_2table.expect_work_package_listed(wp_1, wp_3)+ table.ensure_work_package_not_listed! wp_2global_search.search "# Bar"global_search.find_option "Foo # Bar"global_search.find_option "Foo &# Bar"global_search.submit_in_global_scope- table.ensure_work_package_not_listed! wp_1table.expect_work_package_listed(wp_2)+ table.ensure_work_package_not_listed! wp_1global_search.search "&"# Bug in ng-select causes highlights to break up entitiesglobal_search.find_option "Foo && Bar"global_search.find_option "Foo &# Bar"global_search.submit_in_global_scope- table.ensure_work_package_not_listed! wp_2table.expect_work_package_listed(wp_1, wp_3)+ table.ensure_work_package_not_listed! wp_2endendenddiff --git a/spec/features/support/components/attribute_help_text_modal.rb b/spec/features/support/components/attribute_help_text_modal.rbindex 6ca5683811f..872fd184a1d 100644--- a/spec/features/support/components/attribute_help_text_modal.rb+++ b/spec/features/support/components/attribute_help_text_modal.rb@@ -51,6 +51,7 @@ module Componentsenddef open!+ SeleniumHubWaiter.waitcontainer.find(".help-text--for-#{help_text.attribute_name}").clickexpect(page).to have_selector('.attribute-help-text--modal h3', text: help_text.attribute_caption)enddiff --git a/spec/features/types/reset_form_configuration_spec.rb b/spec/features/types/reset_form_configuration_spec.rbindex 91fa82adaa4..7e733502554 100644--- a/spec/features/types/reset_form_configuration_spec.rb+++ b/spec/features/types/reset_form_configuration_spec.rb@@ -63,12 +63,13 @@ describe 'Reset form configuration', type: :feature, js: true doform.save_changesexpect(page).to have_selector('.flash.notice', text: 'Successful update.', wait: 10)+ SeleniumHubWaiter.waitform.reset_button.clickdialog.expect_opendialog.confirm# Wait for page reload- sleep 1+ SeleniumHubWaiter.waitexpect(page).to have_no_selector('.group-head', text: 'NEW GROUP')expect(page).to have_no_selector('.group-head', text: 'OTHER')diff --git a/spec/features/users/delete_spec.rb b/spec/features/users/delete_spec.rbindex 957883a42fe..fcaa0d5a9ec 100644--- a/spec/features/users/delete_spec.rb+++ b/spec/features/users/delete_spec.rb@@ -107,11 +107,14 @@ describe 'user deletion: ', type: :feature, js: true doexpect(page).to have_content "#{user.firstname} #{user.lastname}"click_on 'Delete'++ SeleniumHubWaiter.waitfill_in 'login_verification', with: user.loginclick_on 'Delete'dialog.confirm_flow_with 'wrong', should_fail: true+ SeleniumHubWaiter.waitfill_in 'login_verification', with: user.loginclick_on 'Delete'diff --git a/spec/features/users/self_registration_spec.rb b/spec/features/users/self_registration_spec.rbindex 11306aee37b..b06fce3573c 100644--- a/spec/features/users/self_registration_spec.rb+++ b/spec/features/users/self_registration_spec.rb@@ -62,14 +62,13 @@ describe 'user self registration', type: :feature, js: true dowithin '.top-menu-items-right .menu_root' doclick_link 'Sign in'- # Wait until click handler has been initialized- sleep(0.1)-+ SeleniumHubWaiter.waitclick_link 'Create a new account'end# deliberately inserting a wrong password confirmationwithin '.registration-modal' do+ SeleniumHubWaiter.waitfill_in 'Username', with: 'heidi'fill_in 'First name', with: 'Heidi'fill_in 'Last name', with: 'Switzerland'@@ -87,6 +86,7 @@ describe 'user self registration', type: :feature, js: true dowithin '.registration-modal' do# Cannot use 'Password' here as the error message on 'Confirmation' is part of the label# and contains the string 'Password' as well+ SeleniumHubWaiter.waitfill_in 'user_password', with: 'test123=321test'fill_in 'Confirmation', with: 'test123=321test'diff --git a/spec/features/users/user_memberships_spec.rb b/spec/features/users/user_memberships_spec.rbindex 00232239bef..93ea339fce7 100644--- a/spec/features/users/user_memberships_spec.rb+++ b/spec/features/users/user_memberships_spec.rb@@ -46,9 +46,11 @@ feature 'user memberships through user page', type: :feature, js: true doendscenario 'handles role modification flow' do+ SeleniumHubWaiter.waituser_page.add_to_project! project.name, as: 'Manager'member = admin.memberships.where(project_id: project.id).first+ SeleniumHubWaiter.waituser_page.edit_roles!(member, %w(Manager Developer))# Modify roles@@ -59,6 +61,7 @@ feature 'user memberships through user page', type: :feature, js: true do# Remove all rolesuser_page.expect_project(project.name)+ SeleniumHubWaiter.waituser_page.edit_roles!(member, %w())expect(page).to have_selector('.flash.error', text: 'Roles need to be assigned.')@@ -68,6 +71,7 @@ feature 'user memberships through user page', type: :feature, js: true douser_page.expect_no_membership(project.name)# Re-add the user+ SeleniumHubWaiter.waituser_page.add_to_project! project.name, as: %w(Manager Developer)user_page.expect_project(project.name)@@ -86,6 +90,7 @@ feature 'user memberships through user page', type: :feature, js: true douser_page.expect_no_membership(project.name)group_page.visit!+ SeleniumHubWaiter.waitgroup_page.add_to_project! project.name, as: 'Manager'expect(page).to have_text 'Successful update'@@ -98,6 +103,7 @@ feature 'user memberships through user page', type: :feature, js: true do# Remove all rolesmember = admin.memberships.where(project_id: project.id).first+ SeleniumHubWaiter.waituser_page.edit_roles!(member, %w())# Keeps inherited role@@ -105,6 +111,7 @@ feature 'user memberships through user page', type: :feature, js: true douser_page.expect_roles(project.name, %w(Manager))# Extend roles+ SeleniumHubWaiter.waituser_page.edit_roles!(member, %w(Developer))user_page.expect_project(project.name)user_page.expect_roles(project.name, %w(Manager Developer))diff --git a/spec/features/versions/create_spec.rb b/spec/features/versions/create_spec.rbindex 42c2e6bf9f8..94da116250c 100644--- a/spec/features/versions/create_spec.rb+++ b/spec/features/versions/create_spec.rb@@ -28,7 +28,7 @@require 'spec_helper'-describe 'version create', type: :feature, js: true do+describe 'version create', type: :feature, js: false dolet(:user) doFactoryBot.create(:user,member_in_project: project,@@ -55,13 +55,12 @@ describe 'version create', type: :feature, js: true doit 'and redirect back to where you started' dovisit project_roadmap_path(project)-click_on 'New version'- expect(page).to have_current_path(new_project_version_path(project))fill_in 'Name', with: new_version_nameclick_on 'Create'+ expect(page).to have_text("Successful creation")expect(page).to have_current_path(project_roadmap_path(project))expect(page).to have_content new_version_nameenddiff --git a/spec/features/watching/toggle_watching_spec.rb b/spec/features/watching/toggle_watching_spec.rbindex 4fb49e67500..0cf2e258511 100644--- a/spec/features/watching/toggle_watching_spec.rb+++ b/spec/features/watching/toggle_watching_spec.rb@@ -49,13 +49,11 @@ describe 'Toggle watching', type: :feature, js: true dotopic_path(message),project_wiki_path(project, wiki_page)].each do |path|visit path-click_link(I18n.t('button_watch'))-expect(page).to have_link(I18n.t('button_unwatch'))+ SeleniumHubWaiter.waitclick_link(I18n.t('button_unwatch'))-expect(page).to have_link(I18n.t('button_watch'))endenddiff --git a/spec/features/wiki/adding_editing_history_spec.rb b/spec/features/wiki/adding_editing_history_spec.rbindex 4a749ad19ed..ed0797d3aff 100644--- a/spec/features/wiki/adding_editing_history_spec.rb+++ b/spec/features/wiki/adding_editing_history_spec.rb@@ -79,19 +79,23 @@ describe 'wiki pages', type: :feature, js: true doexpect(page).to have_selector('.wiki-content', text: content_first_version)within '.toolbar-items' do+ SeleniumHubWaiter.waitclick_on "Edit"endfind('.ck-content').set(content_second_version)+ SeleniumHubWaiter.waitclick_button 'Save'expect(page).to have_selector('.wiki-content', text: content_second_version)within '.toolbar-items' do+ SeleniumHubWaiter.waitclick_on 'More'click_on 'History'end+ SeleniumHubWaiter.waitclick_on 'View differences'within '.text-diff' do@@ -99,16 +103,19 @@ describe 'wiki pages', type: :feature, js: true doexpect(page).to have_selector('del.diffmod', text: 'first')end+ SeleniumHubWaiter.wait# Go back to historyfind('.button', text: 'History').click# Click on first version# to determine text (Regression test #31531)+ SeleniumHubWaiter.waitfind('td.id a', text: 1).clickexpect(page).to have_selector('.wiki-version--details', text: 'Version 1/2')expect(page).to have_selector('.wiki-content', text: content_first_version)+ SeleniumHubWaiter.waitfind('.button', text: 'Next').clickexpect(page).to have_selector('.wiki-version--details', text: 'Version 2/2')diff --git a/spec/features/wiki/attachment_upload_spec.rb b/spec/features/wiki/attachment_upload_spec.rbindex e42bb249d82..0da661caaf9 100644--- a/spec/features/wiki/attachment_upload_spec.rb+++ b/spec/features/wiki/attachment_upload_spec.rb@@ -39,7 +39,7 @@ describe 'Upload attachment to wiki page', js: true doendlet(:project) { FactoryBot.create(:project) }let(:attachments) { ::Components::Attachments.new }- let(:image_fixture) { Rails.root.join('spec/fixtures/files/image.png') }+ let(:image_fixture) { UploadedFile.load_from('spec/fixtures/files/image.png') }let(:editor) { ::Components::WysiwygEditor.new }let(:wiki_page_content) { project.wiki.pages.first.content.text }@@ -51,26 +51,30 @@ describe 'Upload attachment to wiki page', js: true dovisit project_wiki_path(project, 'test')# adding an image- editor.drag_attachment image_fixture, 'Image uploaded the first time'+ editor.drag_attachment image_fixture.path, 'Image uploaded the first time'expect(page).to have_selector('attachment-list-item', text: 'image.png')expect(page).not_to have_selector('notification-upload-progress')click_on 'Save'+ expect(page).to have_text("Successful creation")expect(page).to have_selector('#content img', count: 1)expect(page).to have_content('Image uploaded the first time')expect(page).to have_selector('attachment-list-item', text: 'image.png')+ # required sleep otherwise clicking on the Edit button doesn't do anything+ SeleniumHubWaiter.wait+within '.toolbar-items' doclick_on "Edit"end# Replace the image with a named attachment URL (Regression #28381)- expect(page).to have_selector('.ck-editor__editable')+ expect(page).to have_selector('.ck-editor__editable', wait: 5)editor.set_markdown "\n\nSome text\n\n\nText that prevents the two images colliding"- editor.drag_attachment image_fixture, 'Image uploaded the second time'+ editor.drag_attachment image_fixture.path, 'Image uploaded the second time'expect(page).not_to have_selector('notification-upload-progress')expect(page).to have_selector('attachment-list-item', text: 'image.png', count: 2)@@ -89,6 +93,7 @@ describe 'Upload attachment to wiki page', js: true doclick_on 'Save'+ expect(page).to have_text("Successful update")expect(page).to have_selector('#content img', count: 2)# First figcaption is lost by having replaced the markdownexpect(page).to have_content('Image uploaded the second time')@@ -109,7 +114,7 @@ describe 'Upload attachment to wiki page', js: true do# Upload image to dropzoneexpect(page).to have_no_selector('.work-package--attachments--filename')- attachments.attach_file_on_input(image_fixture)+ attachments.attach_file_on_input(image_fixture.path)expect(page).not_to have_selector('notification-upload-progress')expect(page).to have_selector('.work-package--attachments--filename', text: 'image.png')diff --git a/spec/features/wiki/child_pages_spec.rb b/spec/features/wiki/child_pages_spec.rbindex 9444a3f477b..40c66253e1b 100644--- a/spec/features/wiki/child_pages_spec.rb+++ b/spec/features/wiki/child_pages_spec.rb@@ -56,6 +56,7 @@ describe 'wiki child pages', type: :feature, js: true doclick_on 'Wiki page'+ SeleniumHubWaiter.waitfill_in 'content_page_title', with: child_page_namefind('.ck-content').set('The child page\'s content')diff --git a/spec/features/wiki/rename_spec.rb b/spec/features/wiki/rename_spec.rbindex 04717657c28..683c92f4330 100644--- a/spec/features/wiki/rename_spec.rb+++ b/spec/features/wiki/rename_spec.rb@@ -49,9 +49,11 @@ describe 'Wiki page', type: :feature, js: true doit 'allows renaming' dovisit project_wiki_path(project, wiki_page)+ SeleniumHubWaiter.waitclick_link 'More'click_link 'Rename'+ SeleniumHubWaiter.waitfill_in 'Title', with: rename_nameclick_button 'Rename'diff --git a/spec/features/work_packages/attachments/attachment_upload_spec.rb b/spec/features/work_packages/attachments/attachment_upload_spec.rbindex 9520216e681..4f1f9d88c38 100644--- a/spec/features/work_packages/attachments/attachment_upload_spec.rb+++ b/spec/features/work_packages/attachments/attachment_upload_spec.rb@@ -18,7 +18,7 @@ describe 'Upload attachment to work package', js: true dolet(:wp_page) { ::Pages::FullWorkPackage.new(work_package, project) }let(:attachments) { ::Components::Attachments.new }let(:field) { TextEditorField.new wp_page, 'description' }- let(:image_fixture) { Rails.root.join('spec/fixtures/files/image.png') }+ let(:image_fixture) { UploadedFile.load_from('spec/fixtures/files/image.png') }let(:editor) { Components::WysiwygEditor.new }before do@@ -40,7 +40,7 @@ describe 'Upload attachment to work package', js: true doeditor.expect_button 'Insert image'- editor.drag_attachment image_fixture, 'Some image caption'+ editor.drag_attachment image_fixture.path, 'Some image caption'field.submit_by_click@@ -97,7 +97,7 @@ describe 'Upload attachment to work package', js: true dosubject.set_value 'My subject'target = find('.ck-content')- attachments.drag_and_drop_file(target, image_fixture)+ attachments.drag_and_drop_file(target, image_fixture.path)sleep 2expect(page).not_to have_selector('notification-upload-progress')@@ -144,7 +144,7 @@ describe 'Upload attachment to work package', js: true do# everywhere so if this works it should work everywhere else too.context 'with direct uploads', with_direct_uploads: true dobefore do- allow_any_instance_of(Attachment).to receive(:diskfile).and_return Struct.new(:path).new(image_fixture.to_s)+ allow_any_instance_of(Attachment).to receive(:diskfile).and_return Struct.new(:path).new(image_fixture.path.to_s)endit_behaves_like 'it supports image uploads via drag & drop' do@@ -170,13 +170,13 @@ describe 'Upload attachment to work package', js: true do### Attach file manuallyexpect(page).to have_no_selector('.work-package--attachments--filename')- attachments.attach_file_on_input(image_fixture)+ attachments.attach_file_on_input(image_fixture.path)expect(page).not_to have_selector('notification-upload-progress')expect(page).to have_selector('.work-package--attachments--filename', text: 'image.png', wait: 5)### and via drag & drop- attachments.drag_and_drop_file(container, Rails.root.join('spec/fixtures/files/image.png'))+ attachments.drag_and_drop_file(container, image_fixture.path)expect(page).not_to have_selector('notification-upload-progress')expect(page).to have_selector('.work-package--attachments--filename', text: 'image.png', count: 2, wait: 5)enddiff --git a/spec/features/work_packages/display_representations/switch_display_representations_spec.rb b/spec/features/work_packages/display_representations/switch_display_representations_spec.rbindex 086cc1b2714..29012493128 100644--- a/spec/features/work_packages/display_representations/switch_display_representations_spec.rb+++ b/spec/features/work_packages/display_representations/switch_display_representations_spec.rb@@ -144,7 +144,7 @@ describe 'Switching work package view',expect(url).not_to match(/query_props=.+/)# Since the query is unchanged, the WPs will be displayed as list on larger screens again- page.driver.browser.manage.window.resize_to(680, 1080)+ page.driver.browser.manage.window.resize_to(700, 1080)page.driver.browser.navigate.refreshwp_table.expect_work_package_listed wp_1, wp_2wp_table.expect_work_package_order wp_1, wp_2diff --git a/spec/features/work_packages/export_spec.rb b/spec/features/work_packages/export_spec.rbindex 40651aaed89..ee7fea38ef5 100644--- a/spec/features/work_packages/export_spec.rb+++ b/spec/features/work_packages/export_spec.rb@@ -50,6 +50,7 @@ describe 'work package export', type: :feature dolet(:settings_menu) { ::Components::WorkPackages::SettingsMenu.new }before do+ @download_list = DownloadList.newwp_1wp_2wp_3@@ -59,11 +60,9 @@ describe 'work package export', type: :feature doendlet(:export_type) { 'CSV' }- subject { DownloadedFile.download_content }-- def export!(wait_for_downloads = true)- DownloadedFile::clear_downloads+ subject { @download_list.refresh_from(page).latest_downloaded_content }+ def export!(expect_success = true)work_packages_page.ensure_loadedsettings_menu.open_and_choose 'Export ...'@@ -82,15 +81,13 @@ describe 'work package export', type: :feature do# nothingend- if wait_for_downloads- # Wait for the file to download- ::DownloadedFile.wait_for_download- ::DownloadedFile.wait_for_download_content+ if expect_success+ expect(page).to have_text("The export has completed successfully")endendafter do- DownloadedFile::clear_downloads+ DownloadList.clearendcontext 'CSV export' do@@ -101,7 +98,7 @@ describe 'work package export', type: :feature dofilters.openend- it 'shows all work packages with the default filters', js: true, retry: 2 do+ it 'shows all work packages with the default filters', js: true doexport!expect(subject).to have_text(wp_1.description)@@ -113,7 +110,7 @@ describe 'work package export', type: :feature doexpect(subject.scan(/Type (A|B)/).flatten).to eq %w(A A B A)end- it 'shows all work packages grouped by ', js: true, retry: 2 do+ it 'shows all work packages grouped by ', js: true dogroup_by.enable_via_menu 'Type'wp_table.expect_work_package_listed(wp_1)@@ -133,7 +130,7 @@ describe 'work package export', type: :feature doendit 'shows only the work package with the right progress if filtered this way',- js: true, retry: 2 do+ js: true dofilters.add_filter_by 'Progress (%)', 'is', ['25'], 'percentageDone'sleep 1@@ -149,7 +146,7 @@ describe 'work package export', type: :feature doexpect(subject).not_to have_text(wp_3.description)end- it 'shows only work packages of the filtered type', js: true, retry: 2 do+ it 'shows only work packages of the filtered type', js: true dofilters.add_filter_by 'Type', 'is', wp_3.type.nameexpect(page).to have_no_content(wp_2.description) # safeguard@@ -163,7 +160,7 @@ describe 'work package export', type: :feature doexpect(subject).to have_text(wp_3.description)end- it 'exports selected columns', js: true, retry: 2 do+ it 'exports selected columns', js: true docolumns.add 'Progress (%)'export!diff --git a/spec/features/work_packages/index_sums_spec.rb b/spec/features/work_packages/index_sums_spec.rbindex 40cec11cba1..829606d1b3f 100644--- a/spec/features/work_packages/index_sums_spec.rb+++ b/spec/features/work_packages/index_sums_spec.rb@@ -118,11 +118,11 @@ RSpec.feature 'Work package index sums', js: true do# Add float cf columncolumns.add float_cf.name# Add overall costs column- columns.add 'Overall costs'+ columns.add 'Overall costs', finicky: true# Add unit costs column- columns.add 'Unit costs'+ columns.add 'Unit costs', finicky: true# Add labor costs column- columns.add 'Labor costs'+ columns.add 'Labor costs', finicky: true# Trigger action from action menu dropdownmodal.set_display_sums enable: truediff --git a/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb b/spec/features/work_packages/table/inline_create/create_work_packages_spec.rbindex aa36a40f6e8..d5fbbd1c0f9 100644--- a/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb+++ b/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb@@ -108,7 +108,7 @@ describe 'inline create work package', js: true dosleep(0.3)columns.open_modal- columns.add(cf_list.name, save_changes: true)+ columns.add(cf_list.name, save_changes: true, finicky: true)wp_table.click_inline_creatediff --git a/spec/features/work_packages/table/relations_spec.rb b/spec/features/work_packages/table/relations_spec.rbindex bc24a2ad577..9f4e28638e7 100644--- a/spec/features/work_packages/table/relations_spec.rb+++ b/spec/features/work_packages/table/relations_spec.rb@@ -57,8 +57,8 @@ describe 'Work Package table relations', js: true dowp_table.visit_query(query)wp_table.expect_work_package_listed(wp_from, wp_to, wp_to2)- columns.add("Relations to #{type.name}")- columns.add("follows relations")+ columns.add(type.name, finicky: true)+ columns.add("follows", finicky: true)wp_from_row = wp_table.row(wp_from)wp_from_to = wp_table.row(wp_to)diff --git a/spec/features/work_packages/table/switch_types_spec.rb b/spec/features/work_packages/table/switch_types_spec.rbindex 7fa61c306ce..61640f8ac95 100644--- a/spec/features/work_packages/table/switch_types_spec.rb+++ b/spec/features/work_packages/table/switch_types_spec.rb@@ -188,6 +188,7 @@ describe 'Switching types in work package table', js: true doreq_text_field.expect_active!# Cancel edition now+ SeleniumHubWaiter.waitreq_text_field.cancel_by_escapereq_text_field.expect_state_text '-'@@ -311,6 +312,7 @@ describe 'Switching types in work package table', js: true dovisit new_project_work_packages_path(project.identifier, type: type.id)expect_angular_frontend_initialized+ SeleniumHubWaiter.waitendit 'can switch to the type with CF list' dodiff --git a/spec/features/wysiwyg/macros/child_pages_spec.rb b/spec/features/wysiwyg/macros/child_pages_spec.rbindex 98f4aff7556..0dfd5a52ce2 100644--- a/spec/features/wysiwyg/macros/child_pages_spec.rb+++ b/spec/features/wysiwyg/macros/child_pages_spec.rb@@ -129,6 +129,7 @@ describe 'Wysiwyg child pages spec',expect(page).not_to have_selector('.pages-hierarchy', text: 'Parent page')expect(page).to have_selector('h1', text: 'My page')+ SeleniumHubWaiter.waitfind('.toolbar .icon-edit').clickend@@ -161,9 +162,9 @@ describe 'Wysiwyg child pages spec',expect(page).to have_selector('.pages-hierarchy', text: 'Parent page')expect(page).to have_selector('h1', text: 'My page')+ SeleniumHubWaiter.waitfind('.toolbar .icon-edit').clickend-endendenddiff --git a/spec/features/wysiwyg/macros/code_block_macro_spec.rb b/spec/features/wysiwyg/macros/code_block_macro_spec.rbindex 5db4c9ab79b..1433c526521 100644--- a/spec/features/wysiwyg/macros/code_block_macro_spec.rb+++ b/spec/features/wysiwyg/macros/code_block_macro_spec.rb@@ -83,8 +83,10 @@ describe 'Wysiwyg code block macro',expect(page).to have_selector('pre.highlight-ruby', count: 2)end+ SeleniumHubWaiter.wait# Edit page again, expect widgetclick_on 'Edit'+ # SeleniumHubWaiter.waiteditor.in_editor do |container,|expect(container).to have_selector('.op-uc-code-block', text: snippet, count: 2)@@ -111,6 +113,7 @@ describe 'Wysiwyg code block macro',wp = WikiPage.lastexpect(wp.content.text.gsub("\r\n", "\n")).to eq("```text\nasdf\n```")+ SeleniumHubWaiter.waitclick_on 'Edit'editor.in_editor do |container,|@@ -164,6 +167,7 @@ describe 'Wysiwyg code block macro',end# Edit page again, expect widget+ SeleniumHubWaiter.waitclick_on 'Edit'editor.in_editor do |container,|diff --git a/spec/features/wysiwyg/tables_spec.rb b/spec/features/wysiwyg/tables_spec.rbindex 5f5be2ada44..a965637ac09 100644--- a/spec/features/wysiwyg/tables_spec.rb+++ b/spec/features/wysiwyg/tables_spec.rb@@ -126,6 +126,7 @@ describe 'Wysiwyg tables',expect(page).to have_selector('td', text: 'a')end+ SeleniumHubWaiter.wait# Edit againclick_on 'Edit'@@ -189,6 +190,7 @@ describe 'Wysiwyg tables',expect(page).to have_selector('td[style*="vertical-align:top"]')end+ SeleniumHubWaiter.wait# Edit againclick_on 'Edit'@@ -305,6 +307,7 @@ describe 'Wysiwyg tables',expect(page).to have_selector('td[style*="width:250px"]')end+ SeleniumHubWaiter.wait# Edit againclick_on 'Edit'diff --git a/spec/models/ldap_auth_source_spec.rb b/spec/models/ldap_auth_source_spec.rbindex 5c88ac0291e..4879c0955a5 100644--- a/spec/models/ldap_auth_source_spec.rb+++ b/spec/models/ldap_auth_source_spec.rb@@ -57,7 +57,7 @@ describe LdapAuthSource, type: :model dodescribe 'with live LDAP' dobefore(:all) doldif = Rails.root.join('spec/fixtures/ldap/users.ldif')- @ldap_server = Ladle::Server.new(quiet: false, port: '12389', domain: 'dc=example,dc=com', ldif: ldif).start+ @ldap_server = Ladle::Server.new(quiet: false, port: ParallelHelper.port_for_ldap.to_s, domain: 'dc=example,dc=com', ldif: ldif).startendafter(:all) do@@ -67,7 +67,7 @@ describe LdapAuthSource, type: :model do# Ldap has three users aa729, bb459, cc414let(:ldap) doFactoryBot.create :ldap_auth_source,- port: '12389',+ port: ParallelHelper.port_for_ldap.to_s,account: 'uid=admin,ou=system',account_password: 'secret',base_dn: 'ou=people,dc=example,dc=com',diff --git a/spec/rails_helper.rb b/spec/rails_helper.rbindex 8042f25f8f0..6f9f93196cc 100644--- a/spec/rails_helper.rb+++ b/spec/rails_helper.rb@@ -27,7 +27,6 @@ENV['RAILS_ENV'] ||= 'test'require File.expand_path('../../config/environment', __FILE__)-require 'spec_helper'require 'factory_bot_rails'require 'rspec/rails'require 'shoulda/matchers'@@ -53,6 +52,9 @@ require 'test_prof/recipes/rspec/before_all'# may lead to broken specs on the CI, if we don't sort here# (example: with_config.rb has to precede with_direct_uploads.rb).#+require_relative "./support/parallel_helper"+require_relative "./support/download_list"+require_relative "./support/capybara"Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }Dir[Rails.root.join('spec/features/support/**/*.rb')].each { |f| require f }Dir[Rails.root.join('spec/lib/api/v3/support/**/*.rb')].each { |f| require f }diff --git a/spec/support/browsers/chrome.rb b/spec/support/browsers/chrome.rbindex cafd405105c..f545fe570bc 100644--- a/spec/support/browsers/chrome.rb+++ b/spec/support/browsers/chrome.rb@@ -14,23 +14,28 @@ def register_chrome(language, name: :"chrome_#{language}")if ActiveRecord::Type::Boolean.new.cast(ENV['OPENPROJECT_TESTING_NO_HEADLESS'])# Maximize the window however large the available space isoptions.add_argument('start-maximized')+ # options.add_argument('window-size=1920,1080')# Open dev tools for quick access- options.add_argument('auto-open-devtools-for-tabs')+ if ActiveRecord::Type::Boolean.new.cast(ENV['OPENPROJECT_TESTING_AUTO_DEVTOOLS'])+ options.add_argument('auto-open-devtools-for-tabs')+ endelseoptions.add_argument('window-size=1920,1080')options.add_argument('headless')- options.add_argument('disable-gpu')endoptions.add_argument('no-sandbox')options.add_argument('disable-gpu')options.add_argument('disable-popup-blocking')options.add_argument("lang=#{language}")+ # This is REQUIRED for running in a docker container+ # https://github.com/grosser/parallel_tests/issues/658+ options.add_argument('disable-dev-shm-usage')options.add_preference(:download,directory_upgrade: true,prompt_for_download: false,- default_directory: DownloadedFile::PATH.to_s)+ default_directory: DownloadList::SHARED_PATH.to_s)options.add_preference(:browser, set_download_behavior: { behavior: 'allow' })@@ -44,13 +49,17 @@ def register_chrome(language, name: :"chrome_#{language}")client.read_timeout = 180client.open_timeout = 180+ service = ::Selenium::WebDriver::Service.chrome(args: { verbose: true, log_path: '/tmp/chromedriver.log' })+driver = Capybara::Selenium::Driver.new(app,- browser: ENV['SELENIUM_GRID_URL'] ? :remote : :chrome,+ # browser: ENV['SELENIUM_GRID_URL'] ? :remote : :chrome,+ browser: :chrome,url: ENV['SELENIUM_GRID_URL'],desired_capabilities: capabilities,http_client: client,- options: options+ options: options,+ service: service)if !ENV['SELENIUM_GRID_URL']@@ -61,7 +70,7 @@ def register_chrome(language, name: :"chrome_#{language}")bridge.http.call :post,"/session/#{bridge.session_id}/chromium/send_command",cmd: 'Page.setDownloadBehavior',- params: { behavior: 'allow', downloadPath: DownloadedFile::PATH.to_s }+ params: { behavior: 'allow', downloadPath: DownloadList::SHARED_PATH.to_s }enddriver@@ -76,10 +85,17 @@ register_chrome 'en'# Register german locale for custom field decimal testregister_chrome 'de'+Billy.configure do |c|+ c.proxy_host = Capybara.server_host+ if Capybara.server_port+ c.proxy_port = Capybara.server_port + 1000+ end+end+# Register mocking proxy driverregister_chrome 'en', name: :chrome_billy do |options, capabilities|options.add_argument("proxy-server=#{Billy.proxy.host}:#{Billy.proxy.port}")- options.add_argument('proxy-bypass-list=127.0.0.1;localhost')+ options.add_argument("proxy-bypass-list=127.0.0.1;localhost;#{Capybara.server_host}")capabilities[:acceptInsecureCerts] = trueend@@ -88,4 +104,3 @@ endregister_chrome 'en', name: :chrome_revit_add_in do |options, capabilities|options.add_argument("user-agent='foo bar Revit'")end-diff --git a/spec/support/browsers/firefox.rb b/spec/support/browsers/firefox.rbindex e9a905e5f71..e39f79f5396 100644--- a/spec/support/browsers/firefox.rb+++ b/spec/support/browsers/firefox.rb@@ -20,7 +20,7 @@ def register_firefox(language, name: :"firefox_#{language}")profile = Selenium::WebDriver::Firefox::Profile.newprofile['intl.accept_languages'] = language- profile['browser.download.dir'] = DownloadedFile::PATH.to_s+ profile['browser.download.dir'] = DownloadList::SHARED_PATH.to_sprofile['browser.download.folderList'] = 2profile['browser.helperApps.neverAsk.saveToDisk'] = 'text/csv'@@ -76,17 +76,3 @@ endregister_firefox 'en'# Register german locale for custom field decimal testregister_firefox 'de'--# Register mocking proxy driver-register_firefox 'en', name: :firefox_billy do |profile, options, capabilities|- profile.assume_untrusted_certificate_issuer = false-- ip_address = Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_address- hostname = ENV['CAPYBARA_DYNAMIC_HOSTNAME'].present? ? ip_address : ENV.fetch('CAPYBARA_APP_HOSTNAME', Billy.proxy.host)-- profile.proxy = Selenium::WebDriver::Proxy.new(- http: "#{hostname}:#{Billy.proxy.port}",- ssl: "#{hostname}:#{Billy.proxy.port}")-- capabilities[:accept_insecure_certs] = true-end\ No newline at end of filediff --git a/spec/support/capybara.rb b/spec/support/capybara.rbindex 65924bff745..adec31b79ca 100644--- a/spec/support/capybara.rb+++ b/spec/support/capybara.rb@@ -9,7 +9,7 @@ RSpec.configure do |config|Capybara.default_max_wait_time = 4Capybara.javascript_driver = :chrome_en- port = ENV.fetch('CAPYBARA_SERVER_PORT', '0').to_i+ port = ENV.fetch('CAPYBARA_SERVER_PORT', ParallelHelper.port_for_app).to_iif port > 0Capybara.server_port = portend@@ -17,7 +17,11 @@ RSpec.configure do |config|ip_address = Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_addresshostname = ENV['CAPYBARA_DYNAMIC_HOSTNAME'].present? ? ip_address : ENV.fetch('CAPYBARA_APP_HOSTNAME', 'localhost')- Capybara.server_host = '0.0.0.0'+ if ENV['TRAVIS']+ Capybara.server_host = "0.0.0.0"+ else+ Capybara.server_host = ip_address+ endCapybara.app_host = "http://#{hostname}"end@@ -28,7 +32,7 @@ endCapybara::Screenshot.prune_strategy = :keep_last_run# silence puma if we're using it-Capybara.server = :puma, { Silent: true }+Capybara.server = :puma, { Silent: false }# Set up S3 uploads if desiredif ENV['OPENPROJECT_ENABLE_CAPYBARA_SCREENSHOT_S3_UPLOADS'] && ENV['AWS_ACCESS_KEY_ID']diff --git a/spec/support/components/admin/type_configuration_form.rb b/spec/support/components/admin/type_configuration_form.rbindex 50c219eff20..1c008c9a6f3 100644--- a/spec/support/components/admin/type_configuration_form.rb+++ b/spec/support/components/admin/type_configuration_form.rb@@ -128,6 +128,8 @@ module Componentsenddef add_query_group(name, relation_filter, expect: true)+ SeleniumHubWaiter.wait+add_button_dropdown.clickadd_table_button.click@@ -166,6 +168,8 @@ module Componentsenddef edit_query_group(name)+ SeleniumHubWaiter.wait+group = find_group(name)group.find('.type-form-query-group--edit-button').clickenddiff --git a/spec/support/components/global_search.rb b/spec/support/components/global_search.rbindex 03abd2eac22..aa618d21095 100644--- a/spec/support/components/global_search.rb+++ b/spec/support/components/global_search.rb@@ -18,6 +18,7 @@ module Componentsenddef search(query, submit: false)+ SeleniumHubWaiter.waitinput.set ''input.hoverinput.click@@ -30,6 +31,7 @@ module Componentsdef submit_with_enterinput.send_keys :enter+ SeleniumHubWaiter.waitenddef expect_open@@ -75,7 +77,7 @@ module Componentsdef expect_no_work_package_option(wp)expect(page)- .not_to have_selector('.global-search--option', text: "#{wp.subject}")+ .to have_no_selector('.global-search--option', text: "#{wp.subject}")enddef click_work_package(wp)@@ -87,7 +89,8 @@ module Componentsenddef find_option(text)- page.find('.global-search--wp-subject', text: text, wait: 10)+ expect(page).to have_selector('.global-search--wp-subject', text: text, wait: 10)+ find('.global-search--wp-subject', text: text)enddef canceldiff --git a/spec/support/components/grids/grid_area.rb b/spec/support/components/grids/grid_area.rbindex a1fe1ce9edd..160e6fef227 100644--- a/spec/support/components/grids/grid_area.rb+++ b/spec/support/components/grids/grid_area.rb@@ -27,6 +27,7 @@ module Componentsopen_menu+ SeleniumHubWaiter.waitfind('a.menu-item', text: text).clickenddiff --git a/spec/support/components/ng_select_autocomplete_helpers.rb b/spec/support/components/ng_select_autocomplete_helpers.rbindex 5d0e47bee7f..64ec1b93b20 100644--- a/spec/support/components/ng_select_autocomplete_helpers.rb+++ b/spec/support/components/ng_select_autocomplete_helpers.rb@@ -1,6 +1,7 @@module Componentsmodule NgSelectAutocompleteHelpersdef search_autocomplete(element, query:, results_selector: nil)+ SeleniumHubWaiter.wait# Open the elementelement.click# Insert the text to finddiff --git a/spec/support/components/work_packages/columns.rb b/spec/support/components/work_packages/columns.rbindex 962421a77ca..c54b66c88b1 100644--- a/spec/support/components/work_packages/columns.rb+++ b/spec/support/components/work_packages/columns.rb@@ -67,14 +67,25 @@ module Componentsclose_autocompleterend- def add(name, save_changes: true)+ def add(name, save_changes: true, finicky: false)modal_open? or open_modalselect_autocomplete column_autocompleter,results_selector: '.ng-dropdown-panel-items',query: name- apply if save_changes+ if save_changes+ apply+ within ".work-package-table" do+ # for some reason these columns (e.g. 'Overall costs') don't have a proper link+ if finicky+ SeleniumHubWaiter.wait+ expect(page).to have_selector("a", text: /#{name}/i, visible: :all)+ else+ expect(page).to have_link(name)+ end+ end+ endenddef remove(name, save_changes: true)@@ -117,6 +128,7 @@ module Componentsdef apply@opened = false+ # SeleniumHubWaiter.waitclick_button('Apply')enddiff --git a/spec/support/components/work_packages/filters.rb b/spec/support/components/work_packages/filters.rbindex 0e668ec2111..890376fa995 100644--- a/spec/support/components/work_packages/filters.rb+++ b/spec/support/components/work_packages/filters.rb@@ -38,6 +38,7 @@ module Componentsinclude ::Components::NgSelectAutocompleteHelpersdef open+ SeleniumHubWaiter.waitretry_block do# Run in retry block because filters do nothing if not yet loadedfilter_button.click@@ -65,9 +66,8 @@ module Componentsinput = page.find('#filter-by-text-input')input.hoverinput.click+ SeleniumHubWaiter.waitinput.set text-- sleep 1enddef expect_available_filter(name, present: true)@@ -75,7 +75,8 @@ module Componentsenddef expect_loaded- expect(filter_button).to have_selector('.badge', wait: 20)+ SeleniumHubWaiter.wait+ expect(filter_button).to have_selector('.badge', wait: 2)enddef add_filter_by(name, operator, value, selector = nil)diff --git a/spec/support/components/work_packages/relations.rb b/spec/support/components/work_packages/relations.rbindex 6479848b40f..093678822b1 100644--- a/spec/support/components/work_packages/relations.rb+++ b/spec/support/components/work_packages/relations.rb@@ -46,11 +46,13 @@ module Componentsenddef click_relation(relatable)+ SeleniumHubWaiter.waitpage.find(".relation-row-#{relatable.id} .wp-relations--subject-field").clickenddef edit_relation_type(relatable, to_type:)row = find_row(relatable)+ SeleniumHubWaiter.waitrow.find('.relation-row--type').clickexpect(row).to have_selector('select.inline-edit--field')@@ -65,6 +67,7 @@ module Componentspage.driver.browser.action.move_to(span.native).perform# Click the corresponding action button+ SeleniumHubWaiter.waitrow = find_row(relatable)case actionwhen :delete@@ -85,6 +88,7 @@ module Componentsdef add_relation(type:, to:)# Open create form+ SeleniumHubWaiter.waitfind('#relation--add-relation').click# Select relation type@@ -131,9 +135,11 @@ module Componentsdef add_parent(query, work_package)# Open the parent edit+ SeleniumHubWaiter.waitfind('.wp-relation--parent-change').click# Enter the query and select the child+ SeleniumHubWaiter.waitautocomplete = find(".wp-relations--autocomplete")select_autocomplete autocomplete,query: query,@@ -152,6 +158,7 @@ module Componentsenddef remove_parent+ SeleniumHubWaiter.waitfind('.wp-relation--parent-remove').clickend@@ -167,6 +174,7 @@ module Componentsdef openChildrenAutocompleterretry_block donext if page.has_selector?('.wp-relations--children .ng-input input')+ SeleniumHubWaiter.waitfind('.wp-inline-create--reference-link', text: I18n.t('js.relation_buttons.add_existing_child')).click# Security check to be sure that the autocompleter has finished loading@@ -212,6 +220,7 @@ module Componentspage.within('.work-packages-embedded-view--container') dorow = ".wp-row-#{work_package.id}-table"+ SeleniumHubWaiter.waitfind(row).hoverfind("#{row} .wp-table-action--unlink").clickenddiff --git a/spec/support/components/work_packages/sort_by.rb b/spec/support/components/work_packages/sort_by.rbindex c946eceb339..58611c2e47d 100644--- a/spec/support/components/work_packages/sort_by.rb+++ b/spec/support/components/work_packages/sort_by.rb@@ -35,7 +35,9 @@ module Componentsdef sort_via_header(name, selector: nil, descending: false)text = descending ? 'Sort descending' : 'Sort ascending'+ SeleniumHubWaiter.waitopen_table_column_context_menu(name, selector)+ SeleniumHubWaiter.waitwithin_column_context_menu doclick_link text@@ -44,6 +46,7 @@ module Componentsdef update_criteria(first, second=nil, third=nil)open_modal+ SeleniumHubWaiter.wait[first, second, third].compact@@ -58,6 +61,7 @@ module Componentsdef expect_criteria(first, second=nil, third=nil)open_modal+ SeleniumHubWaiter.wait[first, second, third].compactdiff --git a/spec/support/components/work_packages/table_configuration_modal.rb b/spec/support/components/work_packages/table_configuration_modal.rbindex 574f2107c00..b06aced522a 100644--- a/spec/support/components/work_packages/table_configuration_modal.rb+++ b/spec/support/components/work_packages/table_configuration_modal.rb@@ -56,6 +56,7 @@ module Componentsenddef open!+ SeleniumHubWaiter.waitscroll_to_and_click triggerexpect_openend@@ -99,10 +100,10 @@ module Componentsdef switch_to(target)# Switching too fast may result in the click handler not yet firing# so wait a bit initially- sleep 1+ SeleniumHubWaiter.waitretry_block do- find("#{selector} .tab-show", text: target.upcase, wait: 10).click+ find("#{selector} .tab-show", text: target.upcase, wait: 2).clickselected_tab(target)endenddiff --git a/spec/support/download_list.rb b/spec/support/download_list.rbnew file mode 100644index 00000000000..0df23523b36--- /dev/null+++ b/spec/support/download_list.rb@@ -0,0 +1,50 @@+class DownloadList+ SHARED_PATH = Pathname.new(+ ENV.fetch("CAPYBARA_DOWNLOADED_FILE_DIR", Rails.root.join('tmp/test/downloads'))+ ).join(+ ENV.fetch('TEST_ENV_NUMBER', '1')+ ).tap {|f| p ["DownloadList::SHARED_PATH", f.to_s] ; f.mkpath }++ def initialize+ @history = []+ @latest = nil+ end++ def refresh_from(page)+ @latest = nil+ if false+ page.visit("about:downloads")+ # give some time for page to load+ sleep 0.5+ download_name = page.evaluate_script("document.querySelector('downloads-manager').shadowRoot.querySelector('#downloadsList downloads-item').shadowRoot.querySelector('div#content #file-link')").text()+ if download_name && [email protected]?(download_name)+ Timeout.timeout(Capybara.default_max_wait_time) do+ sleep 0.1 until SHARED_PATH.join(download_name).exist?+ end+ @latest = download_name+ @history << @latest+ end+ else+ sleep 0.5+ @latest = Dir.glob(SHARED_PATH.join("*").to_s).max_by {|f| File.mtime(f) }+ @history << @latest+ end+ self+ end++ def latest_download+ return nil if @latest.nil?+ SHARED_PATH.join(@latest)+ end++ def latest_downloaded_content+ return nil if @latest.nil?+ SHARED_PATH.join(@latest).read+ end++ def self.clear+ Dir[SHARED_PATH.join("*")].each do |file|+ FileUtils.rm_f(file)+ end+ end+enddiff --git a/spec/support/downloaded_file.rb b/spec/support/downloaded_file.rbdeleted file mode 100644index fd6cb7f7710..00000000000--- a/spec/support/downloaded_file.rb+++ /dev/null@@ -1,78 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2021 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2013 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++-#-# Kudos to https://forum.shakacode.com/t/how-to-test-file-downloads-with-capybara/347 from-# where this code was adapted--module DownloadedFile- PATH = Rails.root.join('tmp/test/downloads')-- extend self-- def downloads- Dir[PATH.join("*")]- end-- def download- downloads.first- end-- def download_content(ensure_content = true)- wait_for_download- wait_for_download_content if ensure_content- File.read(download)- end-- def wait_for_download- Timeout.timeout(Capybara.default_max_wait_time) do- sleep 0.1 until downloaded?- end- end-- def wait_for_download_content- Timeout.timeout(Capybara.default_max_wait_time) do- sleep 0.1 until has_content?- end- end-- def downloaded?- !downloading? && downloads.any?- end-- def has_content?- !File.read(download).empty?- end-- def downloading?- downloads.grep(/\.part$/).any?- end-- def clear_downloads- FileUtils.rm_f(downloads)- end-enddiff --git a/spec/support/edit_fields/edit_field.rb b/spec/support/edit_fields/edit_field.rbindex 7705f942f84..23ed285b3ae 100644--- a/spec/support/edit_fields/edit_field.rb+++ b/spec/support/edit_fields/edit_field.rb@@ -65,7 +65,9 @@ class EditFielddef activate!(expect_open: true)retry_block dounless active?+ SeleniumHubWaiter.waitscroll_to_and_click(display_element)+ SeleniumHubWaiter.waitendif expect_open && !active?diff --git a/spec/support/omniauth.rb b/spec/support/omniauth.rbnew file mode 100644index 00000000000..74120447d37--- /dev/null+++ b/spec/support/omniauth.rb@@ -0,0 +1,5 @@+RSpec.configure do |config|+ config.before :each, type: :feature do+ OmniAuth.config.mock_auth[:developer] = nil+ end+enddiff --git a/spec/support/pages/groups.rb b/spec/support/pages/groups.rbindex d044d3a9763..d34b04bd4c2 100644--- a/spec/support/pages/groups.rb+++ b/spec/support/pages/groups.rb@@ -40,9 +40,13 @@ module Pagesenddef add_user_to_group!(user_name, group_name)- visit_page unless current_page?+ unless current_page?+ visit_page+ SeleniumHubWaiter.wait+ endedit_group! group_name+ SeleniumHubWaiter.waitgroup(group_name).add_user! user_nameend@@ -90,6 +94,7 @@ module Pagesdef add_to_project!(project_name, as:)open_projects_tab!+ SeleniumHubWaiter.waitselect_project! project_nameArray(as).each { |role| check role }click_on 'Add'@@ -97,6 +102,7 @@ module Pagesdef remove_from_project!(name)open_projects_tab!+ SeleniumHubWaiter.waitfind_project(name).find('a[data-method=delete]').clickend@@ -114,6 +120,7 @@ module Pagesdef add_user!(user_name)open_users_tab!+ SeleniumHubWaiter.waitcontainer = page.find('.new-group-members--autocomplete')select_autocomplete container,@@ -123,6 +130,8 @@ module Pagesdef remove_user!(user_name)open_users_tab!+ SeleniumHubWaiter.wait+find_user(user_name).find('a[data-method=delete]').clickenddiff --git a/spec/support/pages/members.rb b/spec/support/pages/members.rbindex b06ff807d64..0103bbcdf3f 100644--- a/spec/support/pages/members.rb+++ b/spec/support/pages/members.rb@@ -26,6 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#+++require 'support/components/ng_select_autocomplete_helpers'require 'support/pages/page'module Pages@@ -69,6 +70,7 @@ module Pages# @param as [String] The role as which the user should be added.def add_user!(user_name, as:)click_on 'Add member'+ SeleniumHubWaiter.waitselect_principal! user_name if user_nameselect_role! as if asdiff --git a/spec/support/pages/my/password_page.rb b/spec/support/pages/my/password_page.rbindex ae518948f6c..618d96a1e65 100644--- a/spec/support/pages/my/password_page.rb+++ b/spec/support/pages/my/password_page.rb@@ -36,9 +36,8 @@ module Pagesenddef change_password(old_password, new_password, confirmation = new_password)- # use find and set with id to prevent ambiguous match I get with fill_in- page.find('#password').set(old_password)-+ SeleniumHubWaiter.wait+ page.fill_in('password', with: old_password, match: :prefer_exact)page.fill_in('new_password', with: new_password)page.fill_in('new_password_confirmation', with: confirmation)diff --git a/spec/support/parallel_helper.rb b/spec/support/parallel_helper.rbnew file mode 100644index 00000000000..4a54f69b9a6--- /dev/null+++ b/spec/support/parallel_helper.rb@@ -0,0 +1,9 @@+class ParallelHelper+ def self.port_for_ldap+ ENV.fetch('TEST_ENV_NUMBER', '1').to_i + 12389+ end++ def self.port_for_app+ ENV.fetch('TEST_ENV_NUMBER', '1').to_i + 3000+ end+enddiff --git a/spec/support/puffing_billy_proxy.rb b/spec/support/puffing_billy_proxy.rbindex f4a93b582c7..2892abbcbae 100644--- a/spec/support/puffing_billy_proxy.rb+++ b/spec/support/puffing_billy_proxy.rb@@ -49,7 +49,8 @@ module BillyProxyPatchdef stopreturn unless EM.reactor_running?- super+ rescue Errno::ECONNRESET => e+ STDERR.puts "Got error while shutting down Billy proxy"endenddiff --git a/spec/support/rspec_retry.rb b/spec/support/rspec_retry.rbindex f303f2711ac..0d61f13bffe 100644--- a/spec/support/rspec_retry.rb+++ b/spec/support/rspec_retry.rb@@ -36,6 +36,11 @@ end# Helper to pass options to retriable while logging# failuresdef retry_block(args: {}, screenshot: false, &block)+ if ENV["RSPEC_RETRY_RETRY_COUNT"] == "0"+ block.call+ return+ end+log_errors = Proc.new do |exception, try, elapsed_time, next_interval|$stderr.puts <<-EOS.strip_heredoc#{exception.class}: '#{exception.message}'diff --git a/spec/support/selenium_hub_waiter.rb b/spec/support/selenium_hub_waiter.rbnew file mode 100644index 00000000000..224f3da8047--- /dev/null+++ b/spec/support/selenium_hub_waiter.rb@@ -0,0 +1,7 @@+class SeleniumHubWaiter+ # frontend not fast enough to bind click handlers on buttons?+ # only happens when using the Selenium Hub+ def self.wait+ sleep 1 unless ENV.fetch("SELENIUM_GRID_URL", "").blank?+ end+enddiff --git a/spec/support/shared/with_direct_uploads.rb b/spec/support/shared/with_direct_uploads.rbindex be393812bea..28d4bc26003 100644--- a/spec/support/shared/with_direct_uploads.rb+++ b/spec/support/shared/with_direct_uploads.rb@@ -63,15 +63,17 @@ class WithDirectUploadsenddef around(example)- example.metadata[:driver] = :firefox_billy+ example.metadata[:driver] = :chrome_billycsp_config = SecureHeaders::Configuration.instance_variable_get("@default_config").cspcsp_config.connect_src = ["'self'", "test-bucket.s3.amazonaws.com"]+ csp_config.form_action = ["'self'", "test-bucket.s3.amazonaws.com"]beginexample.runensurecsp_config.connect_src = %w('self')+ csp_config.form_action = %w('self')endenddiff --git a/spec/support/uploaded_file.rb b/spec/support/uploaded_file.rbnew file mode 100644index 00000000000..6865499fa38--- /dev/null+++ b/spec/support/uploaded_file.rb@@ -0,0 +1,27 @@+class UploadedFile+ attr_reader :pathname++ def initialize(pathname)+ @pathname = pathname+ end++ def path+ pathname.to_s+ end++ def to_s+ path+ end++ def basename+ File.basename(path)+ end++ def self.load_from(path)+ full_path = Rails.root.join(path)+ shared_path = DownloadList::SHARED_PATH.join(File.basename(full_path))+ # with remote drivers, files to upload must be in the shared downloads folder+ FileUtils.cp(full_path, shared_path, verbose: true)+ new(shared_path)+ end+enddiff --git a/spec/support/webmock.rb b/spec/support/webmock.rbindex 88ba6f71535..576bdeda8e0 100644--- a/spec/support/webmock.rb+++ b/spec/support/webmock.rb@@ -42,7 +42,7 @@ RSpec.configure do |config|# We will exempt local connections from this block, since selenium etc.# uses localhost to communicate with the browser.# Leaving this off will randomly fail some specs with WebMock::NetConnectNotAllowedError- WebMock.disable_net_connect!(allow_localhost: true)+ WebMock.disable_net_connect!(allow_localhost: true, allow: ["selenium-hub", Capybara.server_host])WebMock.enable!example.runensurediff --git a/spec_legacy/legacy_spec_helper.rb b/spec_legacy/legacy_spec_helper.rbindex a999bd1caf6..552c21613d5 100644--- a/spec_legacy/legacy_spec_helper.rb+++ b/spec_legacy/legacy_spec_helper.rb@@ -52,6 +52,10 @@ RSpec.configure do |config|config.use_transactional_fixtures = trueconfig.use_instantiated_fixtures = false+ config.before(:suite) do+ DatabaseCleaner.clean_with(:truncation)+ end+config.include LegacyAssertionsAndHelpersconfig.include ActiveSupport::Testing::Assertionsconfig.include Shoulda::Context::Assertions