Files
next-static-site/cypress/scripts/fixtures.js
Brandon Lee Kitajchuk db94b17829 Latest news + banner, cypress tests, open source copy, general style tweaks (#13)
* Adding latest news and banners

* Adding first draft of cypress specs and github actions workflow

* Adding sticky position for top banner

* Tweak styles for new latest news section

* Tweak styles for text__layout innerHTML

* Fix Cypress homepage test spec

* Fix mobile navi z-index with sticky top banner

* Fix sticky banner z-index bug with mobile navi

* Refactor markdown tools to support pages beyond developer docs

* Adjust TADHACK text max-widths for small mobile

* initial changes for open source copy

* more copy

* more copy

* updated open source structure

* minor

* typo

* more copy

* Adjust styles for Open Source markdown small text

* Update readme and remove floats from docs webhooks markdown

* Add readme notes on Cypress and flesh out navi spec tests

* Fix main navi highlight when on sub-sections of markdown pages

Co-authored-by: Dave Horton <daveh@beachdognet.com>
2021-07-22 12:34:01 -04:00

22 lines
753 B
JavaScript

// Generates fixtures JSON files from jambonz YAML data for Cypress
// Uses `yarn pretest` to run this script
// Uses `yarn posttest` to run fixtures cleanup (rm -rf)
const fs = require('fs');
const path = require('path');
const yamljs = require('yamljs');
const dataDir = path.join(process.cwd(), 'data');
const fixDir = path.join(process.cwd(), 'cypress/fixtures');
if (!fs.existsSync(fixDir)) {
fs.mkdirSync(fixDir);
}
fs.readdirSync(dataDir).forEach((file) => {
const filePath = `${dataDir}/${file}`;
const fileContents = fs.readFileSync(filePath, 'utf8');
const fileJSON = yamljs.parse(fileContents);
const fileOut = path.join(fixDir, file.replace('.yml', '.json'));
fs.writeFileSync(fileOut, JSON.stringify(fileJSON, null, 2));
});