codeceptjs / codeceptjs/CodeceptJS

[Enhancement] Add namespace definition for helper

Đang mở
#2,638 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
4.2k
Fork
757
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
16

Mô tả

#### What are you trying to achieve?
Can we try to add namespace definition for helper. Because when we are writing helpers, there might be the same action for different scenarios. For example, I want to. add something to my favorite in desktop version or mobile version. But I don't want to write 2 different methods with different name like `addFavoriteInDesktop` and `addFavoriteInMobile`. I hope that I can have `addFavorite` methods in both `favorite_helper.js` in `desktop` folder and `favorite_helper.js` in `mobile` folder. But they have different namespace like
```
class FavoriteHelper extends Helper {
_namespace() {
return 'desktop';
}

addFavorite(something) {...}
}
```

Then I can use it in the test case like
```
Namespace('desktop');
Feature('Favorite');
Scenario('Add something to my favorite', (I) => {
I.addFavorite(something);
.....
}
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.