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

Update notebooks tests #1001

Merged
merged 2 commits into from
Jan 25, 2024
Merged

Conversation

ps48
Copy link
Member

@ps48 ps48 commented Jan 18, 2024

Description

Update notebooks tests, this PR depends on notebooks updates to be merged by this PR: opensearch-project/dashboards-observability#1367

Issues Resolved

#897

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

ps48 added 2 commits January 18, 2024 02:56
Signed-off-by: Shenoy Pratik <[email protected]>
@ps48
Copy link
Member Author

ps48 commented Jan 18, 2024

Local run results

6_notebooks.spec.js.mp4
========================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        9.5.4                                                                          │
  │ Browser:        Electron 94 (headless)                                                         │
  │ Node Version:   v18.16.0 (/Users/sgguruda/.nvm/versions/node/v18.16.0/bin/node)                │
  │ Specs:          1 found (plugins/observability-dashboards/6_notebooks.spec.js)                 │
  │ Searched:       cypress/integration/plugins/observability-dashboards/6_notebooks.spec.js       │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────

  Running:  plugins/observability-dashboards/6_notebooks.spec.js                            (1 of 1)
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
Couldn't determine Mocha version


  Testing notebook actions
    ✓ Creates a code paragraph (19254ms)
    ✓ Renders markdown (12740ms)
    ✓ Adds a SQL query paragraph (6234ms)

  Test reporting integration if plugin installed
    ✓ Create in-context PDF report from notebook
    ✓ Create in-context PNG report from notebook (5103ms)
    ✓ Create on-demand report definition from context menu (11148ms)
    ✓ View reports homepage from context menu (5293ms)

  clean up all test data
    ✓ Cleans up test notebooks (5908ms)


  8 passing (1m)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        8                                                                                │
  │ Passing:      8                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        true                                                                             │
  │ Duration:     1 minute, 10 seconds                                                             │
  │ Spec Ran:     plugins/observability-dashboards/6_notebooks.spec.js                             │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


  (Video)

  -  Started processing:  Compressing to 32 CRF
    Compression progress:  4%
    Compression progress:  12%
  -  Finished processing: /Users/sgguruda/work/git_codebase/temp/opensearch-dashboard   (28 seconds)
                          s-functional-test/cypress/videos/plugins/observability-dash
                          boards/6_notebooks.spec.js.mp4


========================================================================================

  (Run Finished)


       Spec                                              Tests  Passing  Failing  Pending  Skipped
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✔  plugins/observability-dashboards/6_      01:10        8        8        -        -        - │
  │    notebooks.spec.js                                                                           │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
    ✔  All specs passed!                        01:10        8        8        -        -        -

Done in 117.75s.

@ps48
Copy link
Member Author

ps48 commented Jan 20, 2024

@Hailong-am, @wanglam Can you please review this PR? The dependent PR in dashboards-observability is merged in.

const moveToTestNotebook = () => {
cy.visit(`${BASE_PATH}/app/observability-notebooks#/`, {
timeout: delayTime * 3,
});

// Reload page to load notebooks if they are not flushed in OpenSearch index yet.
cy.reload();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shall we check if they are already flushed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

or should we force flush the index before load?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a good suggestion, will look further on how to use the flush API here. The current issue is when page loads and the Flush is in process, browser loads an empty notebooks home page. I'll check if there's a way for force flush via cypress requests. Not sure, if there's a way to check if the flush process is complete as it is auto triggered for the observability index.


describe('clean up all test data', () => {
it('Cleans up test notebooks', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Shall we record the created notebook ids and just clear these items?

const moveToTestNotebook = () => {
cy.visit(`${BASE_PATH}/app/observability-notebooks#/`, {
timeout: delayTime * 3,
});

// Reload page to load notebooks if they are not flushed in OpenSearch index yet.
cy.reload();
Copy link
Collaborator

Choose a reason for hiding this comment

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

or should we force flush the index before load?

@ruanyl
Copy link
Member

ruanyl commented Jan 22, 2024

@ps48 Added backport 2.x label

@ruanyl ruanyl merged commit a1d3ca1 into opensearch-project:main Jan 25, 2024
36 of 37 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-1001-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 a1d3ca1ecef3e25777dbb850793db72d506f22f6
# Push it to GitHub
git push --set-upstream origin backport/backport-1001-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-1001-to-2.x.

@ruanyl
Copy link
Member

ruanyl commented Jan 25, 2024

@ps48 The backport to 2.x is failed, could you do a manual backport?

@ps48
Copy link
Member Author

ps48 commented Jan 30, 2024

Hi @ruanyl & @wanglam, can you please review the backport PR here: #1021 Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants