codeceptjs / codeceptjs/CodeceptJS

[Enhancement] Add namespace definition for helper

オープン
#2,638 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
4.2k
フォーク
757
平均マージ
2日 9時間
マージ済み PR(30日)
16

説明

#### 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);
.....
}
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。