codeceptjs / codeceptjs/CodeceptJS

[Enhancement] Add namespace definition for helper

Abierto
#2,638 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
4.2k
Forks
757
Merge medio
2 d 9 h
PR fusionados (30 d)
16

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.