-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const LAUNCH_URL = process.env.LAUNCH_URL || 'http://localhost:3000'; | ||
module.exports = { | ||
src_folders : ['tests'], | ||
test_settings: { | ||
default: { | ||
launch_url: LAUNCH_URL, | ||
selenium: { | ||
start_process: false, | ||
host: 'localhost', | ||
port: 4444, | ||
}, | ||
desiredCapabilities: { | ||
browserName: 'chrome', | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const {setDefaultTimeout, BeforeAll, Before, AfterAll, After} = require('@cucumber/cucumber') | ||
const {startWebDriver, stopWebDriver, createSession, closeSession} = require('nightwatch-api') | ||
|
||
setDefaultTimeout(60000) | ||
|
||
|
||
|
||
BeforeAll(async function (){ | ||
await startWebDriver({}) | ||
}) | ||
|
||
Before((async function(){ | ||
await createSession({}) | ||
})) | ||
|
||
AfterAll(async function(){ | ||
await stopWebDriver() | ||
}) | ||
|
||
After(async function(){ | ||
await closeSession() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Feature: todo | ||
As a user | ||
I want to add an item to the todo list | ||
So that I can organize task | ||
|
||
Scenario: Add item to the todo list | ||
Given a user has navigated to the homepage | ||
When the user adds "test" to the todo list using the webUI | ||
Then card "test" should be displayed on the webUI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const {Given, When, Then} = require('@cucumber/cucumber') | ||
const {client} = require('nightwatch-api') | ||
|
||
//css selectors | ||
const todoInputField = '.todo-input' | ||
const todoCreateButton = '.todo-button' | ||
const todoListItem = '.todo .todo-item' | ||
|
||
Given('a user has navigated to the homepage', function () { | ||
return client.url("http://localhost:3000"); | ||
}); | ||
|
||
|
||
When('the user adds {string} to the todo list using the webUI', async function (item) { | ||
await client.waitForElementVisible(todoInputField) | ||
.click(todoInputField) | ||
.setValue(todoInputField, item) | ||
.click(todoCreateButton) | ||
return client | ||
}); | ||
|
||
Then('card {string} should be displayed on the webUI', function (item) { | ||
return client.getText(todoListItem, function (result) { | ||
this.assert.equal(result.value, item) | ||
}) | ||
}); |