Suppose have A.js file with 10 it blocks, now in middle of exuction say in 6th it block need to execute another more js file say B.js
Asked
Active
Viewed 60 times
-1
-
I understood what you want to achieve, and most likely it's not possible. But I can't even think of a possible use case for doing this. If you could explain why you want to do so in the first place I may help you find a workaroud – Sergey Pleshakov Jun 18 '19 at 16:53
-
I agree with Sergey here, basically you cannot put an `it` block inside another `it`. Or a `describe` inside an `it` block. Maybe explain to us why you want to do this, so we can offer better help – Joaquin Casco Jun 18 '19 at 17:12
-
I have 2 js files[A.js with some it blocks, B.js with some it block as individual test suite]. Now in A.js, one of the it block requires as pre-condition should execute all flow[all it blocks] which are mentioned in B.js. Instead again pasting all it blocks from B.js to A.js it block, is there any way to handle it. This is what my current scenario. Hope you understand. – JAK Jun 18 '19 at 17:40
1 Answers
0
I'm not sure this is what you mean, but you could have several describe
blocks with their it
blocks inside of them.
describe('Main file', () => {
describe('Describe A', () => {
it('some it block from A', async () => {
// code here
});
});
describe('Describe B', () => {
it('some it block from B', async () => {
// code here
});
});
});

Joaquin Casco
- 704
- 5
- 14
-
-
maybe you can find this link useful https://stackoverflow.com/questions/31830202/nested-it-in-protractor-jasmine took me 2 secs to google – Joaquin Casco Jun 18 '19 at 16:44
-
thanks for reply. Yes that is not what i am expecting. Scenario : A.js : describe('Main file', () => { it('some it block1', async () => { // code here }); it('some it block2', async () => { // code here }); it('some it block3', async () => { }); }); B.js : describe('Main file', () => { it('some it block1', async () => { // code here }); it('some it block2', async () => { // code here }); it('some it block3', async () => { //In this it block I wan to execute A.js }); }); – JAK Jun 18 '19 at 16:45