-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat(components/lists): add paging test harnesses #3185
base: 11.x.x
Are you sure you want to change the base?
Conversation
View your CI Pipeline Execution ↗ for commit 21d1ff4.
☁️ Nx Cloud last updated this comment at |
it('should get the paging component by data-sky-id', async () => { | ||
const { pagingHarness } = await setupTest({ dataSkyId: 'other-paging' }); | ||
|
||
await expectAsync(pagingHarness.getPagingContent()).toBeRejected(); |
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.
Can we confirm that it's getting the other-paging
component with something other than a toBeRejected
which could be true even from that component failing to build? My vote is on pagingLabel
so u wont have to build the stuff inside paging and the component can stay one line in the template.
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.
The dataSkyId
filter already confirms it's the correct paging component. It will fail the test if it doesn't find that specific one. The rejected getPagingContent method also confirms that it's the paging component that doesn't have a sky-paging-content child
async #buttonIsDisabled(button: TestElement): Promise<boolean> { | ||
const disabled = await button.getAttribute('disabled'); | ||
return disabled !== null; | ||
} |
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.
Missing a function to get the pagingLabel
input value that is the aria-label
for the nav
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.
added
const disabled = await button.getAttribute('disabled'); | ||
return disabled !== null; | ||
} | ||
} |
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.
Can we add a function to say if paging is in the "waiting" mode since we add that and show consumers how to set it up in the content code examples
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.
I wouldn't expect consumers to want or need to test that the paging component is in a waiting state while they are in the process of handling a contentChange event. We don't do that in other places where we incorporate our own Wait.
await button.click(); | ||
} | ||
|
||
public async getCurrentPage(): Promise<number> { |
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.
missing jsdocs
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.
added
|
||
/** | ||
* A set of criteria that can be used to filter a list of `SkyPagingHarness` instances. | ||
* @internal |
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.
should this be internal?
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.
fixed
|
||
/** | ||
* Harness to interact with a page control element in tests. | ||
*/ |
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.
Since consumers dont set the page number text and only know it as the 'page number' and not 'page control text', i think we should mark this as internal and use the SkyPagingHarness
to have functions to just get getActivePageNumber
and clickPageNumber
etc
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.
I don't like this approach because it's not immediately clear how they should interact with the controls if they're obfuscated behind the paging harness. Do they ask to click a specific page number, which may not be in the list? Do they ask to click the Nth page control, and if so how do we enforce there are only that many controls to begin with? Giving them an array of the paging controls that exist feels very intuitive for them exploring the structure of the page to me. They get, say, 5 test harness elements, they can do a sanity check that they are paging in the way they expect, and interact with them the same way a user would.
'Could not click the next button because it is disabled.', | ||
); | ||
}); | ||
}); |
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.
can we add a code example spec file for the basic
one as well? I know we havent been being stringent about that but we should moving forward imo
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.
I didn't make one because the basic
code example isn't being used. If we decide to change that, we can add it.
@@ -102,7 +102,7 @@ export class DemoDataService { | |||
totalCount: people.length, | |||
}).pipe( | |||
// Simulate network latency. | |||
delay(1000), | |||
delay(100), |
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.
why are we reducing this?
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.
I was worried about this delay causing the sample tests I was writing to time out. 100ms is still a pretty good length of delay.
AB#2195510