I used the technologies below:
- 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, interacting with it as a user would;
- Page Objects: Page Objects help you write cleaner tests by encapsulating information about the elements on your application page. A Page Object can be reused across multiple tests, and if the template of your application changes, you only need to update the Page Object;
- CucumberJS: Cucumber is a tool for running automated tests written in plain language. Because they're written in plain language, they can be read by anyone on your team. Because they can be read by anyone, you can use them to help improve communication, collaboration and trust on your team;
- SuperTest: The motivation with this module is to provide a high-level abstraction for testing HTTP, while still allowing you to drop down to the lower-level API provided by superagent.
- Mocha: Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.
- Chai: Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework.
- Node.js installed;
- Its need to have the Java Development Kit (JDK) installed to run the standalone Selenium Server.
- Run
npm install
to install dependencies
Store DemoQA: http://store.demoqa.com
e2e
utils
It is to use to manage the data this way you can reuse the data in your testshere feature files should be createdsamplePage.data.js
features
Where feature files should be createdsamplePage.feature
pages
Where the page object of tests should be createdsamplePage.page.js
specs
Where the specification of tests should be createdsamplePage.spec.js
- Run
npm run webdriver-update
to install/update the binaries drivers
-
Start the Selenium Server
npm run webdriver-start
-
Run the tests
npm run e2e
-
Just run the tests are done protractor
npm run e2e -- --cucumberOpts.tags='@pending'
without pending scenarios
If you want to run the tests in your computer and Headless, you just need to set up the following steps:
- In the file
protractor.conf.js
add the code below after the:browserName: 'chrome',
chromeOptions: { args: ['--headless', '--disable-gpu', '--no-sandbox', '--disable-extensions', '--disable-dev-shm-usage', '--window-size=1600,1020']}
- After adding this args, just run the test
npm run e2e
Open Weather API: http://openweathermap.org/current
api
helpers
Where the helpers files should be createdconfig.json
Where the urls should able to use on the testsutils.js
Where are created the information to use before the run the testsweather.bodies.js
Where are the bodies should be created to use in the tests
specs
Where the specification of tests should be createdweather*.specs.js
- Run the tests
npm run api-test
- If the API is slowly you can run this command
npm run api-test -- --timeout 10000
, to set a timeout to every test.