Re: [sensors] Define WebDriver extension API for test automation

I did an initial investigation, came up with following 6 proper sections to be defined in WebDriver extension API, @pozdnyakov, @alexshalamov, and others,  PTAL. thanks!
1. **Create Mock Sensor**  (POST /session/{session id}/sensor/{type})
  Create a given type of mock sensor with configuration something like following dictionary:
```
dictionary MockSensorConfiguration {
  required SensorType sensorType; //Sets sensor type
  boolean getSensorShouldFail = false;  //Sets flag that forces mock sensor creation to fail
  boolean startShouldFail = false;  //Sets flag that forces mock sensor start to fail
  double? maxFrequency;  // Sets the maximum frequency for a concrete sensor  
  double? minFrequency;  // Sets the minimum frequency for a concrete sensor
  ...
}
```
  And define all kinds of sensor type:
```
enum SensorType {
  “ambient-light”;
  “accelerometer”;
  “linear-acceleration”;
  “gravity”;
  “gyroscope”;
  “magnetometer”;
  “uncalibrated-magnetometer”;
  “absolute-orientation”;
  “relative-orientation”;
  “geolocation”;
  “proximity”;
}
```
2. **Remove Mock Sensor** (DELETE /session/{session id}/sensor/{type})
  Remove a given type of mock sensor.
3. **Get Mock Sensor** (GET /session/{session id}/sensor/{type})
Retrieve a given type of mock sensor with capabilities something like following dictionary:
```
dictionary MockSensor {
  SensorType sensorType;
  double maxFrequency;
  double minFrequency;
  double samplingFrequency;
  ...
}
```
4. **Update Mock Sensor Reading** (POST /session/{session id}/sensor/{type}/set)
  Deliver mock sensor reading updates to a given type of mock sensor. As different sensor type with different sensor reading attributes, it's necessary to define all the mapped reading attributes for each sensor type. Could be something like below dictionaries:
```
dictionary MockSensorReadingSettings {
  required SensorType sensorType;
  required SensorReading sensorReading;
}
dictionary SensorReading {
}
dictionary AmbientLightSensorReading : SensorReading {
  double? illuminance;
}
dictionary CoordinateReadingXYZ: SensorReading {
  double? x;
  double? y;
  double? z;
}
dictionary AccelerometerSensorReading : CoordinateReadingXYZ {
}
...
```
5. **Start Mock Sensor** (POST /session/{session id}/sensor/{type}/start)
  Start a given type of mock sensor.
6. **Stop Mock Sensor** (POST /session/{session id}/sensor/{type}/stop)
  Stop a given type of mock sensor.

**Opens:**
1. For the definition of detailed implementation of mock sensor, is it our scope?
2. Will browsers provide specific command line flag to use mock sensor? Similar to 
`--use-fake-device-for-media-stream`, which may be another automation requirement, just like what https://github.com/web-platform-tests/results-collection/issues/125 is doing.

-- 
GitHub Notification of comment by Honry
Please view or discuss this issue at https://github.com/w3c/sensors/issues/363#issuecomment-382313888 using your GitHub account

Received on Wednesday, 18 April 2018 08:51:20 UTC