Files
grafana/packages/grafana-e2e/cypress/plugins/readProvisions.js
T
Steven Vachon a4308fffe7 @grafana/e2e: API improvements (#23079)
* Minor changes

* Fixtures path is now relative to the project directory

* URL support module now has individual exports

* Scenario context timing issues resolved

... caused by being ran synchronously, instead of as part of Cypress' asynchronous queue.

* Scenario context API now supports multiple keys per function call

* addDataSource flow accepts a config argument

… and optionally checks datasource health status

* Added readProvisions command

* Added addPanel flow
2020-03-26 12:15:58 -04:00

15 lines
526 B
JavaScript

'use strict';
const { parse: parseYml } = require('yaml');
const {
promises: { readFile },
} = require('fs');
const { resolve: resolvePath } = require('path');
const readProvision = filePath => readFile(filePath, 'utf8').then(contents => parseYml(contents));
const readProvisions = filePaths => Promise.all(filePaths.map(readProvision));
// Paths are relative to <project-root>/provisioning
module.exports = ({ CWD, filePaths }) =>
readProvisions(filePaths.map(filePath => resolvePath(CWD, 'provisioning', filePath)));