-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update busy model wrapper component to use page object #1625
Update busy model wrapper component to use page object #1625
Conversation
Unsure what I need in the page object because I'm not sure what |
@daveconnis The idea of that component, is, you give it an ember data model and wrap the component around some sort of UI related to that model. If the model is not being saved or deleted at the moment, it shows that UI. Otherwise, it shows a message indicating it's saving or deleting. From that, you don't really need to put anything in the page object, although we may at some point What you want to test is
If you set your render page as page.render(hbs`{{#budy-model-wrapper model=model}}Foo{{/busy-model-wrapper}}`) Then bullet nr. 3 simply asserts |
So to add to my previous comment, your direction is fine. Just need to cover the 2 other cases. |
|
||
assert.equal(this.$().text().trim(), 'template block text'); | ||
assert.equal(page.text, 'Foo', 'the model returns block'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have the first two tests passing, by setting the model, however, I'm unsure how to get the this one passing without something to yield. Nikola mentioned earlier that I could set my renderPage to page.render(hbs{{#busy-model-wrapper model=model}}Foo{{/busy-model-wrapper}}) but I've tried this both in my initial renderPage() function and in the test itself and haven't gotten anywhere with it. The error I get is
Error: Element not found.
PageObject: 'page.text'
Selector: ':first'
I got this on both of my tests prior, but only because I'd messed up the boolean values onSaving and onDeleting. I fixed that, but I'm not sure what this would need to accept that neither onSaving or onDeleting are false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You won't want to use renderPage
for this since that's just a helper function.
In this case you would do:
page.render(hbs`
{{#common/busy-model-wrapper model=model}}
Foo
{{/common/busy-model-wrapper}}
`);
inside of your test.
I've deleted the tag, class, and page object for this, haven't switched the page object syntax back to jQuery yet, but when I do, I'll be sure to comment out WHY we haven't switched this over to a page object. |
@daveconnis do you want to finish this one up before continuing on the other? |
let model = { isSaving: true, isDeleted: false }; | ||
set(this, 'model', model); | ||
renderPage(); | ||
// These tests do not make use of a page object. One was written, but it consisted of an empty string and a .busymodelwrapper scope. Set up this way, the page object wasn't actually rendering anything, just empty code placeholders. Switched to using jQuery selectors in order to have cleaner more effectived code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Biggest thing I want attention on is this comment. Want to make sure it makes sense. Remember, we veto'd the page object for this test because it was just, if I remember right:
tagname: ' ' scope: .busymodelwrapper
|
||
moduleForComponent('common/busy-model-wrapper', 'Integration | Component | common/busy model wrapper', { | ||
integration: true | ||
}); | ||
|
||
test('it renders', function(assert) { | ||
// These tests do not make use of a page object. One was written, but it consisted of an empty string and a .busymodelwrapper scope. Set up this way, the page object wasn't actually rendering anything, just empty code placeholders. Switched to using jQuery selectors in order to have cleaner more effectived code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments should be multi-line when over 80 chars.
c521076
to
3e0fcdf
Compare
3e0fcdf
to
c69b6e9
Compare
@daveconnis I decided to wrap this up. In hindsight, we didn't pay enough attention on how the busy model wrapper works and sent you in the wrong direction. What I ended up doing is I used your findings to setup a dynamically defined page object and a render-page function which wraps the component call in a test container div, so we can still assert |
What's in this PR?
Adding page object to
busy-model-wrapper-test
and writing out tests that actually test the component. Originally, there was only anit renders
test. Planning on testing bothonSaving
andonDeleting
.Fixes #1607