Common Modules for Compass Test Automation, One of Libraries in CTA-OSS Framework
In cta-common, there are four modules as following:
These modules providing common functions across CTA-OSS.
We aim to give you brief guidelines here.
const cta_common = require("cta-common");
It loads the config for specified module using file structure: [module_root]/lib/apps/main/config.
const moduleName = "sample-module";
const config = cta_common.config(moduleName);
The file, which locates at sample-module/lib/apps/main/config/index.js, is loaded as the config.
It loads modules from all *.js files in specified directory. Other extension files are excluded.
For example: there are three files in directory: module1.js, module2.js, and module3.js
const sampleDirectory = "sample-directory";
const array_output = cta_common.loader.asArray(sampleDirectory);
// array_output = [ {default_export_module1}, {default_export_module2}, {default_export_module3} ]
const sampleDirectory = "sample-directory";
const object_output = cta_common.loader.asObject(sampleDirectory);
// object_output = {
// module1: {default_export_module1},
// module2: {default_export_module2},
// module3: {default_export_module3},
// }
It resolves the root directory of module.
const moduleName = "samplemodule";
const root = cta_common.root(moduleName);
For example, [executing_application]/node_modules/samplemodule
It validates the input against specified pattern.
const input = { value: "sample input" };
const pattern = "object";
const output = cta_common.validate(input, pattern);
This module is used to validate a bridge and a tool in CTA-OSS.
Plan for next release