Skip to content

Commit

Permalink
Added tests with nightwatch
Browse files Browse the repository at this point in the history
  • Loading branch information
ItalyPaleAle committed May 15, 2019
1 parent d5fc1ea commit 7869008
Show file tree
Hide file tree
Showing 12 changed files with 1,812 additions and 92 deletions.
5 changes: 4 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
example
.eslint*
.vscode
.vscode
*.log
nightwatch.json
test
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@
},
"[javascript]": {
"editor.tabSize": 4
},
"[json]": {
"editor.tabSize": 2
}
}
8 changes: 3 additions & 5 deletions example/src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
<h1>svelte-spa-router example</h1>
<!-- Navigation links, using the "link" action -->
<!-- Also, use the "active" action to add the "active" CSS class when the URL matches -->
<ul>
<ul class="navigation-links">
<li><a href="/" use:link use:active={'/', 'active'}>Home</a></li>
<li><a href="/hello/svelte" use:link use:active={'/hello/*', 'active'}>Say hi!</a></li>
<li><a href="/does/not/exist" use:link>Not found</a></li>
</ul>

<!-- Navigate with buttons -->
<p>
<p class="navigation-buttons">
<button on:click={() => push('/wild/something')}>Visit /wild/something</button>
<button on:click={() => pop()}>Go back</button>
<button on:click={() => replace('/wild/replaced')}>Replace current page</button>
</p>

<!-- Show the current path -->
<pre><code>
Current path: {$location}
</code></pre>
<p>Current path: <code id="currentpath">{$location}</code></p>

<!-- Show the router -->
<Router {routes}/>
Expand Down
2 changes: 1 addition & 1 deletion example/src/routes/Home.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2>Home!</h2>
<h2 class="routetitle">Home!</h2>
<p>Welcome to this sample code!</p>
<p>Things to try:</p>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions example/src/routes/Name.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h2>Hi there!</h2>
<p>Your name is: <b>{params.first}</b> <b>{#if params.last}{params.last}{/if}</b></p>
<h2 class="routetitle">Hi there!</h2>
<p id="nameparams">Your name is: <b>{params.first}</b> <b>{#if params.last}{params.last}{/if}</b></p>
<p><em>Hint:</em> Try changing the URL and add your name, e.g. <code>/hello/jane/doe</code></p>

<script>
Expand Down
1 change: 1 addition & 0 deletions example/src/routes/NotFound.svelte
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<h2 class="routetitle">NotFound</h2>
<p>Oops, this route doesn't exist!</p>
1 change: 1 addition & 0 deletions example/src/routes/Wild.svelte
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<h2 class="routetitle">Wild</h2>
<p>Your message is: {params.wild}</p>

<script>
Expand Down
33 changes: 33 additions & 0 deletions nightwatch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"src_folders": [
"test/"
],

"webdriver": {
"start_process": true,
"server_path": "node_modules/.bin/chromedriver",
"port": 9515
},

"test_runner" : {
"type" : "mocha",
"options" : {
"ui" : "bdd",
"reporter" : "list"
}
},

"test_settings": {
"default": {
"desiredCapabilities": {
"browserName": "chrome",
"chromeOptions": {
"args": [
"--headless",
"--disable-gpu"
]
}
}
}
}
}
Loading

0 comments on commit 7869008

Please sign in to comment.