Help with capybara testing needed (stuck on the last 1.10 bug)

Hello all,
Probably I need a fresh eye on my problem - I am working on it for too long.
I am working on integration test that should create a host by filling in
all fields. The problem is that I am stuck on IP field for the interface -
the value is not sent to the server.
Test code can be found here: http://www.fpaste.org/303651/14506818/
The code actually does fill all other fields, but for some reason I can see
that the IP field remains empty when sending the info to server. I can see
that by inspecting test.log:

> 2015-12-20T19:01:32 [app] [I] Processing by HostsController#create as /
> 2015-12-20T19:01:32 [app] [I] Parameters: {"utf8"=>"✓",
> "host"=>{"name"=>"myhost1", "hostgroup_id"=>"928644286",
> "compute_resource_id"=>"", "config_group_ids"=>[""],
> "puppetclass_ids"=>[""], "managed"=>"true",
> "progress_report_id"=>"[FILTERED]", type"=>"Host::Managed",
> "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed",
> "mac"=>"11:11:11:11:11:11", "identifier"=>"", "name"=>"myhost1",
> "domain_id"=>"22495316", "subnet_id"=>"980190962", "managed"=>"1",
> "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"",
> "attached_to"=>""}}, "architecture_id"=>"501905021",
> "operatingsystem_id"=>"1073012830", "provision_method"=>"build",
> "build"=>"0", "medium_id"=>"1011586620", "ptable_id"=>"1007981703",
> "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"135138680-Users",
> "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"},
> "bare_metal_capabilities"=>"build"}
> 2015-12-20T19:01:32 [app] [D] Setting current user thread-local variable
> to secret_admin
> 2015-12-20T19:01:32 [app] [I] Failed to save: Ip can't be blank
> 2015-12-20T19:01:32 [app] [I] Rendered hosts/_progress.html.erb (0.1ms)

You can see that "interfaces_attributes"[0] does not contain the IP field.
If I stop the test (binding.pry) just before clicking on a submit button, I
can run "page.evaluate_script("$('form').serialize()")" that will return
the values that should be sent to the server, I can see the IP field there.

Any advice will be appreciated.

> Hello all,
> Probably I need a fresh eye on my problem - I am working on it for too
> long.
> I am working on integration test that should create a host by filling in
> all fields. The problem is that I am stuck on IP field for the interface -
> the value is not sent to the server.
> Test code can be found here: http://www.fpaste.org/303651/14506818/
> The code actually does fill all other fields, but for some reason I can
> see that the IP field remains empty when sending the info to server. I can
> see that by inspecting test.log:
>
>> 2015-12-20T19:01:32 [app] [I] Processing by HostsController#create as /
>> 2015-12-20T19:01:32 [app] [I] Parameters: {"utf8"=>"✓",
>> "host"=>{"name"=>"myhost1", "hostgroup_id"=>"928644286",
>> "compute_resource_id"=>"", "config_group_ids"=>[""],
>> "puppetclass_ids"=>[""], "managed"=>"true",
>> "progress_report_id"=>"[FILTERED]", type"=>"Host::Managed",
>> "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed",
>> "mac"=>"11:11:11:11:11:11", "identifier"=>"", "name"=>"myhost1",
>> "domain_id"=>"22495316", "subnet_id"=>"980190962", "managed"=>"1",
>> "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"",
>> "attached_to"=>""}}, "architecture_id"=>"501905021",
>> "operatingsystem_id"=>"1073012830", "provision_method"=>"build",
>> "build"=>"0", "medium_id"=>"1011586620", "ptable_id"=>"1007981703",
>> "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"135138680-Users",
>> "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"},
>> "bare_metal_capabilities"=>"build"}
>> 2015-12-20T19:01:32 [app] [D] Setting current user thread-local variable
>> to secret_admin
>> 2015-12-20T19:01:32 [app] [I] Failed to save: Ip can't be blank
>> 2015-12-20T19:01:32 [app] [I] Rendered hosts/_progress.html.erb (0.1ms)
>
> You can see that "interfaces_attributes"[0] does not contain the IP field.
> If I stop the test (binding.pry) just before clicking on a submit button,
> I can run "page.evaluate_script("$('form').serialize()")" that will return
> the values that should be sent to the server, I can see the IP field there.
>
> Any advice will be appreciated.
>

can you paste the full test log (e.g. I want to see the AJAX calls to the
server before submitting the form).

Ohad

··· On Mon, Dec 21, 2015 at 9:22 AM, wrote:


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Finally found the error - it was connected to the #12793 bug - the IP field
was filtered out of serialization.

··· On Monday, December 21, 2015 at 1:51:03 PM UTC+2, ohadlevy wrote: > > > > On Mon, Dec 21, 2015 at 9:22 AM, <ssh...@redhat.com > wrote: > >> Hello all, >> Probably I need a fresh eye on my problem - I am working on it for too >> long. >> I am working on integration test that should create a host by filling in >> all fields. The problem is that I am stuck on IP field for the interface - >> the value is not sent to the server. >> Test code can be found here: http://www.fpaste.org/303651/14506818/ >> The code actually does fill all other fields, but for some reason I can >> see that the IP field remains empty when sending the info to server. I can >> see that by inspecting test.log: >> >>> 2015-12-20T19:01:32 [app] [I] Processing by HostsController#create as >>> */* >>> 2015-12-20T19:01:32 [app] [I] Parameters: {"utf8"=>"✓", >>> "host"=>{"name"=>"myhost1", "hostgroup_id"=>"928644286", >>> "compute_resource_id"=>"", "config_group_ids"=>[""], >>> "puppetclass_ids"=>[""], "managed"=>"true", >>> "progress_report_id"=>"[FILTERED]", type"=>"Host::Managed", >>> "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", >>> "mac"=>"11:11:11:11:11:11", "identifier"=>"", "name"=>"myhost1", >>> "domain_id"=>"22495316", "subnet_id"=>"980190962", "managed"=>"1", >>> "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"", >>> "attached_to"=>""}}, "architecture_id"=>"501905021", >>> "operatingsystem_id"=>"1073012830", "provision_method"=>"build", >>> "build"=>"0", "medium_id"=>"1011586620", "ptable_id"=>"1007981703", >>> "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"135138680-Users", >>> "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}, >>> "bare_metal_capabilities"=>"build"} >>> 2015-12-20T19:01:32 [app] [D] Setting current user thread-local variable >>> to secret_admin >>> 2015-12-20T19:01:32 [app] [I] Failed to save: Ip can't be blank >>> 2015-12-20T19:01:32 [app] [I] Rendered hosts/_progress.html.erb (0.1ms) >> >> You can see that "interfaces_attributes"[0] does not contain the IP field. >> If I stop the test (binding.pry) just before clicking on a submit button, >> I can run "page.evaluate_script("$('form').serialize()")" that will return >> the values that should be sent to the server, I can see the IP field there. >> >> Any advice will be appreciated. >> > > can you paste the full test log (e.g. I want to see the AJAX calls to the > server before submitting the form). > > Ohad > >> -- >> You received this message because you are subscribed to the Google Groups >> "foreman-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to foreman-dev...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >