P
P
Peter2016-08-04 14:54:08
Angular
Peter, 2016-08-04 14:54:08

How to test data on a web page?

The SPA application is written in AngularJs 1.4
Depending on what data comes from the server, certain directives, blocks and data are displayed on the page.
Simulating data from the server is not a problem, but how to check that exactly those directives, blocks and data are displayed on the page?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Blokhin, 2016-08-04
@TITnet

Is the display of data on the page dependent on JavaScript?
If not, then take the source code (HTML) of the page, any HTML parser and go.
If it depends, then take Selenium, open the desired page, take the DOM from it and check the data.
Just an example in Ruby.
There is a page /page on which some data should be (prepared on the server "Simulate data from the server"), for example text foo.

require 'selenium-webdriver'
driver = Selenium::WebDriver.for :phantomjs
driver.get '/page'
selector = 'div[class="data"] > span[id="foo"]'
element = driver.first selector
puts 'foo' == element.text

_
_ _, 2016-08-04
@AMar4enko

Well, like a protractor, they made it for this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question