-
Notifications
You must be signed in to change notification settings - Fork 55
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
Closed
Add side panel #580
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
1896ec4
Scaffold side panel
Strift 79283a1
Move help center to left-side panel
Strift 7516672
Scaffold side panel sections
Strift f1b971f
Make links more subtle
Strift d49d651
Tweak the header size
Strift e56f58b
Cleanup layout
Strift 5dc3fa1
Add missing icons
Strift 21cf2ce
Fix header layout
Strift 6c90e60
Update styles
Strift 5d2d3fb
Add open/close logic
Strift 8c0d933
Update margin between items in the header
Strift a3f2308
Decrease emphasis on buttons
Strift 39313fb
Add newsletter form api
Strift a7bb9a2
Update layout success and error layout
Strift 60690c0
Update wording
Strift eed4600
Remove cloud banner
Strift 2a443ab
Fix test-select-indexes tests
Strift 140de96
Fix API key modal tests
Strift 927016a
Add tests for panel
Strift f2c0d06
Remove unused variable
Strift 130a50b
Refactor API key modal opening
Strift bd41773
Fix API key modal display
Strift 086c781
Display error better
Strift 8d25464
wip
Strift 1abc101
Fix api key required tests
Strift afdd501
Fix API key banner display
Strift 6690e71
Fix tests
Strift a865922
Merge API key test suite
Strift 67ed58b
Update tests
Strift 43e16ed
Use API token in interface tests
Strift 431dd16
Add comment
Strift 759b80e
Remove outdated test suite
Strift 32c42d5
Set API key before running tests
Strift d99dce8
Fix api key required tests
Strift 75ad1eb
Set API key before running tests
Strift dbfba63
Update test
Strift 8ada1d9
Allow to set API key when instance is unreacheable
Strift def96cb
Apply suggestions from code review
Strift 3739f5d
Update .env
Strift b1a45c2
Revert unnecessary api key change in config
Strift 8b3b2d0
Remove vscode settings from git
Strift f919ec2
Remove wording change
Strift 89d26c4
Change to simple quotes
Strift b8144de
Revert changes
Strift 597c1fa
Revert changes
Strift 9cfc24b
Revert changes
Strift a16a526
Make panel scrollable
Strift File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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? 👀
There was a problem hiding this comment.
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.