Also, adds a command to reset the testing database.
Config data can be passed in several ways:
* Running 'yarn run cypress [open|run] --env fixtures=/a/path,controller_url=...'
* Setting environment variables named with the 'CYPRESS_' prefix.
* Using Cypress.config() inside the test cases.
For now, 3 config items are needed:
1. Arvados fixtures path
2. System root token (defined on arvados-boot's zzzzz.yml config file) so a
database reset can be called.
3. Controller's URL
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
+
+const YAML = require('yamljs');
+const arvadosFixturesDir = Cypress.env('fixtures');
+const controllerURL = Cypress.env('controller_url');
+const systemToken = Cypress.env('system_token');
+
+Cypress.Commands.add(
+ "arvadosFixture", (name) => {
+ return cy.readFile(arvadosFixturesDir+'/'+name+'.yml').then(
+ function (str) {
+ return YAML.parse(str);
+ }
+ )
+ }
+)
+
+Cypress.Commands.add(
+ "resetDB", () => {
+ cy.request('POST', `${controllerURL}/database/reset?api_token=${systemToken}`);
+ }
+)
\ No newline at end of file
"node-sass": "4.9.4",
"node-sass-chokidar": "1.3.4",
"redux-devtools": "3.4.1",
- "typescript": "3.1.1"
+ "typescript": "3.1.1",
+ "yamljs": "0.3.0"
},
"jest": {
"moduleNameMapper": {
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==
+yamljs@0.3.0:
+ version "0.3.0"
+ resolved "https://registry.yarnpkg.com/yamljs/-/yamljs-0.3.0.tgz#dc060bf267447b39f7304e9b2bfbe8b5a7ddb03b"
+ integrity sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==
+ dependencies:
+ argparse "^1.0.7"
+ glob "^7.0.5"
+
yargs-parser@^11.1.1:
version "11.1.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4"