Laravel 5 codeception functional testing, wait for full page load - laravel

I am trying to write a functional test using codeception for Laravel 5. Fails to validate elements loaded by JS. How do I wait for all JS to be run and the page to be fully loaded. It this achievable?

You should use Selenium for this. Laravel has Selenium support out of the box (though you'll still need to download the Selenium standalone server and have Java installed)

Related

Laravel CRUD Application Dusk vs PHPUnit

I am currently working on a Laravel CRUD application and I was wondering why PHPUnit does not support crawling the browser (anymore, as I read). I already covered the basement of my project via PHPUnit, but I do also want to test links, a tags, button clicks etc. So I do already have a strong basement of unit tests.
Now I read about Dusk providing a crawler for DOM tests. Shall I use both together (is it even possible?) or should I migrate to Dusk? I'm not sure whether Dusk provides the same functionality as PHPUnit does and as stated, I do already have a strong phpunit testing base.
From now on I'm kinda stuck, because of 50:50 testcases, as I do also need to test whether the DOM does provide the correct information.
Appreciate any help or expert advice.
Thank you in advance!
Dusk is not a crawler but a browser driver, it can control a (headless) browser.
Specifically designed on top of PHPunit to do E2E (end to end) testing.
So convert to Dusk what is browser tests (html/javascript), but everything else keep as unit tests.
API tests for example you don't need dusk at all.

Is it possible to turn off JavaScript for some tests using Codeception?

We have client-side validation and server-side validation as a back up in this Laravel application, and we want to test both, but I can't figure out if that's possible. Is it possible to turn off JavaScript for a single run of the tests, then run them again with it on using Codeception?
Test with PhpBrowser or Laravel5 module.
They can't execute Javascript, so only server side validation is possible.
You will have to create a separate test suite (or use functional if you aren't using it yet) for these tests, because you can have only one of WebDriver, PhpBrowser and Laravel5 modules enabled at a time.

ReferenceError: jQuery is not defined using gatling

Hi trying to record some scenario using gatling, when I run my website normally it load jquery properly but not using gatling recording.
Did anyone faced such issue?
Gatling is not a web browser.
This is important, because as far a Gatling is concerned, jQuery is just data. It's a javascript file. You can tell Gatling to download this file, but Gatling won't run it because Gatling is not a web browser.
However, there may still be a way to solve your problem with Gatling. Gatling supports CSS selectors, so may be able to do whatever you were trying to do with jQuery, if you told us what you wanted to do.

How to use Behat with CodeIgniter?

We are toying with Behat to start writing specifications for our PHP applications. All step definition implementation examples are for plain PHP classes, but we are using CodeIgniter as a our prefered framework.
We rule out writing features and scenarios that are UX/UI oriented (that would abstract away the underlying framework) until later in the development stage, and would like instead to test the application layer by accessing the CodeIgniter models.
How do you get Behat to use these models? i.e. how do you integrate Behat with CI?
Download here Behat CI Test
Simple test with Behat and CodeIgniter. The CodeIgniter controller just displays a login page and returns a data array that use to make assertions. There are various debug statements printed with error_log, which Behat displays on stdout, to follow the flow of execution.

How do I run AJAX scripts locally on my machine using IIS(or any related technology)?

I want to run a few AJAX applications on my laptop, but not sure how to do it using IIS. Does anyone know?
You really dont even require IIS server setup to run your own AJAX application.
You can take a look at few of the tutorials onlike which talk about creating your own application using HTML.
Tutorial - http://www.dynamicajax.com/fr/AJAX_Hello_World-.html
This way you can load HTML pages using AJAX.

Resources