Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlatfileButtonComponent eagerly loading FlatfileImporter breaks E2E tests (Protractor) #23

Open
jai-fiix opened this issue Jan 12, 2022 · 0 comments

Comments

@jai-fiix
Copy link

jai-fiix commented Jan 12, 2022

The issue

As FlatFileImporter is eagerly initialized when the flatfile-button component is created, some long-running async tasks within the initialization code cause our existing, non-Flatfile related Protractor tests to fail due to timeout exception. We did not get the chance to pinpoint the exact timer/async process that causes it but it's potentially this one : https://github.com/FlatFilers/Adapter/blob/bcca7f1efc8dbf3648f32bc64530ac90174f8ef3/src/importer.ts#L336 .

Protractor's waitForAngularEnabled might be a workaround but not the best in terms of Developer Experience for our teams as we don't want them to have to think about this when writing their tests. So we decided to pivot to https://github.com/FlatFilers/Adapter to give us better control and as a workaround, we decided to isolate the part where async tasks may be hanging by instantiating FlatfileImporter outside NgZone so that Protractor won't need to wait for it to stabilize:

    this.ngZone.runOutsideAngular(() => {
            this.flatfileImporter = new FlatfileImporter(
            this.licenseKey,
            this.settings,
            this.customer
            );
    });

What are your thoughts about this solution? Is this something that your engineering team has a solution for or is planning to take a look into?

Also, is there an existing way or a future enhancement that allows us to programmatically load Flatfile without relying on the button component? (e.g. service)? It would be great to have the flexibility to trigger it using other UI components/elements.

Environment

  • Flatfile Portal
  • Flatfile Angular Adapter v2.9.6

Steps To Reproduce Issue

  1. Add the flatfile-button component to any angular page
  2. Write a protractor test for the page (not necessarily related to Flatfile)
  3. Test fails as soon as the page loads the FlatfileImporter (Timeout exception)
@jai-fiix jai-fiix changed the title flatfile-button component eagerly loading FlatfileImporter breaks E2E tests (Protractor) FlatfileButtonComponent eagerly loading FlatfileImporter breaks E2E tests (Protractor) Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant