E2E fixes: doSearch extension, item clone intermittence
gitea/salix/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Juan Ferrer 2020-03-31 18:33:48 +02:00
parent 7cd643c8c7
commit 326c92b23f
9 changed files with 49 additions and 71 deletions

View File

@ -125,7 +125,7 @@ let actions = {
let $state = angular.element(document.body).injector().get('$state');
return !$state.transition && $state.is(state);
}, {}, state);
await this.waitForSpinnerLoad(state);
await this.waitForSpinnerLoad();
},
waitForTransition: async function() {
@ -133,6 +133,7 @@ let actions = {
const $state = angular.element(document.body).injector().get('$state');
return !$state.transition;
});
await this.waitForSpinnerLoad();
},
accessToSection: async function(state) {
@ -167,11 +168,17 @@ let actions = {
await this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
},
accessToSearchResult: async function(searchValue) {
doSearch: async function(searchValue) {
await this.clearInput('vn-searchbar');
await this.write('vn-searchbar', searchValue);
if (searchValue)
await this.write('vn-searchbar', searchValue);
await this.waitToClick('vn-searchbar vn-icon[icon="search"]');
await this.waitForTransition();
},
accessToSearchResult: async function(searchValue) {
await this.doSearch(searchValue);
await this.waitFor('.vn-descriptor');
},

View File

@ -15,9 +15,7 @@ describe('Client create path', async() => {
});
it(`should search for the user Carol Danvers to confirm it isn't created yet`, async() => {
await page.write(selectors.clientsIndex.topbarSearch, 'Carol Danvers');
await page.waitToClick(selectors.clientsIndex.searchButton);
await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0);
await page.doSearch('Carol Danvers');
const result = await page.countElement(selectors.clientsIndex.searchResult);
expect(result).toEqual(0);

View File

@ -15,14 +15,14 @@ describe('Item summary path', () => {
});
it('should search for an item', async() => {
await page.clearInput(selectors.itemsIndex.topbarSearch);
await page.write(selectors.itemsIndex.topbarSearch, 'Ranged weapon');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 3);
await page.doSearch('Ranged weapon');
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon');
await page.waitToClick(selectors.itemsIndex.firstResultPreviewButton);
const isVisible = await page.isVisible(selectors.itemSummary.basicData);
expect(nResults).toBe(3);
expect(isVisible).toBeTruthy();
});
@ -67,12 +67,13 @@ describe('Item summary path', () => {
});
it('should search for other item', async() => {
await page.clearInput('vn-searchbar');
await page.write(selectors.itemsIndex.topbarSearch, 'Melee Reinforced');
await page.keyboard.press('Enter');
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
await page.doSearch('Melee Reinforced');
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
await page.waitToClick(selectors.itemsIndex.firstResultPreviewButton);
await page.waitForSelector(selectors.itemSummary.basicData, {visible: true});
expect(nResults).toBe(2);
});
it(`should now check the item summary preview shows fields from basic data`, async() => {

View File

@ -16,13 +16,10 @@ describe('Item Create/Clone path', () => {
describe('create', () => {
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => {
await page.clearInput(selectors.itemsIndex.topbarSearch);
await page.write(selectors.itemsIndex.topbarSearch, 'Infinity Gauntlet');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0);
const result = await page.countElement(selectors.itemsIndex.searchResult);
await page.doSearch('Infinity Gauntlet');
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(0);
expect(nResults).toEqual(0);
});
it('should access to the create item view by clicking the create floating button', async() => {
@ -85,13 +82,10 @@ describe('Item Create/Clone path', () => {
});
it(`should search for the item Infinity Gauntlet`, async() => {
await page.clearInput(selectors.itemsIndex.topbarSearch);
await page.write(selectors.itemsIndex.topbarSearch, 'Infinity Gauntlet');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
const result = await page.countElement(selectors.itemsIndex.searchResult);
await page.doSearch('Infinity Gauntlet');
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(1);
expect(nResults).toEqual(1);
});
it(`should clone the Infinity Gauntlet`, async() => {
@ -102,14 +96,10 @@ describe('Item Create/Clone path', () => {
});
it('should search for the item Infinity Gauntlet and find two', async() => {
await page.waitToClick(selectors.itemTags.goToItemIndexButton);
await page.clearInput(selectors.itemsIndex.topbarSearch);
await page.write(selectors.itemsIndex.topbarSearch, 'Infinity Gauntlet');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
const result = await page.countElement(selectors.itemsIndex.searchResult);
await page.doSearch('Infinity Gauntlet');
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(2);
expect(nResults).toEqual(2);
});
});
});

View File

@ -15,12 +15,10 @@ describe('Item log path', () => {
});
it(`should search for the Knowledge artifact to confirm it isn't created yet`, async() => {
await page.write(selectors.itemsIndex.topbarSearch, 'Knowledge artifact');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0);
const result = await page.countElement(selectors.itemsIndex.searchResult);
await page.doSearch('Knowledge artifact');
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(0);
expect(nResults).toEqual(0);
});
it('should access to the create item view by clicking the create floating button', async() => {

View File

@ -17,7 +17,6 @@ describe('Ticket descriptor path', () => {
});
it('should count the amount of tickets in the turns section', async() => {
await page.waitForNumberOfElements(selectors.ticketsIndex.weeklyTicket, 5);
const result = await page.countElement(selectors.ticketsIndex.weeklyTicket);
expect(result).toEqual(5);
@ -87,12 +86,10 @@ describe('Ticket descriptor path', () => {
});
it('should now search for the weekly ticket 11', async() => {
await page.write(selectors.ticketsIndex.topbarSearch, '11');
await page.waitToClick(selectors.ticketsIndex.searchButton);
await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1);
const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
await page.doSearch('11');
const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
expect(result).toEqual(1);
expect(nResults).toEqual(1);
});
it('should delete the weekly ticket 11', async() => {
@ -104,12 +101,9 @@ describe('Ticket descriptor path', () => {
});
it('should confirm the sixth weekly ticket was deleted', async() => {
await page.waitForContentLoaded();
await page.clearInput('vn-searchbar');
await page.waitToClick(selectors.ticketsIndex.searchWeeklyButton);
await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5);
const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
await page.doSearch();
const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
expect(result).toEqual(5);
expect(nResults).toEqual(5);
});
});

View File

@ -127,10 +127,9 @@ describe('Ticket services path', () => {
it(`should confirm the service was removed`, async() => {
await page.reloadSection('ticket.card.service');
await page.waitForNumberOfElements(selectors.ticketService.serviceLine, 0);
const result = await page.countElement(selectors.ticketService.serviceLine);
const nResults = await page.countElement(selectors.ticketService.serviceLine);
expect(result).toEqual(0);
expect(nResults).toEqual(0);
});
});
});

View File

@ -50,11 +50,9 @@ describe('claim Descriptor path', () => {
});
it(`should search for the deleted claim to find no results`, async() => {
await page.write(selectors.claimsIndex.searchClaimInput, claimId);
await page.waitToClick(selectors.claimsIndex.searchButton);
await page.waitForNumberOfElements(selectors.claimsIndex.searchResult, 0);
const result = await page.countElement(selectors.claimsIndex.searchResult);
await page.doSearch(claimId);
const nResults = await page.countElement(selectors.claimsIndex.searchResult);
expect(result).toEqual(0);
expect(nResults).toEqual(0);
});
});

View File

@ -50,13 +50,10 @@ describe('InvoiceOut descriptor path', () => {
});
it(`should search for the deleted invouceOut to find no results`, async() => {
await page.write(selectors.invoiceOutIndex.topbarSearch, 'T2222222');
await page.waitToClick(selectors.invoiceOutIndex.searchButton);
await page.waitForSpinnerLoad();
await page.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 0);
const result = await page.countElement(selectors.invoiceOutIndex.searchResult);
await page.doSearch('T2222222');
const nResults = await page.countElement(selectors.invoiceOutIndex.searchResult);
expect(result).toEqual(0);
expect(nResults).toEqual(0);
});
it('should navigate to the ticket index', async() => {
@ -67,14 +64,10 @@ describe('InvoiceOut descriptor path', () => {
});
it('should search for tickets with an specific invoiceOut to find no results', async() => {
await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222');
await page.waitToClick(selectors.ticketsIndex.advancedSearchButton);
await page.waitForSpinnerLoad();
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 0);
const result = await page.countElement(selectors.ticketsIndex.searchResult);
await page.doSearch('T2222222');
const nResults = await page.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(0);
expect(nResults).toEqual(0);
});
it('should now navigate to the invoiceOut index', async() => {