
-
-
-
-
URL copied!
What is protractor?
Protractor is an end-to-end test framework for Angular and AngularJS applications. Protractor runs tests against your application running in a real browser, using Selenium.
We can say in other words that Protractor is a tool that helps us to test Angular Apps using Selenium.
And in case you are wondering, is ONLY for Angular App. If you are app is not Angular better start looking another tool to test it.
Why choose protractor?
One of the best things of Protractor is that is open source, and how it was created and for is very interesting too (you can see here the presentation made by Julia, alias the creator, Video).
Protractor was made so anybody can test UI in a way that is simple and fast. And when I say anybody, I mean not only QA Engineers.
Another main reason to choose Protractor is as usual: community. Since a lot of people is using it, you can find several articles ( here on Medium and also on other pages), and for sure lot of resolved issues on StackOverflow.
What other tools are available on the field?
Well…. you know you have a lot of fishes in the sea. So you also have other options regarding testing Angular App.
I will mention some of them and you can take a look whenever you want:
Mocha
Chai
Jest
Let’s start!
The first step first, you will need to get node.js and npm on your local. Here I would strongly recommend you to use the console all the time to perform this. Please if you are using Windows look for a console that is similar to Linux. This is written thinking on Mac mainly very similar is on Linux.
1)To get node.js → https://nodejs.org/en/
verify version executing :
node -v
2)To get npm → https://www.npmjs.com/get-npm
* or simply execute:
apt-get install npm
verify version executing :
npm version
3) To get protractor from npm →https://www.protractortest.org/#/
* just execute:
npm install -g protractor
verify version executing :
protractor –version
Running your first test
In order to run your first test with protractor you will need to :
1 ) get update webdriver-manager
2 ) write the test ( daaa, is obvious that, right?)
3 ) set the configuration to run the test
4 ) run it!
Ok, now you know what is need to be done, let’s go for it.
The first step is pretty easy, just execute:
webdriver-manager update
webdriver-manager start
Note: If you are wondering what you need to do this. Is simply because you are providing protractor with the selenium manager to execute your test. What is going to happen once you have your webdriver-manager up and running you will have the selenium server on http://localhost:4444/wd/hub.
The second step, write the test. Here I want to mention that protractor by default use Jasmine, with BDD makes really easy to write the test. ( You can use other instead Jasmine, but I’m not going to talk about those) . Instead of writing you can simply copy the following and name it helloWorld.js
describe(‘Angularjs homepage Hello World’, function() {
it (‘Say hello world’,function() {
browser.get(‘https://angularjs.org’);
element(by.model(‘yourName’)).sendKeys(‘World’); var welcomeMessage = element.all(by.tagName(‘h1’));
expect(welcomeMessage.get(1).getText()).toEqual(‘Hello World!’);
});
});
Follow step is to configure, use this and name it as conf.js
exports.config = {
framework: ‘jasmine’,
seleniumAddress: ‘http://localhost:4444/wd/hub’,
specs: [‘helloWold.js’]
}
Last step ( are you waiting for this??)
Now you are ready and can execute:
protractor conf.js
This will finally ( yes, FINALLY) execute your test using protractor!
Top Insights



Escribiendo User Stories en Agile
AutomotiveCommunicationsConsumer and RetailFinancial ServicesHealthcareManufacturing and IndustrialMediaTechnology
What is TM Forum Frameworx and how to...
UncategorizedAutomotiveCommunicationsConsumer and RetailFinancial ServicesHealthcareManufacturing and IndustrialMediaTechnology
Impact Mapping en Metodologías ágiles
AutomotiveCommunicationsConsumer and RetailFinancial ServicesHealthcareManufacturing and IndustrialMediaTechnology
Trabajemos juntos
Contenido Relacionado
5 consejos para una planificación eficaz del sprint
La sprint planning es una de las ceremonias de Scrum en donde se define el objetivo de las siguientes semanas de trabajo. Debido a su importancia y complejidad, suele demorarse más que las otras ceremonias y puede ser difícil para el equipo sobrellevarla.
Conocer más
Pishing: 7 formas de prevenir los ataques
El phishing es la forma más frecuente de ciberdelincuencia, una realidad inquietante subrayada por asombrosas estadísticas. Se calcula que cada día 3.400 millones de correos electrónicos maliciosos inundan las bandejas de entrada de todo el mundo.
Conocer más
¿Es ChatGPT el fin de los desarrolladores?
ChatGPT, junto con otras herramientas de IA, ha cambiado la forma en que los desarrolladores interactúan con el código y agiliza el proceso de desarrollo de software. Estas herramientas están diseñadas para comprender y generar código, proporcionando asistencia valiosa a los programadores.
Conocer más
¿Cómo utilizar éticamente la IA? Los nuevos desafíos corporativos
El futuro se escribe con inteligencia artificial, pero la tecnología en constante desarrollo genera tanto beneficios como preocupaciones. Es por esto que las compañías deben buscar soluciones que controlen su utilización para brindar servicios más óptimos y éticos.
Conocer más
¿Puede la tecnología ponerle fin a las estafas y la inseguridad financiera?
La digitalización financiera es un proceso que está transformando la forma de interacción con el sistema financiero. Sin embargo, existe una percepción errónea de que la digitalización financiera aumenta los riesgos de seguridad.
Conocer más
Nuevas oportunidades en la encrucijada de las API financieras y los nuevos estándares globales
En los últimos años, el sector financiero ha experimentado cambios significativos impulsados por la proliferación de APIs y la aplicación de nuevas normas mundiales. Estos avances han abierto nuevas oportunidades tanto para las empresas como para los particulares, ya que proporcionan un mejor acceso a los productos y servicios financieros, así como una mayor seguridad y transparencia. ¿Cuáles son estas oportunidades?
Conocer más
Ciberseguridad: ¿Cómo pueden estar preparadas las empresas para los ataques?
Por Juan Carlos Terragno, Partner en Hexacta, a GlobalLogic Company. A medida que las empresas de todo el mundo dependen cada vez más de las redes informáticas para almacenar datos valiosos y ejecutar tareas rutinarias, la adopción de fuertes medidas de ciberseguridad se ha convertido en la necesidad del momento. En el presente artículo mostraremos … Continue reading E2E test with protractor–Run your first test →
Conocer más
Share this page:
-
-
-
-
URL copied!