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

test(e2e): Add additional assertions to UI tests #2634

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

moduli
Copy link
Collaborator

@moduli moduli commented Dec 18, 2024

Description

This PR is a follow-up to this comment: #2563 (comment)

This PR adds additional assertions to UI tests, specifically, ensuring that a session is successfully created after setting up resources via the Admin UI.

How to Test

Run e2e tests

Checklist

  • I have added before and after screenshots for UI changes
  • I have added JSON response output for API changes
  • I have added steps to reproduce and test for bug fixes in the description
  • I have commented on my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

https://hashicorp.atlassian.net/browse/ICU-15765

Copy link

vercel bot commented Dec 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
boundary-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 2, 2025 8:22pm
boundary-ui-desktop ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 2, 2025 8:22pm

@moduli moduli requested review from ZedLi and calcaide December 18, 2024 17:26
@moduli moduli marked this pull request as ready for review December 18, 2024 17:27
@moduli moduli requested a review from a team as a code owner December 18, 2024 17:27
If no sessions are available and the page needs to reload, we should wait to ensure that the page has loaded before checking what the state of the sessions are
Noticed an issue where a session recording was not playable. The theory is that the session didn't last long enough before it was cancelled. This adds a 2 second wait after establishing a connection before continuing.
ZedLi
ZedLi previously approved these changes Dec 26, 2024
Copy link
Collaborator

@ZedLi ZedLi left a comment

Choose a reason for hiding this comment

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

Looks good! Just had a few more comments

e2e-tests/admin/tests/dynamic-host-catalog-aws-ent.spec.js Outdated Show resolved Hide resolved
},
);
// Wait for 2 seconds to allow for a connection to establish
await new Promise((resolve) => setTimeout(resolve, 2000));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this fix the flakiness? I'm wondering if it might be better to wrap the exec in a promise and return that and that way you wait on any buffered text as a response and can inspect stdout/stderr?

We do something similar here

spawn(command, options) {
return new Promise((resolve, reject) => {
const childProcess = spawn(path, command, options);
childProcess.stdout.on('data', (data) => {
resolve({ childProcess, stdout: data.toString() });
});
childProcess.stderr.on('data', (data) => {
resolve({ childProcess, stderr: data.toString() });
});
childProcess.on('error', (err) => reject(err));
// In case the process has no stdio and didn't error out, resolve a
// promise once the child process closes so we're not waiting forever.
// Windows doesn't seem to return any error nor any output from stderr when
// a timeout occurs so this guarantees we return a response to the caller.
// Otherwise this should not get hit as we should be returning a response
// from one of the handlers above.
childProcess.on('close', () =>
resolve({
childProcess,
stderr: JSON.stringify({ error: 'Process was closed.' }),
}),
);
});
},

moduli added 2 commits January 2, 2025 12:57
- Use .all() when looping
- Add check to see if we need to reload the page or not
Ran into a conflict with the Static/Dynamic host catalog type and the Static/Dynamic credential type.
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.

2 participants