0
1
Fork 0

e2e order creation flow

This commit is contained in:
William Buezas 2024-10-14 08:23:27 -03:00
parent 2d9225f05f
commit bbaa6f936e
4 changed files with 46 additions and 4 deletions

View File

@ -54,11 +54,11 @@
"@quasar/extras": "^1.0.0", "@quasar/extras": "^1.0.0",
"axios": "^0.21.1", "axios": "^0.21.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"eslint-plugin-cypress": "^2.13.3",
"js-yaml": "^3.12.1", "js-yaml": "^3.12.1",
"mootools": "^1.5.2", "mootools": "^1.5.2",
"pinia": "^2.0.11", "pinia": "^2.0.11",
"promise-polyfill": "^8.2.3", "promise-polyfill": "^8.2.3",
"eslint-plugin-cypress": "^2.13.3",
"quasar": "^2.6.0", "quasar": "^2.6.0",
"require-yaml": "0.0.1", "require-yaml": "0.0.1",
"tinymce": "^6.3.0", "tinymce": "^6.3.0",

View File

@ -30,7 +30,7 @@ const currentStep = ref('method');
const id = route.params.id; const id = route.params.id;
const orderForm = ref({ const orderForm = ref({
method: 'AGENCY', method: 'AGENCY',
date: '', date: formatDate(Date.vnNew(), 'YYYY/MM/DD'),
address: '' address: ''
}); });
@ -322,6 +322,7 @@ onMounted(async () => {
:flat="isMobile" :flat="isMobile"
contracted contracted
class="default-radius stepper-container" class="default-radius stepper-container"
data-testid="checkoutStepper"
> >
<QStep <QStep
v-for="(step, stepIndex) in steps[orderForm.method]" v-for="(step, stepIndex) in steps[orderForm.method]"
@ -374,6 +375,7 @@ onMounted(async () => {
<QList <QList
v-if="step.name === 'address'" v-if="step.name === 'address'"
class="vn-w-xs q-gutter-y-sm column" class="vn-w-xs q-gutter-y-sm column"
data-testid="checkoutAddressStep"
> >
<span class="text-h6 step-title"> <span class="text-h6 step-title">
{{ {{
@ -417,6 +419,7 @@ onMounted(async () => {
option-label="description" option-label="description"
option-value="id" option-value="id"
:options="agencies" :options="agencies"
data-testid="agencyStepSelect"
/> />
</div> </div>
<div <div
@ -431,6 +434,7 @@ onMounted(async () => {
option-label="description" option-label="description"
option-value="id" option-value="id"
:options="warehouses" :options="warehouses"
data-testid="pickupStepSelect"
/> />
</div> </div>
<!-- Confirm step --> <!-- Confirm step -->
@ -457,6 +461,7 @@ onMounted(async () => {
icon="arrow_back" icon="arrow_back"
dense dense
class="left-navigation-button" class="left-navigation-button"
data-testid="checkoutStepperLeftButton"
> >
<QTooltip> <QTooltip>
{{ t(`${step.backButtonLabel || 'back'}`) }} {{ t(`${step.backButtonLabel || 'back'}`) }}
@ -471,6 +476,7 @@ onMounted(async () => {
" "
dense dense
class="right-navigation-button" class="right-navigation-button"
data-testid="checkoutStepperRightButton"
> >
<QTooltip> <QTooltip>
{{ t(`${step.nextButtonLabel || 'next'}`) }} {{ t(`${step.nextButtonLabel || 'next'}`) }}

View File

@ -6,7 +6,13 @@ describe('User flow 1', () => {
cy.changeLanguage('es'); cy.changeLanguage('es');
}); });
it('should log in successfully', () => { const checkoutNextStep = () => {
cy.get('[data-testid="checkoutStepperRightButton"]')
.should('be.visible')
.click();
};
it('should success', () => {
// 1- Loguear como empleado // 1- Loguear como empleado
cy.loginFlow('employee'); cy.loginFlow('employee');
@ -22,10 +28,33 @@ describe('User flow 1', () => {
'¿Quieres recibir o recoger el pedido?' '¿Quieres recibir o recoger el pedido?'
); );
cy.get('[aria-label="Recibir en mi tienda"]').click(); cy.get('[aria-label="Recibir en mi tienda"]').click();
cy.get('[data-testid="checkoutStepperRightButton"]').click();
checkoutNextStep();
cy.get('[data-testid="checkoutStepper"]').should( cy.get('[data-testid="checkoutStepper"]').should(
'contain', 'contain',
'¿Qué día quieres recibir el pedido?' '¿Qué día quieres recibir el pedido?'
); );
checkoutNextStep();
cy.get('[data-testid="checkoutStepper"]').should(
'contain',
'¿Dónde quieres recibir el pedido?'
);
cy.get('[data-testid="checkoutAddressStep"]').within(() => {
cy.get('label:first').click();
});
checkoutNextStep();
cy.get('[data-testid="checkoutStepper"]').should(
'contain',
'¿Cómo quieres recibir el pedido?'
);
cy.get('[data-testid="agencyStepSelect"]').should('exist');
cy.selectOption('[data-testid="agencyStepSelect"]', 'Other agency');
checkoutNextStep();
checkoutNextStep();
cy.url().should('contain', '/#/ecomerce/catalog');
cy.get('.q-notification__message:first').should(
'have.text',
'¡Pedido cargado en la cesta!'
);
}); });
}); });

View File

@ -79,3 +79,10 @@ Cypress.Commands.add('changeLanguage', language => {
cy.get('[data-testid="switchLanguage"]').click(); cy.get('[data-testid="switchLanguage"]').click();
cy.get('.q-menu .q-item').eq(index).click(); // Selecciona y hace clic en el tercer elemento "index" de la lista cy.get('.q-menu .q-item').eq(index).click(); // Selecciona y hace clic en el tercer elemento "index" de la lista
}); });
// Fill Inputs
Cypress.Commands.add('selectOption', (selector, option) => {
cy.waitForElement(selector);
cy.get(selector).click();
cy.get('.q-menu .q-item').contains(option).click();
});