File tree Expand file tree Collapse file tree
src/pages/product/productEdit Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { Page } from '@playwright/test' ;
2+
3+ import BasePageModel from '@/pages/BasePageModel' ;
4+ import InventoryLevelsTabSection from '@/pages/product/productEdit/tabs/InventoryLevelsTabSection' ;
5+
6+ class ProductEditPage extends BasePageModel {
7+ inventoryLevelsTabSection : InventoryLevelsTabSection ;
8+
9+ constructor ( page : Page ) {
10+ super ( page ) ;
11+ this . inventoryLevelsTabSection = new InventoryLevelsTabSection ( page ) ;
12+ }
13+
14+ async goToPage ( id : string ) {
15+ await this . page . goto ( `./product/edit/${ id } ` ) ;
16+ }
17+
18+ get detailskTab ( ) {
19+ return this . page . getByRole ( 'link' , { name : 'Details' } ) ;
20+ }
21+
22+ get inventoryLevelsTab ( ) {
23+ return this . page . getByRole ( 'link' , { name : 'Inventory Levels' } ) ;
24+ }
25+ }
26+
27+ export default ProductEditPage ;
Original file line number Diff line number Diff line change 1+ import { Page } from '@playwright/test' ;
2+
3+ import BasePageModel from '@/pages/BasePageModel' ;
4+
5+ class CreateStockLevelModal extends BasePageModel {
6+ constructor ( page : Page ) {
7+ super ( page ) ;
8+ }
9+
10+ get modal ( ) {
11+ return this . page . getByRole ( 'dialog' ) ;
12+ }
13+
14+ get receivingTab ( ) {
15+ return this . page . getByRole ( 'link' , { name : 'Receiving' } ) ;
16+ }
17+
18+ get defaultPutawayLocation ( ) {
19+ return this . modal . locator (
20+ 'select[name="preferredBinLocation"] + .chosen-container'
21+ ) ;
22+ }
23+
24+ getDefaultPutawayLocation ( putawayLocation : string ) {
25+ return this . defaultPutawayLocation
26+ . locator ( '.chosen-results' )
27+ . getByRole ( 'listitem' )
28+ . getByText ( putawayLocation , { exact : true } ) ;
29+ }
30+
31+ get createButton ( ) {
32+ return this . modal . getByRole ( 'button' , { name : 'Create' } ) ;
33+ }
34+
35+ get deleteInventoryLevelButton ( ) {
36+ return this . modal . getByRole ( 'link' , { name : 'Delete' } ) ;
37+ }
38+
39+ async clickDeleteInventoryLevel ( ) {
40+ this . page . once ( 'dialog' , ( dialog ) => dialog . accept ( ) ) ;
41+ await this . deleteInventoryLevelButton . click ( ) ;
42+ }
43+ }
44+
45+ export default CreateStockLevelModal ;
Original file line number Diff line number Diff line change 1+ import { Locator , Page } from '@playwright/test' ;
2+
3+ import BasePageModel from '@/pages/BasePageModel' ;
4+ import CreateStockLevelModal from '@/pages/product/productEdit/components/createStockLevelModal' ;
5+
6+ class InventoryLevelsTabSection extends BasePageModel {
7+ createStockLevelModal : CreateStockLevelModal ;
8+
9+ constructor ( page : Page ) {
10+ super ( page ) ;
11+ this . createStockLevelModal = new CreateStockLevelModal ( page ) ;
12+ }
13+
14+ get createStockLevelButton ( ) {
15+ return this . page . getByRole ( 'link' , { name : 'Create stock level' } ) ;
16+ }
17+
18+ get table ( ) {
19+ return this . page . locator ( '#ui-tabs-3' ) . getByRole ( 'table' ) ;
20+ }
21+
22+ get rows ( ) {
23+ return this . table . getByRole ( 'row' ) ;
24+ }
25+
26+ row ( index : number ) {
27+ return new Row ( this . page , this . rows . nth ( index ) ) ;
28+ }
29+ }
30+
31+ class Row extends BasePageModel {
32+ row : Locator ;
33+ constructor ( page : Page , row : Locator ) {
34+ super ( page ) ;
35+ this . row = row ;
36+ }
37+
38+ get editInventoryLevelButton ( ) {
39+ return this . row
40+ . getByRole ( 'cell' )
41+ . locator ( 'a.btn-show-dialog' , { hasText : 'Edit' } ) ;
42+ }
43+ }
44+
45+ export default InventoryLevelsTabSection ;
You can’t perform that action at this time.
0 commit comments