Untitled

 avatar
unknown
plain_text
a year ago
34 kB
6
Indexable
import 'cypress-localstorage-commands'
import { reset_window, configure_common, configure_main, configure_dss, checkYAML, configure_oauth2 } from '../../support/pages/batch-ing/rest'


const MAIN = {
    MIN:   { auth: 'oauth2', rbs: null },
    MAX:   { auth: 'oauth2', rbs: 1000000 },
    UPD:   { auth: 'oauth2', rbs: 1000001 },
    SHORT: { auth: 'oauth2', rbs: undefined },
    DEV:   { auth: 'oauth2', rbs: 1001000 },
    TEST:  { auth: 'oauth2', rbs: 1002000 },
    PROD:  { auth: 'oauth2', rbs: 1003000 }
}
const OAUTH2 = {
    MIN:   { auth_grant_type: null,            client_auth_method: 'client_secret_basic', cid: 'fwcy-cid',      client_secret: '${{}fwcy-cs}',      scope: [ 'FEDEX' ],                         tkn_url: 'https://fwcy-tkn-url.com' },
    MAX:   { auth_grant_type: 'fwcy-agt',      client_auth_method: 'client_secret_basic', cid: 'fwcy-cid',      client_secret: '${{}fwcy-cs}',      scope: [ 'FEDEX' ],                         tkn_url: 'https://fwcy-tkn-url.com' },
    UPD:   { auth_grant_type: 'fwcy-agtu',     client_auth_method: 'client_secret_post',  cid: 'fwcy-cidu',     client_secret: '${{}fwcy-csu}',     scope: [ 'EXTERNAL_INTSHIPSTAT' ],          tkn_url: 'https://fwcy-tkn-urlu.com' },
    SHORT: { auth_grant_type: undefined,       client_auth_method: 'client_secret_basic', cid: 'fwcy-cid',      client_secret: '${{}fwcy-cs}',      scope: [ 'FEDEX' ],                         tkn_url: 'https://fwcy-tkn-url.com' },
    DEV:   { auth_grant_type: 'fwcy-agt-dev',  client_auth_method: 'client_secret_basic', cid: 'fwcy-cid-dev',  client_secret: '${{}fwcy-cs-dev}',  scope: [ 'FEDEX' ],                         tkn_url: 'https://fwcy-tkn-url-dev.com' },
    TEST:  { auth_grant_type: 'fwcy-agt-test', client_auth_method: 'client_secret_post',  cid: 'fwcy-cid-test', client_secret: '${{}fwcy-cs-test}', scope: [ 'EXTERNAL_INTSHIPSTAT' ],          tkn_url: 'https://fwcy-tkn-url-test.com' },
    PROD:  { auth_grant_type: 'fwcy-agt-prod', client_auth_method: 'client_secret_jwt',   cid: 'fwcy-cid-prod', client_secret: '${{}fwcy-cs-prod}', scope: [ 'FEDEX', 'EXTERNAL_INTSHIPSTAT' ], tkn_url: 'https://fwcy-tkn-url-prod.com' }
}
const DS_R_AUTH = {  // TODO: ask Andrew, are the fields: auth_method (always 'oauth2'), client_auth_method (always 'client_secret_post'), scope (always [ 'Custom_Scope' ]) really required on the UI.
    MIN: {
        DS1: {
            R1: { cid: null, client_secret: null, grant_type: null, rid: undefined, tkn_url: null },
            R2: { cid: null, client_secret: null, grant_type: null, rid: undefined, tkn_url: null },
            R3: { cid: null, client_secret: null, grant_type: null, rid: undefined, tkn_url: null }
        },
        DS2: {
            R1: { cid: null, client_secret: null, grant_type: null, rid: undefined, tkn_url: null },
            R2: { cid: null, client_secret: null, grant_type: null, rid: undefined, tkn_url: null },
            R3: { cid: null, client_secret: null, grant_type: null, rid: undefined, tkn_url: null }
        },
        DS3: {
            R1: { cid: null, client_secret: null, grant_type: null, rid: undefined, tkn_url: null },
            R2: { cid: null, client_secret: null, grant_type: null, rid: undefined, tkn_url: null },
            R3: { cid: null, client_secret: null, grant_type: null, rid: undefined, tkn_url: null }
        }
    },
    MAX: {
        DS1: {
            R1: { cid: 'fwcy-ds1-r1-cid', client_secret: '${{}fwcy-ds1-r1-cs}', grant_type: 'fwcy-ds1-r1-agt', rid: 'service_standard_registration', tkn_url: 'https://fwcy-ds1-r1.com' },
            R2: { cid: 'fwcy-ds1-r2-cid', client_secret: '${{}fwcy-ds1-r2-cs}', grant_type: 'fwcy-ds1-r2-agt', rid: 'network_node_registration',     tkn_url: 'https://fwcy-ds1-r2.com' },
            R3: { cid: 'fwcy-ds1-r3-cid', client_secret: '${{}fwcy-ds1-r3-cs}', grant_type: 'fwcy-ds1-r3-agt', rid: 'network_node_registration',     tkn_url: 'https://fwcy-ds1-r3.com' }
        },
        DS2: {
            R1: { cid: 'fwcy-ds2-r1-cid', client_secret: '${{}fwcy-ds2-r1-cs}', grant_type: 'fwcy-ds2-r1-agt', rid: 'network_node_registration',     tkn_url: 'https://fwcy-ds2-r1.com' },
            R2: { cid: 'fwcy-ds2-r2-cid', client_secret: '${{}fwcy-ds2-r2-cs}', grant_type: 'fwcy-ds2-r2-agt', rid: 'service_standard_registration', tkn_url: 'https://fwcy-ds2-r2.com' },
            R3: { cid: 'fwcy-ds2-r3-cid', client_secret: '${{}fwcy-ds2-r3-cs}', grant_type: 'fwcy-ds2-r3-agt', rid: 'network_node_registration',     tkn_url: 'https://fwcy-ds2-r3.com' }
        },
        DS3: {
            R1: { cid: 'fwcy-ds3-r1-cid', client_secret: '${{}fwcy-ds3-r1-cs}', grant_type: 'fwcy-ds3-r1-agt', rid: 'network_node_registration',     tkn_url: 'https://fwcy-ds3-r1.com' },
            R2: { cid: 'fwcy-ds3-r2-cid', client_secret: '${{}fwcy-ds3-r2-cs}', grant_type: 'fwcy-ds3-r2-agt', rid: 'network_node_registration',     tkn_url: 'https://fwcy-ds3-r2.com' },
            R3: { cid: 'fwcy-ds3-r3-cid', client_secret: '${{}fwcy-ds3-r3-cs}', grant_type: 'fwcy-ds3-r3-agt', rid: 'service_standard_registration', tkn_url: 'https://fwcy-ds3-r3.com' }
        }
    },
    UPD: {
        DS1: {
            R1: { cid: 'fwcy-ds1u-r1-cid', client_secret: '${{}fwcy-ds1u-r1-cs}', grant_type: 'fwcy-ds1u-r1-agt', rid: 'network_node_registration',     tkn_url: 'https://fwcy-ds1u-r1.com' },
            R2: { cid: 'fwcy-ds1u-r2-cid', client_secret: '${{}fwcy-ds1u-r2-cs}', grant_type: 'fwcy-ds1u-r2-agt', rid: 'service_standard_registration', tkn_url: 'https://fwcy-ds1u-r2.com' },
            R3: { cid: 'fwcy-ds1u-r3-cid', client_secret: '${{}fwcy-ds1u-r3-cs}', grant_type: 'fwcy-ds1u-r3-agt', rid: 'service_standard_registration', tkn_url: 'https://fwcy-ds1u-r3.com' }
        },
        DS2: {
            R1: { cid: 'fwcy-ds2u-r1-cid', client_secret: '${{}fwcy-ds2u-r1-cs}', grant_type: 'fwcy-ds2u-r1-agt', rid: 'service_standard_registration', tkn_url: 'https://fwcy-ds2u-r1.com' },
            R2: { cid: 'fwcy-ds2u-r2-cid', client_secret: '${{}fwcy-ds2u-r2-cs}', grant_type: 'fwcy-ds2u-r2-agt', rid: 'network_node_registration',     tkn_url: 'https://fwcy-ds2u-r2.com' },
            R3: { cid: 'fwcy-ds2u-r3-cid', client_secret: '${{}fwcy-ds2u-r3-cs}', grant_type: 'fwcy-ds2u-r3-agt', rid: 'service_standard_registration', tkn_url: 'https://fwcy-ds2u-r3.com' }
        },
        DS3: {
            R1: { cid: 'fwcy-ds3u-r1-cid', client_secret: '${{}fwcy-ds3u-r1-cs}', grant_type: 'fwcy-ds3u-r1-agt', rid: 'service_standard_registration', tkn_url: 'https://fwcy-ds3u-r1.com' },
            R2: { cid: 'fwcy-ds3u-r2-cid', client_secret: '${{}fwcy-ds3u-r2-cs}', grant_type: 'fwcy-ds3u-r2-agt', rid: 'service_standard_registration', tkn_url: 'https://fwcy-ds3u-r2.com' },
            R3: { cid: 'fwcy-ds3u-r3-cid', client_secret: '${{}fwcy-ds3u-r3-cs}', grant_type: 'fwcy-ds3u-r3-agt', rid: 'network_node_registration',     tkn_url: 'https://fwcy-ds3u-r3.com' }
        }
    },
    SHORT: { cid: undefined,          client_secret: undefined,              grant_type: undefined,          rid: undefined,                       tkn_url: undefined },
    DEV:   { cid: 'fwcy-ds-dev-cid',  client_secret: '${{}fwcy-ds-dev-cs}',  grant_type: 'fwcy-ds-dev-agt',  rid: 'network_node_registration',     tkn_url: 'https://fwcy-ds-dev.com' },
    TEST:  { cid: 'fwcy-ds-test-cid', client_secret: '${{}fwcy-ds-test-cs}', grant_type: 'fwcy-ds-test-agt', rid: 'network_node_registration',     tkn_url: 'https://fwcy-ds-test.com' },
    PROD:  { cid: 'fwcy-ds-prod-cid', client_secret: '${{}fwcy-ds-prod-cs}', grant_type: 'fwcy-ds-prod-agt', rid: 'service_standard_registration', tkn_url: 'https://fwcy-ds-prod.com' }
}
const DS_R_PAG = {
    MIN:   {
        DS1: {
            R1: { lim: null, lab: null, limlab: null, start: null },
            R2: { lim: null, lab: null, limlab: null, start: null },
            R3: { lim: null, lab: null, limlab: null, start: null }
        },
        DS2: {
            R1: { lim: null, lab: null, limlab: null, start: null },
            R2: { lim: null, lab: null, limlab: null, start: null },
            R3: { lim: null, lab: null, limlab: null, start: null }
        },
        DS3: {
            R1: { lim: null, lab: null, limlab: null, start: null },
            R2: { lim: null, lab: null, limlab: null, start: null },
            R3: { lim: null, lab: null, limlab: null, start: null }
        },
    },
    MAX:   {
        DS1: {
            R1: { lim: 1100, lab: 'fwcy-ds1-r1-pag-lab', limlab: 'fwcy-ds1-r1-limlab', start: 1010 },
            R2: { lim: 1200, lab: 'fwcy-ds1-r2-pag-lab', limlab: 'fwcy-ds1-r2-limlab', start: 1020 },
            R3: { lim: 1300, lab: 'fwcy-ds1-r3-pag-lab', limlab: 'fwcy-ds1-r3-limlab', start: 1030 }
        },
        DS2: {
            R1: { lim: 2100, lab: 'fwcy-ds2-r1-pag-lab', limlab: 'fwcy-ds2-r1-limlab', start: 2010 },
            R2: { lim: 2200, lab: 'fwcy-ds2-r2-pag-lab', limlab: 'fwcy-ds2-r2-limlab', start: 2020 },
            R3: { lim: 2300, lab: 'fwcy-ds2-r3-pag-lab', limlab: 'fwcy-ds2-r3-limlab', start: 2030 }
        },
        DS3: {
            R1: { lim: 3100, lab: 'fwcy-ds3-r1-pag-lab', limlab: 'fwcy-ds3-r1-limlab', start: 3010 },
            R2: { lim: 3200, lab: 'fwcy-ds3-r2-pag-lab', limlab: 'fwcy-ds3-r2-limlab', start: 3020 },
            R3: { lim: 3300, lab: 'fwcy-ds3-r3-pag-lab', limlab: 'fwcy-ds3-r3-limlab', start: 3030 }
        }
    },
    UPD:   {
        DS1: {
            R1: { lim: 1101, lab: 'fwcy-ds1u-r1-pag-lab', limlab: 'fwcy-ds1u-r1-limlab', start: 1011 },
            R2: { lim: 1201, lab: 'fwcy-ds1u-r2-pag-lab', limlab: 'fwcy-ds1u-r2-limlab', start: 1021 },
            R3: { lim: 1301, lab: 'fwcy-ds1u-r3-pag-lab', limlab: 'fwcy-ds1u-r3-limlab', start: 1031 }
        },
        DS2: {
            R1: { lim: 2101, lab: 'fwcy-ds2u-r1-pag-lab', limlab: 'fwcy-ds2u-r1-limlab', start: 2011 },
            R2: { lim: 2201, lab: 'fwcy-ds2u-r2-pag-lab', limlab: 'fwcy-ds2u-r2-limlab', start: 2021 },
            R3: { lim: 2301, lab: 'fwcy-ds2u-r3-pag-lab', limlab: 'fwcy-ds2u-r3-limlab', start: 2031 }
        },
        DS3: {
            R1: { lim: 3101, lab: 'fwcy-ds3u-r1-pag-lab', limlab: 'fwcy-ds3u-r1-limlab', start: 3011 },
            R2: { lim: 3201, lab: 'fwcy-ds3u-r2-pag-lab', limlab: 'fwcy-ds3u-r2-limlab', start: 3021 },
            R3: { lim: 3301, lab: 'fwcy-ds3u-r3-pag-lab', limlab: 'fwcy-ds3u-r3-limlab', start: 3031 }
        }
    },
    SHORT: { lim: undefined, lab: undefined,                limlab: undefined,               start: undefined },
    DEV:   { lim: 1100,      lab: 'fwcy-ds-dev-r-pag-lab',  limlab: 'fwcy-ds-dev-r-limlab',  start: 1010 },
    TEST:  { lim: 1200,      lab: 'fwcy-ds-test-r-pag-lab', limlab: 'fwcy-ds-test-r-limlab', start: 1020 },
    PROD:  { lim: 1300,      lab: 'fwcy-ds-prod-r-pag-lab', limlab: 'fwcy-ds-prod-r-limlab', start: 1030 }
}
const DS_R = {
    MIN:   {
        DS1: {
            R1: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: DS_R_PAG.MIN.DS1.R1, req_timeout: null, retries_cnt: null, retry_timeout: null, auth: DS_R_AUTH.MIN.DS1.R1 },
            R2: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: DS_R_PAG.MIN.DS1.R2, req_timeout: null, retries_cnt: null, retry_timeout: null, auth: DS_R_AUTH.MIN.DS1.R2 },
            R3: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: DS_R_PAG.MIN.DS1.R3, req_timeout: null, retries_cnt: null, retry_timeout: null, auth: DS_R_AUTH.MIN.DS1.R3 }
        },
        DS2: {
            R1: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: DS_R_PAG.MIN.DS2.R1, req_timeout: null, retries_cnt: null, retry_timeout: null, auth: DS_R_AUTH.MIN.DS2.R1 },
            R2: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: DS_R_PAG.MIN.DS2.R2, req_timeout: null, retries_cnt: null, retry_timeout: null, auth: DS_R_AUTH.MIN.DS2.R2 },
            R3: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: DS_R_PAG.MIN.DS2.R3, req_timeout: null, retries_cnt: null, retry_timeout: null, auth: DS_R_AUTH.MIN.DS2.R3 }
        },
        DS3: {
            R1: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: DS_R_PAG.MIN.DS3.R1, req_timeout: null, retries_cnt: null, retry_timeout: null, auth: DS_R_AUTH.MIN.DS3.R1 },
            R2: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: DS_R_PAG.MIN.DS3.R2, req_timeout: null, retries_cnt: null, retry_timeout: null, auth: DS_R_AUTH.MIN.DS3.R2 },
            R3: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: DS_R_PAG.MIN.DS3.R3, req_timeout: null, retries_cnt: null, retry_timeout: null, auth: DS_R_AUTH.MIN.DS3.R3 }
        }
    },
    MAX:   {
        DS1: {
            R1: { method: 'POST', body_key: 'fwcy_ds1_r1_rbk', body: 'fwcy-ds1-r1-bs', th_lim: 11000, sleep_duration: 10100, pag: DS_R_PAG.MAX.DS1.R1, req_timeout: 9100, retries_cnt: 910, retry_timeout: 90010, auth: DS_R_AUTH.MAX.DS1.R1 },
            R2: { method: 'GET',  body_key: 'fwcy_ds1_r2_rbk', body: 'fwcy-ds1-r2-bs', th_lim: 12000, sleep_duration: 10200, pag: DS_R_PAG.MAX.DS1.R2, req_timeout: 9200, retries_cnt: 920, retry_timeout: 90020, auth: DS_R_AUTH.MAX.DS1.R1 },
            R3: { method: 'GET',  body_key: 'fwcy_ds1_r3_rbk', body: 'fwcy-ds1-r3-bs', th_lim: 13000, sleep_duration: 10300, pag: DS_R_PAG.MAX.DS1.R3, req_timeout: 9300, retries_cnt: 930, retry_timeout: 90030, auth: DS_R_AUTH.MAX.DS1.R1 }
        },
        DS2: {
            R1: { method: 'GET',  body_key: 'fwcy_ds2_r1_rbk', body: 'fwcy-ds2-r1-bs', th_lim: 21000, sleep_duration: 20100, pag: DS_R_PAG.MAX.DS2.R1, req_timeout: 8100, retries_cnt: 810, retry_timeout: 80010, auth: DS_R_AUTH.MAX.DS2.R1 },
            R2: { method: 'POST', body_key: 'fwcy_ds2_r2_rbk', body: 'fwcy-ds2-r2-bs', th_lim: 22000, sleep_duration: 20200, pag: DS_R_PAG.MAX.DS2.R2, req_timeout: 8200, retries_cnt: 820, retry_timeout: 80020, auth: DS_R_AUTH.MAX.DS2.R1 },
            R3: { method: 'GET',  body_key: 'fwcy_ds2_r3_rbk', body: 'fwcy-ds2-r3-bs', th_lim: 23000, sleep_duration: 20300, pag: DS_R_PAG.MAX.DS2.R3, req_timeout: 8300, retries_cnt: 830, retry_timeout: 80030, auth: DS_R_AUTH.MAX.DS2.R1 }
        },
        DS3: {
            R1: { method: 'GET',  body_key: 'fwcy_ds3_r1_rbk', body: 'fwcy-ds3-r1-bs', th_lim: 31000, sleep_duration: 30100, pag: DS_R_PAG.MAX.DS3.R1, req_timeout: 7100, retries_cnt: 710, retry_timeout: 70010, auth: DS_R_AUTH.MAX.DS3.R1 },
            R2: { method: 'GET',  body_key: 'fwcy_ds3_r2_rbk', body: 'fwcy-ds3-r2-bs', th_lim: 32000, sleep_duration: 30200, pag: DS_R_PAG.MAX.DS3.R2, req_timeout: 7200, retries_cnt: 720, retry_timeout: 70020, auth: DS_R_AUTH.MAX.DS3.R1 },
            R3: { method: 'POST', body_key: 'fwcy_ds3_r3_rbk', body: 'fwcy-ds3-r3-bs', th_lim: 33000, sleep_duration: 30300, pag: DS_R_PAG.MAX.DS3.R3, req_timeout: 7300, retries_cnt: 730, retry_timeout: 70030, auth: DS_R_AUTH.MAX.DS3.R1 }
        }
    },
    UPD:   {
        DS1: {
            R1: { method: 'GET',  body_key: 'fwcy_ds1u_r1_rbk', body: 'fwcy-ds1u-r1-bs', th_lim: 11001, sleep_duration: 10101, pag: DS_R_PAG.UPD.DS1.R1, req_timeout: 9101, retries_cnt: 911, retry_timeout: 90011, auth: DS_R_AUTH.UPD.DS1.R1 },
            R2: { method: 'POST', body_key: 'fwcy_ds1u_r2_rbk', body: 'fwcy-ds1u-r2-bs', th_lim: 12001, sleep_duration: 10201, pag: DS_R_PAG.UPD.DS1.R2, req_timeout: 9201, retries_cnt: 921, retry_timeout: 90021, auth: DS_R_AUTH.UPD.DS1.R1 },
            R3: { method: 'POST', body_key: 'fwcy_ds1u_r3_rbk', body: 'fwcy-ds1u-r3-bs', th_lim: 13001, sleep_duration: 10301, pag: DS_R_PAG.UPD.DS1.R3, req_timeout: 9301, retries_cnt: 931, retry_timeout: 90031, auth: DS_R_AUTH.UPD.DS1.R1 }
        },
        DS2: {
            R1: { method: 'POST', body_key: 'fwcy_ds2u_r1_rbk', body: 'fwcy-ds2u-r1-bs', th_lim: 21001, sleep_duration: 20101, pag: DS_R_PAG.UPD.DS2.R1, req_timeout: 8101, retries_cnt: 811, retry_timeout: 80011, auth: DS_R_AUTH.UPD.DS1.R1 },
            R2: { method: 'GET',  body_key: 'fwcy_ds2u_r2_rbk', body: 'fwcy-ds2u-r2-bs', th_lim: 22001, sleep_duration: 20201, pag: DS_R_PAG.UPD.DS2.R2, req_timeout: 8201, retries_cnt: 821, retry_timeout: 80021, auth: DS_R_AUTH.UPD.DS1.R1 },
            R3: { method: 'POST', body_key: 'fwcy_ds2u_r3_rbk', body: 'fwcy-ds2u-r3-bs', th_lim: 23001, sleep_duration: 20301, pag: DS_R_PAG.UPD.DS2.R3, req_timeout: 8301, retries_cnt: 831, retry_timeout: 80031, auth: DS_R_AUTH.UPD.DS1.R1 }
        },
        DS3: {
            R1: { method: 'POST', body_key: 'fwcy_ds3u_r1_rbk', body: 'fwcy-ds3u-r1-bs', th_lim: 31001, sleep_duration: 30101, pag: DS_R_PAG.UPD.DS3.R1, req_timeout: 7101, retries_cnt: 711, retry_timeout: 70011, auth: DS_R_AUTH.UPD.DS1.R1 },
            R2: { method: 'POST', body_key: 'fwcy_ds3u_r2_rbk', body: 'fwcy-ds3u-r2-bs', th_lim: 32001, sleep_duration: 30201, pag: DS_R_PAG.UPD.DS3.R2, req_timeout: 7201, retries_cnt: 721, retry_timeout: 70021, auth: DS_R_AUTH.UPD.DS1.R1 },
            R3: { method: 'GET',  body_key: 'fwcy_ds3u_r3_rbk', body: 'fwcy-ds3u-r3-bs', th_lim: 33001, sleep_duration: 30301, pag: DS_R_PAG.UPD.DS3.R3, req_timeout: 7301, retries_cnt: 731, retry_timeout: 70031, auth: DS_R_AUTH.UPD.DS1.R1 }
        }
    },
    SHORT: { method: undefined, body_key: undefined,            body: undefined,           th_lim: undefined, sleep_duration: undefined, pag: DS_R_PAG.SHORT, req_timeout: undefined, retries_cnt: undefined, retry_timeout: undefined, auth: DS_R_AUTH.SHORT },
    DEV:   { method: 'GET',     body_key: 'fwcy_ds_dev_r_rbk',  body: 'fwcy-ds-dev-r-bs',  th_lim: 11000,     sleep_duration: 10100,     pag: DS_R_PAG.DEV,   req_timeout: 9100,      retries_cnt: 910,       retry_timeout: 90010,     auth: DS_R_AUTH.DEV },
    TEST:  { method: 'GET',     body_key: 'fwcy_ds_test_r_rbk', body: 'fwcy-ds-test-r-bs', th_lim: 12000,     sleep_duration: 10200,     pag: DS_R_PAG.TEST,  req_timeout: 9200,      retries_cnt: 920,       retry_timeout: 90020,     auth: DS_R_AUTH.TEST },
    PROD:  { method: 'POST',    body_key: 'fwcy_ds_prod_r_rbk', body: 'fwcy-ds-prod-r-bs', th_lim: 13000,     sleep_duration: 10300,     pag: DS_R_PAG.PROD,  req_timeout: 9300,      retries_cnt: 930,       retry_timeout: 90030,     auth: DS_R_AUTH.PROD }
}
const DS = {
    MIN:   {
        DS1: { query_params: undefined },
        DS2: { query_params: undefined },
        DS3: { query_params: undefined }
    },
    MAX:   {
        DS1: { query_params: [ 'data_period' ] },
        DS2: { query_params: [ 'deviceId' ] },
        DS3: { query_params: [ 'facilityNumber' ] },
    },
    UPD:   {
        DS1: { query_params: [ 'deviceId', 'facilityNumber' ] },
        DS2: { query_params: [ 'data_period', 'facilityNumber' ] },
        DS3: { query_params: [ 'data_period', 'deviceId' ] }
    },
    SHORT: { query_params: undefined },
    DEV:   { query_params: [ 'data_period' ] },
    TEST:  { query_params: [ 'deviceId' ] },
    PROD:  { query_params: [ 'facilityNumber' ] }
}
const DS_DEP = {
    MIN: {
        DS1: { jads: null, jvm: '-Xmx1G', k8s_cpu: null, k8s_ram: null, m: null, h: null, d: null },
        DS2: { jads: null, jvm: '-Xmx2G', k8s_cpu: null, k8s_ram: null, m: null, h: null, d: null },
        DS3: { jads: null, jvm: '-Xmx3G', k8s_cpu: null, k8s_ram: null, m: null, h: null, d: null }
    },
    MAX: {
        DS1: { jads: 1000, jvm: '-Xmx1G', k8s_cpu: 1100, k8s_ram: '11Gi', m: 31, h: 21, d: 11, mon: 'January',  wd: 'Monday' },
        DS2: { jads: 2000, jvm: '-Xmx2G', k8s_cpu: 2100, k8s_ram: '12Gi', m: 32, h: 22, d: 12, mon: 'February', wd: 'Tuesday' },
        DS3: { jads: 3000, jvm: '-Xmx3G', k8s_cpu: 3100, k8s_ram: '13Gi', m: 33, h: 23, d: 13, mon: 'March',    wd: 'Wednesday' }
    },
    UPD: {
        DS1: { jads: 1010, jvm: '-Xmx2G', k8s_cpu: 1110, k8s_ram: '12Gi', m: 32, h: 22, d: 12, mon: 'September',  wd: 'Thursday' },
        DS2: { jads: 2010, jvm: '-Xmx3G', k8s_cpu: 2110, k8s_ram: '13Gi', m: 33, h: 23, d: 13, mon: 'October',    wd: 'Friday' },
        DS3: { jads: 3010, jvm: '-Xmx4G', k8s_cpu: 3110, k8s_ram: '14Gi', m: 34, h: 24, d: 14, mon: 'November',   wd: 'Saturday' }
    },
    SHORT: { jads: undefined, jvm: undefined, k8s_cpu: undefined, k8s_ram: undefined, m: undefined, h: undefined, d: undefined, mon: undefined,  wd: undefined },
    DEV:   { jads: 1000,      jvm: '-Xmx1G',  k8s_cpu: 1100,      k8s_ram: '11Gi',    m: 31,        h: 21,        d: 11,        mon: 'January',  wd: 'Monday' },
    TEST:  { jads: 2000,      jvm: '-Xmx2G',  k8s_cpu: 2100,      k8s_ram: '12Gi',    m: 32,        h: 22,        d: 12,        mon: 'February', wd: 'Tuesday' },
    PROD:  { jads: 3000,      jvm: '-Xmx3G',  k8s_cpu: 3100,      k8s_ram: '13Gi',    m: 33,        h: 23,        d: 13,        mon: 'March',    wd: 'Wednesday' }
}
const DS_ING = {
    MIN: {
        DS1: { bblock: 10000, bbuff: null, cs: 10100,  ts: null },
        DS2: { bblock: 20000, bbuff: null, cs: 10200,  ts: null },
        DS3: { bblock: 30000, bbuff: null, cs: 10300,  ts: null }
    },
    MAX: {
        DS1: { bblock: 10000, bbuff: 11000, cs: 10100, ts: '2001-01-21 11:21:31' },
        DS2: { bblock: 20000, bbuff: 21000, cs: 20100, ts: '2002-02-22 12:22:32' },
        DS3: { bblock: 30000, bbuff: 31000, cs: 30100, ts: '2002-03-23 13:23:33' }
    },
    UPD: {
        DS1: { bblock: 10001, bbuff: 11001, cs: 10101, ts: '2011-09-11 21:31:41' },
        DS2: { bblock: 20001, bbuff: 21001, cs: 20101, ts: '2012-08-12 22:32:42' },
        DS3: { bblock: 30001, bbuff: 31001, cs: 30101, ts: '2013-07-13 23:33:43' }
    },
    SHORT: { bblock: undefined, bbuf: undefined, cs: undefined, ts: undefined },
    DEV:   { bblock: 10000, bbuff: 11000, cs: 10100, ts: '2001-01-21 11:21:31' },
    TEST:  { bblock: 20000, bbuff: 21000, cs: 20100, ts: '2002-02-22 12:22:32' },
    PROD:  { bblock: 30000, bbuff: 31000, cs: 30100, ts: '2002-03-23 13:23:33' }
}

function create__no_dc__no_dss__test() {
    // Configure common. TEST, PROD: disable. DEV: enable and configure.
    configure_common({ dc: 'fwcy-dc', ing: 'rest', conf_dc: false, conf_dss: false })
    cy.switchEnv('TEST').switch('Configure', false)
    cy.switchEnv('PROD').switch('Configure', false)
    cy.switchEnv('DEV').switch('Configure', true)

    // Click the 'CREATE' button. DEV, TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV').checkNoYAML()
    cy.switchEnv('TEST').checkNoYAML()
    cy.switchEnv('PROD').checkNoYAML()
}

function create__dc_min__test() {
    // Configure common. TEST, PROD: disable. DEV: enable and configure.
    let common = configure_common({ dc: 'fwcy-dc', ing: 'rest', conf_dc: true, conf_dss: false })
    cy.switchEnv('TEST').switch('Configure', false)
    cy.switchEnv('PROD').switch('Configure', false)
    cy.switchEnv('DEV').switch('Configure', true)
    let main = configure_main(MAIN.MIN)
    let oauth2 = configure_oauth2(OAUTH2.MIN)

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, oauth2 })
    // cy.switchEnv('TEST').checkNoYAML()
    // cy.switchEnv('PROD').checkNoYAML()
}

function create__dc_max__test() {
    // Configure common. TEST, PROD: disable. DEV: enable and configure.
    let common = configure_common({ dc: 'fwcy-dc', ing: 'rest', conf_dc: true, conf_dss: false })
    cy.switchEnv('TEST').switch('Configure', false)
    cy.switchEnv('PROD').switch('Configure', false)
    cy.switchEnv('DEV').switch('Configure', true)
    let main = configure_main(MAIN.MAX)
    let oauth2 = configure_oauth2(OAUTH2.MAX)

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, oauth2 })
    // cy.switchEnv('TEST').checkNoYAML()
    // cy.switchEnv('PROD').checkNoYAML()
}

function create__dss_min__test() {
    // Configure common. TEST, PROD: disable. DEV: enable and configure.
    let common = configure_common({ dc: 'fwcy-dc', ing: 'rest', conf_dc: false, conf_dss: true })
    cy.switchEnv('TEST').switch('Configure', false)
    cy.switchEnv('PROD').switch('Configure', false)
    cy.switchEnv('DEV').switch('Configure', true)
    let main = configure_main(MAIN.SHORT)  // TODO: drop when the bug is fixed (when configuring the DC page is not needed).
    let oauth2 = configure_oauth2(OAUTH2.SHORT)  // TODO: drop when the bug is fixed (when configuring the DC page is not needed).

    // Navigate to the 'Data Sets' tab. DEV: configure.
    cy.navigate('Data Sets')
    cy.switchEnv('DEV')
    const ds1_rs = { 'https://fwcy-ds1-r1.com': DS_R.MIN.DS1.R1, 'https://fwcy-ds1-r2.com': DS_R.MIN.DS1.R2 }
    const ds2_rs = { 'https://fwcy-ds2-r1.com': DS_R.MIN.DS2.R1, 'https://fwcy-ds2-r2.com': DS_R.MIN.DS2.R2 }
    let dss = configure_dss({
        'fwcy-ds1': { ...DS.MIN.DS1, dep: DS_DEP.MIN.DS1, ing: DS_ING.MIN.DS1, rs: ds1_rs },
        'fwcy-ds2': { ...DS.MIN.DS2, dep: DS_DEP.MIN.DS2, ing: DS_ING.MIN.DS2, rs: ds2_rs }
    })

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, oauth2, dss })
    // cy.switchEnv('TEST').checkNoYAML()
    // cy.switchEnv('PROD').checkNoYAML()
}

function create__dss_max__test() {
    // Configure common. TEST, PROD: disable. DEV: enable and configure.
    let common = configure_common({ dc: 'fwcy-dc', ing: 'rest', conf_dc: false, conf_dss: true })
    cy.switchEnv('TEST').switch('Configure', false)
    cy.switchEnv('PROD').switch('Configure', false)
    cy.switchEnv('DEV').switch('Configure', true)
    let main = configure_main(MAIN.SHORT)
    let oauth2 = configure_oauth2(OAUTH2.SHORT)

    // Navigate to the 'Data Sets' tab. DEV: configure.
    cy.navigate('Data Sets')
    cy.switchEnv('DEV')
    const ds1_rs = { 'https://fwcy-ds1-r1.com': DS_R.MAX.DS1.R1, 'https://fwcy-ds1-r2.com': DS_R.MAX.DS1.R2 }
    const ds2_rs = { 'https://fwcy-ds2-r1.com': DS_R.MAX.DS2.R1, 'https://fwcy-ds2-r2.com': DS_R.MAX.DS2.R2 }
    let dss = configure_dss({
        'fwcy-ds1': { ...DS.MAX.DS1, dep: DS_DEP.MAX.DS1, ing: DS_ING.MAX.DS1, rs: ds1_rs },
        'fwcy-ds2': { ...DS.MAX.DS2, dep: DS_DEP.MAX.DS2, ing: DS_ING.MAX.DS2, rs: ds2_rs }
    })

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, oauth2, dss })
    // cy.switchEnv('TEST').checkNoYAML()
    // cy.switchEnv('PROD').checkNoYAML()
}

function create__dc__dss__test() {
    // Configure common. TEST, PROD: disable. DEV: enable and configure.
    let common = configure_common({ dc: 'fwcy-dc', ing: 'rest', conf_dc: true, conf_dss: true })
    cy.switchEnv('TEST').switch('Configure', false)
    cy.switchEnv('PROD').switch('Configure', false)
    cy.switchEnv('DEV').switch('Configure', true)
    let main = configure_main(MAIN.MAX)
    let oauth2 = configure_oauth2(OAUTH2.MAX)

    // Navigate to the 'Data Sets' tab. DEV: configure.
    cy.navigate('Data Sets')
    cy.switchEnv('DEV')
    const ds1_rs = { 'https://fwcy-ds1-r1.com': DS_R.MAX.DS1.R1, 'https://fwcy-ds1-r2.com': DS_R.MAX.DS1.R2 }
    const ds2_rs = { 'https://fwcy-ds2-r1.com': DS_R.MAX.DS2.R1, 'https://fwcy-ds2-r2.com': DS_R.MAX.DS2.R2 }
    let dss = configure_dss({
        'fwcy-ds1': { ...DS.MAX.DS1, dep: DS_DEP.MAX.DS1, ing: DS_ING.MAX.DS1, rs: ds1_rs },
        'fwcy-ds2': { ...DS.MAX.DS2, dep: DS_DEP.MAX.DS2, ing: DS_ING.MAX.DS2, rs: ds2_rs }
    })

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, oauth2, dss })
    // cy.switchEnv('TEST').checkNoYAML()
    // cy.switchEnv('PROD').checkNoYAML()
}

function create__all_envs__test() {
    // Configure common. DEV, TEST, PROD: enable and configure.
    let common = configure_common({ dc: 'fwcy-dc', ing: 'rest', conf_dc: true, conf_dss: true })
    cy.switchEnv('DEV').switch('Configure', true)
    let dev = { main: configure_main(MAIN.DEV, 'DEV'), oauth2: configure_oauth2(OAUTH2.DEV, 'DEV') }
    cy.switchEnv('TEST').switch('Configure', true)
    let test = { main: configure_main(MAIN.TEST, 'TEST'), oauth2: configure_oauth2(OAUTH2.TEST, 'TEST') }
    cy.switchEnv('PROD').switch('Configure', true)
    let prod = { main: configure_main(MAIN.PROD, 'PROD'), oauth2: configure_oauth2(OAUTH2.PROD, 'PROD') }

    // Navigate to the 'Data Sets' tab. DEV, TEST, PROD: configure.
    cy.navigate('Data Sets')
    cy.switchEnv('DEV')
    dev.dss = configure_dss({ 'fwcy-ds-dev': { ...DS.DEV, dep: DS_DEP.DEV, ing: DS_ING.DEV, rs: { 'https://fwcy-ds-dev-r.com': DS_R.DEV } } }, 'DEV')
    cy.switchEnv('TEST')
    test.dss = configure_dss({ 'fwcy-ds-test': { ...DS.TEST, dep: DS_DEP.TEST, ing: DS_ING.TEST, rs: { 'https://fwcy-ds-test-r.com': DS_R.TEST } } }, 'TEST')
    cy.switchEnv('PROD')
    prod.dss = configure_dss({ 'fwcy-ds-prod': { ...DS.PROD, dep: DS_DEP.PROD, ing: DS_ING.PROD, rs: { 'https://fwcy-ds-prod-r.com': DS_R.PROD } } }, 'PROD')

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, ...dev })
    cy.switchEnv('TEST')
    checkYAML({ common, ...test })
    cy.switchEnv('PROD')
    checkYAML({ common, ...prod })
}

function update__dc__test() {
    // Configure common. DEV: enable and configure.
    configure_common({ dc: 'fwcy-dc', ing: 'rest', conf_dc: true, conf_dss: false })
    cy.switchEnv('TEST').switch('Configure', false)
    cy.switchEnv('PROD').switch('Configure', false)
    cy.switchEnv('DEV').switch('Configure', true)
    configure_main(MAIN.MAX)
    configure_oauth2(MAIN.MAX)

    // Click the 'CREATE' button. Click the 'UPDATE' button. Navigate to the 'Ingestion' tab. Reconfigure common. DEV: reconfigure.
    cy.create()
    cy.update()
    cy.navigate('Ingestion')
    let common = configure_common({ dc: 'fwcy-dc-upd' })
    cy.switchEnv('DEV')
    let main = configure_main(MAIN.UPD)
    let oauth2 = configure_oauth2(MAIN.UPD)

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, oauth2 })
    // cy.switchEnv('TEST').checkNoYAML()
    // cy.switchEnv('PROD').checkNoYAML()
}

function update__dss__test() {
    // Configure common. DEV: enable and configure.
    let common = configure_common({ dc: 'fwcy-dc', ing: 'rest', conf_dc: false, conf_dss: true })
    cy.switchEnv('TEST').switch('Configure', false)
    cy.switchEnv('PROD').switch('Configure', false)
    cy.switchEnv('DEV').switch('Configure', true)
    let main = configure_main(MAIN.SHORT)
    let oauth2 = configure_oauth2(MAIN.SHORT)

    // Navigate to the 'Data Sets' tab. DEV: configure.
    cy.navigate('Data Sets')
    cy.switchEnv('DEV')
    const ds1_rs = { 'https://fwcy-ds1-r1.com': DS_R.MAX.DS1.R1, 'https://fwcy-ds1-r2.com': DS_R.MAX.DS1.R2, 'https://fwcy-ds1-r3.com': DS_R.MAX.DS1.R3 }
    const ds2_rs = { 'https://fwcy-ds2-r1.com': DS_R.MAX.DS2.R1, 'https://fwcy-ds2-r2.com': DS_R.MAX.DS2.R2, 'https://fwcy-ds2-r0.com': DS_R.SHORT }
    const ds3_rs = { 'https://fwcy-ds3-r1.com': DS_R.MAX.DS3.R1, 'https://fwcy-ds3-r2.com': DS_R.MAX.DS3.R2, 'https://fwcy-ds3-r3.com': DS_R.MAX.DS3.R3 }
    configure_dss({
        'fwcy-ds0': { ...DS_MTLS.SHORT,   dep: DS_DEP.SHORT,   ing: DS_ING.SHORT,   rs: { 'https://fwcy-ds0-r1.com': DS_R.SHORT } },
        'fwcy-ds1': { ...DS_MTLS.MAX.DS1, dep: DS_DEP.MAX.DS1, ing: DS_ING.MAX.DS1, rs: ds1_rs },
        'fwcy-ds2': { ...DS_MTLS.MAX.DS2, dep: DS_DEP.MAX.DS2, ing: DS_ING.MAX.DS2, rs: ds2_rs }
    })

    // Click the 'CREATE' button. Click the 'UPDATE' button. Navigate to the 'Data Sets' tab. DEV: reconfigure.
    cy.create()
    cy.update()
    cy.navigate('Data Sets')
    cy.switchEnv('DEV')
    const ds2_rs_upd = {  // 0 - drop, 1 - no changes, 2 - update, 3 - add.
        'https://fwcy-ds2-r0.com': null,
        'https://fwcy-ds2-r2.com': { ...DS_R.UPD.DS2.R2, r: 'https://fwcy-ds2-r2-upd.com' },
        'https://fwcy-ds2-r3.com': DS_R.MAX.DS2.R3
    }
    let dss = configure_dss({  // 0 - drop, 1 - no changes, 2 - update, 3 - add.
        'fwcy-ds0': null,
        'fwcy-ds2': { ...DS_MTLS.UPD.DS2, dep: DS_DEP.UPD.DS2, ing: DS_ING.UPD.DS2, rs: ds2_rs_upd, ds: 'fwcy-ds2-upd' },
        'fwcy-ds3': { ...DS_MTLS.MAX.DS3, dep: DS_DEP.MAX.DS3, ing: DS_ING.MAX.DS3, rs: ds3_rs },
    })

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, oauth2, dss })
    // cy.switchEnv('TEST').checkNoYAML()
    // cy.switchEnv('PROD').checkNoYAML()
}

describe(
    'Batch Ingestiong wizard ("rest" ingestion type and "mtls" auth method) test suit.',
    () => {
        before(() => { cy.login() })
        beforeEach(() => {
			reset_window()
            cy.restoreLocalStorage()
            cy.visit('/')
            cy.open('Create Batch Ingestion')
        })
        // Create:
        // it('(C+) Create W/ no DC and no DSs.',            create__no_dc__no_dss__test)  // TODO: discuss behavior W/ Yevheniia.
        it.only('(C+) Create W/ minimal DC.',                  create__dc_min__test)
        it.only('(C+) Create W/ maximum DC.',                  create__dc_max__test)
        it('(C+) Create W/ minimal DSs.',                 create__dss_min__test)  // TODO: ask Andrew, Yevheniia, are the dropdowns in the request auth config required.
        it('(C+) Create W/ maximum DSs.',                 create__dss_max__test)
        it('(C+) Create W/ DC and DSs.',                  create__dc__dss__test)
        it('(C+) Create W/ all environments configured.', create__all_envs__test)  // TODO: add different invironments to the configuration
        // Update:
        it('(M+) Update DC.',  update__dc__test)
        it('(M+) Update Dss.', update__dss__test)
        // Options:
        // TODO: add dropdown options tests here.
        // Default:
        // TODO: add wizard default values tests here...
        afterEach(() => { cy.saveLocalStorage() })
        after(() => { })
    }
);
Editor is loading...
Leave a Comment