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

e2e test for file_uploader on_change bug #4390

Merged
merged 5 commits into from Feb 16, 2022

Conversation

kajarenc
Copy link
Collaborator

@kajarenc kajarenc commented Feb 10, 2022

📚 Context

Please describe the project or issue background here

  • What kind of change does this PR introduce?

    • Bugfix
    • Feature
    • Refactoring
    • Other, please describe:

🧠 Description of Changes

🧪 Testing Done

  • Screenshots included
  • Added/Updated unit tests
  • Added/Updated e2e tests

🌐 References

Does this depend on other work, documents, or tickets?

  • Issue: Closes #XXXX

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@kajarenc kajarenc marked this pull request as ready for review February 14, 2022 20:03
@@ -56,3 +56,20 @@
st.text("No upload")
else:
st.text(form_file.read())


if st._is_running_with_streamlit:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this if line is here because we run e2e tests in "bare Python mode" as part of our Python tests, and this test doesn't work in that circumstance? Can you add a comment here explaining that?

@@ -393,4 +393,51 @@ describe("st.file_uploader", () => {
);
});
});

// regression test for https://github.com/streamlit/streamlit/issues/4256 bug
it("not calls callback if not changed", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it("does not call a callback when not changed") instead?


// On rerun, make sure callback is not called, since file not changed
cy.get("body").type("r");
cy.wait(1000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily something to stop the PR for, but I wonder if there's a more deterministic way to wait for the rerun to happen than cy.wait(1000). Could we instead test for the presence of the "Running..." indicator?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

The newly-added loadApp custom cypress command (in frontend/cypress/support/commands.js) has an example of how to do this. It sounds like it may be useful to generalize that into a a cypress command so that we have a standard way of waiting until an app has finished running

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!
I agree, having a more deterministic way of waiting for the application to load and using it is more correct and more reliable.

I'd like to mergde these changes as they are, as the cy.wait occurs in many places, and it would take a long time to rewrite it for me now.

And come back to using loadApp command in e2e tests at some point in the future!

Thank you for your comments!


// On rerun, make sure callback is not called, since file not changed
cy.get("body").type("r");
cy.wait(1000);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

The newly-added loadApp custom cypress command (in frontend/cypress/support/commands.js) has an example of how to do this. It sounds like it may be useful to generalize that into a a cypress command so that we have a standard way of waiting until an app has finished running

@kajarenc kajarenc added the tests label Feb 15, 2022
@kajarenc kajarenc merged commit 5971c35 into streamlit:develop Feb 16, 2022
tconkling added a commit that referenced this pull request Feb 22, 2022
* develop:
  Bump url-parse from 1.5.3 to 1.5.7 in /frontend (#4414)
  ScriptRequestQueue cleanup (#4386)
  session_state docstrings (+ minor housekeeping) (#4403)
  Rename script_path to main_script_path (#4408)
  [STLT-17] ✨ (Release Pipeline) Add full release regression suite via pytest (#4397)
  [STLT-16] 🔄 (CircleCI Release Pipeline) Commit and push version changes (#4336)
  e2e test for file_uploader on_change bug (#4390)
  Add myself as a codeowner for new dependencies
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

Successfully merging this pull request may close these issues.

None yet

3 participants