#2024 e2e travel.thermograph + refactors
gitea/salix/2024-e2e-travel-thermograph This commit looks good
Details
gitea/salix/2024-e2e-travel-thermograph This commit looks good
Details
This commit is contained in:
parent
cbc5ea7a00
commit
14cee74ae2
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
|
@ -21,6 +21,7 @@ let actions = {
|
|||
} catch (error) {
|
||||
throw new Error(`failed to reach URL containing: ${expectedHash}`);
|
||||
}
|
||||
await this.waitForContentLoaded();
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -167,7 +168,7 @@ let actions = {
|
|||
|
||||
waitToGetProperty: async function(selector, property) {
|
||||
let builtSelector = selector;
|
||||
if (property != 'innerText')
|
||||
if (selector.includes('vn-input-file') || property != 'innerText')
|
||||
builtSelector = await this.selectorFormater(selector);
|
||||
|
||||
try {
|
||||
|
@ -311,6 +312,9 @@ let actions = {
|
|||
if (selector.includes('vn-textfield'))
|
||||
return builtSelector = `${selector} input`;
|
||||
|
||||
if (selector.includes('vn-input-file'))
|
||||
return builtSelector = `${selector} section`;
|
||||
|
||||
return builtSelector;
|
||||
},
|
||||
|
||||
|
@ -365,14 +369,15 @@ let actions = {
|
|||
await this.write('vn-searchbar', searchValue);
|
||||
await this.waitToClick('vn-searchbar vn-icon[icon="search"]');
|
||||
await this.waitForNumberOfElements('.search-result', 1);
|
||||
await this.waitFor(1000);
|
||||
await this.waitForContentLoaded();
|
||||
await this.evaluate(() => {
|
||||
return document.querySelector('.search-result').click();
|
||||
});
|
||||
await this.waitForContentLoaded();
|
||||
},
|
||||
|
||||
accessToSection: async function(sectionRoute) {
|
||||
await this.waitForSelector(`vn-left-menu`, {visible: true});
|
||||
await this.waitForSelector('vn-left-menu');
|
||||
let nested = await this.evaluate(sectionRoute => {
|
||||
return document.querySelector(`vn-left-menu li li > a[ui-sref="${sectionRoute}"]`) != null;
|
||||
}, sectionRoute);
|
||||
|
@ -394,6 +399,7 @@ let actions = {
|
|||
autocompleteSearch: async function(selector, searchValue) {
|
||||
let builtSelector = await this.selectorFormater(selector);
|
||||
|
||||
await this.waitForContentLoaded();
|
||||
await this.waitToClick(selector);
|
||||
await this.waitForSelector(selector => {
|
||||
document
|
||||
|
@ -424,10 +430,11 @@ let actions = {
|
|||
}, {}, builtSelector, searchValue);
|
||||
|
||||
await this.waitForMutation(`.vn-drop-down`, 'childList');
|
||||
await this.waitForContentLoaded();
|
||||
},
|
||||
|
||||
reloadSection: async function(sectionRoute) {
|
||||
await this.waitFor(1000);
|
||||
await this.waitForContentLoaded();
|
||||
await Promise.all([
|
||||
this.waitForNavigation({waitUntil: 'networkidle0'}),
|
||||
this.click('vn-icon[icon="desktop_windows"]', {}),
|
||||
|
@ -437,6 +444,7 @@ let actions = {
|
|||
this.waitForNavigation({waitUntil: 'networkidle0'}),
|
||||
this.click(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`, {}),
|
||||
]);
|
||||
await this.waitForContentLoaded();
|
||||
},
|
||||
|
||||
forceReloadSection: async function(sectionRoute) {
|
||||
|
|
|
@ -748,5 +748,12 @@ export default {
|
|||
taxTwo: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-two > vn-table > div > vn-tbody > vn-tr:nth-child(2)',
|
||||
ticketOne: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(1)',
|
||||
ticketTwo: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(2)'
|
||||
},
|
||||
travelThermograph: {
|
||||
add: 'vn-travel-thermograph-index vn-float-button[icon="add"]',
|
||||
thermographID: 'vn-travel-thermograph-create vn-autocomplete[ng-model="$ctrl.dms.thermographId"]',
|
||||
uploadIcon: 'vn-travel-thermograph-create vn-icon[icon="cloud_upload"]',
|
||||
createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr',
|
||||
upload: 'vn-travel-thermograph-create button[type=submit]'
|
||||
}
|
||||
};
|
||||
|
|
|
@ -53,7 +53,6 @@ describe('Client create path', async() => {
|
|||
await page.write(selectors.createClientView.name, 'Carol Danvers');
|
||||
await page.write(selectors.createClientView.socialName, 'AVG tax');
|
||||
await page.write(selectors.createClientView.street, 'Many places');
|
||||
await page.waitForContentLoaded();
|
||||
await page.autocompleteSearch(selectors.createClientView.country, 'España');
|
||||
await page.autocompleteSearch(selectors.createClientView.province, 'Province one');
|
||||
await page.write(selectors.createClientView.city, 'Valencia');
|
||||
|
@ -113,7 +112,6 @@ describe('Client create path', async() => {
|
|||
});
|
||||
|
||||
it(`should search for the user Carol Danvers to confirm it exists`, async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.accessToSearchResult('Carol Danvers');
|
||||
let url = await page.expectURL('#!/client/114/summary');
|
||||
|
|
@ -70,14 +70,14 @@ describe('Client Edit basicData path', () => {
|
|||
});
|
||||
|
||||
describe('as salesAssistant', () => {
|
||||
beforeAll(async() => {
|
||||
it('should navigate to a client basic data', async() => {
|
||||
await page.loginAndModule('salesASsistant', 'client');
|
||||
await page.accessToSearchResult('Ptonomy Wallace');
|
||||
await page.accessToSection('client.card.basicData');
|
||||
});
|
||||
}, 30000);
|
||||
|
||||
it('should be able to change the salesPerson', async() => {
|
||||
await page.wait(selectors.clientBasicData.name);
|
||||
await page.waitForSelector(selectors.clientBasicData.name);
|
||||
const result = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.clientBasicData.salesPerson} input`);
|
|
@ -83,7 +83,7 @@ describe('Client Edit fiscalData path', () => {
|
|||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Invalid Tax number');
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
it(`should edit the fiscal this time with a valid fiscal id`, async() => {
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalId);
|
|
@ -24,7 +24,6 @@ describe('Client Add credit path', () => {
|
|||
});
|
||||
|
||||
it(`should edit the credit`, async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.clearInput(selectors.clientCredit.credit);
|
||||
await page.write(selectors.clientCredit.credit, '999');
|
||||
await page.waitToClick(selectors.clientCredit.saveButton);
|
||||
|
@ -34,7 +33,6 @@ describe('Client Add credit path', () => {
|
|||
});
|
||||
|
||||
it('should confirm the credit was updated', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
const result = await page.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText');
|
||||
|
||||
expect(result).toContain(999);
|
|
@ -17,7 +17,6 @@ describe('Client balance path', () => {
|
|||
|
||||
it('should now edit the local user config data', async() => {
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.waitForContentLoaded();
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs');
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
|
@ -118,7 +117,6 @@ describe('Client balance path', () => {
|
|||
});
|
||||
|
||||
it('should now search for the user Petter Parker', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.write(selectors.clientsIndex.topbarSearch, 'Petter Parker');
|
||||
await page.waitToClick(selectors.clientsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1);
|
|
@ -21,7 +21,7 @@ describe('User config', () => {
|
|||
|
||||
it('should now open the user config form to check the settings', async() => {
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.waitFor(1000);
|
||||
await page.waitForContentLoaded();
|
||||
|
||||
let expectedLocalWarehouse = await page
|
||||
.expectPropertyValue(selectors.globalItems.userLocalWarehouse, 'value', '');
|
|
@ -41,7 +41,6 @@ describe('Item Edit basic data path', () => {
|
|||
|
||||
it(`should confirm the item name was edited`, async() => {
|
||||
await page.reloadSection('item.card.basicData');
|
||||
await page.waitForContentLoaded();
|
||||
const result = await page.waitToGetProperty(selectors.itemBasicData.name, 'value');
|
||||
|
||||
expect(result).toEqual('Rose of Purity');
|
|
@ -40,7 +40,6 @@ describe('Item Create/Clone path', () => {
|
|||
});
|
||||
|
||||
it('should now access to the create item view by clicking the create floating button', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||
let url = await page.expectURL('#!/item/create');
|
||||
|
|
@ -81,7 +81,6 @@ describe('Item regularize path', () => {
|
|||
});
|
||||
|
||||
it('should clear the user local settings now', async() => {
|
||||
await page.waitForTransitionEnd('vn-searchbar');
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
|
||||
const result = await page.waitForLastSnackbar();
|
|
@ -25,7 +25,7 @@ describe('Ticket Create notes path', () => {
|
|||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
it('should confirm the note is the expected one', async() => {
|
||||
await page.reloadSection('ticket.card.observation');
|
|
@ -26,7 +26,6 @@ describe('Ticket descriptor path', () => {
|
|||
it('should go back to the ticket index then search and access a ticket summary', async() => {
|
||||
await page.accessToSection('ticket.index');
|
||||
await page.accessToSearchResult('11');
|
||||
await page.waitForContentLoaded();
|
||||
});
|
||||
|
||||
it('should add the ticket to thursday turn using the descriptor more menu', async() => {
|
||||
|
@ -64,7 +63,6 @@ describe('Ticket descriptor path', () => {
|
|||
});
|
||||
|
||||
it('should now search for the ticket 11', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.write(selectors.ticketsIndex.topbarSearch, '11');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
|
@ -81,7 +79,6 @@ describe('Ticket descriptor path', () => {
|
|||
});
|
||||
|
||||
it('should add the ticket to saturday turn using the descriptor more menu', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
|
||||
await page.waitToClick(selectors.ticketDescriptor.saturdayButton);
|
|
@ -34,7 +34,6 @@ describe('Ticket descriptor path', () => {
|
|||
});
|
||||
|
||||
it(`should update the shipped hour using the descriptor menu`, async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour);
|
||||
await page.pickTime(selectors.ticketDescriptor.changeShippedHour, '08:15');
|
||||
|
@ -130,7 +129,6 @@ describe('Ticket descriptor path', () => {
|
|||
});
|
||||
|
||||
it('should delete the stowaway', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton);
|
||||
await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton);
|
|
@ -26,7 +26,7 @@ describe('Ticket services path', () => {
|
|||
const result = await page.isDisabled(selectors.ticketService.firstAddServiceTypeButton);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
it('should receive an error if you attempt to save a service without access rights', async() => {
|
||||
await page.clearInput(selectors.ticketService.firstPrice);
|
||||
|
@ -50,7 +50,6 @@ describe('Ticket services path', () => {
|
|||
});
|
||||
|
||||
it('should click on the add button to prepare the form to create a new service', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketService.addServiceButton);
|
||||
const result = await page
|
||||
.isVisible(selectors.ticketService.firstServiceType);
|
|
@ -17,7 +17,6 @@ describe('Ticket create from client path', () => {
|
|||
});
|
||||
|
||||
it('should click the create simple ticket on the descriptor menu', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.clientDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.clientDescriptor.simpleTicketButton);
|
||||
let url = await page.expectURL('clientFk=102');
|
|
@ -29,7 +29,7 @@ describe('Claim development', () => {
|
|||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
it(`should redirect to the next section of claims as the role is salesAssistant`, async() => {
|
||||
let url = await page.expectURL('/action');
|
|
@ -24,7 +24,6 @@ describe('claim Descriptor path', () => {
|
|||
});
|
||||
|
||||
it(`should not be able to see the delete claim button of the descriptor more menu`, async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.claimDescriptor.moreMenu);
|
||||
await page.waitForSelector(selectors.claimDescriptor.moreMenuDeleteClaim, {hidden: true});
|
||||
});
|
|
@ -27,7 +27,7 @@ describe('Order edit basic data path', () => {
|
|||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(`You can't make changes on the basic data of an confirmed order or with rows`);
|
||||
}, 15000);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when order with rows', () => {
|
||||
|
@ -39,7 +39,6 @@ describe('Order edit basic data path', () => {
|
|||
await page.waitForContentLoaded();
|
||||
await page.accessToSearchResult(orderId);
|
||||
await page.accessToSection('order.card.basicData');
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitForSelector(selectors.orderBasicData.observation, {visible: true});
|
||||
let url = await page.expectURL(`#!/order/${orderId}/basic-data`);
|
||||
|
||||
|
@ -47,7 +46,6 @@ describe('Order edit basic data path', () => {
|
|||
});
|
||||
|
||||
it('should not be able to change anything', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.write(selectors.orderBasicData.observation, 'observation');
|
||||
await page.waitToClick(selectors.orderBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
|
@ -35,9 +35,7 @@ describe('Order catalog', () => {
|
|||
});
|
||||
|
||||
it('should add the realm and type filters and obtain results', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.orderCatalog.plantRealmButton);
|
||||
await page.waitForContentLoaded();
|
||||
await page.autocompleteSearch(selectors.orderCatalog.type, 'Anthurium');
|
||||
await page.waitForNumberOfElements('section.product', 4);
|
||||
const result = await page.countElement('section.product');
|
|
@ -31,7 +31,7 @@ describe('Route basic Data path', () => {
|
|||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
it('should confirm the worker was edited', async() => {
|
||||
await page.reloadSection('route.card.basicData');
|
|
@ -23,7 +23,6 @@ describe('InvoiceOut summary path', () => {
|
|||
});
|
||||
|
||||
it('should contain the company from which the invoice is emited', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
const result = await page.waitToGetProperty(selectors.invoiceOutSummary.company, 'innerText');
|
||||
|
||||
expect(result).toEqual('Company VNL');
|
|
@ -37,7 +37,6 @@ describe('InvoiceOut descriptor path', () => {
|
|||
});
|
||||
|
||||
it('should search for the target invoiceOut', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.write(selectors.invoiceOutIndex.topbarSearch, 'T2222222');
|
||||
await page.waitToClick(selectors.invoiceOutIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 1);
|
||||
|
@ -108,7 +107,6 @@ describe('InvoiceOut descriptor path', () => {
|
|||
});
|
||||
|
||||
it(`should search and access to the invoiceOut summary`, async() => {
|
||||
await page.waitForContentLoaded();
|
||||
await page.accessToSearchResult('T1111111');
|
||||
let url = await page.expectURL('/summary');
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Travel thermograph path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'travel');
|
||||
await page.accessToSearchResult('3');
|
||||
await page.accessToSection('travel.card.thermograph.index');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should reach the thermograph section', async() => {
|
||||
const result = await page.expectURL('/thermograph/index');
|
||||
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should click the add thermograph floating button', async() => {
|
||||
await page.waitToClick(selectors.travelThermograph.add);
|
||||
const result = await page.expectURL('/thermograph/create');
|
||||
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should select the thermograph and then the file to upload', async() => {
|
||||
let currentDir = process.cwd();
|
||||
let filePath = `${currentDir}/e2e/dms/ecc/3.jpeg`;
|
||||
await page.autocompleteSearch(selectors.travelThermograph.thermographID, '138350-0');
|
||||
|
||||
const [fileChooser] = await Promise.all([
|
||||
page.waitForFileChooser(),
|
||||
page.waitToClick(selectors.travelThermograph.uploadIcon)
|
||||
]);
|
||||
await fileChooser.accept([filePath]);
|
||||
|
||||
await page.waitToClick(selectors.travelThermograph.upload);
|
||||
});
|
||||
|
||||
it('should reload the section and check everything was saved', async() => {
|
||||
let createdThermograph = await page.waitToGetProperty(selectors.travelThermograph.createdThermograph, 'innerText');
|
||||
|
||||
expect(createdThermograph).toContain('138350-0');
|
||||
});
|
||||
});
|
|
@ -174,12 +174,13 @@ function e2eSingleRun() {
|
|||
`${__dirname}/e2e/paths/07*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/08*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/09*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/10*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/**/*[sS]pec.js`
|
||||
];
|
||||
|
||||
return gulp.src(specFiles).pipe(jasmine({
|
||||
errorOnFail: false,
|
||||
timeout: 10000,
|
||||
timeout: 30000,
|
||||
reporter: [
|
||||
new SpecReporter({
|
||||
spec: {
|
||||
|
|
Loading…
Reference in New Issue