Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts adjustments #3

Merged
merged 16 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/explicit-function-return-type": "error"
}
}
3 changes: 3 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ jobs:
- name: Check Prettier Formatting
run: npm run prettier:check

- name: Run Typescript Check
run: npm run typecheck

- name: Run ESLint on TS Files
run: npm run lint
4 changes: 2 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from 'cypress';
import dotenv from 'dotenv';
import * as fs from 'fs';
import { existsSync } from 'fs';

dotenv.config();

Expand Down Expand Up @@ -30,7 +30,7 @@ export default defineConfig({
setupNodeEvents(on) {
on('task', {
isFileExists(filename: string): boolean {
return fs.existsSync(filename);
return existsSync(filename);
},
});
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import { CartPage } from '../../../support/pages/yves';
import { CheckoutScenario, CustomerLoginScenario } from '../../../support/scenarios/yves';
import { container } from '../../../support/utils/inversify/inversify.config';
import {
OrderManagementStaticFixtures,
OrderManagementSuite1DynamicFixtures,
} from '../../../support/types/backoffice/order-managment/fixture-types';
import { UserLoginScenario } from '../../../support/scenarios/backoffice';
import { SalesIndexPage } from '../../../support/pages/backoffice';
import { OrderManagementStaticFixtures, OrderManagementSuite1DynamicFixtures } from '@interfaces/backoffice';
import { SalesIndexPage } from '@pages/backoffice';
import { CartPage } from '@pages/yves';
import { UserLoginScenario } from '@scenarios/backoffice';
import { CheckoutScenario, CustomerLoginScenario } from '@scenarios/yves';
import { container } from '@utils';

describe('order management suite 1', { tags: ['@order-management'] }, (): void => {
const cartPage: CartPage = container.get(CartPage);
const salesIndexPage: SalesIndexPage = container.get(SalesIndexPage);
const loginCustomerScenario: CustomerLoginScenario = container.get(CustomerLoginScenario);
const checkoutScenario: CheckoutScenario = container.get(CheckoutScenario);
const userLoginScenario: UserLoginScenario = container.get(UserLoginScenario);
const cartPage = container.get(CartPage);
const salesIndexPage = container.get(SalesIndexPage);
const loginCustomerScenario = container.get(CustomerLoginScenario);
const checkoutScenario = container.get(CheckoutScenario);
const userLoginScenario = container.get(UserLoginScenario);

let staticFixtures: OrderManagementStaticFixtures;
let dynamicFixtures: OrderManagementSuite1DynamicFixtures;
Expand All @@ -23,12 +20,19 @@ describe('order management suite 1', { tags: ['@order-management'] }, (): void =
});

it('should be able to create an order by existing customer', (): void => {
loginCustomerScenario.execute(dynamicFixtures.customer.email, staticFixtures.defaultPassword);
loginCustomerScenario.execute({ email: dynamicFixtures.customer.email, password: staticFixtures.defaultPassword });

checkoutScenario.execute(false, false, dynamicFixtures.address.id_customer_address);
checkoutScenario.execute({
isGuest: false,
isMultiShipment: false,
idCustomerAddress: dynamicFixtures.address.id_customer_address,
});
cy.contains('Your order has been placed successfully!');

userLoginScenario.execute(dynamicFixtures.rootUser.username, staticFixtures.defaultPassword);
userLoginScenario.execute({
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});
salesIndexPage.viewLastPlacedOrder();

cy.get('body').contains(dynamicFixtures.product.name);
Expand All @@ -38,10 +42,13 @@ describe('order management suite 1', { tags: ['@order-management'] }, (): void =
cartPage.visit();
cartPage.quickAddToCart(dynamicFixtures.product.sku, 1);

checkoutScenario.execute(true);
checkoutScenario.execute({ isGuest: true });
cy.contains('Your order has been placed successfully!');

userLoginScenario.execute(dynamicFixtures.rootUser.username, staticFixtures.defaultPassword);
userLoginScenario.execute({
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});
salesIndexPage.viewLastPlacedOrder();

cy.get('body').contains(dynamicFixtures.product.name);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import { container } from '../../../support/utils/inversify/inversify.config';
import { SalesDetailPage, SalesIndexPage, SalesReturnGuiCreatePage } from '../../../support/pages/backoffice';
import { CheckoutScenario, CustomerLoginScenario } from '../../../support/scenarios/yves';
import { UserLoginScenario } from '../../../support/scenarios/backoffice';
import {
ReturnManagementStaticFixtures,
ReturnManagementSuite1DynamicFixtures,
} from '../../../support/types/backoffice/return-managment/fixture-types';
import { ReturnManagementStaticFixtures, ReturnManagementSuite1DynamicFixtures } from '@interfaces/backoffice';
import { SalesDetailPage, SalesIndexPage, SalesReturnGuiCreatePage } from '@pages/backoffice';
import { UserLoginScenario } from '@scenarios/backoffice';
import { CheckoutScenario, CustomerLoginScenario } from '@scenarios/yves';
import { container } from '@utils';

describe('return management suite 1', { tags: ['@return-management'] }, (): void => {
const salesIndexPage: SalesIndexPage = container.get(SalesIndexPage);
const salesDetailPage: SalesDetailPage = container.get(SalesDetailPage);
const salesReturnGuiCreatePage: SalesReturnGuiCreatePage = container.get(SalesReturnGuiCreatePage);
const customerLoginScenario: CustomerLoginScenario = container.get(CustomerLoginScenario);
const userLoginScenario: UserLoginScenario = container.get(UserLoginScenario);
const checkoutScenario: CheckoutScenario = container.get(CheckoutScenario);
const salesIndexPage = container.get(SalesIndexPage);
const salesDetailPage = container.get(SalesDetailPage);
const salesReturnGuiCreatePage = container.get(SalesReturnGuiCreatePage);
const customerLoginScenario = container.get(CustomerLoginScenario);
const userLoginScenario = container.get(UserLoginScenario);
const checkoutScenario = container.get(CheckoutScenario);

let dynamicFixtures: ReturnManagementSuite1DynamicFixtures;
let staticFixtures: ReturnManagementStaticFixtures;
Expand All @@ -23,12 +20,22 @@ describe('return management suite 1', { tags: ['@return-management'] }, (): void
});

beforeEach((): void => {
customerLoginScenario.execute(dynamicFixtures.customer.email, staticFixtures.defaultPassword);
customerLoginScenario.execute({
email: dynamicFixtures.customer.email,
password: staticFixtures.defaultPassword,
});
});

it('should be able to create return from (from shipped order state)', (): void => {
checkoutScenario.execute(false, false, dynamicFixtures.address.id_customer_address);
userLoginScenario.execute(dynamicFixtures.rootUser.username, staticFixtures.defaultPassword);
checkoutScenario.execute({
isGuest: false,
isMultiShipment: false,
idCustomerAddress: dynamicFixtures.address.id_customer_address,
});
userLoginScenario.execute({
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});

salesIndexPage.visit();
salesIndexPage.viewLastPlacedOrder();
Expand All @@ -44,8 +51,15 @@ describe('return management suite 1', { tags: ['@return-management'] }, (): void
});

it('should be able to create return from (from delivery order state)', (): void => {
checkoutScenario.execute(false, false, dynamicFixtures.address.id_customer_address);
userLoginScenario.execute(dynamicFixtures.rootUser.username, staticFixtures.defaultPassword);
checkoutScenario.execute({
isGuest: false,
isMultiShipment: false,
idCustomerAddress: dynamicFixtures.address.id_customer_address,
});
userLoginScenario.execute({
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});

salesIndexPage.visit();
salesIndexPage.viewLastPlacedOrder();
Expand Down
Loading
Loading