refactor(ticket_sale): split e2e, change name backTest
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
8794f8639f
commit
f67a4355db
|
@ -206,11 +206,13 @@ describe('Ticket Edit sale path', () => {
|
||||||
expect(message.text).toContain('Data saved!');
|
expect(message.text).toContain('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should select the third sale and create a pay back', async() => {
|
it('should log in as salesAssistant and navigate to ticket sales', async() => {
|
||||||
await page.loginAndModule('salesAssistant', 'ticket');
|
await page.loginAndModule('salesAssistant', 'ticket');
|
||||||
await page.accessToSearchResult('16');
|
await page.accessToSearchResult('16');
|
||||||
await page.accessToSection('ticket.card.sale');
|
await page.accessToSection('ticket.card.sale');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should select the third sale and create a pay back', async() => {
|
||||||
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
||||||
await page.waitToClick(selectors.ticketSales.moreMenu);
|
await page.waitToClick(selectors.ticketSales.moreMenu);
|
||||||
await page.waitToClick(selectors.ticketSales.moreMenuPayBack);
|
await page.waitToClick(selectors.ticketSales.moreMenuPayBack);
|
||||||
|
|
|
@ -45,9 +45,9 @@ module.exports = Self => {
|
||||||
|
|
||||||
const isClaimManager = await Self.app.models.Account.hasRole(userId, 'claimManager');
|
const isClaimManager = await Self.app.models.Account.hasRole(userId, 'claimManager');
|
||||||
const isSalesAssistant = await Self.app.models.Account.hasRole(userId, 'salesAssistant');
|
const isSalesAssistant = await Self.app.models.Account.hasRole(userId, 'salesAssistant');
|
||||||
const checkRoles = isClaimManager || isSalesAssistant;
|
const hasValidRole = isClaimManager || isSalesAssistant;
|
||||||
|
|
||||||
if (!checkRoles)
|
if (!hasValidRole)
|
||||||
throw new UserError(`You don't have privileges to create pay back`);
|
throw new UserError(`You don't have privileges to create pay back`);
|
||||||
|
|
||||||
sales.forEach(sale => {
|
sales.forEach(sale => {
|
||||||
|
|
|
@ -26,7 +26,7 @@ describe('sale payBack()', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error for not have privileges', async() => {
|
it(`should throw an error if the user doesn't have privileges to create a pay back`, async() => {
|
||||||
const tx = await models.Sale.beginTransaction({});
|
const tx = await models.Sale.beginTransaction({});
|
||||||
const ctx = {req: {accessToken: {userId: 1}}};
|
const ctx = {req: {accessToken: {userId: 1}}};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue