This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/application.ts b/src/application.ts | |
| index e9b2e72..4eb841f 100644 | |
| --- a/src/application.ts | |
| +++ b/src/application.ts | |
| @@ -1,4 +1,7 @@ | |
| -import express, { Application as ExApplication } from 'express'; | |
| +import express, { Application as ExApplication, Handler } from 'express'; | |
| +import { controllers } from './controllers'; | |
| +import { MetadataKeys } from './utils/metadata.keys'; | |
| +import { IRouter } from './utils/decorators/handlers.decorator'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Handler, Request } from 'express'; | |
| import { CognitoIdentityServiceProvider } from 'aws-sdk'; | |
| const identityServiceProvider = new CognitoIdentityServiceProvider({ | |
| region: process.env.REGION || 'ap-northeast-1', | |
| }); | |
| export interface IUser { | |
| id: string; | |
| email: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import express from 'express'; | |
| import cognitoUserPoolHelper from './cognito.user.pool.helper'; | |
| interface IUserController { | |
| signUp: express.Handler, | |
| signIn: express.Handler, | |
| confirmSignUp: express.Handler, | |
| getProfile: express.Handler, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'cross-fetch/polyfill'; | |
| import { AuthenticationDetails, CognitoUser, CognitoUserAttribute, CognitoUserPool } from 'amazon-cognito-identity-js'; | |
| export interface IUserToken { | |
| accessToken: string; | |
| refreshToken: string; | |
| } | |
| class CognitoUserPoolHelper { | |
| public userPool: CognitoUserPool; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { IProduct } from '../interfaces'; | |
| import BasePO from './base.po'; | |
| class CartPO extends BasePO { | |
| private readonly $cartItem = '.cart_item'; | |
| private readonly $cart = { | |
| $name: '.inventory_item_name', | |
| $price: '.inventory_item_price', | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { IProduct } from '../interfaces'; | |
| import BasePO from './base.po'; | |
| class InventoryPO extends BasePO { | |
| private readonly $productItem = '.inventory_item'; | |
| private readonly $addCart = '.btn_inventory'; | |
| private readonly $cartCount = '.shopping_cart_badge'; | |
| private readonly $product = { | |
| $name: '.inventory_item_name', | |
| $price: '.inventory_item_price', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cartPo from './pages/cart.po'; | |
| import inventoryPo from './pages/inventory.po'; | |
| describe('Cart', () => { | |
| beforeEach(async () => { | |
| await inventoryPo.go(); | |
| }); | |
| it('should add correct products to cart', async () => { | |
| const products = await inventoryPo.getProducts(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import loginPo from './pages/login.po'; | |
| describe('Login', () => { | |
| beforeEach(async () => { | |
| await loginPo.go(); | |
| }); | |
| it.each` | |
| username | password | message | |
| ${'wrong_username'}| ${'secret_sauce'} | ${'Epic sadface: Username and password do not match any user in this service'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import BasePO from './base.po'; | |
| class LoginPO extends BasePO { | |
| private readonly $usernameInput = '#user-name'; | |
| private readonly $passwordInput = '#password'; | |
| private readonly $loginButton = '#login-button'; | |
| private readonly $errorMessageContainer = '.error-message-container'; | |
| async go() { | |
| await this.navigate('/'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ElementHandle } from 'puppeteer'; | |
| export default abstract class BasePO { | |
| protected readonly BASE_URL = 'https://www.saucedemo.com'; | |
| abstract go(): Promise<void>; | |
| async navigate(url: string) { | |
| await page.goto(`${this.BASE_URL}${url}`); | |
| } |