e2e client path non search results test plus extension for rearch results management
This commit is contained in:
parent
12d7f0776c
commit
937cacd44d
|
@ -11,7 +11,7 @@ Nightmare.action('login', function(done) {
|
|||
try {
|
||||
this.goto(`${config.url}auth/?apiKey=salix`)
|
||||
.write(`${child(selectors.login.textFieldInput, 1)}`, 'nightmare')
|
||||
.write(`${child(selectors.login.textFieldInput, 2)}`, 'nightmarePassword')
|
||||
.write(`${child(selectors.login.textFieldInput, 2)}`, 'nightmare')
|
||||
.click(selectors.login.submitButton)
|
||||
.then(done);
|
||||
} catch (err) {
|
||||
|
@ -101,3 +101,16 @@ Nightmare.action('selectText', function(selector, done) {
|
|||
.mouseup(selector)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('countSearchResults', function(selector, done) {
|
||||
this.evaluate_now(selector => {
|
||||
return document.querySelectorAll(selector).length;
|
||||
}, done, selector);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForNumberOfElements', function(selector, count, done) {
|
||||
this.wait((selector, count) => {
|
||||
return document.querySelectorAll(selector).length === count;
|
||||
}, selectors.clientsView.searchResult, count)
|
||||
.then(done);
|
||||
});
|
||||
|
|
|
@ -13,6 +13,9 @@ export default {
|
|||
clientsSectionButton: 'body > vn-app > vn-vertical > vn-vertical > vn-home > vn-vertical > vn-module-container > a:nth-child(1)'
|
||||
},
|
||||
clientsView: {
|
||||
searchClientInput: 'body > vn-app > vn-vertical > vn-vertical > vn-client-index > div > div > vn-card:nth-child(1) > div > vn-horizontal > vn-searchbar > form > vn-horizontal > vn-textfield > div > input',
|
||||
searchButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-index > div > div > vn-card:nth-child(1) > div > vn-horizontal > vn-searchbar > form > vn-horizontal > vn-icon-button > button',
|
||||
searchResult: 'body > vn-app > vn-vertical > vn-vertical > vn-client-index > div > div > vn-card:nth-child(2) > div > vn-item-client',
|
||||
createClientButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-index > div > a > vn-float-button > button'
|
||||
},
|
||||
createClientView: {
|
||||
|
|
|
@ -35,6 +35,20 @@ describe('Clients path', () => {
|
|||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
it(`should search for the user Bruce Wayne to confirm it isn't created yet`, done => {
|
||||
nightmare
|
||||
.wait(selectors.clientsView.searchResult)
|
||||
.type(selectors.clientsView.searchClientInput, 'Bruce Wayne')
|
||||
.click(selectors.clientsView.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsView.searchResult, 0)
|
||||
.countSearchResults(selectors.clientsView.searchResult)
|
||||
.then(result => {
|
||||
expect(result).toBe(0);
|
||||
done();
|
||||
})
|
||||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
it('should access to the create client view by clicking the create-client floating button', done => {
|
||||
nightmare
|
||||
.click(selectors.clientsView.createClientButton)
|
||||
|
|
Loading…
Reference in New Issue