From f519e2eaa5cc4fb04262642aca936bc7b826c893 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 6 Oct 2015 19:24:28 +0200 Subject: Test entering the form including javascript stuff. --- public/regform.js | 28 ++++++++++++------------- spec/features/register_band_spec.rb | 42 +++++++++++++++++++++++++++++++++++++ views/index.erb | 36 +++++++++++++++---------------- 3 files changed, 74 insertions(+), 32 deletions(-) create mode 100644 spec/features/register_band_spec.rb diff --git a/public/regform.js b/public/regform.js index 7509f0b..e620b04 100644 --- a/public/regform.js +++ b/public/regform.js @@ -8,8 +8,8 @@ $(function() { '
' + '

Medlem nr. '+num_members+'

' + '
' + - ' ' + - ' ' + + ' ' + + ' ' + '
' + '
' + ' ' + @@ -29,28 +29,28 @@ $(function() { '
' + '

Låt nr '+num_songs+'

' + '
' + - ' ' + - ' ' + + ' ' + + ' ' + '
' + '
' + - ' ' + - ' '+ + ' ' + + ' '+ '
' + '
' + - ' ' + - ' '+ + ' ' + + ' '+ '
' + '
' + - ' '+ - ' ' + + ' '+ + ' ' + '
' + '
' + - ' '+ - ' ' + + ' '+ + ' ' + '
' + '
' + - ' '+ - ' ' + + ' '+ + ' ' + '
' + '
' ) diff --git a/spec/features/register_band_spec.rb b/spec/features/register_band_spec.rb new file mode 100644 index 0000000..65eede4 --- /dev/null +++ b/spec/features/register_band_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +feature "Register a band" do + + scenario "with valid input", js: true do + band_params = create_band_params + + visit '/' + + fill_in 'Bandnavn:', with: band_params['name'] + fill_in 'Hjemsted:', with: band_params['city'] + fill_in 'Webside:', with: band_params['website'] + fill_in 'Plateselskap:', with: band_params['label'] + fill_in 'Kort bio:', with: band_params['shortbio'] + + within '#form-contact-info' do + fill_in 'Navn:', with: band_params['contact']['name'] + fill_in 'Postadresse:', with: band_params['contact']['addr'] + fill_in 'Tlf:', with: band_params['contact']['phone'] + fill_in 'E-post:', with: band_params['contact']['email'] + end + + click_on 'Legg til medlem' + + within '#form-members .member-info' do + fill_in 'Navn:', with: band_params['members']['1']['name'] + end + + click_on 'Legg til låt' + + within '#form-songs #song-1-info' do + fill_in 'Tittel:', with: band_params['songs']['1']['title'] + fill_in 'Lengde:', with: band_params['songs']['1']['time'] + fill_in 'ISRC-kode:', with: band_params['songs']['1']['isrc'] + fill_in 'Utøvere:', with: band_params['songs']['1']['performers'] + fill_in 'Opphavsmenn:', with: band_params['songs']['1']['composers'] + fill_in 'Andre merknader:', with: band_params['songs']['1']['notes'] + end + + click_on 'Send skjema' + end +end diff --git a/views/index.erb b/views/index.erb index 51ec288..1a63651 100644 --- a/views/index.erb +++ b/views/index.erb @@ -6,51 +6,51 @@

Generell info:

- - + +
- - + +
- - + +
- - + +
- - + +

Kontaktperson

- - + +
- - + +
- - + +
- - + +
-- cgit v1.2.3