Closed jsi closed 6 years ago
This is a good start. I would like to have a full example of a complete test somewhere. Just a very simple test, but one that does a full setup. Also, there should be some mention of the page objects.
This could look like this (I just picked a random test here. There may be better examples: `describe('Edit an user - change name and roles', function () { this.timeout(70000); webDriverHelper.setupBrowser(); let testUser;
it('GIVEN existing user is opened WHEN display name has been changed THEN user should be searchable with the new display name',
() => {
return testUtils.selectUserAndOpenWizard(testUser.displayName).then(()=> {
return userWizard.typeDisplayName('new-name');
}).pause(500).then(()=> {
return testUtils.saveAndCloseWizard('new-name');
}).then(()=> {
return testUtils.typeNameInFilterPanel('new-name');
}).pause(500).then(()=> {
return expect(userBrowsePanel.isItemDisplayed(testUser.displayName)).to.eventually.be.true;
})
});
beforeEach(() => testUtils.navigateToUsersApp(webDriverHelper.browser));
afterEach(() => testUtils.doCloseUsersApp(webDriverHelper.browser));
});`
Then, explain each line:
What does webDriverHelper.setupBrowser();
do?
What does let testUser;
do?
What are the testUtils
? Where can they be found?
What does userBrowsePanel.isItemDisplayed
do? Where is the code for this?
What does beforeEach
and afterEach
do? (It is partially explained already, but here is an example that can help.)
Finally, it would be good with a link to the Chai API.
Alan have also given some feedback:
All developers should start writing basic tests for their code. We now have the Users App tests as an example of how it can be done.
Please write this page: http://wiki.enonic.com/display/support/How+to+write+a+UI+test+for+XP
It should basically describe: