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

Increase Playwright timeouts, robustify YAML editor interaction #422

Merged
merged 3 commits into from
Sep 12, 2024

Conversation

gabalafou
Copy link
Contributor

@gabalafou gabalafou commented Sep 10, 2024

Hoping this will fix failing jobs on GitHub.

Ideally, we would have shorter timeouts for local dev and longer timeouts for CI, but I'm not sure how to do that off the top of my head.

@gabalafou gabalafou requested a review from trallard September 10, 2024 21:33
@gabalafou
Copy link
Contributor Author

@@ -10,7 +10,7 @@
import random


DEFAULT_TIMEOUT = 30_000 # time in ms
DEFAULT_TIMEOUT = 60_000 # time in ms
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I increased this value because I saw "Timeout 30000ms exceeded" in the GitHub Action logs

@@ -120,7 +120,7 @@ def _create_new_environment(page, screenshot=False):


def _existing_environment_interactions(
page, env_name, time_to_build_env=3 * 60 * 1000, screenshot=False
page, env_name, time_to_build_env=5 * 60 * 1000, screenshot=False
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I increased this value because I also saw "Timeout 180000ms exceeded" in the GitHub Action logs

@trallard
Copy link
Collaborator

I can see new errors now - something like buttons not being enabled so perhaps the button behaviour is now different

https://github.com/conda-incubator/conda-store-ui/actions/runs/10800940370/job/29960020029?pr=422#step:6:1153

@gabalafou gabalafou mentioned this pull request Sep 11, 2024
3 tasks
@gabalafou gabalafou changed the title Increase Playwright timeouts Increase Playwright timeouts, robustify YAML editor interaction Sep 11, 2024
Copy link
Contributor Author

@gabalafou gabalafou left a comment

Choose a reason for hiding this comment

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

self review

@@ -27,7 +27,7 @@ export const CodeEditor = ({ code, onChangeEditor }: ICodeEditor) => {
const convertToJSON = (e: string) => {
try {
setIsError(false);
onChangeEditor(parse(e));
onChangeEditor(parse(e) || {});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a lazy fix to prevent a runtime error that occurs if you clear the YAML editor. But a more rigorous fix would take a lot more time because the editor right now just doesn't have good validation.

@@ -52,6 +52,7 @@ export const CodeEditor = ({ code, onChangeEditor }: ICodeEditor) => {
theme={isGrayscaleStyleType ? undefined : greenAccentTheme}
extensions={[StreamLanguage.define(yamlLanguage)]}
onChange={e => convertToJSON(e)}
data-testid="yaml-editor"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should have done this a long time ago since it allows us to avoid the text matching (page.get_by_text) that you can find in the diff on the left in the Playwright test file. But I wonder if this test id data attribute should be "yaml-editor-container" or maybe "code-mirror-container" because, as you might notice in the changes to the Playwright test file in this PR, the locator for the actual textbox field looks like this:

page.get_by_test_id("yaml-editor").get_by_role("textbox")

That's because the HTML structure of the CodeMirror React component is like this:

<div data-testid="yaml-editor">
  <!-- stuff -->
  <div contenteditable>
  <!-- more stuff -->

Copy link
Collaborator

@trallard trallard left a comment

Choose a reason for hiding this comment

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

Seems this fixes the Playwright issues. Thank you

@trallard trallard merged commit d0ad03e into conda-incubator:main Sep 12, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants