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

Add side panel #580

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
1896ec4
Scaffold side panel
Strift Jan 20, 2025
79283a1
Move help center to left-side panel
Strift Jan 20, 2025
7516672
Scaffold side panel sections
Strift Jan 20, 2025
f1b971f
Make links more subtle
Strift Jan 20, 2025
d49d651
Tweak the header size
Strift Jan 21, 2025
e56f58b
Cleanup layout
Strift Jan 21, 2025
5dc3fa1
Add missing icons
Strift Jan 21, 2025
21cf2ce
Fix header layout
Strift Jan 21, 2025
6c90e60
Update styles
Strift Jan 21, 2025
5d2d3fb
Add open/close logic
Strift Jan 21, 2025
8c0d933
Update margin between items in the header
Strift Jan 21, 2025
a3f2308
Decrease emphasis on buttons
Strift Jan 21, 2025
39313fb
Add newsletter form api
Strift Jan 30, 2025
a7bb9a2
Update layout success and error layout
Strift Jan 30, 2025
60690c0
Update wording
Strift Feb 11, 2025
eed4600
Remove cloud banner
Strift Feb 11, 2025
2a443ab
Fix test-select-indexes tests
Strift Feb 11, 2025
140de96
Fix API key modal tests
Strift Feb 11, 2025
927016a
Add tests for panel
Strift Feb 11, 2025
f2c0d06
Remove unused variable
Strift Feb 11, 2025
130a50b
Refactor API key modal opening
Strift Feb 11, 2025
bd41773
Fix API key modal display
Strift Feb 11, 2025
086c781
Display error better
Strift Feb 20, 2025
8d25464
wip
Strift Feb 20, 2025
1abc101
Fix api key required tests
Strift Feb 20, 2025
afdd501
Fix API key banner display
Strift Feb 20, 2025
6690e71
Fix tests
Strift Feb 20, 2025
a865922
Merge API key test suite
Strift Feb 20, 2025
67ed58b
Update tests
Strift Feb 20, 2025
43e16ed
Use API token in interface tests
Strift Feb 20, 2025
431dd16
Add comment
Strift Feb 20, 2025
759b80e
Remove outdated test suite
Strift Feb 20, 2025
32c42d5
Set API key before running tests
Strift Feb 20, 2025
d99dce8
Fix api key required tests
Strift Feb 20, 2025
75ad1eb
Set API key before running tests
Strift Feb 20, 2025
dbfba63
Update test
Strift Feb 20, 2025
8ada1d9
Allow to set API key when instance is unreacheable
Strift Feb 20, 2025
def96cb
Apply suggestions from code review
Strift Feb 24, 2025
3739f5d
Update .env
Strift Feb 20, 2025
b1a45c2
Revert unnecessary api key change in config
Strift Feb 20, 2025
8b3b2d0
Remove vscode settings from git
Strift Feb 24, 2025
f919ec2
Remove wording change
Strift Feb 24, 2025
89d26c4
Change to simple quotes
Strift Feb 24, 2025
b8144de
Revert changes
Strift Feb 24, 2025
597c1fa
Revert changes
Strift Feb 24, 2025
9cfc24b
Revert changes
Strift Feb 24, 2025
a16a526
Make panel scrollable
Strift Feb 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Meilisearch
REACT_APP_MEILI_SERVER_ADDRESS=http://localhost:7700

# Hubspot newsletter
REACT_APP_HUBSPOT_PORTAL_ID=25945010
REACT_APP_HUBSPOT_FORM_GUID=991e2a09-77c2-4428-9242-ebf26bfc6c64
4 changes: 2 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ const { defineConfig } = require('cypress')

module.exports = defineConfig({
watchForFileChanges: true,
retries: 2,
retries: 0,
Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, why did you update this one? 👀

Copy link
Collaborator Author

@Strift Strift Feb 24, 2025

Choose a reason for hiding this comment

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

Make the tests fail sooner, because it was taking a long time to run them. It never happened that something failed, and then worked after a retry.

viewportWidth: 1440,
viewportHeight: 900,
env: {
host: 'http://0.0.0.0:7700',
apiKey: 'masterKey',
wrongApiKey: 'wrongApiKey',
waitingTime: 1000,
waitingTime: 250,
},
e2e: {
baseUrl: 'http://localhost:3000',
Expand Down
23 changes: 0 additions & 23 deletions cypress/e2e/cloud-banner.cy.js

This file was deleted.

135 changes: 135 additions & 0 deletions cypress/e2e/test-api-key-is-required.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/* eslint-disable cypress/no-unnecessary-waiting */
const API_KEY = Cypress.env('apiKey')
const WRONG_APIKEY = Cypress.env('wrongApiKey')
const WAITING_TIME = Cypress.env('waitingTime')

const API_MODAL_SELECTOR = `div[aria-label=ask-for-api-key]`
const SAVE_API_KEY_BUTTON_TEXT = 'Save'

describe(`API key is required`, () => {
before(() => {
cy.deleteAllIndexes()
})

describe('When there is no API key in local storage', () => {
beforeEach(() => {
cy.visit('/')
})

it('Should visit the dashboard', () => {
cy.url().should('match', /\//)
})

it('Should find a text in modal requesting API key', () => {
cy.contains('Enter your Admin API key')
})

it('Should fail on wrong API key triggered with mouse click', () => {
cy.get(API_MODAL_SELECTOR).within(() => {
cy.get('input[name="apiKey"]').as('apiKeyInput')
cy.get('@apiKeyInput').type(WRONG_APIKEY)
cy.get('@apiKeyInput').should('have.value', WRONG_APIKEY)
cy.get('button').contains(SAVE_API_KEY_BUTTON_TEXT).click()
cy.wait(WAITING_TIME)
cy.contains('The provided API key is invalid.')
})
})

it('Should fail on wrong API key triggered with enter key', () => {
cy.get(API_MODAL_SELECTOR).within(() => {
cy.get('input[name="apiKey"]').as('apiKeyInput')
cy.get('@apiKeyInput').type(WRONG_APIKEY)
cy.get('@apiKeyInput').should('have.value', WRONG_APIKEY)
cy.get('@apiKeyInput').type('{enter}')
cy.wait(WAITING_TIME)
cy.contains('The provided API key is invalid.')
})
})

it('Should accept valid API key', () => {
cy.get(API_MODAL_SELECTOR).within(() => {
cy.get('input[name="apiKey"]').as('apiKeyInput')
cy.get('@apiKeyInput').clear()
cy.get('@apiKeyInput').type(API_KEY)
cy.get('@apiKeyInput').should('have.value', API_KEY)
cy.get('button').contains(SAVE_API_KEY_BUTTON_TEXT).click()
cy.wait(WAITING_TIME)
})
cy.contains('Welcome to')
})
})

describe('With existing API key in local storage', () => {
it('Should display the API key', () => {
// Set API key in localStorage before visiting the page
cy.window().then((win) => {
win.localStorage.setItem('apiKey', JSON.stringify(API_KEY))
})
cy.visit('/')

// Wait for any initial animations/loading to complete
cy.wait(WAITING_TIME)

// Click the API key button to open settings modal
cy.get('button[aria-label="Edit API key"]').click()

// Verify the API key in the settings modal
cy.get(API_MODAL_SELECTOR).within(() => {
cy.get('input[name="apiKey"]').should('have.value', API_KEY)
})
})

it('Should open the modal when the API key is invalid', () => {
cy.window().then((win) => {
win.localStorage.setItem('apiKey', JSON.stringify(WRONG_APIKEY))
})
cy.visit('/')

cy.get(API_MODAL_SELECTOR).within(() => {
cy.get('input[name="apiKey"]').as('apiKeyInput')
cy.get('@apiKeyInput').should('have.value', WRONG_APIKEY)
})
})
})

describe(`Providing an API key in the query params`, () => {
before(() => {
cy.deleteAllIndexes()

cy.wait(WAITING_TIME)
cy.createIndex('movies')
cy.wait(WAITING_TIME)
cy.fixture('movies.json').then((movies) => {
cy.addDocuments('movies', movies)
cy.wait(WAITING_TIME)
})
})

beforeEach(() => {
cy.visit(`/?api_key=${API_KEY}`)
// Wait for the API key to be stored and modal to be hidden
cy.window()
.its('localStorage')
.should((localStorage) => {
const storedApiKey = localStorage.getItem('apiKey')
expect(JSON.parse(storedApiKey)).to.equal(API_KEY)
})
})

it('Should display the movies', () => {
cy.wait(WAITING_TIME)
cy.get('ul')
.children()
.should(($p) => {
expect($p).to.have.length(20)
})
})

it('Should have the api key written in the modal', () => {
cy.get('button[aria-label="Edit API key"]').click()
cy.get(API_MODAL_SELECTOR).within(() => {
cy.get('input[name="apiKey"]').should('have.value', API_KEY)
})
})
})
})
39 changes: 0 additions & 39 deletions cypress/e2e/test-api-key-query-param.cy.js

This file was deleted.

98 changes: 0 additions & 98 deletions cypress/e2e/test-api-key-required.cy.js

This file was deleted.

31 changes: 5 additions & 26 deletions cypress/e2e/test-interface.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const WAITING_TIME = Cypress.env('waitingTime')

const API_KEY = Cypress.env('apiKey')
describe(`Test interface`, () => {
before(() => {
// Recreate the movies index with documents in it
Expand All @@ -20,32 +20,11 @@ describe(`Test interface`, () => {
})

beforeEach(() => {
cy.visit('/')
})

it('Should open the help center on click on the "?" button', () => {
cy.get('button[aria-label="help"]').click()
cy.get('div[aria-label="Help Center"]').within(() => {
cy.contains('Help Center')
cy.contains(
'If you need help with anything, here are a few links that can be useful.'
)
cy.contains('Explore our repositories on Github')
cy.contains('Join our Discord and find the help you need')
cy.contains('Learn how to tune your Meilisearch')
cy.get('a')
.first()
.should('have.attr', 'href', 'https://github.com/meilisearch')
.next()
.should('have.attr', 'href', 'https://discord.meilisearch.com')
.next()
.should(
'have.attr',
'href',
'https://docs.meilisearch.com/?utm_campaign=oss&utm_source=integration&utm_medium=minidashboard'
)
cy.get('button[aria-label="close"]').click()
// Set API key in localStorage before visiting the page to avoid triggering the modal
cy.window().then((win) => {
win.localStorage.setItem('apiKey', JSON.stringify(API_KEY))
})
cy.visit('/')
})

it('Should contain a "Show more" button if a document has more than 6 fields', () => {
Expand Down
Loading
Loading