Check marking when creating a page using AngularJS

We have a one-page application created using AngularJS. We would like to check the markup of this application. The problem is that the markup is mostly generated using a script, so if we pass the source code to the validator, the result will be only partial.

We are currently studying the testing page as follows.

  • Open the page using the Selenium web automation library.
  • Take a few steps.
  • Flush current HTML to file.
  • Process it with an autonomous validator.

It takes a long time to implement this thread, since we will need to hard-code all the ways to use the application, so I would like to ask: are there other ways to do this?

+6
source share
3 answers

With AngularJS you should NOT check all variations of your page as a DOM using a script in your single page application if you adhere to AngularJS programming and adhere to the following: -

  • Check every HTML file / snippet .

    These are Angular templates / partial or any HTML files that you have (index.html). Use grunt based on html modules for validation, such as this so that the grunt workflow can guarantee that the HTML is valid even before it is bound to the source code of the repository. Such plugins can check HTML fragments.

  • Use the built-in AngularJS directives to control the DOM .

    eg. ngSwitch, ngView, ngIf etc. instead of any custom materials using jQuery or another mechanism.

    AngularJS already provides a valid HTML DOM. This means that your resulting HTML will always be valid.

+4
source

Do you consider using Angular e2e:

http://docs.angularjs.org/guide/dev_guide.e2e-testing

This allows you to get / check elements from html, for example:

 expect(element('#email').html()).toBe('something'); 

From the Angular Documentation using jazmine:

 describe('Buzz Client', function() { it('should filter results', function() { input('user').enter('jacksparrow'); element(':button').click(); expect(repeater('ul li').count()).toEqual(10); input('filterText').enter('Bees'); expect(repeater('ul li').count()).toEqual(1); }); 

});

Update 1

Then you can try something like:

+2
source

I call it GUI level testing. Visual Studio has a great browser recording and playback tool that allows the tester to create automated tests that verify everything the tester wants.

Here is the video: https://onedrive.live.com/?cid=ae5cd7309cccc43c&id=AE5CD7309CCCC43C%21183&sff=1&authkey=%21ANqaLtCZbtJrImU&v=3

For this you will need the Premium Edition. In addition, I heard good reports about Selenium, in fact, MSFT themselves approved it.

0
source

All Articles