functional-testing

How to import Rails helpers in to the functional tests

巧了我就是萌 提交于 2019-12-20 00:43:33
问题 Hi I recently inherited a project in which the former dev was not familiar with rails, and decided to put a lot of important logic into the view helpers. class ApplicationController < ActionController::Base protect_from_forgery include SessionsHelper include BannersHelper include UsersHelper include EventsHelper end Specifically session management. This is okay and working with the app but I am having problems writing tests for this. A specific example. Some of the actions do a before_filter

How to import Rails helpers in to the functional tests

走远了吗. 提交于 2019-12-20 00:43:10
问题 Hi I recently inherited a project in which the former dev was not familiar with rails, and decided to put a lot of important logic into the view helpers. class ApplicationController < ActionController::Base protect_from_forgery include SessionsHelper include BannersHelper include UsersHelper include EventsHelper end Specifically session management. This is okay and working with the app but I am having problems writing tests for this. A specific example. Some of the actions do a before_filter

Disable Soft Deleteable filter for hard delete record doesn't work

懵懂的女人 提交于 2019-12-18 06:58:17
问题 I'm trying to disable "Soft Deleteable" filter during functional testing and I do it as follow: First option: tried to disable at tearDown() in my test: protected function tearDown() { parent::tearDown(); $entityUser = $this->em->getRepository("UserSecurityBundle:User")->find($this->user->getUser()->getId()); $filter = $this->em->getFilters()->disable('softdeleteable'); $this->em->remove($entityUser); $this->em->flush(); $this->em->close(); } Didn't work. Second option: make a doctrine_test

Make protractor test occupy the entire screen

我的梦境 提交于 2019-12-18 03:41:06
问题 I have seen a couple questions online related to this issue (How to set default browser window size in Protractor/WebdriverJS) but they don't address my issue. I have the tests that I want to be able to run successfully on a laptop screen or desktop screen of ant size. I had tried all of these methods below but unsuccesfully. The issue with this one is that I have to hardcode a width and height. I want to detect the screen size automatically browser.driver.manage().window().setSize(width,

Selenium Page Object Reuse

房东的猫 提交于 2019-12-18 02:49:49
问题 I really like how selenium 2 by convention pushes you towards using PageObjects as POJOs, and then simply using the PageFactory to instantiate the fields in this class. What I am finding limiting is that we reuse a lot of elements on many different pages. The big problem is that these reused components do not have the same id / name when they appear on different pages; however the tests we would run for each of them is the same. As an example we collect dates in many places. So an example

Send keys control + click in Selenium with Python bindings

与世无争的帅哥 提交于 2019-12-17 15:27:51
问题 I need to open link in new tab using Selenium. So is it possible to perform ctrl+click on element in Selenium to open it in new tab? 回答1: Use an ActionChain with key_down to press the control key, and key_up to release it: import time from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys driver = webdriver.Chrome() driver.get('http://google.com') element = driver.find_element_by_link_text('About')

Send keys control + click in Selenium with Python bindings

你离开我真会死。 提交于 2019-12-17 15:26:34
问题 I need to open link in new tab using Selenium. So is it possible to perform ctrl+click on element in Selenium to open it in new tab? 回答1: Use an ActionChain with key_down to press the control key, and key_up to release it: import time from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys driver = webdriver.Chrome() driver.get('http://google.com') element = driver.find_element_by_link_text('About')

Best way to take screenshots of tests in Selenium 2?

扶醉桌前 提交于 2019-12-17 07:10:27
问题 I need a way to take screenshots of my functional tests. Right now I'm using Selenium 2 with C# bindings. I pretty much want to take a screenshot at the end of the test to make sure the desired page is displayed. Are there any particular tools you guys know of that I can incorporate into my C# code that will trigger a screenshot? I couldn't find a built-in Selenium 2 solution (without looking it over). 回答1: To do screenshots in Selenium 2 you need to do the following driver = new

Unit tests vs Functional tests

萝らか妹 提交于 2019-12-17 02:26:15
问题 What is the difference between unit tests and functional tests? Can a unit test also test a function? 回答1: Unit Test - testing an individual unit, such as a method (function) in a class, with all dependencies mocked up. Functional Test - AKA Integration Test, testing a slice of functionality in a system. This will test many methods and may interact with dependencies like Databases or Web Services. 回答2: Unit tests tell a developer that the code is doing things right; functional tests tell a

Unit tests vs Functional tests

两盒软妹~` 提交于 2019-12-17 02:26:01
问题 What is the difference between unit tests and functional tests? Can a unit test also test a function? 回答1: Unit Test - testing an individual unit, such as a method (function) in a class, with all dependencies mocked up. Functional Test - AKA Integration Test, testing a slice of functionality in a system. This will test many methods and may interact with dependencies like Databases or Web Services. 回答2: Unit tests tell a developer that the code is doing things right; functional tests tell a