cucumber

Easy way to detect whether rspec or cucumber is running?

感情迁移 提交于 2019-12-11 11:09:47
问题 I'm currently checking in some places whether code is being executed in test mode, by Rails.env.test? I would like to go one step further, and check whether it is Cucumber or Rspec executing the code, in order to finetune some methods for i18n (which I do want to run differently in a Cucumber context, but not in an Rspec context) Is there any way to do this? 回答1: You can set RAILS_ENV=cucumber and then ask: Rails.env.cucumber? 回答2: I'm using the cucumber-rails gem, and with that at least you

cucumber contradictory error messages

有些话、适合烂在心里 提交于 2019-12-11 10:15:59
问题 Problem Background: "cucumber declarative step definitions using web_steps.rb" Stack Overflow Question In troubleshooting the problem in question two contradictory error messages are arrived at; with the statement: When /^(?:|I )uncheck "([^"]*)"$/ do |field| check(field) end added to 'features/step_definitions/movie_steps.rb' execution of 'bundle exec cucumber features/filter_movie_list.feature' results in: Ambiguous match of "I uncheck "ratings_G"": features/step_definitions/movie_steps.rb

Unable to check the checkbox in GEB

跟風遠走 提交于 2019-12-11 09:58:39
问题 I am trying to check my check box in Geb. I have tried following codes, but no luck $('input', type:'checkbox', id: 'chkTermsConditions', tabindex: '-1').value('true') $(".CheckBoxUI").value('true') Following is the HTML After mouse go over the check box additional text updated (marked in the screen shot) 回答1: You are attempting to check the box which has the attribute with value='true' From the Geb manual: The value of input, select and textarea elements can be retrieved and set with the

Rails Feature tests failing after Yosemite upgrade

断了今生、忘了曾经 提交于 2019-12-11 09:32:23
问题 Immediately after upgrading my Mac to Yosemite, some feature tests started failing, specifically steps using the fill_in method. The following step definition fails on the first fill_in. def sign_in visit '/users/sign_in' fill_in "Email", :with => @visitor[:email] fill_in "Password", :with => @visitor[:password] click_button "Log in" end I get the following error; Selenium::WebDriver::Error::JavascriptError: arguments[0] is undefined It was passing before the upgrade. Anyone else run into

Execute @Given only once in cucumber feature file

南笙酒味 提交于 2019-12-11 09:22:46
问题 I have the following feature that I would like to test in cucumber. But, I would like to process the input file only once ( @Given in the below feature ). But, it seems to be executing the @Given step each time. Is it possible to execute this @Given in the following feature only once? @fileValidation Scenario Outline: File Validation Given a file is uploaded with name "something.csv" Then response filename created should not match input filename "something.csv" And reason for errors should be

Two Step Definitions that are the same but one is for Given and one is for Then

拜拜、爱过 提交于 2019-12-11 08:47:43
问题 Cucumber feature files are throwing an error (multiple step definitions declared) if I try to have two similar step definitions but with different annotations - @Then("^element with id \"([^\"]*)\" is displayed$") & @Given("^element with id \"([^\"]*)\" is displayed$") So far I've fooled it by putting an extra space in the @Then definition (look carefully at @Then, after the regex). But this is not good practice. I want the @Given, because it sets up up my scenario, and I definitely need the

How do I wait until a cookie is set?

两盒软妹~` 提交于 2019-12-11 08:07:59
问题 I am writing the acceptance tests for my application's login feature. At some point, I want to double-check the cookie's expiry time. Upon clicking on the "Login" button, a graphql query is sent to my server which responds with a Jwt. Upon reception of the jwt, the application sets the cookie with document.cookie = ... In my Cypress test, I check the token in the following way: Then("sa session s'ouvre pour {SessionDurationType}", expectedDuration => { cy.get('@graphql').then(() => { cy.wait

Redirect_to sign in page if AJAX call is not authorized

て烟熏妆下的殇ゞ 提交于 2019-12-11 08:06:24
问题 I have a form and when you click submit it will make an AJAX call to update the thing you want to change. My user session expires in 4 hours, so if the user wants to update the form and his session has expired in the meantime it will render a flash message asking to reload the page and sign in again. When trying to test this behavior using Cucumber , Capybara , Selenium and Chrome the AJAX response is never received as the flash message is not rendered. (If I test it manually it works just

geb.error.PageInstanceNotInitializedException

六眼飞鱼酱① 提交于 2019-12-11 08:00:22
问题 I am new in using Geb and Cucumber for grails and I am following this tutorial https://github.com/hauner/grails-cucumber/wiki/Testing-Grails-with-Cucumber-and-Geb Everything has been fine up until I made a Page class and used it in my step definition. I ran the test and this error showed up. Error running forked test-app: Instance of page class pages.ListPage has not been initialized. Please pass it to Browser.to(), Browser.via(), Browser.page() or Browser.at() before using it. (NOTE: Stack

Cucumber Aruba trying to change directory results in a strange error

三世轮回 提交于 2019-12-11 07:45:16
问题 So I create the dotfiles directory and then cd to dotfiles. However, cucumber aruba is giving me an error that says dotfiles is not a directory. I can't figure out why this is? the code in pry results in the correct behavior. @creation Scenario: Create a dotfiles git repository Given the directory dotfiles does not exist in the home directory When I successfully run `dotfiles init dotfile_one dotfile_two dotfile_three` Then a dotfiles directory should exist in the home directory When I change