Skip to content

Commit bba065f

Browse files
OBPIH-6686 Add tests for using keyboard shortcuts on receiving table (#43)
* OBPIH-6686 add new products * OBPIH-6686 add pack levels to StockMovementService * OBPIH-6686 add elements to receiving table * OBPIH-6686 add tests for using keyboard shortcuts in receiving * OBPIH-6686 add pack levels to stock movement service * OBPIH-6686 add new products * OBPIH-6686 add tests for using keyboard shortcuts in receiving * update playwright upload-artifact * update playwright upload-pages-artifact * OBPIH-6686 remove products * OBPIH-6686 improve getProduct() * OBPIH-6686 adjust test * Update deploy-pages action to v4 --------- Co-authored-by: Walkowiak <awalkowiak@soldevelo.com>
1 parent 1171972 commit bba065f

11 files changed

Lines changed: 332 additions & 15 deletions

File tree

.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ LOCATION_DEPOT=locationId
1414
LOCATION_NO_PICK_AND_PUTAWAY_STOCK_DEPOT=locationId
1515
LOCATION_WARD=locationId
1616
PRODUCT_ONE=productId
17-
PRODUCT_TWO=productId
17+
PRODUCT_TWO=productId
18+
PRODUCT_THREE=productId
19+
PRODUCT_FOUR=productId
20+
PRODUCT_FIVE=productId

.github/workflows/playwright.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,16 @@ jobs:
6464
LOCATION_NO_PICK_AND_PUTAWAY_STOCK_DEPOT: ${{ secrets.LOCATION_NO_PICK_AND_PUTAWAY_STOCK_DEPOT }}
6565
PRODUCT_ONE: ${{ secrets.PRODUCT_ONE }}
6666
PRODUCT_TWO: ${{ secrets.PRODUCT_TWO }}
67+
PRODUCT_THREE: ${{ secrets.PRODUCT_THREE }}
68+
PRODUCT_FOUR: ${{ secrets.PRODUCT_FOUR }}
69+
PRODUCT_FIVE: ${{ secrets.PRODUCT_FIVE }}
6770
run: |
6871
echo "Running playwright tests on the ${{ inputs.environment || 'obdev5' }} server"
6972
npx playwright test
7073
7174
- name: Upload Playwright Report to Artifacts
7275
if: ${{ always() }}
73-
uses: actions/upload-artifact@v3
76+
uses: actions/upload-artifact@v4
7477
with:
7578
name: playwright-report
7679
path: playwright-report/
@@ -81,11 +84,11 @@ jobs:
8184

8285
- name: Upload artifact
8386
if: ${{ always() }}
84-
uses: actions/upload-pages-artifact@v1
87+
uses: actions/upload-pages-artifact@v3
8588
with:
8689
path: playwright-report/
8790

8891
- name: Deploy to Github Pages
8992
if: ${{ always() }}
9093
id: deployment
91-
uses: actions/deploy-pages@v1
94+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ node_modules/
1111
/blob-report/
1212
/playwright/.cache/
1313
/.authStorage/
14-
/localFiles
14+
/localFiles
15+
16+
.idea/

src/api/ProductService.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import BaseServiceModel from '@/api/BaseServiceModel';
2-
import { ApiResponse, ProductDemandResponse } from '@/types';
2+
import { ApiResponse, ProductDemandResponse, ProductResponse } from '@/types';
33
import { parseRequestToJSON } from '@/utils/ServiceUtils';
44

55
class ProductService extends BaseServiceModel {
@@ -12,6 +12,16 @@ class ProductService extends BaseServiceModel {
1212
throw new Error('Problem fetching product demand');
1313
}
1414
}
15+
16+
async get(id: string): Promise<ApiResponse<ProductResponse>> {
17+
try {
18+
const apiResponse = await this.request.get(`./api/products/${id}`);
19+
20+
return await parseRequestToJSON(apiResponse);
21+
} catch (error) {
22+
throw new Error('Problem fetching product data');
23+
}
24+
}
1525
}
1626

1727
export default ProductService;

src/api/StockMovementService.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ class StockMovementService extends BaseServiceModel {
134134
expirationDate: it?.expirationDate
135135
? formatDate(it?.expirationDate)
136136
: undefined,
137+
palletName: it?.palletName,
138+
boxName: it?.boxName,
137139
})),
138140
});
139141
await this.updateStatusStockMovement(id, { status: 'CHECKING' });

src/config/AppConfig.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export enum LOCATION_KEY {
2929
export enum PRODUCT_KEY {
3030
ONE = 'productOne',
3131
TWO = 'productTwo',
32+
THREE = 'productThree',
33+
FOUR = 'productFour',
34+
FIVE = 'productFive',
3235
}
3336

3437
/**
@@ -224,7 +227,9 @@ class AppConfig {
224227
noPickAndPutawayStockDepot: new LocationConfig({
225228
id: env.get('LOCATION_NO_PICK_AND_PUTAWAY_STOCK_DEPOT').asString(),
226229
key: LOCATION_KEY.NO_PICK_AND_PUTAWAY_STOCK,
227-
name: this.uniqueIdentifier.generateUniqueString('no-pickandputawaystock-depot'),
230+
name: this.uniqueIdentifier.generateUniqueString(
231+
'no-pickandputawaystock-depot'
232+
),
228233
requiredActivityCodes: new Set([
229234
ActivityCode.MANAGE_INVENTORY,
230235
ActivityCode.DYNAMIC_CREATION,
@@ -240,9 +245,6 @@ class AppConfig {
240245
required: false,
241246
type: LocationTypeCode.DEPOT,
242247
}),
243-
244-
245-
246248
};
247249

248250
this.products = {
@@ -260,6 +262,27 @@ class AppConfig {
260262
quantity: 123,
261263
required: false,
262264
}),
265+
productThree: new ProductConfig({
266+
id: env.get('PRODUCT_THREE').asString(),
267+
key: PRODUCT_KEY.THREE,
268+
name: this.uniqueIdentifier.generateUniqueString('product-three'),
269+
quantity: 150,
270+
required: false,
271+
}),
272+
productFour: new ProductConfig({
273+
id: env.get('PRODUCT_FOUR').asString(),
274+
key: PRODUCT_KEY.FOUR,
275+
name: this.uniqueIdentifier.generateUniqueString('product-four'),
276+
quantity: 100,
277+
required: false,
278+
}),
279+
productFive: new ProductConfig({
280+
id: env.get('PRODUCT_FIVE').asString(),
281+
key: PRODUCT_KEY.FIVE,
282+
name: this.uniqueIdentifier.generateUniqueString('product-five'),
283+
quantity: 160,
284+
required: false,
285+
}),
263286
};
264287
}
265288
}

src/fixtures/fixtures.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ type Fixtures = {
7878
// PRODUCT DATA
7979
mainProductService: ProductData;
8080
otherProductService: ProductData;
81+
thirdProductService: ProductData;
82+
fourthProductService: ProductData;
83+
fifthProductService: ProductData;
8184
// USERS DATA
8285
mainUserService: UserData;
8386
altUserService: UserData;
@@ -144,12 +147,18 @@ export const test = baseTest.extend<Fixtures>({
144147
wardLocationService: async ({ page }, use) =>
145148
use(new LocationData(LOCATION_KEY.WARD, page.request)),
146149
noPickAndPutawayStockDepotService: async ({ page }, use) =>
147-
use(new LocationData(LOCATION_KEY.NO_PICK_AND_PUTAWAY_STOCK, page.request)),
150+
use(new LocationData(LOCATION_KEY.NO_PICK_AND_PUTAWAY_STOCK, page.request)),
148151
// PRODUCTS
149152
mainProductService: async ({ page }, use) =>
150153
use(new ProductData(PRODUCT_KEY.ONE, page.request)),
151154
otherProductService: async ({ page }, use) =>
152155
use(new ProductData(PRODUCT_KEY.TWO, page.request)),
156+
thirdProductService: async ({ page }, use) =>
157+
use(new ProductData(PRODUCT_KEY.THREE, page.request)),
158+
fourthProductService: async ({ page }, use) =>
159+
use(new ProductData(PRODUCT_KEY.FOUR, page.request)),
160+
fifthProductService: async ({ page }, use) =>
161+
use(new ProductData(PRODUCT_KEY.FIVE, page.request)),
153162
// USERS
154163
mainUserService: async ({ page }, use) =>
155164
use(new UserData(USER_KEY.MAIN, page.request)),

src/pages/receiving/components/ReceivingTable.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ class ReceivingTable extends BasePageModel {
3535
class Row extends BasePageModel {
3636
row: Locator;
3737
receivingNowField: TextField;
38+
commentField: TextField;
3839

3940
constructor(page: Page, row: Locator) {
4041
super(page);
4142
this.row = row;
4243
this.receivingNowField = new TextField(page, 'Receiving now', row);
44+
this.commentField = new TextField(page, 'Comment', row);
4345
}
4446

4547
get checkbox() {

0 commit comments

Comments
 (0)