How to start with protractor automation using jasmin - protractor

I am new to protractor. I started to automate a small application using protractor. My question is do we create the project straight away using package.json by mentioning dependencies or
Do we install selenium , protractor through command prompt then write scripts. Once all done and working fine, then build the project using package.json again?
Please some one clarify me.
Thanks in advance

Protractor is used for end to end testing of another web project
You can create a separate folder called e2e in your project folder.
You can use the same package.json file, but create a new configuration file for e2e.
In the npm scripts you can first, build the project first and then run the test script.
Finally, I would say that a separate project is not required, as they are part of the same application.
I have worked on a couple of protractor projects. Feel free to ask anything.
Hope this answers your question.

You can create a simple project by downloading angular CLI project onto your workspace.
You can refer to any angular CLI site or video to start with. You will get all needed folders to start with, like e2e, src, etc and files like package.json, protractor conf etc.

Related

Javascript Protractor - Is there any solution to run protractor test with remote node_modules?

I'm writing automation test for the angularjs web app. Using protractor and cucumber.
From beginning, I organized the test as a separate folder and actually it required different node packages from the root project(the project built up the web app).
Today there's a requirement that the node_modules of test project should be merged with the node_modules of root project.
As per my knowledge, when running the command protractor protractor_conf.js, the system looks for the node_modules in 1 level upstream folder.
I'm attaching the screenshot of my project folder to be clearer.
Appreciate all suggestions !
Thanks.
I will not recommend you not to save node_modules as the separate folder in the project directory. Instead, you can create a package.json file for your test project and list all the dependencies in the package.json file. so each time before you run protractor conf.js ,just run npm install command from the directory where your project is available. So by doing this way will help you to run the e2e scripts in different machines without depending on the node_modules folder.
Example package.json for protractor
Also, it is advisable to maintain separate node_modules for different project because it may avoid versions conflicts of any node_module that is used in both projects.

Generating Scala Play project for IntelliJ

I am new to Play Framework. I wished to make a simple hello world project using SBT (without activator), but unless I did something wrong it seems to me that not all of the files and folders are generated.
Followed the instructions here: http://www.playframework.com/documentation/2.3.x/IDE
Can anyone direct me to some resource that could help me?
Thank you!
First, follow "Create a new application without Activator" section here:
http://www.playframework.com/documentation/2.3.1/NewApplication
Then run "idea" in SBT console to generate .idea and .idea_modules directories with IntelliJ IDEA configuration. Afterwards, use File - Open dialog in the IDE.
The steps above will create an empty application. You will have to create a controller, a view and routes file yourself if you don't want to install activator. Still I advise you to install activator where you'll find plenty of templates including "hello playframework" that would fit your needs.

Run Ant files when performing Build and Deploy Worklight 5.x.x Application

I have a Worklight application set up in Eclipse. Before executing Build And Deploy Worklight Application, I need to run a bat that compiles a bunch of HTML templates. This templates are necessary to run the app correctly.
So, I would like to know if it is possible to link (maybe under Run Configurations...?) an Ant file or similar that allows me to execute the bat and perform the build & deploy in an automatic way. Any advice?
Hope the question is clear.
I believe you can add an extra project builder to your application that invokes the Ant task you need.
Under Eclipse take a look at Project->Properties->Builders->New.
You will find Ant buildfiles as project builders a useful link.

Automate Tomcat adding to Eclipse

I'm trying to write a script (Perl) that will automate the adding of Tomcat server for a Java project under Eclipse.
The project is checked out via SVN, and I want, once the project is downloaded via SVN, to run a script that will automatically configure the remaining bits of the project. In this context, I need to find how can I edit which Eclipse's configuration files to automate the adding of a Tomcat server. Actually the script will also modify other configuration files, but I'm facing a hard time trying to find which files to edit and how to add Tomcat.
Any insights will be welcome, thanks in advance.
There is a plugin for eclipse called Escripts. You can create xml like scripts to automate actions like doing wizard actions. I tried to check the documentation, but the homepage of the Escripts is giving back http 500 for me (http://escripts.sf.net). I have written a mail to the author, if he answers, I will let you know. The update site looks like working (uncheck the categorize by groups to see the uncategorized plugin): http://escripts.sf.net/updates .
Some examples you can found at http://escripts.svn.sourceforge.net/viewvc/escripts/trunk/net.sf.escripts.tests/src/net/sf/escripts/tests/
What you should enter in the script is a wizard with id org.eclipse.wst.server.ui.new.server. The plugin, that is containing it is org.eclipse.wst.server.ui. Take a look at the plugin.xml in that plugin. Without the documentation, this is what I can remember of.
Have you tried the following files in the Eclipse workspace?
.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.jdt.core.prefs
.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.jdt.launching.prefs
.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.wst.server.core.prefs
.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.jst.server.tomcat.core.prefs
I took the following files and dropped them into a new instance of eclipse and it created the Tomcat server under Server->Runtime Environment.
http://dl.dropbox.com/u/9591144/StackOverflow/org.eclipse.jdt.core.prefs
http://dl.dropbox.com/u/9591144/StackOverflow/org.eclipse.jdt.launching.prefs
http://dl.dropbox.com/u/9591144/StackOverflow/org.eclipse.jst.server.tomcat.core.prefs
http://dl.dropbox.com/u/9591144/StackOverflow/org.eclipse.wst.server.core.prefs

How to run Eclipse launch configurations programmatically?

I'm finding it difficult to phrase this question well, as there are quite a few generic terms (run, configuration, launch, etc.). Here goes:
You can save run configurations in a .launch file. (in the Run Configuration Dialog, under the Common tab, Save as a shared file.
We check these in to SVN. The developers can pass them around, and it helps getting new devs running a working application quicker.
I'd like to check these out as part of our build and use them to programatically run the application, the tests, etc, without spinning up the whole IDE.
What would be the best way to run a .launch file outside of the UI?
Edit: I am trying to unify the tests run on the build server and the IDE. I do not
particularly want to give up integrated debugging, which would be the case with an ant script to run the tests .
This is probably more a problem for integration testing with multiple bundles, or unit testing a whole bundle, where you'd like to mock up extensions.
there is an eclipse plugin built over JUnit, called TPTP. It provides an automation client which can be used to launch the test from eclipse with no gui. maybe it helps
Ant4Eclipse may provide a good starting point on how to do this.
Unfortunately, this is limited to Java Applications and JUnit configurations; I am more interested in PDE applications and Plugin JUnit tests.
I have recently had alot of success building an Eclipse RCP app inside a Hudson CI server using Eclipse Buckminster. It took a bit of doing, but once I setup both features, made my RCP product be based on features, and added the Buckminster query files and the like, it worked. There is a Hudson/Jenkins Buckminster plugin that allowed me to have hudson build the application.
After saving the launch configurations for each test fragment, I created hudson commands to invoke them (yes one line per test fragment unfortunately), but after that I got the automated CI build that I wanted.
You could also use the shell command Eclipse uses. To get it:
Run your program in Eclipse
Go to the "Debug" view
Right-click on the process (probably the second item in the tree) and select "Properties"
Copy shell command and delete the agentlib flag to run in bash
I think you don't need to use the .launch configurations to run the tests. If you build an application using the Eclipse Build System, then you can use the AntRunner application from Eclipse to run your units tests. This doesn't start the whole IDE.
This article describes how to run the tests during your build process. With this process, you use a special "Test" Eclipse and load the plugins you want to test.
Perhaps running the configurations the way you would run your own custom run configurations would help here. It is described in this article.