Skip to content

Commit 3b82e17

Browse files
committed
Implement a simple Nightwatch test
1 parent 5d845ee commit 3b82e17

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

client/pages/VinNumbers/AddVinForm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AddVinForm extends React.Component {
2424
render() {
2525
const {handleSubmit, submitting} = this.props;
2626
return (
27-
<Form onSubmit={handleSubmit(this.onCreate.bind(this))}>
27+
<Form onSubmit={handleSubmit(this.onCreate.bind(this))} id="add-vin-form">
2828
<Input name="value" label="VIN number" validate={validateVin} />
2929
<Input name="notes" label="Notes" />
3030
<Button text="Save" type="submit" loading={submitting} />

client/pages/VinNumbers/VinNumberCard.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default class VinNumberCard extends React.Component {
2424
<Card.Content>
2525
<Card.Header>VIN # {vin.value}</Card.Header>
2626
<Card.Meta>{vin.friendlyCreationDate()}</Card.Meta>
27+
<Card.Description>{vin.notes}</Card.Description>
2728
</Card.Content>
2829
<Card.Content extra>
2930
<Button.Group fluid>

imports/api/vinNumbers/collection.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const VinNumberFields = new SimpleSchema({
1111
},
1212
notes: {
1313
type: String,
14+
optional: true
1415
}
1516
});
1617

imports/startup/server/seedVinNumbers.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import {addVin} from '/imports/api/vinNumbers/methods';
44
const isSeededAlready = () => VinNumbers.find().count() > 1;
55

66
const dummyVins = [
7-
{value: 'Vin1', notes: 'Note1'},
8-
{value: 'Vin2', notes: 'Note2'},
9-
{value: 'Vin3', notes: 'Note3'},
7+
{value: '5GZCZ43D13S812715', notes: 'First'},
8+
{value: 'SGZCZ43D13S812715', notes: 'Second'},
109
];
1110

1211
const seedVinNumbers = () => {

tests/fixtures/addVinNumber.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ module.exports = {
99
console.log('Executing test `before` hook');
1010
},
1111

12-
// @todo #2:30min Implement 'Add VIN number' test
1312
'Add a VIN number': function (browser) {
1413
browser
1514
.goHome()
15+
.waitForElementVisible('#add-vin-form')
16+
.setValue('#add-vin-form input[name=value]', 'SGZCZ43D13S812715')
17+
.setValue('#add-vin-form input[name=notes]', 'Submitted by Nightwatch')
18+
.click('#add-vin-form button')
1619
.end();
1720
}
1821
};

0 commit comments

Comments
 (0)