Skip to content

Commit 2d4bed8

Browse files
committed
test: Update cypress tests
1 parent 3638a10 commit 2d4bed8

File tree

7 files changed

+143
-16
lines changed

7 files changed

+143
-16
lines changed

cypress.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
2-
"baseUrl": "http://localhost:10001",
2+
"baseUrl": "http://localhost:5000",
33
"fixturesFolder": "tests/e2e/fixtures",
44
"screenshotsFolder": "tests/e2e/screenshots",
55
"integrationFolder": "tests/e2e/integration",
66
"fileServerFolder": "demo",
77
"pluginsFile": false,
8-
"supportFile": false,
9-
"videoRecording": false
8+
"supportFile": false
109
}

demo/index.html

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919

2020
<div id="app">
2121
<!-- data-vst is used for internal testing, it is not required -->
22-
<vue-skip-to
23-
to="#search"
24-
text="Skip to search"
25-
data-vst="skip-to"
26-
></vue-skip-to>
22+
<vue-skip-to to="#main" data-vst="skip-to"></vue-skip-to>
2723
<header>
2824
<h1>Press tab</h1>
2925

@@ -38,11 +34,7 @@ <h2>Navigation</h2>
3834
</ul>
3935
</nav>
4036
</header>
41-
42-
<div>
43-
<input id="search" type="search" name="search" />
44-
</div>
45-
37+
4638
<div id="main" role="main">
4739
<p>
4840
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ornare elit vitae felis tincidunt commodo. Phasellus volutpat pharetra consectetur. Mauris eu orci fermentum, maximus odio ut, consequat dui. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec et tortor sagittis, euismod risus vel, pulvinar urna. Suspendisse non facilisis leo. Quisque rhoncus vel mauris sed dapibus. Nunc nibh mauris, fringilla ut nisi at, maximus varius magna. Proin hendrerit a orci quis ullamcorper. Curabitur molestie eros quis eros tempus auctor. Proin luctus nibh quis sem dictum tempus. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed eleifend, tortor tristique efficitur egestas, nulla libero tincidunt quam, vel pulvinar velit nulla id libero. Maecenas nisl quam, dictum in tempus in, ultrices a felis.

demo/search.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Using vue-skip-to</title>
8+
9+
<style>
10+
a:focus, div:focus {
11+
background-color: yellow;
12+
}
13+
</style>
14+
15+
<script src="https://unpkg.com/vue"></script>
16+
<script src="vue-skip-to.js"></script>
17+
</head>
18+
<body>
19+
20+
<div id="app">
21+
<!-- data-vst is used for internal testing, it is not required -->
22+
<vue-skip-to to="#search" text="Skip to search" data-vst="skip-to"></vue-skip-to>
23+
<header>
24+
<h1>Press tab</h1>
25+
26+
<nav>
27+
<h2>Navigation</h2>
28+
<ul>
29+
<li><a href="#">Home</a></li>
30+
<li><a href="#">About</a></li>
31+
<li><a href="#">Products</a></li>
32+
<li><a href="#">Support</a></li>
33+
<li><a href="#">Contact</a></li>
34+
</ul>
35+
</nav>
36+
</header>
37+
38+
<label for="search">
39+
Search: <input id="search" type="search" name="search" />
40+
</label>
41+
</div>
42+
<script>
43+
var App = new Vue({
44+
el: '#app'
45+
})
46+
</script>
47+
</body>
48+
</html>

package-lock.json

Lines changed: 61 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
"jest": "^26.0.1",
7878
"rollup": "^2.9.0",
7979
"rollup-plugin-eslint": "^7.0.0",
80+
"rollup-plugin-livereload": "^1.3.0",
81+
"rollup-plugin-serve": "^1.0.1",
8082
"rollup-plugin-terser": "^5.3.0",
8183
"rollup-plugin-vue": "^5.1.6",
8284
"standard-version": "^8.0.0",

rollup.config.dev.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import buble from '@rollup/plugin-buble'
22
import resolve from '@rollup/plugin-node-resolve'
33
import chokidar from 'chokidar'
44
import { eslint } from 'rollup-plugin-eslint'
5+
import livereload from 'rollup-plugin-livereload'
6+
import serve from 'rollup-plugin-serve'
57
import vue from 'rollup-plugin-vue'
68

79
export default {
@@ -19,7 +21,16 @@ export default {
1921
css: true,
2022
compileTemplate: true
2123
}),
22-
buble()
24+
buble(),
25+
serve({
26+
port: 5000,
27+
verbose: true,
28+
contentBase: 'demo',
29+
historyApiFallback: true
30+
}),
31+
livereload({
32+
watch: 'demo'
33+
})
2334
],
2435
output: [
2536
{

tests/e2e/integration/skip-to.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe('index', () => {
1+
describe('Skip to min content', () => {
22
beforeEach(() => {
33
cy.visit('/')
44
})
@@ -12,3 +12,18 @@ describe('index', () => {
1212
cy.focused().should('have.id', 'main')
1313
})
1414
})
15+
16+
describe('Skip to search', () => {
17+
beforeEach(() => {
18+
cy.visit('/search.html')
19+
})
20+
21+
it('Should assert that page content is correct', () => {
22+
cy.get('[data-vst="skip-to"]').should('contain', 'search')
23+
})
24+
25+
it('The input search must receive the focus', () => {
26+
cy.get('[data-vst="skip-to"]').focus().click()
27+
cy.focused().should('have.id', 'search')
28+
})
29+
})

0 commit comments

Comments
 (0)