test: refs #7356 fix test ticketSale
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
20f3525e50
commit
21c9abf273
|
@ -4,7 +4,7 @@ const firstRow = 'tbody > :nth-child(1)';
|
|||
describe('TicketSale', () => {
|
||||
describe('#23', () => {
|
||||
beforeEach(() => {
|
||||
cy.login('salesPerson');
|
||||
cy.login('salesBoss');
|
||||
cy.viewport(1920, 1080);
|
||||
cy.visit('/#/ticket/23/sale');
|
||||
});
|
||||
|
@ -17,11 +17,11 @@ describe('TicketSale', () => {
|
|||
cy.dataCy('ticketEditManaProxy').should('exist');
|
||||
cy.waitForElement('[data-cy="Price_input"]');
|
||||
cy.dataCy('Price_input').clear().type(price);
|
||||
cy.intercept('POST', '**/api').as('saveMana');
|
||||
cy.intercept('POST', /\/api\/Sales\/\d+\/updatePrice/).as('updatePrice');
|
||||
|
||||
cy.dataCy('saveManaBtn').click();
|
||||
cy.wait('@saveMana').its('response.statusCode').should('eq', 200);
|
||||
handleVnConfirm();
|
||||
cy.wait('@updatePrice').its('response.statusCode').should('eq', 200);
|
||||
|
||||
cy.get('[data-col-field="price"]')
|
||||
.find('.q-btn > .q-btn__content')
|
||||
|
@ -34,13 +34,14 @@ describe('TicketSale', () => {
|
|||
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
||||
cy.dataCy('ticketEditManaProxy').should('exist');
|
||||
cy.waitForElement('[data-cy="Disc_input"]');
|
||||
cy.dataCy('Disc_input').clear();
|
||||
cy.dataCy('Disc_input').type(discount);
|
||||
cy.intercept('POST', '**/api').as('saveMana');
|
||||
cy.dataCy('Disc_input').clear().type(discount);
|
||||
cy.intercept('POST', /\/api\/Tickets\/\d+\/updateDiscount/).as(
|
||||
'updateDiscount',
|
||||
);
|
||||
|
||||
cy.dataCy('saveManaBtn').click();
|
||||
cy.wait('@saveMana').its('response.statusCode').should('eq', 200);
|
||||
handleVnConfirm();
|
||||
cy.wait('@updateDiscount').its('response.statusCode').should('eq', 204);
|
||||
|
||||
cy.get('[data-col-field="discount"]')
|
||||
.find('.q-btn > .q-btn__content')
|
||||
|
@ -51,6 +52,8 @@ describe('TicketSale', () => {
|
|||
const concept = Math.floor(Math.random() * 100) + 1;
|
||||
cy.waitForElement(firstRow);
|
||||
cy.get('[data-col-field="item"]').click();
|
||||
cy.intercept('POST', '**/api').as('postRequest');
|
||||
|
||||
cy.get('.q-menu')
|
||||
.find('[data-cy="undefined_input"]')
|
||||
.type(concept)
|
||||
|
@ -63,6 +66,8 @@ describe('TicketSale', () => {
|
|||
const quantity = Math.floor(Math.random() * 100) + 1;
|
||||
cy.waitForElement(firstRow);
|
||||
cy.dataCy('ticketSaleQuantityInput').find('input').clear();
|
||||
cy.intercept('POST', '**/api').as('postRequest');
|
||||
|
||||
cy.dataCy('ticketSaleQuantityInput')
|
||||
.find('input')
|
||||
.type(quantity)
|
||||
|
@ -134,7 +139,9 @@ describe('TicketSale', () => {
|
|||
cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
|
||||
});
|
||||
|
||||
it('should update discount when "Update discount" is clicked', () => {
|
||||
it.only('should update discount when "Update discount" is clicked', () => {
|
||||
const discount = Number((Math.random() * 99 + 1).toFixed(2));
|
||||
|
||||
selectFirstRow();
|
||||
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||
cy.waitForElement('[data-cy="updateDiscountItem"]');
|
||||
|
@ -142,11 +149,13 @@ describe('TicketSale', () => {
|
|||
cy.dataCy('updateDiscountItem').click();
|
||||
cy.waitForElement('[data-cy="ticketSaleDiscountInput"]');
|
||||
cy.dataCy('ticketSaleDiscountInput').find('input').focus();
|
||||
cy.dataCy('ticketSaleDiscountInput').find('input').type('10');
|
||||
cy.intercept('POST', '**/api').as('saveMana');
|
||||
cy.intercept('POST', /\/api\/Tickets\/\d+\/updateDiscount/).as(
|
||||
'updateDiscount',
|
||||
);
|
||||
cy.dataCy('ticketSaleDiscountInput').find('input').type(discount);
|
||||
|
||||
cy.dataCy('saveManaBtn').click();
|
||||
cy.wait('@saveMana').its('response.statusCode').should('eq', 200);
|
||||
cy.wait('@updateDiscount').its('response.statusCode').should('eq', 204);
|
||||
cy.checkNotification('Data saved');
|
||||
cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
|
||||
});
|
||||
|
@ -202,5 +211,6 @@ function selectFirstRow() {
|
|||
}
|
||||
function handleVnConfirm() {
|
||||
cy.confirmVnConfirm();
|
||||
|
||||
cy.checkNotification('Data saved');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue