docs: issues técnicas para nuevas funcionalidades
Agrega 19 issues técnicas documentando funcionalidades implementadas y pendientes. Issues completadas (movidas a dev/issues/completed/): - 001-conversor-web-markdown.md - 002-accessibility-tree.md - 003-gestion-cookies-perfil.md - 004-gestion-extensiones-chrome.md - 005-eliminar-timeouts-innecesarios.md Issues implementadas: - 006-manejo-tabs-ventanas.md - 016-manejo-iframes.md - 017-actions-api.md - 018-file-uploads.md - 019-expected-conditions-mejoradas.md Issues pendientes (media prioridad): - 007-alert-prompt-confirm-handling.md - 008-screenshot-elementos-especificos.md - 009-pdf-generation.md - 010-device-emulation-completo.md - 011-downloads-handling.md Issues pendientes (baja prioridad / avanzado): - 012-browser-contexts-multi-sesion.md - 013-video-recording.md - 014-network-mocking-avanzado.md - 015-geolocation-permissions.md Incluye también dev/NUEVAS_FUNCIONALIDADES.md con resumen completo. Directorio: dev/
This commit is contained in:
@@ -0,0 +1,172 @@
|
||||
# Issue #015: Geolocation & Permissions
|
||||
|
||||
**Tipo**: Enhancement
|
||||
**Prioridad**: Baja (Avanzado)
|
||||
**Estado**: Pendiente
|
||||
|
||||
## Descripción
|
||||
|
||||
Implementar sistema para configurar geolocation y permisos del navegador (notifications, geolocation, camera, mic, etc.).
|
||||
|
||||
## Funcionalidad deseada
|
||||
|
||||
### Geolocation
|
||||
- Establecer coordenadas GPS personalizadas
|
||||
- Simular precisión de GPS
|
||||
- Cambiar ubicación dinámicamente
|
||||
|
||||
### Permissions
|
||||
- Otorgar/denegar permisos específicos
|
||||
- Permisos por origen (URL)
|
||||
- Lista completa de permisos soportados
|
||||
|
||||
## API propuesta
|
||||
|
||||
```go
|
||||
type Geolocation struct {
|
||||
Latitude float64
|
||||
Longitude float64
|
||||
Accuracy float64 // En metros
|
||||
}
|
||||
|
||||
type Permission string
|
||||
const (
|
||||
PermissionGeolocation Permission = "geolocation"
|
||||
PermissionNotifications Permission = "notifications"
|
||||
PermissionCamera Permission = "videoCapture"
|
||||
PermissionMicrophone Permission = "audioCapture"
|
||||
PermissionClipboard Permission = "clipboardReadWrite"
|
||||
PermissionMIDI Permission = "midi"
|
||||
PermissionBackgroundSync Permission = "backgroundSync"
|
||||
PermissionPersistentStorage Permission = "persistentStorage"
|
||||
)
|
||||
|
||||
func (b *Browser) SetGeolocation(ctx context.Context, geo *Geolocation) error
|
||||
func (b *Browser) ClearGeolocation(ctx context.Context) error
|
||||
func (b *Browser) GrantPermissions(ctx context.Context, origin string, permissions []Permission) error
|
||||
func (b *Browser) DenyPermissions(ctx context.Context, origin string, permissions []Permission) error
|
||||
func (b *Browser) ResetPermissions(ctx context.Context) error
|
||||
```
|
||||
|
||||
## Uso
|
||||
|
||||
### Establecer ubicación
|
||||
```go
|
||||
// Simular estar en Nueva York
|
||||
b.SetGeolocation(ctx, &browser.Geolocation{
|
||||
Latitude: 40.7128,
|
||||
Longitude: -74.0060,
|
||||
Accuracy: 10, // 10 metros
|
||||
})
|
||||
|
||||
b.Navigate(ctx, "https://maps.google.com", nil)
|
||||
```
|
||||
|
||||
### Otorgar permisos
|
||||
```go
|
||||
// Permitir notifications y geolocation
|
||||
b.GrantPermissions(ctx, "https://example.com", []browser.Permission{
|
||||
browser.PermissionNotifications,
|
||||
browser.PermissionGeolocation,
|
||||
})
|
||||
|
||||
b.Navigate(ctx, "https://example.com", nil)
|
||||
```
|
||||
|
||||
### Denegar cámara/micrófono
|
||||
```go
|
||||
b.DenyPermissions(ctx, "https://videocall.com", []browser.Permission{
|
||||
browser.PermissionCamera,
|
||||
browser.PermissionMicrophone,
|
||||
})
|
||||
```
|
||||
|
||||
### Cambiar ubicación dinámicamente
|
||||
```go
|
||||
// Simular movimiento
|
||||
locations := []browser.Geolocation{
|
||||
{Latitude: 40.7128, Longitude: -74.0060}, // NYC
|
||||
{Latitude: 34.0522, Longitude: -118.2437}, // LA
|
||||
{Latitude: 41.8781, Longitude: -87.6298}, // Chicago
|
||||
}
|
||||
|
||||
for _, loc := range locations {
|
||||
b.SetGeolocation(ctx, &loc)
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
```
|
||||
|
||||
## CDP Methods
|
||||
|
||||
### Geolocation
|
||||
```go
|
||||
// Establecer
|
||||
{"method": "Emulation.setGeolocationOverride", "params": {
|
||||
"latitude": 40.7128,
|
||||
"longitude": -74.0060,
|
||||
"accuracy": 10
|
||||
}}
|
||||
|
||||
// Limpiar
|
||||
{"method": "Emulation.clearGeolocationOverride"}
|
||||
```
|
||||
|
||||
### Permissions
|
||||
```go
|
||||
// Otorgar
|
||||
{"method": "Browser.grantPermissions", "params": {
|
||||
"origin": "https://example.com",
|
||||
"permissions": ["geolocation", "notifications"]
|
||||
}}
|
||||
|
||||
// Denegar (remover)
|
||||
{"method": "Browser.resetPermissions"}
|
||||
```
|
||||
|
||||
## Permisos disponibles
|
||||
|
||||
| Permission | Descripción |
|
||||
|-----------|-------------|
|
||||
| `geolocation` | Acceso a GPS |
|
||||
| `notifications` | Push notifications |
|
||||
| `videoCapture` | Cámara |
|
||||
| `audioCapture` | Micrófono |
|
||||
| `clipboardReadWrite` | Clipboard |
|
||||
| `midi` | MIDI devices |
|
||||
| `backgroundSync` | Background sync |
|
||||
| `persistentStorage` | Persistent storage |
|
||||
|
||||
## Casos de uso
|
||||
|
||||
### Testing de apps con geolocation
|
||||
```go
|
||||
// Test en diferentes ciudades
|
||||
cities := map[string]browser.Geolocation{
|
||||
"NYC": {40.7128, -74.0060, 10},
|
||||
"LA": {34.0522, -118.2437, 10},
|
||||
}
|
||||
|
||||
for name, loc := range cities {
|
||||
b.SetGeolocation(ctx, &loc)
|
||||
b.Navigate(ctx, "https://app.com/nearby", nil)
|
||||
// Verificar resultados específicos de ciudad
|
||||
}
|
||||
```
|
||||
|
||||
### Testing sin permisos
|
||||
```go
|
||||
// Simular usuario que deniega permisos
|
||||
b.DenyPermissions(ctx, "https://app.com", []browser.Permission{
|
||||
browser.PermissionCamera,
|
||||
})
|
||||
|
||||
b.Navigate(ctx, "https://app.com/video-call", nil)
|
||||
// Verificar que app maneja correctamente el error
|
||||
```
|
||||
|
||||
## Referencias
|
||||
|
||||
- CDP Emulation.setGeolocationOverride: https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setGeolocationOverride
|
||||
- CDP Browser.grantPermissions: https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-grantPermissions
|
||||
- Playwright geolocation: https://playwright.dev/docs/emulation#geolocation
|
||||
- Playwright permissions: https://playwright.dev/docs/emulation#permissions
|
||||
Reference in New Issue
Block a user