UNPKG

@tshifhiwa/ohrm-ui-automation-framework

Version:

Playwright and TypeScript–based test automation framework for validating core UI features and workflows of the OrangeHRM demo application.

45 lines (37 loc) 1.31 kB
import type { EnvironmentStage } from "../constants/environment.constants.js"; import StagesFilePathResolver from "../../environment/manager/resolvers/stagesFilePathResolver.js"; export default class EnvironmentDetector { /** * Checks if running in CI environment */ public static isCI(): boolean { return !!( process.env.CI || process.env.GITHUB_ACTIONS || process.env.GITLAB_CI || process.env.TRAVIS || process.env.CIRCLECI || process.env.JENKINS_URL || process.env.BITBUCKET_BUILD_NUMBER ); } public static getCurrentEnvironmentStage(): EnvironmentStage { const env = process.env.ENV || process.env.NODE_ENV || "dev"; return StagesFilePathResolver.isValidStage(env) ? env : "dev"; } public static isDevelopment(): boolean { return this.getCurrentEnvironmentStage() === "dev"; } public static isQA(): boolean { return this.getCurrentEnvironmentStage() === "qa"; } public static isUAT(): boolean { return this.getCurrentEnvironmentStage() === "uat"; } public static isPreprod(): boolean { return this.getCurrentEnvironmentStage() === "preprod"; } public static isProduction(): boolean { return this.getCurrentEnvironmentStage() === "prod"; } }