I have a component listing-table
which takes a number of properties, like this:
{{listing-table model=model.devices type='user' exclude='customerName'}}
This works as intended, and the integration tests also work just fine. However, my acceptance tests fail, because apparently my exclude
property is not being taken into account while running an acceptance test.
I have tested this by printing to console the value of this.get('exclude')
in the component's javascript file and getting undefined
. However, printing e.g. this.get('type')
yields the expected results.
I have then, for testing purposes, removed exclude
and replaced type
's value with it, i.e. type='endpointName,typeName'
, however, I would get the previous value in the console, e.g. user
.
This is all way beyond puzzling, and I'd really like to know what's the matter with acceptance test. Any sort of hints are more than welcome, and thanks for your time!
EDIT:
I have now edited my acceptance test to exclude clicking through various elements to get to the route that contains my listing-table
component:
From:
visit('/users/1')
click('a:contains("Devices")')
To:
visit('/users/1/devices')
And the test passes. I still don't understand why clicking through makes my component's properties disappear, whereas visiting the page directly works just fine.
EDIT 2:
So, here is some sample code. This is what my test looks like:
test('/customers/1/devices should display 5 devices', function (assert) {
let type = server.create('endpoint-type')
let user = server.create('user')
let endpoint = server.create('endpoint', { type })
server.createList('device', 5, { user })
visit('/customers');
click('a:contains("Customer 0")')
click('a:contains("Devices")')
andThen(function () {
assert.equal(find('.device-listing').length, 5, 'should see 5 listings')
assert.equal(find('th').text().trim(), 'IDModelManufacturerMACExtensionLocation', 'should only contain ID, Model, Manufacturer, MAC, Extension, and Location columns')
})
Now, my Devices table should, in this case, omit the 'Customer' column, however, the column does appear in there, even though my component in devices.show.customers
has been invoked with:
{{listing-table model=model.devices type='user' exclude='customerName'}}
My listing-table.js
file basically uses this.get('exclude')
inside the init ()
function to process the excludes, but as I said, if I add a console.log(this.get('exclude')
in that file, I get undefined
.
EDIT 3:
After more testing, I have made some progress, and the resulting question needs its own page, here.