e2e path updated + test fix
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-10-19 20:49:38 +02:00
parent dc7c541b1d
commit a61a6e7c6a
6 changed files with 52 additions and 13 deletions

View File

@ -42,13 +42,24 @@ export default {
taxNumber: 'vn-client-create vn-textfield[ng-model="$ctrl.client.fi"]',
socialName: 'vn-client-create vn-textfield[ng-model="$ctrl.client.socialName"]',
street: 'vn-client-create vn-textfield[ng-model="$ctrl.client.street"]',
addPostCode: 'vn-client-create vn-datalist[ng-model="$ctrl.client.postcode"] vn-icon-button[icon="add_circle"]',
addProvince: 'vn-autocomplete[ng-model="$ctrl.location.provinceFk"] vn-icon-button[icon="add_circle"]',
addCity: 'vn-autocomplete[ng-model="$ctrl.location.townFk"] vn-icon-button[icon="add_circle"]',
newProvinceName: 'vn-textfield[ng-model="$ctrl.province.name"]',
newCityName: 'vn-textfield[ng-model="$ctrl.city.name"]',
newCityProvince: 'vn-autocomplete[ng-model="$ctrl.city.provinceFk"]',
newPostcode: 'vn-textfield[ng-model="$ctrl.location.code"]',
postcode: 'vn-client-create vn-datalist[ng-model="$ctrl.client.postcode"]',
city: 'vn-client-create vn-datalist[ng-model="$ctrl.client.city"]',
province: 'vn-client-create vn-autocomplete[ng-model="$ctrl.client.provinceFk"]',
province: 'vn-autocomplete[ng-model="$ctrl.client.provinceFk"]',
country: 'vn-client-create vn-autocomplete[ng-model="$ctrl.client.countryFk"]',
dialogCountry: 'vn-autocomplete[ng-model="$ctrl.province.countryFk"]',
userName: 'vn-client-create vn-textfield[ng-model="$ctrl.client.userName"]',
email: 'vn-client-create vn-textfield[ng-model="$ctrl.client.email"]',
salesPerson: 'vn-client-create vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]',
saveNewProvicenButton: '#saveProvince',
saveNewCityButton: '#saveCity',
saveNewPoscode: '#savePostcode',
createButton: 'vn-client-create button[type=submit]'
},
clientDescriptor: {

View File

@ -8,7 +8,7 @@ describe('Client create path', () => {
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'client');
await page.loginAndModule(' deliveryBoss', 'client');
});
afterAll(async() => {
@ -45,14 +45,40 @@ describe('Client create path', () => {
expect(message.text).toBe('Some fields are invalid');
});
it(`should create a new province`, async() => {
await page.waitToClick(selectors.createClientView.addPostCode);
await page.waitToClick(selectors.createClientView.addProvince);
await page.write(selectors.createClientView.newProvinceName, 'Massachusetts');
await page.autocompleteSearch(selectors.createClientView.dialogCountry, 'España');
await page.waitToClick(selectors.createClientView.saveNewProvicenButton);
const message = await page.waitForSnackbar();
expect(message.text).toBe('The province has been created');
});
it(`should create a new city`, async() => {
await page.waitToClick(selectors.createClientView.addCity);
await page.write(selectors.createClientView.newCityName, 'Boston');
await page.autocompleteSearch(selectors.createClientView.newCityProvince, 'Massachusetts');
await page.waitToClick(selectors.createClientView.saveNewCityButton);
const message = await page.waitForSnackbar();
expect(message.text).toBe('The city has been created');
});
it(`should create a new post code`, async() => {
await page.write(selectors.createClientView.newPostcode, '61616');
await page.waitToClick(selectors.createClientView.saveNewPoscode);
const message = await page.waitForSnackbar();
expect(message.text).toBe('The postcode has been created. You can save the data now');
});
it(`should attempt to create a new user with all it's data but wrong email`, 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.autocompleteSearch(selectors.createClientView.country, 'España');
await page.autocompleteSearch(selectors.createClientView.province, 'Province one');
await page.write(selectors.createClientView.city, 'Valencia');
await page.write(selectors.createClientView.postcode, '46000');
await page.clearInput(selectors.createClientView.email);
await page.write(selectors.createClientView.email, 'incorrect email format');
await page.waitToClick(selectors.createClientView.createButton);
@ -82,14 +108,14 @@ describe('Client create path', () => {
const clientCountry = await page
.waitToGetProperty(selectors.createClientView.country, 'value');
expect(clientCity).toEqual('Valencia');
expect(clientProvince).toContain('Province one');
expect(clientCity).toEqual('Boston');
expect(clientProvince).toContain('Massachusetts');
expect(clientCountry).toEqual('España');
});
it(`should create a new user with all correct data`, async() => {
await page.clearInput(selectors.createClientView.postcode);
await page.write(selectors.createClientView.postcode, '46000');
await page.write(selectors.createClientView.postcode, '61616');
await page.waitToClick(selectors.createClientView.createButton);
const message = await page.waitForSnackbar();

View File

@ -26,7 +26,9 @@ describe('Entry create path', () => {
await page.autocompleteSearch(selectors.entryIndex.newEntryCompany, 'ORN');
await page.waitToClick(selectors.entryIndex.saveNewEntry);
await page.waitFor(500);
await page.waitForNavigation({
waitUntil: 'load',
});
await page.waitForState('entry.card.basicData');
});
});

View File

@ -22,6 +22,6 @@
</tpl-body>
<tpl-buttons>
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Save</button>
<button id="saveCity" response="accept" translate>Save</button>
</tpl-buttons>
</vn-dialog>

View File

@ -61,7 +61,7 @@
</tpl-body>
<tpl-buttons>
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Save</button>
<button id= "savePostcode" response="accept" translate>Save</button>
</tpl-buttons>
</vn-dialog>
<!-- New province dialog -->

View File

@ -22,6 +22,6 @@
</tpl-body>
<tpl-buttons>
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Save</button>
<button id="saveProvince" response="accept" translate>Save</button>
</tpl-buttons>
</vn-dialog>