I'm struggling with a coding problem that I couldn't find any information on, so I've decided to seek help here:
Here's the code snippet I am working with
const smdb = new SmdbPage;
const edit = new SmdbEdit;
describe('SMDB Edit:', () => {
it('should navigate to SMDB, select random',
async () => {
await smdb.navmenu(smdb.tooltipName.smbd);
await smdb.getFirst();
});
it('Should edit edu & training', async () => {
await edit.clearEduTrain();
await edit.edu();
await edit.train();
});
});
and this is the class I have:
export class SmdbEdit extends BasicEdit {
// definitions of elements
async clearEduTrain() {
// function body
}
async edu() {
// function body
}
async train() {
// function body
}
}
The issue I'm facing is that when the second "it" function in describe() is activated, it runs all the functions inside it, causing clearEduTrain();edu();train()
to be called without proper ordering.
Additionally, I encounter an error in clearEduTrain():
Should edit edu & training
- StaleElementReferenceError: stale element reference: element is not attached to the page document
(Session info: chrome=80.0.3987.87)
(Driver info: chromedriver=80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185}),platform=Mac OS X 10.14.6 x86_64)
As I'm still learning protractor and end-to-end testing, I would appreciate an explanation of what's happening here. Thank you!