Untitled

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


const MAIN = {
    MIN:   { auth: 'custom', rbs: null },
    MAX:   { auth: 'custom', rbs: 1000000 },
    UPD:   { auth: 'custom', rbs: 1001000 },
    SHORT: { auth: 'custom', rbd: undefined},
    DEV:   { auth: 'custom', rbs: 1001000 },
    TEST:  { auth: 'custom', rbs: 1002000 },
    PROD:  { auth: 'custom', rbs: 1003000 }
}
const CUSTOM = {
    MIN:   { cid: 'fwcy-cid',      client_secret: '${{}fwcy-cs}',      tkn_body: null,                 tkn_url: null,                    qps: { },                                      ths: { } },
    MAX:   { cid: 'fwcy-cid',      client_secret: '${{}fwcy-cs}',      tkn_body: 'fwcy-tkn-body',      tkn_url: 'https://fwcy.com',      qps: { 'fwcy-qp1-k': 'fwcy-qp1-v' },           ths: { 'fwcy-th1-k': 'fwcy-th1-v' } },
    UPD:   { cid: 'fwcy-cidu',     client_secret: '${{}fwcy-csu}',     tkn_body: 'fwcy-tkn-body',      tkn_url: 'https://fwcyu.com',     qps: { 'fwcy-qp1-k': 'fwcy-qp1-vu' },          ths: { 'fwcy-th1-k': 'fwcy-th1-vu' } },
    SHORT: { cid: 'fwcy-cid',      client_secret: '${{}fwcy-cs}',      tkn_body: undefined,            tkn_url: undefined,               qps: { },                                      ths: { } },
    DEV:   { cid: 'fwcy-cid-dev',  client_secret: '${{}fwcy-cs-dev}',  tkn_body: 'fwcy-tkn-body-dev',  tkn_url: 'https://fwcy-dev.com',  qps: { 'fwcy-qp1-k-dev': 'fwcy-qp1-v-dev' },   ths: { 'fwcy-th1-k-dev': 'fwcy-th1-v-dev' } },
    TEST:  { cid: 'fwcy-cid-test', client_secret: '${{}fwcy-cs-test}', tkn_body: 'fwcy-tkn-body-test', tkn_url: 'https://fwcy-test.com', qps: { 'fwcy-qp1-k-test': 'fwcy-qp1-v-test' }, ths: { 'fwcy-th1-k-test': 'fwcy-th1-v-test' } },
    PROD:  { cid: 'fwcy-cid-prod', client_secret: '${{}fwcy-cs-prod}', tkn_body: 'fwcy-tkn-body-prod', tkn_url: 'https://fwcy-prod.com', qps: { 'fwcy-qp1-k-prod': 'fwcy-qp1-v-prod' }, ths: { 'fwcy-th1-k-prod': 'fwcy-th1-v-prod' } }
}
const DS_AU = {
    MIN:   {
        DS1: {
            AU1: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: { lim: null, lab: null, limlab: null, start: null } },
            AU2: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: { lim: null, lab: null, limlab: null, start: null } },
            AU3: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: { lim: null, lab: null, limlab: null, start: null } }
        },
        DS2: {
            AU1: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: { lim: null, lab: null, limlab: null, start: null } },
            AU2: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: { lim: null, lab: null, limlab: null, start: null } },
            AU3: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: { lim: null, lab: null, limlab: null, start: null } },
        },
        DS3: {
            AU1: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: { lim: null, lab: null, limlab: null, start: null } },
            AU2: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: { lim: null, lab: null, limlab: null, start: null } },
            AU3: { method: undefined, body_key: null, body: null, th_lim: null, sleep_duration: null, pag: { lim: null, lab: null, limlab: null, start: null } },
        },
    },
    MAX:   {
        DS1: {
            AU1: { method: 'POST', body_key: 'fwcy_ds1_r1_rbk', body: 'fwcy-ds1-r1-bs', th_lim: 11000, sleep_duration: 10100, pag: { lim: 1100, lab: 'fwcy-ds1-r1-pag-lab', limlab: 'fwcy-ds1-r1-limlab', start: 1010 } },
            AU2: { method: 'GET',  body_key: 'fwcy_ds1_r2_rbk', body: 'fwcy-ds1-r2-bs', th_lim: 12000, sleep_duration: 10200, pag: { lim: 1200, lab: 'fwcy-ds1-r2-pag-lab', limlab: 'fwcy-ds1-r2-limlab', start: 1020 } },
            AU3: { method: 'GET',  body_key: 'fwcy_ds1_r3_rbk', body: 'fwcy-ds1-r3-bs', th_lim: 13000, sleep_duration: 10300, pag: { lim: 1300, lab: 'fwcy-ds1-r3-pag-lab', limlab: 'fwcy-ds1-r3-limlab', start: 1030 } }
        },
        DS2: {
            AU1: { method: 'GET',  body_key: 'fwcy_ds2_r1_rbk', body: 'fwcy-ds2-r1-bs', th_lim: 21000, sleep_duration: 20100, pag: { lim: 2100, lab: 'fwcy-ds2-r1-pag-lab', limlab: 'fwcy-ds2-r1-limlab', start: 2010 } },
            AU2: { method: 'POST', body_key: 'fwcy_ds2_r2_rbk', body: 'fwcy-ds2-r2-bs', th_lim: 22000, sleep_duration: 20200, pag: { lim: 2200, lab: 'fwcy-ds2-r2-pag-lab', limlab: 'fwcy-ds2-r2-limlab', start: 2020 } },
            AU3: { method: 'GET',  body_key: 'fwcy_ds2_r3_rbk', body: 'fwcy-ds2-r3-bs', th_lim: 23000, sleep_duration: 20300, pag: { lim: 2300, lab: 'fwcy-ds2-r3-pag-lab', limlab: 'fwcy-ds2-r3-limlab', start: 2030 } }
        },
        DS3: {
            AU1: { method: 'GET',  body_key: 'fwcy_ds3_r1_rbk', body: 'fwcy-ds3-r1-bs', th_lim: 31000, sleep_duration: 30100, pag: { lim: 3100, lab: 'fwcy-ds3-r1-pag-lab', limlab: 'fwcy-ds3-r1-limlab', start: 3010 } },
            AU2: { method: 'GET',  body_key: 'fwcy_ds3_r2_rbk', body: 'fwcy-ds3-r2-bs', th_lim: 32000, sleep_duration: 30200, pag: { lim: 3200, lab: 'fwcy-ds3-r2-pag-lab', limlab: 'fwcy-ds3-r2-limlab', start: 3020 } },
            AU3: { method: 'POST', body_key: 'fwcy_ds3_r3_rbk', body: 'fwcy-ds3-r3-bs', th_lim: 33000, sleep_duration: 30300, pag: { lim: 3300, lab: 'fwcy-ds3-r3-pag-lab', limlab: 'fwcy-ds3-r3-limlab', start: 3030 } }
        }
    },
    UPD:   {
        DS1: {
            AU1: { method: 'GET',  body_key: 'fwcy_ds1u_r1_rbk', body: 'fwcy-ds1u-r1-bs', th_lim: 11001, sleep_duration: 10101, pag: { lim: 1101, lab: 'fwcy-ds1u-r1-pag-lab', limlab: 'fwcy-ds1u-r1-limlab', start: 1011 } },
            AU2: { method: 'POST', body_key: 'fwcy_ds1u_r2_rbk', body: 'fwcy-ds1u-r2-bs', th_lim: 12001, sleep_duration: 10201, pag: { lim: 1201, lab: 'fwcy-ds1u-r2-pag-lab', limlab: 'fwcy-ds1u-r2-limlab', start: 1021 } },
            AU3: { method: 'POST', body_key: 'fwcy_ds1u_r3_rbk', body: 'fwcy-ds1u-r3-bs', th_lim: 13001, sleep_duration: 10301, pag: { lim: 1301, lab: 'fwcy-ds1u-r3-pag-lab', limlab: 'fwcy-ds1u-r3-limlab', start: 1031 } }
        },
        DS2: {
            AU1: { method: 'POST', body_key: 'fwcy_ds2u_r1_rbk', body: 'fwcy-ds2u-r1-bs', th_lim: 21001, sleep_duration: 20101, pag: { lim: 2101, lab: 'fwcy-ds2u-r1-pag-lab', limlab: 'fwcy-ds2u-r1-limlab', start: 2011 } },
            AU2: { method: 'GET',  body_key: 'fwcy_ds2u_r2_rbk', body: 'fwcy-ds2u-r2-bs', th_lim: 22001, sleep_duration: 20201, pag: { lim: 2201, lab: 'fwcy-ds2u-r2-pag-lab', limlab: 'fwcy-ds2u-r2-limlab', start: 2021 } },
            AU3: { method: 'POST', body_key: 'fwcy_ds2u_r3_rbk', body: 'fwcy-ds2u-r3-bs', th_lim: 23001, sleep_duration: 20301, pag: { lim: 2301, lab: 'fwcy-ds2u-r3-pag-lab', limlab: 'fwcy-ds2u-r3-limlab', start: 2031 } }
        },
        DS3: {
            AU1: { method: 'POST', body_key: 'fwcy_ds3u_r1_rbk', body: 'fwcy-ds3u-r1-bs', th_lim: 31001, sleep_duration: 30101, pag: { lim: 3101, lab: 'fwcy-ds3u-r1-pag-lab', limlab: 'fwcy-ds3u-r1-limlab', start: 3011 } },
            AU2: { method: 'POST', body_key: 'fwcy_ds3u_r2_rbk', body: 'fwcy-ds3u-r2-bs', th_lim: 32001, sleep_duration: 30201, pag: { lim: 3201, lab: 'fwcy-ds3u-r2-pag-lab', limlab: 'fwcy-ds3u-r2-limlab', start: 3021 } },
            AU3: { method: 'GET',  body_key: 'fwcy_ds3u_r3_rbk', body: 'fwcy-ds3u-r3-bs', th_lim: 33001, sleep_duration: 30301, pag: { lim: 3301, lab: 'fwcy-ds3u-r3-pag-lab', limlab: 'fwcy-ds3u-r3-limlab', start: 3031 } }
        }
    },
    SHORT: { method: undefined, body_key: undefined, body: undefined, th_lim: undefined, sleep_duration: undefined, pag: { lim: undefined, lab: undefined, limlab: undefined, start: undefined } },
    DEV:   { method: 'GET',  body_key: 'fwcy_ds_dev_r_rbk',  body: 'fwcy-ds-dev-r-bs',  th_lim: 11000, sleep_duration: 10100, pag: { lim: 1100, lab: 'fwcy-ds-dev-r-pag-lab',  limlab: 'fwcy-ds-dev-r-limlab',  start: 1010 } },
    TEST:  { method: 'GET',  body_key: 'fwcy_ds_test_r_rbk', body: 'fwcy-ds-test-r-bs', th_lim: 12000, sleep_duration: 10200, pag: { lim: 1200, lab: 'fwcy-ds-test-r-pag-lab', limlab: 'fwcy-ds-test-r-limlab', start: 1020 } },
    PROD:  { method: 'POST', body_key: 'fwcy_ds_prod_r_rbk', body: 'fwcy-ds-prod-r-bs', th_lim: 13000, sleep_duration: 10300, pag: { lim: 1300, lab: 'fwcy-ds-prod-r-pag-lab', limlab: 'fwcy-ds-prod-r-limlab', start: 1030 } }
}
const DS = {
    MIN:   {
        DS1: { join_keys: null },
        DS2: { join_keys: null },
        DS3: { join_keys: null }
    },
    MAX:   {
        DS1: { join_keys: 'fwcy,ds1,jk' },
        DS2: { join_keys: 'fwcy,ds2,jk' },
        DS3: { join_keys: 'fwcy,ds3,jk' },
    },
    UPD:   {
        DS1: { join_keys: 'fwcy,ds1u,jk' },
        DS2: { join_keys: 'fwcy,ds2u,jk' },
        DS3: { join_keys: 'fwcy,ds3u,jk' }
    },
    SHORT: { join_keys: undefined },
    DEV:   { join_keys: 'fwcy,ds,dev,jk' },
    TEST:  { join_keys: 'fwcy,ds,test,jk' },
    PROD:  { join_keys: 'fwcy,ds,prod,jk' }
}
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 custom = configure_custom(CUSTOM.MIN)

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, custom })
    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 custom = configure_custom(CUSTOM.MAX)

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, custom })
    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)

    // Navigate to the 'Data Sets' tab. DEV: configure.
    cy.navigate('Data Sets')
    cy.switchEnv('DEV')
    const ds1_aus = { 'https://fwcy-ds1-au1.com': DS_AU.MIN.DS1.AU1, 'https://fwcy-ds1-au2.com': DS_AU.MIN.DS1.AU2 }
    const ds2_aus = { 'https://fwcy-ds2-au1.com': DS_AU.MIN.DS2.AU1, 'https://fwcy-ds2-au2.com': DS_AU.MIN.DS2.AU2 }
    let dss = configure_dss({
        'fwcy-ds1': { ...DS.MIN.DS1, dep: DS_DEP.MIN.DS1, ing: DS_ING.MIN.DS1, aus: ds1_aus },
        'fwcy-ds2': { ...DS.MIN.DS2, dep: DS_DEP.MIN.DS2, ing: DS_ING.MIN.DS2, aus: ds2_aus }
    })

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, 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)  // TODO: dropd when the bug is fixed (when configuring DC page is not required).

    // Navigate to the 'Data Sets' tab. DEV: configure.
    cy.navigate('Data Sets')
    cy.switchEnv('DEV')
    const ds1_aus = { 'https://fwcy-ds1-au1.com': DS_AU.MAX.DS1.AU1, 'https://fwcy-ds1-au2.com': DS_AU.MAX.DS1.AU2 }
    const ds2_aus = { 'https://fwcy-ds2-au1.com': DS_AU.MAX.DS2.AU1, 'https://fwcy-ds2-au2.com': DS_AU.MAX.DS2.AU2 }
    let dss = configure_dss({
        'fwcy-ds1': { ...DS.MAX.DS1, dep: DS_DEP.MAX.DS1, ing: DS_ING.MAX.DS1, aus: ds1_aus },
        'fwcy-ds2': { ...DS.MAX.DS2, dep: DS_DEP.MAX.DS2, ing: DS_ING.MAX.DS2, aus: ds2_aus }
    })

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, 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 custom = configure_custom(CUSTOM.MAX)

    // Navigate to the 'Data Sets' tab. DEV: configure.
    cy.navigate('Data Sets')
    cy.switchEnv('DEV')
    const ds1_aus = { 'https://fwcy-ds1-au1.com': DS_AU.MAX.DS1.AU1, 'https://fwcy-ds1-au2.com': DS_AU.MAX.DS1.AU2 }
    const ds2_aus = { 'https://fwcy-ds2-au1.com': DS_AU.MAX.DS2.AU1, 'https://fwcy-ds2-au2.com': DS_AU.MAX.DS2.AU2 }
    let dss = configure_dss({
        'fwcy-ds1': { ...DS.MAX.DS1, dep: DS_DEP.MAX.DS1, ing: DS_ING.MAX.DS1, aus: ds1_aus },
        'fwcy-ds2': { ...DS.MAX.DS2, dep: DS_DEP.MAX.DS2, ing: DS_ING.MAX.DS2, aus: ds2_aus }
    })

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, custom, 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'), custom: configure_custom(CUSTOM.DEV, 'DEV') }
    cy.switchEnv('TEST').switch('Configure', true)
    let test = { main: configure_main(MAIN.TEST, 'TEST'), custom: configure_custom(CUSTOM.TEST, 'TEST') }
    cy.switchEnv('PROD').switch('Configure', true)
    let prod = { main: configure_main(MAIN.PROD, 'PROD'), custom: configure_custom(CUSTOM.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, aus: { 'https://fwcy-ds-dev-au.com': DS_AU.DEV } } }, 'DEV')
    cy.switchEnv('TEST')
    test.dss = configure_dss({ 'fwcy-ds-test': { ...DS.TEST, dep: DS_DEP.TEST, ing: DS_ING.TEST, aus: { 'https://fwcy-ds-test-au.com': DS_AU.TEST } } }, 'TEST')
    cy.switchEnv('PROD')
    prod.dss = configure_dss({ 'fwcy-ds-prod': { ...DS.PROD, dep: DS_DEP.PROD, ing: DS_ING.PROD, aus: { 'https://fwcy-ds-prod-au.com': DS_AU.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_custom(CUSTOM.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: 'fwcyu-dc' })
    cy.switchEnv('DEV')
    let main = configure_main(MAIN.UPD)
    let custom = configure_custom(CUSTOM.UPD)

    // Click the 'CREATE' button. DEV: check YAML. TEST, PROD: check no YAML.
    cy.create()
    cy.switchEnv('DEV')
    checkYAML({ common, main, custom })
    // 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)  // TODO: dropd when configuring DC page is not needed (when the bug is fixed).

    // Navigate to the 'Data Sets' tab. DEV: configure.
    cy.navigate('Data Sets')
    cy.switchEnv('DEV')
    const ds1_aus = { 'https://fwcy-ds1-au1.com': DS_AU.MAX.DS1.AU1, 'https://fwcy-ds1-au2.com': DS_AU.MAX.DS1.AU2, 'https://fwcy-ds1-au3.com': DS_AU.MAX.DS1.AU3 }
    const ds2_aus = { 'https://fwcy-ds2-au1.com': DS_AU.MAX.DS2.AU1, 'https://fwcy-ds2-au2.com': DS_AU.MAX.DS2.AU2, 'https://fwcy-ds2-au0.com': DS_AU.SHORT }
    const ds3_aus = { 'https://fwcy-ds3-au1.com': DS_AU.MAX.DS3.AU1, 'https://fwcy-ds3-au2.com': DS_AU.MAX.DS3.AU2, 'https://fwcy-ds3-au3.com': DS_AU.MAX.DS3.AU3 }
    configure_dss({
        'fwcy-ds0': { ...DS.SHORT,   dep: DS_DEP.SHORT,   ing: DS_ING.SHORT,   aus: { 'https://fwcy-ds0-au1.com': DS_AU.SHORT } },
        'fwcy-ds1': { ...DS.MAX.DS1, dep: DS_DEP.MAX.DS1, ing: DS_ING.MAX.DS1, aus: ds1_aus },
        'fwcy-ds2': { ...DS.MAX.DS2, dep: DS_DEP.MAX.DS2, ing: DS_ING.MAX.DS2, aus: ds2_aus }
    })

    // 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_aus_upd = {  // 0 - drop, 1 - no changes, 2 - update, 3 - add.
        'https://fwcy-ds2-au0.com': null,
        'https://fwcy-ds2-au2.com': { ...DS_AU.UPD.DS2.AU2, au: 'https://fwcy-ds2-au2-upd.com' },
        'https://fwcy-ds2-au3.com': DS_AU.MAX.DS2.AU3
    }
    let dss = configure_dss({  // 0 - drop, 1 - no changes, 2 - update, 3 - add.
        'fwcy-ds0': null,
        'fwcy-ds2': { ...DS.UPD.DS2, dep: DS_DEP.UPD.DS2, ing: DS_ING.UPD.DS2, aus: ds2_aus_upd, ds: 'fwcy-ds2-upd' },
        'fwcy-ds3': { ...DS.MAX.DS3, dep: DS_DEP.MAX.DS3, ing: DS_ING.MAX.DS3, aus: ds3_aus },
    })

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

describe(
    'Batch Ingestiong wizard ("rest" ingestion type and "custom" 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('(C+) Create W/ minimal DC.',                  create__dc_min__test)
        it('(C+) Create W/ maximum DC.',                  create__dc_max__test)
        it('(C+) Create W/ minimal DSs.',                 create__dss_min__test)
        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)
        // 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