protractor icon indicating copy to clipboard operation
protractor copied to clipboard

access logstash ws from protractor?

Open csarnevesht opened this issue 13 years ago • 3 comments

Hi,

I am currently testing our angularjs application which has a separate backend server and a logging server (logstash). I have a particular scenario I need to test in which the backend server sends logging statements to logstash which I would like to take advantage of when testing the featulre. Logstash has a mechanism to track certain log statements via "curl". For example, I can make a call as follows: curl -X GET "http://localhost:8983/solr/corpus_development.people/select?q=emails%[email protected]_+AND+source%3Agoogle&wt=json&indent=true"

and that curl will return:

    "responseHeader":{
                                   Dload  Upload   Total   Spent    Left  Speed 
      "status":0,

      "QTime":9,
      "params":{
        "indent":"true",
        "q":"emails:*[email protected]* AND source:google",
        "wt":"json"}},
    "response":{"numFound":1,"start":0,"docs":[
        {     
          "uniqueId":"google:104098896523754584935",
          "belongsTo":"c10cc6ed-77ba-46a8-a616-12b5f723fb0e",
          "emails":["[email protected]"],
          "names":["Omar AutomationOne"],
          "source":"google",
          "sourceSpecificId":"104098896523754584935"}]
    }}

Is there a way I could do http requests to the local logstash server from protractor?

I have been trying to use XMLHttpRequest from protractor but I haven't been succesful. Could you please give me some help, ideally with some example on how to do this?

Any help would be greatly appreciated. Thanks.

csarnevesht avatar Dec 01 '13 17:12 csarnevesht

Protractor is a nodejs application and therefore it can use any nodejs module. In particular the http module can do what you need - check out the documentation here - http://docs.nodejitsu.com/articles/HTTP/clients/how-to-create-a-HTTP-request

manevpe avatar Dec 01 '13 17:12 manevpe

perfect!  

i'm a newbie to this... i wish i had asked this question yesterday... would have saved me a long time!

thank you!

On Sunday, December 1, 2013 9:16 AM, Petar Manev [email protected] wrote:

Protractor is a nodejs application and therefore it can use any nodejs module. In particular the http module can do what you need - check out the documentation here - http://docs.nodejitsu.com/articles/HTTP/clients/how-to-create-a-HTTP-request — Reply to this email directly or view it on GitHub.

csarnevesht avatar Dec 01 '13 17:12 csarnevesht

Looks like it's worked out - closing, please open a new issue if there's lingering questions!

juliemr avatar Dec 02 '13 14:12 juliemr