functional-testing

Using mocha for controller in functional test with RSPEC

[亡魂溺海] 提交于 2021-01-29 17:55:15
问题 I'm doing some tests here using Rspec and I would like to assure that the controller is calling the log method in some actions. I'm also using mocha. I would like something like this: it "update action should redirect when model is valid" do Tag.any_instance.stubs(:valid?).returns(true) put :update, :id => Tag.first controller.expects(:add_team_log).at_least_once response.should redirect_to(edit_admin_tag_url(assigns[:tag])) end is there something to use as the 'controller' variable? I tried

How to stop Github Actions step when functional tests failed (using Codeception)

拥有回忆 提交于 2021-01-28 13:51:38
问题 I'm new with Github Actions and I try to make some continuous integration with functional tests. I use Codeception and my workflow run perfectly, but when some tests fail the step is written as success. Github don't stop the action and continue to run the nexts steps. Here is my workflow yml file : name: Run codeception tests on: push: branches: [ feature/functional-tests/codeception ] jobs: build: runs-on: ubuntu-latest steps: # —— Setup Github Actions 🐙 —————————————————————————————————————

How to stop Github Actions step when functional tests failed (using Codeception)

风格不统一 提交于 2021-01-28 13:47:41
问题 I'm new with Github Actions and I try to make some continuous integration with functional tests. I use Codeception and my workflow run perfectly, but when some tests fail the step is written as success. Github don't stop the action and continue to run the nexts steps. Here is my workflow yml file : name: Run codeception tests on: push: branches: [ feature/functional-tests/codeception ] jobs: build: runs-on: ubuntu-latest steps: # —— Setup Github Actions 🐙 —————————————————————————————————————

How do I debug a Testcafe browser running in a testcafe/testcafe docker container?

孤者浪人 提交于 2021-01-27 13:20:41
问题 Got a test for a React app's login function in a Page class: async login(t) { console.log('starting login...'); debugger; this.logBrowserMessages(t); await this.loginModal({ visibilityCheck: true }); await t .expect(this.loginModal.visible) .ok() // then log the user in etc... And the test, which passes when running locally but fails in the container test.requestHooks(mock)('user can log in', async t => { await page.login(t); // Make sure test user's orders render. await t.expect(page.orders

Symfony functional test fail but the same request works in browser

核能气质少年 提交于 2020-12-08 07:15:07
问题 I followed the Symfony documentation about functional tests in order to write my first one, but I have some issues. The response I get via browser works good: But when I run phpunit -c app/ in the shell I get a failure. 1) AppBundle\Tests\Controller\MeterAPIControllerTest::testGetAllVariables Failed asserting that 500 matches expected 200. This is the code: <?php namespace AppBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class MeterAPIControllerTest extends

How to mock service with symfony 4 in functional tests?

…衆ロ難τιáo~ 提交于 2020-06-10 14:54:54
问题 I have an commandbus handler, which injects some service: class SomeHandler { private $service; public function __construct(SomeService $service) { $this->service = $service; } public test(CommandTest $command) { $this->service->doSomeStuff(); } } SomeService has method doSomeStuff with external calls, which I want not to use during testing. class SomeService { private $someBindedVariable; public function __construct($someBindedVariable) { $this->someBindedVariable = $someBindedVariable; }