Since you are using Angular, you can make use of RxJS operators to handle this scenario. The forkJoin operator will allow you to wait for the while loop operation to be completed before returning all the observables.
This is how you can make use of the operator:
testingFunction() {
let i: number = 0;
const observablesList = [];
while(i < 20){
observablesList.push(this.testService.getAll());
i++;
}
forkJoin(observablesList).subscribe((response) => {
console.log(response);
});
}