Giter Site home page Giter Site logo

lookingglass-automation-challenge's Introduction

LookingGlass Automation Challenge

Setup

Prerequisites:

  • You must have node and git already installed to complete the setup.
  • You also need chrome and firefox installed to execute the test.

Setting up the project is simple and these steps apply to any platform (Linux, Windows or Mac OS):

  1. Clone it
  2. Run npm install - this installs all project dependencies
  3. Run npm run wdupdate - this downloads the needed chrome/firefox webdrivers

Running Tests

There are 2 tests in this automation suite: test1.spec.ts and test2.spec.ts

test1.spec.ts is the hackerrank automation challenge original test case.

test2.spec.ts uses the same functionality from test 1 except it adds different products and uses many of the same page-object functions.

The tests are configured to run through npm's default test command, so all you need to do is open a terminal in the project folder and run:

npm test

Running npm test also runs the following npm scripts via pre-hooks:

"clean": "rm -rf tmp", // only works on Unix
"tsc": "tsc", // compiles TypeScript files to JavaScript
"pretest": "npm run clean && npm run tsc", // run both scripts above before test
"test": "protractor ./protractor.conf.js", // run the tests

To switch between chrome and firefox, simply update the protractor.conf.js in the root of the project like-so:

Chrome:

capabilities: {
    browserName: 'chrome'
},

Firefox:

capabilities: {
    browserName: 'firefox'
},

Test Results

Test results can be viewed in 2 ways:

  1. The terminal output
  2. The HTML screenshot report
    • Located under tmp/report after executing a test
    • Open index.html in a browser to view the report

Granted there are no issues with setup/running the tests, the tests should pass without an issue. To see how the tests might look when they fail, simply update any of the assertions on the SummaryPage.

  1. Go to page-objects > summaryPage.ts
  2. Update any of the assertions so that it fails (assertions on lines 49, 52, 96, 97 and 98). Example:
// line 96 - before
await expect(calculatedTotalProduct).toEqual(totalProduct, calculatedTotalProduct + " is expected to equal " + totalProduct);
// line 96 - after
await expect(calculatedTotalProduct).toEqual(2, calculatedTotalProduct + " is expected to equal " + 2);

lookingglass-automation-challenge's People

Contributors

maddawik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.