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(editor): Unit tests for assistant store and new design system components (no-changelog) #10508

Merged
merged 8 commits into from
Aug 23, 2024

Conversation

MiloradFilipovic
Copy link
Contributor

Summary

  • Unit tests for AI Assistant store (note that some functionality is not tested here since it's covered in end-to-end tests. Did this to avoid having to mock a lot of things in unit tests)
  • Added snapshot tests for new design-system components

Related Linear tickets, Github issues, and Community forum posts

Closes ADO2-74
Closes ADO2-65

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

* master:
  🚀 Release 1.56.0 (#10502)
  fix(editor): Sending 'Assistant session started event' to posthog (no-changelog) (#10500)
  fix(core): Use class-validator with XSS check for survey answers (#10490)
  fix(editor): Stop telemetry from triggering when initializing workflow in new canvas (no-changelog) (#10492)
  fix(AI Transform Node): Remove prompt as it's already set in ASK AI endpoint (no-changelog) (#10496)
  fix(editor): Prevent unloading when changes are pending in new canvas (no-changelog) (#10474)
  feat(core): Upgrade axios to address CVE-2024-39338 (no-changelog) (#10494)
* master:
  ci: Fix benchmark cli path (no-changelog) (#10506)
  refactor(core): Standardize filenames in `cli` (no-changelog) (#10484)
  fix(AI Agent Node): Allow AWS Bedrock Chat to be used with conversational agent (#10489)
  feat(AI Agent Node): Add tutorial link to agent node (#10493)
  feat: Add n8n-benchmark cli (no-changelog) (#10410)
  feat(core): Logout should invalidate the auth token (no-changelog) (#10335)
  refactor(editor): Add types to importCurlEventBus (no-changelog) (#10497)
  refactor(editor): Add types to htmlEditorEventBus (no-changelog) (#10498)
  refactor(editor): Add types for dataPinningEventBus (no-changelog) (#10499)
  refactor(editor): Add types to codeNodeEditorEventBus (no-changelog) (#10501)
@MiloradFilipovic MiloradFilipovic self-assigned this Aug 22, 2024
@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Aug 22, 2024
@MiloradFilipovic MiloradFilipovic changed the title test(editor): Unit tests for assistant store and new design system components test(editor): Unit tests for assistant store and new design system components (no-changelog) Aug 22, 2024
});
it('renders chat with messages correctly', () => {
const { container } = render(AskAssistantChat, {
props: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have a function that create this objects? By default would have this values and they can be overrides via parameters. That way we do not need to do so much repetition? 🤔

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 tried but since the assistant types are so tangled up this will require a lot of TypeScript gymnastics or a lot of if/else branches which will make util function pretty ugly so decided to keep it this way. Let me know what you think @RicardoE105


const message: ChatRequest.MessageResponse = {
type: 'agent-suggestion',
role: 'assistant',
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above? Maybe we can have a create assistant message and provide as parameter the type, which will create the object with default values and accept parameters in case you want to override values for a specific Uds case 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above :)

Copy link

cypress bot commented Aug 23, 2024

n8n    Run #6590

Run Properties:  status check passed Passed #6590  •  git commit d275f2293c: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 MiloradFilipovic 🗃️ e2e/*
Project n8n
Branch Review ADO2-74-assistant-store-unit-tests
Run status status check passed Passed #6590
Run duration 04m 44s
Commit git commit d275f2293c: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 MiloradFilipovic 🗃️ e2e/*
Committer Milorad Filipovic
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 414
View all changes introduced in this branch ↗︎

Copy link
Contributor

✅ All Cypress E2E specs passed

@MiloradFilipovic MiloradFilipovic merged commit a6f4dbb into master Aug 23, 2024
32 checks passed
@MiloradFilipovic MiloradFilipovic deleted the ADO2-74-assistant-store-unit-tests branch August 23, 2024 13:55
MiloradFilipovic added a commit that referenced this pull request Aug 26, 2024
* master:
  ci: Use correct env in destroy benchmark env job (no-changelog) (#10546)
  refactor(editor): Standardize components sections order (no-changelog) (#10540)
  refactor(editor): Convert Node.vue component to composition API (no-changelog) (#10535)
  feat: Add new credentials for the HTTP Request node (#9833)
  fix: Pass k6 api token correctly (no-changelog) (#10536)
  feat: Report benchmark results (no-changelog) (#10534)
  test(editor): Unit tests for assistant store and new design system components (no-changelog) (#10508)
  refactor(editor): Migrate `App.vue` to composition api (no-changelog) (#10524)
  refactor(editor): Convert DeleteUserModal to composition api (no-changelog) (#10531)
  ci: Fix fetch depth in benchmark (no-changelog) (#10532)
  ci: Use correct env for benchmark nightly workflow (no-changelog) (#10529)
  fix(core): Update zod to the latest version (no-changelog) (#10516)
  feat: Benchmark env with run scripts (no-changelog) (#10477)
  ci: Configure eslint for benchmark cli (#10480)
  fix(AI Transform Node): Data Transformation > Other section should not contain node (no-changelog) (#10519)
  fix(editor): Prevent dialog overlay from rendering on top of AI Assistant (no-changelog) (#10509)
  fix: Fix resolving of k6 executable (no-changelog) (#10511)
  fix(core): Restore Redis cache key (#10520)

# Conflicts:
#	packages/editor-ui/src/App.vue
#	packages/editor-ui/src/components/AskAssistant/AskAssistantChat.vue
#	packages/editor-ui/src/components/Modal.vue
#	packages/editor-ui/src/components/NodeDetailsView.vue
@janober
Copy link
Member

janober commented Aug 28, 2024

Got released with n8n@1.57.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team Released ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants