1

I have two files "test.js" and "gmail.js"(Mail listener 2). I need to run "test.js" file first and then after 2 minutes i need to run "gmail.js" file.

Is it possible?

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
nrs
  • 937
  • 3
  • 17
  • 42
  • I would add a `browser.sleep(120000);` in `beforeAll` for the second file. Adding to it using the protractor config file to order the files execution order, it should give you the result you are expecting. Hope it helps. – Ania Jun 14 '17 at 14:54
  • @AnnaN Can you share the code please...I don't know how to put it. – nrs Jun 14 '17 at 15:25
  • 1
    @raghavendrat done, check it out. – alecxe Jun 14 '17 at 15:26

1 Answers1

2

One option would be to properly configure your specs parameter in the Protractor config:

specs: [
    "path/to/test.js",
    "path/to/gmail.js",
],

specs are executed sequentially one by one.

As far as adding a time delay, you can put it under the beforeAll into gmail.js:

describe("Should test something", function () {
    beforeAll(function () {
        browser.sleep(120000);  // wait for 2 minutes
    });

    it("should do something", function () {
        // your test logic here
    });
}, 300000);  // adjusting the default timeout interval -- 5 minutes for this spec
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • I tried the above answer but as soon as i run the script it is running the second file also.(gmail.js file contains mail listener 2 test case). – nrs Jun 14 '17 at 14:47
  • @raghavendrat have you added the desired time delay into the second spec? – alecxe Jun 14 '17 at 14:48
  • No i didn't... How to add the time delay?Can u send me the code please – nrs Jun 14 '17 at 15:22
  • @raghavendrat `browser.sleep(120000)` to wait for 2 minutes. Note that you would also need to adjust the spec's default jasmine timeout interval: https://stackoverflow.com/a/9957990/771848. Thanks. – alecxe Jun 14 '17 at 15:24
  • Thanks.. i will try and let you know. – nrs Jun 14 '17 at 15:28
  • I tried and its not executing second file (gmail.js) now, but now it's waiting 2 minutes. Can u share with me your personnel mail id so that i will share all my user credentials.Please help me. – nrs Jun 14 '17 at 15:53