cumulocity-cypress
Version:
Cypress commands for Cumulocity IoT
43 lines (42 loc) • 1.37 kB
JavaScript
import { FetchClient } from "@c8y/client";
import { getC8yClientAuthentication } from "../utils";
if (!Cypress.c8ypact) {
Cypress.c8ypact = {
mode: () => "disabled",
recordingMode: () => "refresh",
current: null,
getCurrentTestId: () => "-",
isRecordingEnabled: () => false,
isMockingEnabled: () => false,
savePact: () => new Promise((resolve) => resolve()),
isEnabled: () => false,
matcher: undefined,
pactRunner: undefined,
schemaMatcher: undefined,
debugLog: false,
preprocessor: undefined,
config: {},
getConfigValue: (key, defaultValue) => defaultValue,
getConfigValues: () => ({}),
loadCurrent: () => cy.wrap(null, { log: false }),
env: () => ({}),
on: {},
createFetchClient: (auth, baseUrl) => new FetchClient(getC8yClientAuthentication(auth), baseUrl),
};
}
if (!Cypress.c8yctrl) {
Cypress.c8yctrl = {
mode: () => "disabled",
recordingMode: () => "append",
get current() {
return null;
},
isEnabled: () => false,
isRecordingEnabled: () => false,
isMockingEnabled: () => false,
setCurrent: () => cy.wrap(null),
resetCurrent: () => cy.wrap(null),
url: () => null,
debugLog: false,
};
}