Skip to content

waitfor working intermittenly #2724

@lane711

Description

@lane711

I am trying to create e2e ui tests for a complex Angular-based app. Almost all user interactions have an API call, so there are delays with nearly every click event.

I'm usingwaitFor for many times. It seems to work 90% of the time but not 100%. The only way around this that I've found is to add explicit wait via await waitFor(3000); before and after many interactions which is obviously not a good solution.

I'm working on a large enterprise project and many other developers working with Taiko have had to implement similar workarounds.

Is there some technique we should be trying to eliminate the explicit waits?

Here are some lines of code that intermittently fail:

 await goto(url, { waitForEvents: ["loadEventFired"] });
 await waitFor(async () => await text(" Item Management ").exists());
 await waitFor("Item Management ").exists());

 const btnAdd = $(() => {
   return document.querySelector(`.identify__im_add-new-open-menu-gl-button`);
 });
 await waitFor(async () => await btnAdd.exists());
 await click(btnAdd);

   await waitFor(async () => await text("Kit Name").exists());
   await write(kitname, into(textBox(near("Kit Name"))));

   await waitFor(async () => await text(" 1 – 3 of 3 ").exists());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions