#1568 e2e claim descriptor
gitea/salix/dev This commit has test failures Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-06-28 14:01:43 +02:00
parent 27104b44a7
commit 99cdc7ad3b
2 changed files with 75 additions and 0 deletions

View File

@ -494,6 +494,11 @@ export default {
searchResult: 'vn-claim-index vn-card > div > vn-table > div > vn-tbody > a',
searchButton: 'vn-claim-index vn-searchbar vn-icon[icon="search"]'
},
claimDescriptor: {
moreMenu: 'vn-claim-descriptor vn-icon-menu[vn-id="more-button"]',
moreMenuDeleteClaim: 'vn-claim-descriptor vn-icon-menu vn-drop-down li[name="Delete claim"]',
acceptDeleteClaim: 'vn-claim-descriptor > vn-confirm[vn-id="confirm-delete-claim"] button[response="ACCEPT"]'
},
claimSummary: {
header: 'vn-claim-summary > vn-card > div > h5',
state: 'vn-claim-summary vn-label-value[label="State"] > section > span',

View File

@ -0,0 +1,70 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('claim Descriptor path', () => {
const nightmare = createNightmare();
const claimId = 1;
it('should navigate to the target claim summary section', async() => {
let url = await nightmare
.loginAndModule('employee', 'claim')
.accessToSearchResult(claimId)
.waitForURL('/summary')
.parsedUrl();
expect(url.hash).toContain('/summary');
});
it(`should not be able to see the delete claim button of the descriptor more menu`, async() => {
let exists = await nightmare
.waitToClick(selectors.claimDescriptor.moreMenu)
.exists(selectors.claimDescriptor.moreMenuDeleteClaim);
expect(exists).toBeFalsy();
});
it(`should log in as salesAssistant and navigate to the target claim`, async() => {
let url = await nightmare
.loginAndModule('salesAssistant', 'claim')
.accessToSearchResult(claimId)
.waitForURL('/summary')
.parsedUrl();
expect(url.hash).toContain('/summary');
});
it(`should be able to see the delete claim button of the descriptor more menu`, async() => {
let exists = await nightmare
.waitToClick(selectors.claimDescriptor.moreMenu)
.exists(selectors.claimDescriptor.moreMenuDeleteClaim);
expect(exists).toBeTruthy();
});
it(`should delete the claim`, async() => {
let result = await nightmare
.waitToClick(selectors.claimDescriptor.moreMenuDeleteClaim)
.waitToClick(selectors.claimDescriptor.acceptDeleteClaim)
.waitForLastSnackbar();
expect(result).toEqual('Claim deleted!');
});
it(`should have been relocated to the claim index`, async() => {
let url = await nightmare
.waitForURL('/claim/index')
.parsedUrl();
expect(url.hash).toContain('/claim/index');
});
it(`should search for the deleted claim to find no results`, async() => {
const result = await nightmare
.write(selectors.claimsIndex.searchClaimInput, claimId)
.waitToClick(selectors.claimsIndex.searchButton)
.waitForNumberOfElements(selectors.claimsIndex.searchResult, 0)
.countElement(selectors.claimsIndex.searchResult);
expect(result).toEqual(0);
});
});