Skip to content

Commit a8904cc

Browse files
bors[bot]meili-botbidoubiwacurquiza
authored
Merge #501
501: Changes related to the next MeiliSearch release (v0.25.0) r=bidoubiwa a=meili-bot This PR gathers the changes related to the next MeiliSearch release (v0.25.0) so that this package is ready when the official release is out. ⚠️ This PR should NOT be merged until: - the next release of MeiliSearch (v0.25.0) is out. - the [`meilisearch-js`](https://github.com/meilisearch/meilisearch-js) dependency has been released to be compatible with MeiliSearch v0.25.0. Once the release is out, the upgrade of the `meilisearch-js` dependency might be committed to this branch. _This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/master/guides/pre-release-week.md) purpose._ Co-authored-by: meili-bot <[email protected]> Co-authored-by: Charlotte Vermandel <[email protected]> Co-authored-by: Clémentine Urquizar <[email protected]> Co-authored-by: cvermand <[email protected]> Co-authored-by: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
2 parents ab34a15 + 5cd5a88 commit a8904cc

File tree

13 files changed

+5762
-21
lines changed

13 files changed

+5762
-21
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Testing the code base against the Meilisearch pre-releases
2+
name: Pre-Release Tests
3+
4+
# Will only run for PRs and pushes to bump-meilisearch-v*
5+
on:
6+
push:
7+
branches: [bump-meilisearch-v*]
8+
pull_request:
9+
branches: [bump-meilisearch-v*]
10+
11+
jobs:
12+
tests:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
node: ["12", "14"]
18+
name: Tests (Node.js ${{ matrix.node }})
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Setup node
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: ${{ matrix.node }}
25+
- name: Install dependencies
26+
run: yarn install
27+
- name: Build
28+
run: yarn run build
29+
- name: Run tests
30+
run: yarn run test
31+
32+
cypress-run:
33+
runs-on: ubuntu-latest
34+
# Browser on which the tests are run
35+
container: cypress/browsers:node12.18.3-chrome87-ff82
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v2
39+
- name: Cache dependencies
40+
uses: actions/cache@v2
41+
with:
42+
path: |
43+
./node_modules
44+
key: ${{ hashFiles('yarn.lock') }}
45+
- name: Setup node
46+
uses: actions/setup-node@v2
47+
with:
48+
node-version: "14.x"
49+
- name: Install dependencies
50+
run: yarn --dev && yarn --cwd ./tests/env/browser
51+
- name: Grep latest version of Meilisearch
52+
run: |
53+
echo "MEILISEARCH_LATEST=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | sh)" >> $GITHUB_ENV
54+
- name: Download Meilisearch
55+
run: |
56+
curl https://github.com/meilisearch/meilisearch/releases/download/${{ env.MEILISEARCH_LATEST }}/meilisearch-linux-amd64 --output meilisearch --location
57+
chmod +x meilisearch
58+
- name: Run Meilisearch
59+
run: |
60+
./meilisearch --master-key=masterKey --no-analytics true &
61+
- name: Browser tests
62+
uses: cypress-io/github-action@v2
63+
with:
64+
# Your starting script
65+
start: yarn test:browser
66+
# Creates and uploads GitHub artifacts in case of failure
67+
- uses: actions/upload-artifact@v2
68+
if: failure()
69+
with:
70+
name: cypress-screenshots
71+
path: cypress/screenshots
72+
- uses: actions/upload-artifact@v2
73+
if: failure()
74+
with:
75+
name: cypress-videos
76+
path: cypress/videos

.github/workflows/tests.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111

1212
jobs:
1313
tests:
14+
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
15+
# Will still run for each push to bump-meilisearch-v*
16+
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
1417
runs-on: ubuntu-latest
1518
strategy:
1619
fail-fast: false
@@ -41,6 +44,9 @@ jobs:
4144
run: yarn run lint
4245

4346
cypress-run:
47+
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
48+
# Will still run for each push to bump-meilisearch-v*
49+
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
4450
runs-on: ubuntu-latest
4551
# Browser on which the tests are run
4652
container: cypress/browsers:node12.18.3-chrome87-ff82
@@ -58,12 +64,19 @@ jobs:
5864
with:
5965
node-version: "14.x"
6066
- name: Install dependencies
61-
run: yarn --dev && yarn --cwd ./playgrounds/html
67+
run: yarn --dev && yarn --cwd ./tests/env/browser
68+
- name: Download the latest stable version of Meilisearch
69+
run: |
70+
curl -L https://install.meilisearch.com | sh
71+
chmod +x meilisearch
72+
- name: Run Meilisearch
73+
run: |
74+
./meilisearch --master-key=masterKey --no-analytics true &
6275
- name: Browser tests
6376
uses: cypress-io/github-action@v2
6477
with:
6578
# Your starting script
66-
start: yarn playground
79+
start: yarn test:browser
6780
# Creates and uploads GitHub artifacts in case of failure
6881
- uses: actions/upload-artifact@v2
6982
if: failure()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ Here is the [CSS customization](https://github.com/meilisearch/vuepress-plugin-m
321321

322322
## 🤖 Compatibility with Meilisearch
323323

324-
This package only guarantees the compatibility with the [version v0.24.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.24.0).
324+
This package only guarantees the compatibility with the [version v0.25.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.25.0).
325325

326326
## ⚙️ Development Workflow and Contributing
327327

cypress/integration/first_tests.specs.js renamed to cypress/integration/search.specs.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint jest/expect-expect: ["off"]*/
2+
13
const HOST = `http://localhost:1234` // Please adjust to your own app port
24

35
describe(`My first test`, () => {
@@ -14,17 +16,15 @@ describe(`My first test`, () => {
1416
})
1517

1618
it('Should check if autocomplete is visible during typing', () => {
17-
cy.get('#docs-searchbar-suggestion').type('Quick')
19+
cy.get('#docs-searchbar-suggestion').type('gett')
1820
cy.get('#meilisearch-autocomplete-listbox-0').should('be.visible')
1921
cy.get('div.dsb-suggestion:nth-child(1)') // the first entry should be "Quick start"
20-
.contains('Quick start')
22+
.contains('Getting started')
2123
})
2224

2325
it('Should test all other subheadings', () => {
2426
cy.get('div.dsb-suggestion:nth-child(2)') // the second entry should be "Download and launch"
25-
.contains('Download and launch')
26-
cy.get('div.dsb-suggestion:nth-child(3)') // the third entry should be "Add documents"
27-
.contains('Add documents')
27+
.contains('FAQ')
2828
})
2929

3030
it('Should have valid placeholder text', () => {

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ module.exports = {
33
bail: true,
44
resetMocks: true,
55
restoreMocks: true,
6-
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/docs/'],
6+
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/docs/', '/tests/env'],
77
}

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "docs-searchbar.js",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "Add a relevant search bar to your documentation using Meilisearch",
55
"keywords": [
66
"documentation",
@@ -22,8 +22,9 @@
2222
"lint:fix": "eslint --fix .",
2323
"test": "./scripts/test",
2424
"test:watch": "./scripts/test-watch",
25-
"test:e2e:watch": "concurrently --kill-others -s first \"yarn playground\" \"cypress open\"",
26-
"test:e2e": "concurrently --kill-others -s first \"yarn playground\" \"cypress run\""
25+
"test:browser": "yarn --cwd ./tests/env/browser && yarn --cwd ./tests/env/browser setup && yarn --cwd ./tests/env/browser serve",
26+
"test:e2e:watch": "concurrently --kill-others -s first \"yarn test:browser\" \"cypress open\"",
27+
"test:e2e": "concurrently --kill-others -s first \"yarn test:browser\" \"cypress run\""
2728
},
2829
"files": [
2930
"dist/"
@@ -65,7 +66,7 @@
6566
},
6667
"dependencies": {
6768
"autocomplete.js": "^0.38.0",
68-
"meilisearch": "^0.23.0",
69+
"meilisearch": "0.24.0",
6970
"to-factory": "^1.0.0",
7071
"zepto": "^1.2.0"
7172
}

playgrounds/javascript/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ docsSearchBar({
1616
},
1717
debug: true, // Set debug to true if you want to inspect the dropdown
1818
enhancedSearchInput: true,
19-
enableDarkMode: true,
19+
enableDarkMode: 'auto',
2020
})

src/lib/templates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const templates = {
9090
<div class="${footerPrefix}">
9191
Powered by
9292
<a href="https://www.meilisearch.com" target="_blank">
93-
<img src="https://res.cloudinary.com/meilisearch/image/upload/v1582710599/Logo_fumols.svg" height="20" width="97" class="${footerPrefix}-logo"/>
93+
<img src="https://res.cloudinary.com/meilisearch/image/upload/v1643647003/Logo/logo_text_mono.svg" height="20" width="97" class="${footerPrefix}-logo"/>
9494
</a>
9595
</div>
9696
`,

tests/env/browser/index.html

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="color-scheme" content="dark light" />
7+
<title>Docs SearchBar playground</title>
8+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css" />
9+
<link rel="stylesheet" href="../../../src/styles/main.scss" />
10+
</head>
11+
12+
<body>
13+
<div class="container">
14+
<div class="col-md-12">
15+
<input type="search" placeholder="docs-searchbar input" class="form-control" id="q" />
16+
</div>
17+
</div>
18+
<!-- at the end of the BODY -->
19+
<script src="../../../index.js"></script>
20+
<script>
21+
docsSearchBar.default({
22+
// Test with MeiliSearch Documentation
23+
hostUrl: 'http://localhost:7700',
24+
apiKey:
25+
'masterKey',
26+
indexUid: 'docs',
27+
inputSelector: '#q',
28+
handleSelected(input, event, suggestion, datasetNumber, context) {
29+
console.info(input)
30+
console.info(event)
31+
console.info(suggestion)
32+
console.info(datasetNumber)
33+
console.info(context)
34+
},
35+
debug: true, // Set debug to true if you want to inspect the dropdown
36+
enhancedSearchInput: true,
37+
enableDarkMode: "auto"
38+
})
39+
</script>
40+
<style>
41+
.container {
42+
margin: 10%;
43+
}
44+
45+
div [data-ds-theme] .searchbox {
46+
width: 60%;
47+
margin: auto;
48+
margin-top: 10%;
49+
display: block;
50+
}
51+
52+
div [data-ds-theme] .searchbox input {
53+
height: 34px;
54+
border-radius: 4px;
55+
font-size: 14px;
56+
}
57+
58+
@media (prefers-color-scheme: dark) {
59+
body {
60+
background-color: #152028;
61+
color: #eaeaea;
62+
}
63+
}
64+
</style>
65+
</body>
66+
67+
</html>

tests/env/browser/package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "docs-searchbar-playground",
3+
"version": "0.1.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"serve": "parcel serve index.html --global docsSearchBar --open",
8+
"build": "parcel build index.html --global docsSearchBar",
9+
"setup": "node setup.js"
10+
},
11+
"author": "",
12+
"license": "ISC",
13+
"devDependencies": {
14+
"@babel/core": "^7.14.3",
15+
"parcel-bundler": "^1.12.5"
16+
},
17+
"dependencies": {
18+
"meilisearch": "^0.24.0"
19+
}
20+
}

0 commit comments

Comments
 (0)