From 0cebe648403b65839d8b49b1dc4d205799e80b99 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Mon, 14 Dec 2015 21:22:29 +0100 Subject: [PATCH] browser test: fix logic to find edit action The simple math test failed to find the edit link on a non existent page. It was looking for the text 'Create source' from Vector which is now simply 'Create'. Change the PageObject selector to use a CSS selector, more robust to text changes. Change-Id: Ifcbd07da8e343b5697fcff6af6ffac90ff4d6420 --- tests/browser/features/math.feature | 2 +- tests/browser/features/step_definitions/math_steps.rb | 4 ++-- tests/browser/features/support/pages/does_not_exist_page.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/browser/features/math.feature b/tests/browser/features/math.feature index 3f9e83b..48c8c05 100644 --- a/tests/browser/features/math.feature +++ b/tests/browser/features/math.feature @@ -15,7 +15,7 @@ Feature: Math Scenario: Display simple math Given I am logged in And I am at page that does not exist - When I click link Create source + When I click link Create And I type 3 + 2 And I click Preview Then the page should contain an img tag diff --git a/tests/browser/features/step_definitions/math_steps.rb b/tests/browser/features/step_definitions/math_steps.rb index f63befe..2918cf1 100644 --- a/tests/browser/features/step_definitions/math_steps.rb +++ b/tests/browser/features/step_definitions/math_steps.rb @@ -14,8 +14,8 @@ Given(/^I am at page that does not exist$/) do visit(DoesNotExistPage, using_params: { page_name: @random_string }) end -When(/^I click link Create source$/) do - on(DoesNotExistPage).create_source_element.when_present.click +When(/^I click link Create$/) do + on(DoesNotExistPage).action_edit_element.when_present.click end When(/^I click Preview$/) do diff --git a/tests/browser/features/support/pages/does_not_exist_page.rb b/tests/browser/features/support/pages/does_not_exist_page.rb index f3a58da..dbd01f1 100644 --- a/tests/browser/features/support/pages/does_not_exist_page.rb +++ b/tests/browser/features/support/pages/does_not_exist_page.rb @@ -14,5 +14,5 @@ class DoesNotExistPage page_url '<%=params[:page_name]%>' - a(:create_source, text: 'Create source') + a(:action_edit, css: 'li#ca-edit > span > a') end