Skip to content

Commit 0e54ea1

Browse files
authored
[Test] : e2e tests using cypress (#999)
* chore: added cypresss * chore: added sidebar tests * chore: script update * chore: removed cypress examples * chore: added lib to eslintignore * chore: script fixes * chore: updated the snapshot
1 parent a213f98 commit 0e54ea1

File tree

110 files changed

+2029
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2029
-114
lines changed

.eslintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
packages/docsify-server-renderer/build.js
33
node_modules
44
build
5-
server.js
5+
server.js
6+
cypress
7+
lib

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
node_modules
55
themes/
66
lib/
7+
cypress/integration/examples
8+
cypress/fixtures/docs
79

810
# exceptions
911
!.gitkeep

.travis.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
sudo: false
22
language: node_js
33
node_js: stable
4-
4+
node_js:
5+
- '10'
6+
- '8'
7+
- '12'
8+
branches:
9+
only:
10+
- master
11+
- develop
12+
cache:
13+
directories:
14+
- node_modules
15+
before_install:
16+
- npm update
17+
install:
18+
- npm install
19+
script:
20+
- npm run build
21+
- npm run test:e2e
522
script:
623
- npm run lint

cypress.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"video": false
3+
}

cypress/fixtures/tpl/docs.index.html

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>docsify-e2e-tests</title>
6+
<link rel="icon" href="_media/favicon.ico" />
7+
<meta
8+
name="google-site-verification"
9+
content="6t0LoIeFksrjF4c9sqUEsVXiQNxLp2hgoqo0KryT-sE"
10+
/>
11+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
12+
<meta
13+
name="keywords"
14+
content="doc,docs,documentation,gitbook,creator,generator,github,jekyll,github-pages"
15+
/>
16+
<meta name="description" content="A magical documentation generator." />
17+
<meta
18+
name="viewport"
19+
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
20+
/>
21+
<link rel="stylesheet" href="lib/themes/vue.css" title="vue" />
22+
<link rel="stylesheet" href="lib/themes/dark.css" title="dark" disabled />
23+
<link rel="stylesheet" href="lib/themes/buble.css" title="buble" disabled />
24+
<link rel="stylesheet" href="lib/themes/pure.css" title="pure" disabled />
25+
<script src="//unpkg.com/docsify-plugin-codefund/index.js"></script>
26+
<style>
27+
nav.app-nav li ul {
28+
min-width: 100px;
29+
}
30+
</style>
31+
</head>
32+
33+
<body>
34+
<div id="app">Loading Docsify e2e tests suite...</div>
35+
<script>
36+
window.$docsify = {
37+
alias: {
38+
'.*?/awesome':
39+
'https://raw.githubusercontent.com/docsifyjs/awesome-docsify/master/README.md',
40+
'.*?/changelog':
41+
'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG.md',
42+
'/.*/_navbar.md': '/_navbar.md',
43+
'/zh-cn/(.*)':
44+
'https://raw.githubusercontent.com/docsifyjs/docs-zh/master/$1',
45+
'/de-de/(.*)':
46+
'https://raw.githubusercontent.com/docsifyjs/docs-de/master/$1',
47+
'/ru/(.*)':
48+
'https://raw.githubusercontent.com/docsifyjs/docs-ru/master/$1',
49+
'/es/(.*)':
50+
'https://raw.githubusercontent.com/docsifyjs/docs-es/master/$1'
51+
},
52+
auto2top: true,
53+
coverpage: true,
54+
executeScript: true,
55+
loadSidebar: true,
56+
loadNavbar: true,
57+
mergeNavbar: true,
58+
maxLevel: 4,
59+
subMaxLevel: 2,
60+
ga: 'UA-106147152-1',
61+
matomo: {
62+
host: '//matomo.thunderwave.de',
63+
id: 6
64+
},
65+
name: 'docsify',
66+
search: {
67+
noData: {
68+
'/de-de/': 'Keine Ergebnisse!',
69+
'/zh-cn/': '没有结果!',
70+
'/': 'No results!'
71+
},
72+
paths: 'auto',
73+
placeholder: {
74+
'/de-de/': 'Suche',
75+
'/zh-cn/': '搜索',
76+
'/': 'Search'
77+
}
78+
},
79+
formatUpdated: '{MM}/{DD} {HH}:{mm}',
80+
plugins: [
81+
function(hook, vm) {
82+
hook.beforeEach(function(html) {
83+
if (/githubusercontent\.com/.test(vm.route.file)) {
84+
url = vm.route.file
85+
.replace('raw.githubusercontent.com', 'github.com')
86+
.replace(/\/master/, '/blob/master')
87+
} else {
88+
url =
89+
'https://github.com/docsifyjs/docsify/blob/master/docs/' +
90+
vm.route.file
91+
}
92+
var editHtml = '[:memo: Edit Document](' + url + ')\n'
93+
return (
94+
editHtml +
95+
html +
96+
'\n\n----\n\n' +
97+
'<a href="https://docsify.js.org" target="_blank" style="color: inherit; font-weight: normal; text-decoration: none;">Powered by docsify</a>'
98+
)
99+
})
100+
}
101+
]
102+
}
103+
</script>
104+
<script src="lib/docsify.min.js"></script>
105+
<script src="lib/plugins/search.min.js"></script>
106+
<script src="lib/plugins/ga.min.js"></script>
107+
<script src="lib/plugins/matomo.min.js"></script>
108+
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
109+
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
110+
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
111+
112+
<script>
113+
;((window.gitter = {}).chat = {}).options = {
114+
room: 'docsifyjs/Lobby'
115+
}
116+
</script>
117+
<script
118+
src="https://sidecar.gitter.im/dist/sidecar.v1.js"
119+
async
120+
defer
121+
></script>
122+
</body>
123+
</html>

0 commit comments

Comments
 (0)