0
describe('describe 1', function () {

  beforeEach(async () => {
    await browser.sleep(3000);
    await browser.navigate().to(URL);   
  });

  it('Edit Client', async () => {
    await browser.wait(until.presenceOf(SpadesPageObj.ClientEdit), 50000, 'Client Edit');
    await SpadesPageObj.ClientEdit.click();
  });

})

describe('describe 2', function () {

  beforeEach(async () => {
    await browser.sleep(3000);
    await browser.navigate().to(URL);

  })
    it('Edit Client', async () => {
    await browser.wait(until.presenceOf(SpadesPageObj.ClientEdit), 50000, 'Client Edit');
    await SpadesPageObj.ClientEdit.click();
  });

})

Is the above code correct? Can I have two describe block in one spec file? My problem is I do not want to run beforeEach for all the IT blocks so I created a two describe, Is there any workaround in which I can skip beforeEach for some of the test cases?

I tried to run the above code and the only 1st describe runs and it skips the 2nd describe.

  • 1
    it worked for me too add your cofig fiel and console out put where you see only one describe ran7 – PDHide Dec 03 '20 at 13:24

1 Answers1

0

yes you can do that. and you can also do nested describes (one inside another) https://stackoverflow.com/a/50802275/9150146

Sergey Pleshakov
  • 7,964
  • 2
  • 17
  • 40