Skip to content

Commit f47f50a

Browse files
authored
Merge pull request #958 from zoran995/test/e2e-tests
Add e2e tests
2 parents 9114925 + b888bcf commit f47f50a

File tree

16 files changed

+23075
-15368
lines changed

16 files changed

+23075
-15368
lines changed

.github/workflows/cypress.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Cypress Tests using Cypress Docker Image
2+
3+
on: push
4+
5+
jobs:
6+
cypress-run:
7+
runs-on: ubuntu-22.04
8+
container:
9+
image: cypress/browsers:node-20.14.0-chrome-126.0.6478.114-1-ff-127.0.1-edge-126.0.2592.61-1
10+
options: --user 1001
11+
services:
12+
meilisearch:
13+
image: getmeili/meilisearch:latest
14+
env:
15+
MEILI_MASTER_KEY: 'masterKey'
16+
MEILI_NO_ANALYTICS: 'true'
17+
ports:
18+
- '7700:7700'
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
- name: Setup node
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: '20.x'
27+
cache: yarn
28+
- name: Cache dependencies
29+
uses: actions/cache@v3
30+
with:
31+
path: |
32+
./playground/node_modules
33+
key: ${{ hashFiles('playground/yarn.lock') }}
34+
- name: Install dependencies
35+
run: yarn --dev && yarn --cwd ./playground
36+
- name: Remove plugin symlink
37+
run: rm ./playground/src/plugins/meilisearch
38+
- name: Move plugin inside playground
39+
# Since the plugin is located at the root of the project but a symlink links
40+
# to it in ./playground/plugins/meilisearch it causes a circular
41+
# chaining problem.
42+
# Now that we removed the symlink (see previous step), we need to move our plugin in the
43+
# plugin directory of the playground.
44+
run: mkdir ./playground/src/plugins/meilisearch &&
45+
mv admin ./playground/src/plugins/meilisearch &&
46+
mv server ./playground/src/plugins/meilisearch &&
47+
mv strapi-admin.js ./playground/src/plugins/meilisearch &&
48+
mv strapi-server.js ./playground/src/plugins/meilisearch &&
49+
cp package.json ./playground/src/plugins/meilisearch
50+
51+
- name: Run e2e browser tests
52+
uses: cypress-io/github-action@v6
53+
with:
54+
build: yarn playground:build
55+
start: yarn playground:dev
56+
env: env=ci
57+
browser: chrome
58+
59+
- uses: actions/upload-artifact@v3
60+
if: failure()
61+
with:
62+
name: cypress-screenshots
63+
path: cypress/screenshots
64+
- uses: actions/upload-artifact@v3
65+
if: failure()
66+
with:
67+
name: cypress-videos
68+
path: cypress/videos

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"endOfLine": "lf",
3+
"tabWidth": 2,
4+
"singleQuote": true,
5+
"semi": false,
6+
"arrowParens": "avoid",
7+
"quoteProps": "consistent"
8+
}

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

cypress.config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const { defineConfig } = require('cypress')
2+
3+
module.exports = defineConfig({
4+
env: {
5+
user: {
6+
7+
password: 'Qwertyuiop1',
8+
},
9+
env: 'develop',
10+
apiKey: 'masterKey',
11+
test: {
12+
adminUrl: 'http://localhost:1337/admin',
13+
host: 'http://localhost:7700',
14+
},
15+
watch: {
16+
adminUrl: 'http://localhost:8000/admin',
17+
host: 'http://localhost:7700',
18+
},
19+
develop: {
20+
adminUrl: 'http://localhost:1337/admin',
21+
host: 'http://localhost:7700',
22+
},
23+
ci: {
24+
adminUrl: 'http://localhost:1337/admin',
25+
host: 'http://meilisearch:7700',
26+
},
27+
prereleaseci: {
28+
adminUrl: 'http://localhost:1337/admin',
29+
host: 'http://localhost:7700',
30+
},
31+
},
32+
e2e: {
33+
setupNodeEvents() {
34+
// implement node event listeners here
35+
},
36+
},
37+
})

0 commit comments

Comments
 (0)