From 208ef0bfe139e6407fa027a4ae92aae112fc8996 Mon Sep 17 00:00:00 2001 From: Luka Murn Date: Mon, 21 Jan 2019 15:06:39 +0100 Subject: [PATCH] Fix the Cucumber tests so they pass With the change of factories, single Cucumber test stopped working due to text in the test being dependant on a now randomly (Faker) defined value. --- features/settings_page/team.feature | 11 ++--------- features/step_definitions/shared_steps.rb | 5 +++++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/features/settings_page/team.feature b/features/settings_page/team.feature index 5db5997ce..3716ff51b 100644 --- a/features/settings_page/team.feature +++ b/features/settings_page/team.feature @@ -23,19 +23,12 @@ Feature: Team settings Then I click "Save" button And I should see "BioSistemika Process Company" on "#team-name" element - @javascript - Scenario: Successfully adds team description - Given I'm on "BioSistemika Process" team settings page - Then I click on ".description-label" element - And I fill in "I was on Triglav one summer." in "team_description" textarea field - Then I click "Save" button - And I should see "I was on Triglav one summer." on ".description-label" element - @javascript Scenario: Successfully changes team description Given I'm on "BioSistemika Process" team settings page Then I click on ".description-label" element - And I change "Lorem ipsum dolor sit amet, consectetuer adipiscing eli." with "I was on Triglav one summer." in "team_description" textarea field + Then I should not see "I was on Triglav one summer." on ".description-label" element + And I fill in "I was on Triglav one summer." in "team_description" textarea field Then I click "Save" button And I should see "I was on Triglav one summer." on ".description-label" element diff --git a/features/step_definitions/shared_steps.rb b/features/step_definitions/shared_steps.rb index 4aa9dced0..01a3550bd 100644 --- a/features/step_definitions/shared_steps.rb +++ b/features/step_definitions/shared_steps.rb @@ -128,6 +128,11 @@ Then(/^I change "([^"]*)" with "([^"]*)" in "([^"]*)" textarea field$/) do |old_ textarea.set(new_text) end +Then(/^I should not see "([^"]*)" on "([^"]*)" element$/) do |text, element| + wait_for_ajax + expect(find(element)).not_to have_content(text) +end + Then(/^I should see "([^"]*)" on "([^"]*)" element$/) do |text, element| wait_for_ajax expect(find(element)).to have_content(text)