SUPARNA SOMAN
SUPARNA SOMAN

Reputation: 2693

How to close my browser after each test in a suite for protractor?

I was trying to run my tests as a suite. There are three tests in a suite, how can I make my browser close after each test ?

suites:
        {
          one: 'one.js',
          two: 'two.js',
          three: 'three.js'
        };

The problem is that each of this test is used to load a separate url, and each test checks whether the correct url is loaded. But my test fails each time as all the urls are different.

Upvotes: 2

Views: 12148

Answers (1)

hitesh jani
hitesh jani

Reputation: 61

You can use below method in you spec.js

afterEach(() => {
         browser.close(); (or browser.driver.close();)
        console.log('afterEach');
    });

Upvotes: 5

Related Questions