Skip to content

Commit e15b48d

Browse files
authored
Merge pull request sumcumo#126 from mst101/test/e2e
Setup e2e testing with BDD, Cypress & Cucumber
2 parents 5fa4028 + 9ecf9a9 commit e15b48d

Some content is hidden

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

44 files changed

+45250
-4138
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
'airbnb-base',
1010
'plugin:compat/recommended',
1111
'prettier',
12+
'plugin:cypress/recommended',
1213
'plugin:jest/recommended',
1314
'plugin:vue/recommended',
1415
],

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ npm-debug.log
55
.coveralls.yml
66
example/demo.js
77
example/demo.js.map
8+
example-e2e/app.js
9+
example-e2e/app.js.map
810
test/unit/coverage
11+
test/e2e/cucumber-json
912
yarn-debug.log*
1013
yarn-error.log*
1114
.idea

cypress.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"pluginsFile": "test/e2e/plugins/index.js",
3+
"baseUrl": "http://localhost:8080",
4+
"chromeWebSecurity": true,
5+
"testFiles": "**/*.{feature,features}",
6+
"nodeVersion": "system",
7+
"defaultCommandTimeout": 1000
8+
}

example-e2e/App.vue

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
<template>
2+
<div id="app">
3+
<h1>Datepicker Integration Tests</h1>
4+
<div class="example">
5+
<h3>Default datepicker...</h3>
6+
<Datepicker
7+
:id="id"
8+
:append-to-body="appendToBody"
9+
:autofocus="autofocus"
10+
:bootstrap-styling="bootstrapStyling"
11+
:calendar-button="calendarButton"
12+
:calendar-class="calendarClass"
13+
:clear-button="clearButton"
14+
:day-cell-content="dayCellContent"
15+
:disabled="disabled"
16+
:disabled-dates="disabledDates"
17+
:first-day-of-week="firstDayOfWeek"
18+
:fixed-position="fixedPosition"
19+
:format="format"
20+
:full-month-name="fullMonthName"
21+
:initial-view="initialView"
22+
:inline="inline"
23+
:input-class="inputClass"
24+
:language="languages[language]"
25+
:maxlength="maxLength"
26+
:maximum-view="maximumView"
27+
:minimum-view="minimumView"
28+
:name="name"
29+
:open-date="openDate"
30+
:pattern="pattern"
31+
:placeholder="placeholder"
32+
:required="required"
33+
:ref-name="refName"
34+
:show-edge-dates="showEdgeDates"
35+
:show-header="showHeader"
36+
:show-calendar-on-focus="showCalendarOnFocus"
37+
:show-calendar-on-button-click="showCalendarOnButtonClick"
38+
:tabindex="tabindex"
39+
:typeable="typeable"
40+
:use-utc="useUtc"
41+
:value="value"
42+
:wrapper-class="wrapperClass"
43+
:year-picker-range="yearPickerRange"
44+
/>
45+
<code>
46+
&lt;datepicker placeholder="Select Date"&gt;&lt;/datepicker&gt;
47+
</code>
48+
</div>
49+
</div>
50+
</template>
51+
52+
<script>
53+
import Datepicker from '~/components/Datepicker.vue'
54+
import * as lang from '~/locale/index'
55+
56+
export default {
57+
name: 'Demo',
58+
components: {
59+
Datepicker,
60+
},
61+
data() {
62+
return {
63+
languages: lang,
64+
}
65+
},
66+
computed: {
67+
appendToBody() {
68+
return this.$store.state.appendToBody
69+
},
70+
autofocus() {
71+
return this.$store.state.autofocus
72+
},
73+
bootstrapStyling() {
74+
return this.$store.state.bootstrapStyling
75+
},
76+
calendarButton() {
77+
return this.$store.state.calendarButton
78+
},
79+
calendarClass() {
80+
return this.$store.state.calendarClass
81+
},
82+
clearButton() {
83+
return this.$store.state.clearButton
84+
},
85+
dayCellContent() {
86+
return this.$store.state.dayCellContent
87+
},
88+
disabled() {
89+
return this.$store.state.disabled
90+
},
91+
disabledDates() {
92+
return this.$store.state.disabledDates
93+
},
94+
firstDayOfWeek() {
95+
return this.$store.state.firstDayOfWeek
96+
},
97+
fixedPosition() {
98+
return this.$store.state.fixedPosition
99+
},
100+
format() {
101+
return this.$store.state.format
102+
},
103+
fullMonthName() {
104+
return this.$store.state.fullMonthName
105+
},
106+
id() {
107+
return this.$store.state.id
108+
},
109+
initialView() {
110+
return this.$store.state.initialView
111+
},
112+
inline() {
113+
return this.$store.state.inline
114+
},
115+
inputClass() {
116+
return this.$store.state.inputClass
117+
},
118+
language() {
119+
return this.$store.state.language
120+
},
121+
maxLength() {
122+
return this.$store.state.maxLength
123+
},
124+
maximumView() {
125+
return this.$store.state.maximumView
126+
},
127+
minimumView() {
128+
return this.$store.state.minimumView
129+
},
130+
name() {
131+
return this.$store.state.name
132+
},
133+
openDate() {
134+
return this.$store.state.openDate
135+
},
136+
pattern() {
137+
return this.$store.state.pattern
138+
},
139+
placeholder() {
140+
return this.$store.state.placeholder
141+
},
142+
required() {
143+
return this.$store.state.required
144+
},
145+
refName() {
146+
return this.$store.state.refName
147+
},
148+
showEdgeDates() {
149+
return this.$store.state.showEdgeDates
150+
},
151+
showHeader() {
152+
return this.$store.state.showHeader
153+
},
154+
showCalendarOnFocus() {
155+
return this.$store.state.showCalendarOnFocus
156+
},
157+
showCalendarOnButtonClick() {
158+
return this.$store.state.showCalendarOnButtonClick
159+
},
160+
tabindex() {
161+
return this.$store.state.tabindex
162+
},
163+
typeable() {
164+
return this.$store.state.typeable
165+
},
166+
useUtc() {
167+
return this.$store.state.useUtc
168+
},
169+
value() {
170+
return this.$store.state.value
171+
},
172+
wrapperClass() {
173+
return this.$store.state.wrapperClass
174+
},
175+
yearPickerRange() {
176+
return this.$store.state.yearPickerRange
177+
},
178+
},
179+
}
180+
</script>
181+
182+
<style>
183+
body {
184+
font-family: 'Helvetica Neue Light', Helvetica, sans-serif;
185+
padding: 1em 2em 2em;
186+
}
187+
188+
input,
189+
select {
190+
padding: 0.75em 0.5em;
191+
font-size: 100%;
192+
border: 1px solid #ccc;
193+
width: 100%;
194+
}
195+
196+
.example {
197+
background: #f2f2f2;
198+
border: 1px solid #ddd;
199+
padding: 0 1em 1em;
200+
margin-bottom: 2em;
201+
}
202+
203+
code,
204+
pre {
205+
margin: 1em 0;
206+
padding: 1em;
207+
border: 1px solid #bbb;
208+
display: block;
209+
background: #ddd;
210+
border-radius: 3px;
211+
}
212+
213+
h5 {
214+
font-size: 100%;
215+
padding: 0;
216+
}
217+
218+
h3 {
219+
margin-top: 20px;
220+
}
221+
222+
.form-group label {
223+
font-size: 80%;
224+
display: block;
225+
}
226+
</style>

example-e2e/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Vue.js Datepicker</title>
6+
<link rel="stylesheet" type="text/css" href="styles/bootstrap.min.css">
7+
</head>
8+
<body>
9+
<div id="app"></div>
10+
<script src="./app.js"></script>
11+
</body>
12+
</html>

example-e2e/main.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Vue from 'vue'
2+
import Vuex from 'vuex'
3+
import App from './App.vue'
4+
import storeConfig from './store'
5+
6+
Vue.use(Vuex)
7+
Vue.config.productionTip = false
8+
Vue.config.devtools = false
9+
10+
const store = new Vuex.Store(storeConfig)
11+
12+
const app = new Vue({
13+
render: (h) => h(App),
14+
store,
15+
}).$mount('#app')
16+
17+
window.app = app

example-e2e/store/index.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
export default {
2+
state: {
3+
appendToBody: false,
4+
autofocus: false,
5+
bootstrapStyling: false,
6+
calendarButton: false,
7+
calendarClass: null,
8+
clearButton: false,
9+
dayCellContent: (day) => day.date,
10+
disabled: false,
11+
disabledDates: {},
12+
firstDayOfWeek: 'sun',
13+
fixedPosition: 'bottom',
14+
format: 'dd MMM yyyy',
15+
fullMonthName: false,
16+
id: null,
17+
initialView: '',
18+
inline: false,
19+
inputClass: null,
20+
language: 'en',
21+
maxLength: null,
22+
maximumView: 'year',
23+
minimumView: 'day',
24+
name: null,
25+
openDate: null,
26+
pattern: null,
27+
placeholder: 'Select Date',
28+
required: false,
29+
refName: '',
30+
showEdgeDates: true,
31+
showHeader: true,
32+
showCalendarOnFocus: false,
33+
showCalendarOnButtonClick: false,
34+
tabindex: null,
35+
typeable: false,
36+
useUtc: false,
37+
value: '',
38+
wrapperClass: null,
39+
yearPickerRange: 10,
40+
},
41+
getters: {},
42+
actions: {},
43+
modules: {},
44+
}

example-e2e/styles/bootstrap.min.css

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)