diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2b9eaed..0be7b4a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: ruby-version: '3.1' bundler-cache: true - name: Test - run: bundle exec cucumber + run: bundle exec cucumber --retry 1 env: ALLURE_TESTPLAN_PATH: features/support/fixture - name: Upload allure-results diff --git a/Gemfile b/Gemfile index 10f7751..b791404 100644 --- a/Gemfile +++ b/Gemfile @@ -9,6 +9,5 @@ gem 'capybara', '~> 3.39' gem 'cucumber', '~> 9.1' gem 'pry', '~> 0.14.2' gem 'rspec', '~> 3.12' -gem 'selenium-webdriver', '~> 4.10' +gem 'selenium-webdriver', '~> 4.15' gem 'solargraph', '~> 0.49.0' -gem 'webdrivers', '~> 5.3' diff --git a/Gemfile.lock b/Gemfile.lock index 1f68971..19fbcd3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -124,7 +124,7 @@ GEM parser (>= 3.2.1.0) ruby-progressbar (1.13.0) rubyzip (2.3.2) - selenium-webdriver (4.10.0) + selenium-webdriver (4.15.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -152,11 +152,7 @@ GEM unicode-display_width (2.4.2) uuid (2.3.9) macaddr (~> 1.0) - webdrivers (5.3.1) - nokogiri (~> 1.6) - rubyzip (>= 1.3.0) - selenium-webdriver (~> 4.0, < 4.11) - websocket (1.2.9) + websocket (1.2.10) xpath (3.2.0) nokogiri (~> 1.8) yard (0.9.32) @@ -173,9 +169,8 @@ DEPENDENCIES cucumber (~> 9.1) pry (~> 0.14.2) rspec (~> 3.12) - selenium-webdriver (~> 4.10) + selenium-webdriver (~> 4.15) solargraph (~> 0.49.0) - webdrivers (~> 5.3) BUNDLED WITH 2.3.23 diff --git a/features/google.feature b/features/google.feature index 7c0a225..449a39a 100644 --- a/features/google.feature +++ b/features/google.feature @@ -27,3 +27,8 @@ Feature: Using Google gitlab.com """ Then I should see gitlab icon + + Scenario: Passes on the second try + Given I am a flaky test + When I run this test + Then it passes on the second try diff --git a/features/step_definitions/common_steps.rb b/features/step_definitions/common_steps.rb index c117d08..cc1e00e 100644 --- a/features/step_definitions/common_steps.rb +++ b/features/step_definitions/common_steps.rb @@ -4,10 +4,18 @@ visit("http://#{url}") end +Given 'I am a flaky test' do + # no-op step to test retry +end + When 'I enter {string}' do |term| fill_in('q', with: term) end +When 'I run this test' do + Global.increment_run +end + Then 'I should see results' do expect(page).to have_css('[role=listbox]') end @@ -19,3 +27,7 @@ Then 'I should see gitlab icon' do expect(page).to have_css('[id=tanukiHomeDesktop]', visible: :all) end + +Then 'it passes on the second try' do + expect(Global.run).to eq(2) +end diff --git a/features/support/env.rb b/features/support/env.rb index 91bd796..87a72aa 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -3,7 +3,8 @@ require 'pry' require 'allure-cucumber' require 'capybara/cucumber' -require 'webdrivers/chromedriver' + +require_relative 'global' # Allure AllureCucumber.configure do |c| diff --git a/features/support/global.rb b/features/support/global.rb new file mode 100644 index 0000000..5f481db --- /dev/null +++ b/features/support/global.rb @@ -0,0 +1,10 @@ +module Global + def self.run + @run ||= 0 + end + + def self.increment_run + run + @run += 1 + end +end