github.com/rancher/elemental/tests@v0.0.0-20240517125144-ae048c615b3f/cypress/latest/plugins/index.ts (about)

     1  /*
     2  Copyright © 2022 - 2024 SUSE LLC
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7      http://www.apache.org/licenses/LICENSE-2.0
     8  Unless required by applicable law or agreed to in writing, software
     9  distributed under the License is distributed on an "AS IS" BASIS,
    10  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11  See the License for the specific language governing permissions and
    12  limitations under the License.
    13  */
    14  
    15  /// <reference types="cypress" />
    16  // eslint-disable-next-line @typescript-eslint/no-var-requires
    17  require('dotenv').config();
    18  
    19  /**
    20   * @type {Cypress.PluginConfig}
    21   */
    22  // eslint-disable-next-line no-unused-vars
    23  module.exports = (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) => {
    24    // `on` is used to hook into various events Cypress emits
    25    // `config` is the resolved Cypress config
    26    const url = process.env.RANCHER_URL || 'https://localhost:8005';
    27    // eslint-disable-next-line @typescript-eslint/no-var-requires
    28    const { isFileExist, findFiles } = require('cy-verify-downloads');
    29    on('task', { isFileExist, findFiles })
    30  
    31    config.baseUrl                    = url.replace(/\/$/, );
    32    config.env.boot_type              = process.env.BOOT_TYPE;
    33    config.env.cache_session          = process.env.CACHE_SESSION || false;
    34    config.env.chartmuseum_repo       = process.env.CHARTMUSEUM_REPO;
    35    config.env.cluster                = process.env.CLUSTER_NAME;
    36    config.env.cypress_tags           = process.env.CYPRESS_TAGS;
    37    config.env.elemental_dev_version  = process.env.ELEMENTAL_DEV_VERSION;
    38    config.env.elemental_ui_version   = process.env.ELEMENTAL_UI_VERSION;
    39    config.env.k8s_downstream_version = process.env.K8S_DOWNSTREAM_VERSION;
    40    config.env.operator_repo          = process.env.OPERATOR_REPO;
    41    config.env.os_version_install     = process.env.OS_VERSION_INSTALL;
    42    config.env.os_version_target      = process.env.OS_VERSION_TARGET;
    43    config.env.password               = process.env.RANCHER_PASSWORD;
    44    config.env.proxy_ip               = process.env.PROXY_IP;
    45    config.env.proxy                  = process.env.PROXY;
    46    config.env.rancher_version        = process.env.RANCHER_VERSION;
    47    config.env.ui_account             = process.env.UI_ACCOUNT;
    48    config.env.upgrade_from_version   = process.env.UPGRADE_FROM_VERSION;
    49    config.env.upgrade_image          = process.env.UPGRADE_IMAGE;
    50    config.env.upgrade_os_channel     = process.env.UPGRADE_OS_CHANNEL;
    51    config.env.username               = process.env.RANCHER_USER;
    52  
    53    return config;
    54  };