refactor selectors
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Bernat Exposito Domenech 2020-10-01 08:53:31 +02:00
parent cdd71d00ec
commit 998bfcd4df
11 changed files with 19 additions and 36 deletions

View File

@ -22,13 +22,10 @@ export default {
userConfigThirdAutocomplete: '#localCompany',
acceptButton: '.vn-confirm.shown button[response=accept]',
searchButton: 'vn-searchbar vn-icon[icon="search"]',
globalItems: `button[type=submit]`
},
clientsIndex: {
topbarSearch: 'vn-topbar',
searchButton: 'vn-searchbar vn-icon[icon="search"]',
searchResult: 'vn-client-index .vn-item',
createClientButton: `vn-float-button`,
othersButton: 'vn-left-menu li[name="Others"] > a'
createClientButton: `vn-float-button`
},
clientSummary: {
header: 'vn-client-summary > vn-card > h5',
@ -76,7 +73,6 @@ export default {
socialName: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.socialName"]',
fiscalId: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.fi"]',
equalizationTaxCheckbox: 'vn-client-fiscal-data vn-check[ng-model="$ctrl.client.isEqualizated"]',
acceptPropagationButton: '.vn-confirm.shown button[response=accept]',
address: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.street"]',
postcode: 'vn-client-fiscal-data vn-datalist[ng-model="$ctrl.client.postcode"]',
city: 'vn-client-fiscal-data vn-datalist[ng-model="$ctrl.client.city"]',
@ -90,7 +86,6 @@ export default {
notifyByMailCheckbox: 'vn-client-fiscal-data vn-check[label="Notify by email"]',
viesCheckbox: 'vn-client-fiscal-data vn-check[label="Vies"]',
saveButton: 'button[type=submit]',
acceptDuplicationButton: '.vn-confirm.shown button[response=accept]',
watcher: 'vn-client-fiscal-data vn-watcher'
},
clientBillingData: {
@ -211,15 +206,12 @@ export default {
saveButton: 'button[type=submit]'
},
itemsIndex: {
searchIcon: 'vn-searchbar vn-icon[icon="search"]',
createItemButton: `vn-float-button`,
firstSearchResult: 'vn-item-index a:nth-child(1)',
searchResult: 'vn-item-index a.vn-tr',
firstResultPreviewButton: 'vn-item-index vn-tbody > :nth-child(1) .buttons > [icon="desktop_windows"]',
searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]',
acceptClonationAlertButton: '.vn-confirm.shown [response="accept"]',
topbarSearch: 'vn-topbar',
searchButton: 'vn-searchbar vn-icon[icon="search"]',
closeItemSummaryPreview: '.vn-popup.shown',
fieldsToShowButton: 'vn-item-index vn-table > div > div > vn-icon-button[icon="more_vert"]',
fieldsToShowForm: '.vn-popover.shown .content',
@ -388,7 +380,6 @@ export default {
searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr',
searchResultDate: 'vn-ticket-summary [label=Landed] span',
topbarSearch: 'vn-searchbar',
searchButton: 'vn-searchbar vn-icon[icon="search"]',
moreMenu: 'vn-ticket-index vn-icon-button[icon=more_vert]',
sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6)',
weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr',
@ -438,7 +429,6 @@ export default {
ticketExpedition: {
expeditionButton: 'vn-left-menu a[ui-sref="ticket.card.expedition"]',
secondExpeditionRemoveButton: 'vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]',
acceptDeleteRowButton: '.vn-confirm.shown button[response=accept]',
expeditionRow: 'vn-ticket-expedition vn-table vn-tbody > vn-tr'
},
ticketPackages: {
@ -506,8 +496,6 @@ export default {
moveToTicketInput: 'form vn-input-number[ng-model="$ctrl.transfer.ticketId"] input',
moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]',
moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]',
acceptDeleteLineButton: '.vn-confirm.shown button[response=accept]',
acceptDeleteTicketButton: '.vn-confirm.shown button[response=accept]',
stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]',
stateMenuFixOption: ''
},
@ -571,9 +559,7 @@ export default {
saveStateButton: `button[type=submit]`
},
claimsIndex: {
searchClaimInput: 'vn-searchbar',
searchResult: 'vn-claim-index vn-card > vn-table > div > vn-tbody > a',
searchButton: 'vn-searchbar vn-icon[icon="search"]'
searchResult: 'vn-claim-index vn-card > vn-table > div > vn-tbody > a'
},
claimDescriptor: {
moreMenu: 'vn-claim-descriptor vn-icon-button[icon=more_vert]',
@ -639,15 +625,13 @@ export default {
secondSearchResultTotal: 'vn-order-index vn-card > vn-table > div > vn-tbody vn-tr:nth-child(2) vn-td:nth-child(9)',
searchResultDate: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)',
searchResultAddress: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)',
searchButton: 'vn-searchbar vn-icon[icon="search"]',
advancedSearchButton: 'vn-order-search-panel vn-submit[label="Search"]',
openAdvancedSearch: 'vn-searchbar vn-icon[icon="arrow_drop_down"]',
advancedSearchShowEmptyCheckbox: 'vn-order-search-panel vn-check[label="Show empty"]',
createOrderButton: 'vn-float-button',
},
orderDescriptor: {
returnToModuleIndexButton: 'vn-order-descriptor a[ui-sref="order.index"]',
acceptNavigationButton: '.vn-confirm.shown button[response=accept]'
returnToModuleIndexButton: 'vn-order-descriptor a[ui-sref="order.index"]'
},
createOrderView: {
client: 'vn-autocomplete[label="Client"]',
@ -832,7 +816,6 @@ export default {
},
invoiceOutIndex: {
topbarSearch: 'vn-searchbar',
searchButton: 'vn-searchbar vn-icon[icon="search"]',
searchResult: 'vn-invoice-out-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
},
invoiceOutDescriptor: {

View File

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

View File

@ -77,7 +77,7 @@ describe('Client Edit fiscalData path', () => {
await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox);
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
await page.waitToClick(selectors.clientFiscalData.saveButton);
await page.waitToClick(selectors.clientFiscalData.acceptDuplicationButton);
await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar();
expect(message.text).toBe('Invalid Tax number');
@ -87,14 +87,14 @@ describe('Client Edit fiscalData path', () => {
await page.clearInput(selectors.clientFiscalData.fiscalId);
await page.write(selectors.clientFiscalData.fiscalId, '94980061C');
await page.waitToClick(selectors.clientFiscalData.saveButton);
await page.waitToClick(selectors.clientFiscalData.acceptDuplicationButton);
await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar();
expect(message.type).toBe('success');
});
it('should propagate the Equalization tax', async() => {
await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton);
await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar();
expect(message.text).toBe('Equivalent tax spreaded');
@ -157,7 +157,7 @@ describe('Client Edit fiscalData path', () => {
it('should propagate the Equalization tax changes', async() => {
await page.waitFor(1000);
await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton);
await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar();
expect(message.text).toBe('Equivalent tax spreaded');

View File

@ -59,7 +59,7 @@ describe('Client lock verified data path', () => {
it('should check the Verified data checkbox', async() => {
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
await page.waitToClick(selectors.clientFiscalData.saveButton);
await page.waitToClick(selectors.clientFiscalData.acceptDuplicationButton);
await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar();
expect(message.type).toBe('success');

View File

@ -8,7 +8,7 @@ describe('Item index path', () => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('salesPerson', 'item');
await page.waitToClick(selectors.itemsIndex.searchIcon);
await page.waitToClick(selectors.globalItems.searchButton);
});
afterAll(async() => {
@ -42,7 +42,7 @@ describe('Item index path', () => {
it('should navigate forth and back to see the images column is still visible', async() => {
await page.waitToClick(selectors.itemsIndex.firstSearchResult);
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
await page.waitToClick(selectors.itemsIndex.searchIcon);
await page.waitToClick(selectors.globalItems.searchButton);
await page.wait(selectors.itemsIndex.searchResult);
await page.waitImgLoad(selectors.itemsIndex.firstItemImage);
const imageVisible = await page.isVisible(selectors.itemsIndex.firstItemImageTd);
@ -76,7 +76,7 @@ describe('Item index path', () => {
it('should now navigate forth and back to see the ids column is now visible', async() => {
await page.waitToClick(selectors.itemsIndex.firstSearchResult);
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
await page.waitToClick(selectors.itemsIndex.searchIcon);
await page.waitToClick(selectors.globalItems.searchButton);
await page.wait(selectors.itemsIndex.searchResult);
const idVisible = await page.isVisible(selectors.itemsIndex.firstItemId);

View File

@ -101,7 +101,7 @@ describe('Ticket List sale path', () => {
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
await page.waitToClick(selectors.ticketSales.deleteSaleButton);
await page.waitToClick(selectors.ticketSales.acceptDeleteLineButton);
await page.waitToClick(selectors.globalItems.acceptButton);
const message = await page.waitForSnackbar();
expect(message.type).toBe('success');

View File

@ -219,7 +219,7 @@ describe('Ticket Edit sale path', () => {
await page.wait(2000);
await page.waitToClick(selectors.ticketSales.deleteSaleButton);
await page.wait(2000);
await page.waitToClick(selectors.ticketSales.acceptDeleteLineButton);
await page.waitToClick(selectors.globalItems.acceptButton);
await page.wait(2000);
await page.waitForSpinnerLoad();
const message = await page.waitForSnackbar();

View File

@ -19,7 +19,7 @@ describe('Ticket expeditions and log path', () => {
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async() => {
await page.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton);
await page.waitToClick(selectors.ticketExpedition.acceptDeleteRowButton);
await page.waitToClick(selectors.globalItems.acceptButton);
await page.reloadSection('ticket.card.expedition');
await page.waitForSelector(selectors.ticketExpedition.expeditionRow, {});

View File

@ -53,7 +53,7 @@ describe('Ticket descriptor path', () => {
it(`should search for the deleted ticket and check it's date`, async() => {
await page.write(selectors.ticketsIndex.topbarSearch, '18');
await page.waitToClick(selectors.ticketsIndex.searchButton);
await page.waitToClick(selectors.globalItems.searchButton);
await page.waitForState('ticket.card.summary');
const result = await page.waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText');

View File

@ -34,7 +34,7 @@ describe('Order edit basic data path', () => {
const orderId = '16';
await page.waitToClick(selectors.orderDescriptor.returnToModuleIndexButton);
await page.waitToClick(selectors.orderDescriptor.acceptNavigationButton);
await page.waitToClick(selectors.globalItems.acceptButton);
await page.waitForContentLoaded();
await page.accessToSearchResult(orderId);
await page.accessToSection('order.card.basicData');

View File

@ -16,7 +16,7 @@ describe('Order Index', () => {
});
it(`should check the second search result doesn't contain a total of 0€`, async() => {
await page.waitToClick(selectors.ordersIndex.searchButton);
await page.waitToClick(selectors.globalItems.searchButton);
const result = await page.waitToGetProperty(selectors.ordersIndex.secondSearchResultTotal, 'innerText');
expect(result).not.toContain('0.00');