Skip to main content
some typos fixed
Source Link
Alexey R.
  • 11.6k
  • 5
  • 20
  • 39

The purpose of describe is to allow BDD format:

describe('Given user logins', () => {
    describe('Given user Selects payment', () => {
        describe('Given user clicks pay', () => {
            it('Then deducts payment', () => {   
 
            })    
        })
    })
})

So it's perfectly fine to nextnest the describe. You can rightwrite steps in each describe blocblock using beforeEach

describe('Given user logins', () => {

    beforeEach(async function() {
         login();
    });

    describe('Given user Selects payment', () => {

        beforeEach(async function() {
            selectpayment();
        });

        describe('Given user clicks pay', () => {
            it('Then deducts payment', () => {  
  
            })    
        })
    })
})

The purpose of describe is to allow BDD format:

describe('Given user logins', () => {
    describe('Given user Selects payment', () => {
        describe('Given user clicks pay', () => {
            it('Then deducts payment', () => {   
 
            })    
        })
    })
})

So it's perfectly fine to next the describe. You can right steps in each describe bloc using beforeEach

describe('Given user logins', () => {

    beforeEach(async function() {
         login();
    });

    describe('Given user Selects payment', () => {

        beforeEach(async function() {
            selectpayment();
        });

        describe('Given user clicks pay', () => {
            it('Then deducts payment', () => {  
  
            })    
        })
    })
})

The purpose of describe is to allow BDD format:

describe('Given user logins', () => {
    describe('Given user Selects payment', () => {
        describe('Given user clicks pay', () => {
            it('Then deducts payment', () => {   
 
            })    
        })
    })
})

So it's perfectly fine to nest the describe. You can write steps in each describe block using beforeEach

describe('Given user logins', () => {

    beforeEach(async function() {
         login();
    });

    describe('Given user Selects payment', () => {

        beforeEach(async function() {
            selectpayment();
        });

        describe('Given user clicks pay', () => {
            it('Then deducts payment', () => {  
  
            })    
        })
    })
})

The purpose of describe is to allow BDD format:

describe('Given user logins', () => {
    describe('Given user Selects payment', () => {
        describe('Given user clicks pay', () => {
            it('Then deducts payment', () => {   
 
            })
     
        })
    })
})

So it's perfectly fine to next the describe. You can right steps in each describe bloc using beforeEach

describe('Given user logins', () => {

    beforeEach(async function() {
         login();
    });

    describe('Given user Selects payment', () => {
 

        beforeEach(async function() {
            selectpayment();
        });

        describe('Given user clicks pay', () => {
            it('Then deducts payment', () => {  
  
            })
     
        })
    })
})

The purpose of describe is to allow BDD format:

describe('Given user logins', () => {
describe('Given user Selects payment', () => {
describe('Given user clicks pay', () => {
it('Then deducts payment', () => {

})
 
})
})
})

So it's perfectly fine to next the describe. You can right steps in each describe bloc using beforeEach

describe('Given user logins', () => {

    beforeEach(async function() {
     login();
    });

describe('Given user Selects payment', () => {
 

    beforeEach(async function() {
     selectpayment();
    });

describe('Given user clicks pay', () => {
it('Then deducts payment', () => {

})
 
})
})
})

The purpose of describe is to allow BDD format:

describe('Given user logins', () => {
    describe('Given user Selects payment', () => {
        describe('Given user clicks pay', () => {
            it('Then deducts payment', () => {   
 
            })    
        })
    })
})

So it's perfectly fine to next the describe. You can right steps in each describe bloc using beforeEach

describe('Given user logins', () => {

    beforeEach(async function() {
         login();
    });

    describe('Given user Selects payment', () => {

        beforeEach(async function() {
            selectpayment();
        });

        describe('Given user clicks pay', () => {
            it('Then deducts payment', () => {  
  
            })    
        })
    })
})
Source Link
PDHide
  • 11.1k
  • 2
  • 16
  • 43

The purpose of describe is to allow BDD format:

describe('Given user logins', () => {
describe('Given user Selects payment', () => {
describe('Given user clicks pay', () => {
it('Then deducts payment', () => {

})

})
})
})

So it's perfectly fine to next the describe. You can right steps in each describe bloc using beforeEach

describe('Given user logins', () => {

    beforeEach(async function() {
     login();
    });

describe('Given user Selects payment', () => {


    beforeEach(async function() {
     selectpayment();
    });

describe('Given user clicks pay', () => {
it('Then deducts payment', () => {

})

})
})
})