element disconnected from webpage, asynchronous operations executing concurrently

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!

Answer №1

attempt to accomplish

async executeTrainingClearance() {
        await browser.wait( // <--
// ...

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

TypeORM issue - UnsupportedDataTypeError

Here is the entity file I'm working with, user.ts: @Entity('users') export class User { @PrimaryGeneratedColumn() id: number | undefined; @Column({ type: 'string', name: 'username', nullable: true }) username: s ...

Switching from a Promise to an Observable using React-Redux and TypeScript

I am struggling to grasp the concept of storing a Promise response into Redux. I believe finding a solution to this issue would greatly benefit me. Currently, I am utilizing a library that returns a Promise, and I wish to save this response - whether it i ...

Error in saving base URL on Selenium IDE: not saved

I have recently begun using Selenium IDE for automating the testing of a website that I am developing. I have created all the test cases using the LIVE base URL, but now I want to run the tests on the staging environment. I attempted two methods: Updati ...

Issue: Unable to assign type 'FormDataEntryValue' to type 'string'. Type 'File' cannot be assigned to type 'string'

After retrieving data from the formData, I need to pass it to a function for sending an email. Error: The error message states that 'FormDataEntryValue' is not compatible with type 'string | null'.ts(2322) definitions.ts(119, 3): The e ...

I have encountered limitations with useFormik where it does not accept null values for initialValues, even while utilizing a validationSchema

I am currently utilizing the useFormik hook to handle my form. The userId field is a select, so by default its value is set to null. However, my validationSchema requires this field to be populated before submission. const formik = useFormik<ApiCredit ...

What is the significance of utilizing generic types as values within a generic class?

Why is the compiler giving an error for the following code T' only refers to a type, but is being used as a value here: class Factory<T> { create(TCreator: (new () => T)): T { return new TCreator(); } test(json: string) ...

Is there a way to change the data type of all parameters in a function to a specific type?

I recently created a clamp function to restrict values within a specified range. (I'm sure most of you are familiar with what a clamp function does) Here is the function I came up with (using TS) function clamp(value: number, min: number, max: number ...

A step-by-step guide on integrating Azure Cognitive Search within a SharePoint Online SPFx webpart

I haven't had much experience with SPFx recently, so it looks like I'll need to brush up a bit. :) I'm interested in implementing this NPM package: https://www.npmjs.com/package/azure-search Within a simple new SPFx web part: The code ...

Steps for generating data with Typescript Sequelize model without specifying an id:

Currently, I am utilizing Sequelize in conjunction with Typescript and facing a challenge when attempting to execute the Course.create() method without explicitly specifying an id field. Below is the Course model for reference: import { DataTypes, Model, O ...

Parameters for locating elements using the Selenium page object design pattern

Exploring the world of Selenium's page object pattern has been an interesting journey for me. I've grasped the basic concept and implementation of the PageFactory, but what puzzles me is its lack of flexibility. How can the page object pattern ha ...

Using TypeScript with Vue in a non-component-based architecture

Recently, I've been facing a challenge while developing an application. I'm using Vue + Vuetify with typescript, but I'm trying to steer clear of creating a single-page application or using webpack to handle .vue components. My goal is to cr ...

Clearing the filename in a file type input field using React

When using this input field, only video files are accepted. If any other types of files are uploaded by enabling the "all files" option, an alert will be displayed. While this functionality is working correctly, a problem arises if a non-video file is adde ...

Exception displaying for findElement function

I am trying to click a button that only appears 50% of the time. I attempted to use try/catch with findElementBy in order to handle this, but unfortunately, it is not working and I keep getting an exception. Is there a better way to efficiently handle th ...

Share selenium analysis results directly from Jenkins

I am currently using maven to run selenium scripts. I am encountering issues with publishing the selenium reports under post build actions in Jenkins. Despite trying different options, such as: Publish selenium report Publish selenium html report ...

Selenium was unable to locate the element by its name or ID

While using Selenium to log in to my MathWorks account, I encountered the following error message: "AttributeError: 'NoneType' object has no attribute 'send_keys'." Below are the source links for the login page of MathWorks: https://i ...

Using Node.js: Only bring in the necessary function, don't execute the entire file

Today, I stumbled upon an interesting observation and I'm curious about the peculiar behavior of node in this scenario. I have two files structured as follows: src/api/index-api.ts src/worker/index-worker.ts Both of these files contain a simple con ...

Leverage the event handler within a React Component when working with TSX tags

Is there a way to expose an event handler that is defined within a React Component in an HTML-like tag? For example: <MyComp param1="abc" param2="def" onDoSomething={this.someMethod} /> I am trying to define the onDoSomething event, but currently I ...

Angular 2 - Utilizing a Shared Service for Subscriptions

After referencing this guide: Parent and children communicate via a service I have decided to utilize a shared service instead of EventEmitter. The reason being that EventEmitter only facilitates communication between parent and child components, which do ...

Testing automation made easy for non-coders in the field of testing

Looking to enhance the testing process at my workplace without altering the existing structure. We currently use VSTS, Selenium IDE, and testers who create test cases but do not code. My goal is to integrate our TFS continuous integration with the Seleni ...

What is the best way to determine the highest value?

How can I ensure that the data is displayed based on the condition c.date <= this.selectedReport.report_date? The current code snippet if (Math.max(...this.costs.map(c => c.date))){} seems to be causing an issue where no data is being displayed. What ...