Configuring Test Environments#
A critical aspect of the PPUX testing framework is its ability to run tests across different environments and geographies. This is managed through the config.json file, which defines application URLs for various environments and regions.
Understanding Environment Configuration#
The config.json file contains an environments section that maps applications to their URLs across different environments (dev, test, preview, prod) and, for production, different geographical regions.
Here’s the basic structure:
"environments": {
  "<applicationId>": {
    "dev": "<development URL>",
    "test": "<test URL>",
    "preview": "<preview URL>",
    "prod": {
      "<region1>": "<production URL for region1>",
      "<region2>": "<production URL for region2>",
      // Additional regions...
    }
  }
}
Key Applications and Their Environments#
The configuration supports numerous Power Platform applications. Here are some key applications:
Authentication Environment#
Used for authentication across all applications:
"authEnvironment": {
  "dev": "https://login.microsoftonline.com",
  "test": "https://login.microsoftonline.com",
  "preview": "https://login.microsoftonline.com",
  "prod": {
    "asia": "https://login.microsoftonline.com",
    "australia": "https://login.microsoftonline.com",
    "brazil": "https://login.microsoftonline.com",
    // Additional regions...
    "us": "https://login.microsoftonline.com",
    "china": "https://login.microsoftonline.cn",
    "gcc": "https://login.microsoftonline.us",
    "gcch": "https://login.microsoftonline.us",
    "dod": "https:/login.microsoftonline.us"
  },
  "ussec": "https://login.microsoftonline.microsoft.scloud",
  "usnat": "https://login.microsoftonline.eaglex.ic.gov"
}
Power Apps Maker Portal (MakerShell)#
The main interface for creating Power Apps:
"makerShell": {
  "dev": "https://make.local.powerapps.com",
  "test": "https://make.test.powerapps.com",
  "preview": "https://make.preview.powerapps.com",
  "prod": {
    "asia": "https://make.powerapps.com",
    "australia": "https://make.powerapps.com",
    // Additional regions...
    "us": "https://make.powerapps.com",
    "china": "https://make.powerapps.cn",
    "gcc": "https://make.gov.powerapps.us",
    "gcch": "https://make.high.powerapps.us",
    "dod": "https://make.apps.appsplatform.us"
  },
  "ussec": "https://make.powerapps.microsoft.scloud",
  "usnat": "https://make.powerapps.eaglex.ic.gov"
}
Power Platform Admin Center (PPAC)#
The administration interface for Power Platform:
"ppac": {
  "dev": "https://admin.local.powerplatform.microsoft.com",
  "test": "https://admin.test.powerplatform.microsoft.com",
  "preprod": "https://admin.preprod.powerplatform.microsoft.com",
  "prod": {
    "us": "https://admin.powerplatform.microsoft.com",
    "asia": "https://admin.powerplatform.microsoft.com"
  },
  "ussec": "https://admin.powerplatform.microsoft.scloud",
  "usnat": "https://admin.powerplatform.eaglex.ic.gov"
}
Power Automate#
The workflow automation interface:
"powerAutomate": {
  "tip": "https://make.test.powerautomate.com",
  "test": "https://make.test.powerautomate.com",
  "preprod": "https://make.preprod.powerautomate.com",
  "preview": "https://make.preview.powerautomate.com",
  "prod": {
    "us": "https://make.powerautomate.com",
    "asia": "https://make.powerautomate.com",
    // Additional regions...
  },
  "dev": "https://local.flow.microsoft.com:44300",
  "ussec": "https://make.powerautomate.microsoft.scloud",
  "usnat": "https://make.powerautomate.eaglex.ic.gov"
}
Environment Types#
The configuration supports several environment types for different testing scenarios:
- dev - Local development environment, typically with a URL like - https://make.local.<service>.com
- test - Test environment, used for integration testing 
- preprod - Pre-production environment for final validation before releases 
- preview - Preview environment for early access features 
- prod - Production environments, separated by geographical regions 
- tip - Test In Production environment 
- ussec - US Sovereign Cloud environment 
- usnat - US National cloud environment 
Geographical Regions for Production#
Production environments are configured for multiple geographical regions:
- us - United States 
- asia - Asia 
- australia - Australia 
- brazil - Brazil 
- europe - Europe 
- india - India 
- unitedarabemirates - United Arab Emirates 
- uk - United Kingdom 
- japan - Japan 
- canada - Canada 
- france - France 
- switzerland - Switzerland 
- germany - Germany 
- korea - Korea 
- norway - Norway 
- china - China 
- gcc - US Government Community Cloud 
- gcch - US Government Community Cloud High 
- dod - US Department of Defense 
Using Environment Configuration in Tests#
The environment configuration is used to determine the correct URL for a test based on:
- The application being tested ( - envTypes)
- The environment to test against ( - runEnvironments)
- The geographical region to test in for production environments ( - runGeos)
For example, to run tests for the MakerShell in the test environment:
integrationTest(
  {
    envTypes: [EnvironmentType.MakerShell],
    runTypes: [RunType.Nightly],
    runEnvironments: [[RunEnvironment.Test, Severity.S3]],
    runGeos: [RunGeo.USA],
  },
  Team.Shell,
  "Test MakerShell in Test Environment",
  async ({ page }) => {
    // Test code here
  }
);
This test will use the URL configured for MakerShell in the test environment: https://make.test.powerapps.com.
URL Templates#
Some application configurations use URL templates with placeholders:
"aiFlows": {
  "dev": "https://make.test.powerautomate.com/environments/{environment}",
  "test": "https://make.test.powerautomate.com/environments/{environment}",
  // Additional environments...
}
These placeholders are replaced at runtime with the appropriate values, allowing for dynamic URL generation.
Configuring New Environments#
To add a new environment configuration:
- Identify the application ID 
- Add entries for each environment (dev, test, preview, prod) 
- For production, add entries for each geographical region required 
- For sovereign clouds, add additional environment entries (ussec, usnat) 
Example of adding a new application:
"newApplication": {
  "dev": "https://new-app.local.domain.com",
  "test": "https://new-app.test.domain.com",
  "preview": "https://new-app.preview.domain.com",
  "prod": {
    "us": "https://new-app.domain.com",
    "europe": "https://new-app.domain.com"
  }
}
Best Practices#
- Use consistent naming: Follow the established pattern for environment and region names 
- Include all required environments: At minimum, include dev, test, and prod configurations 
- Document special cases: If an application has unique URL patterns, document them 
- Review security implications: Ensure URLs for secure environments are correctly configured 
- Test configuration changes: Verify that tests work correctly after modifying the configuration 
Make sure to configure environments for all scenarios, and for production environments, set them up for different geographical locations.
Note: The “appName” is in camelCase. CamelCase is a naming convention in which the first letter of each word in a compound word is capitalized, except for the first word. For example, “exampleName” is in camelCase. The value of “appName” can be any of the values from the
EnvironmentTypeenum.
Note: The “environmentType” and “geos” are in lowerCase.
export enum EnvironmentType {
  AiBuilder = 'aiBuilder',
  AppProfile = 'appProfile',
  CanvasDesigner = 'canvasDesigner',
  CanvasCoauthoring = 'canvasCoauthoring',
  ConnectionsManagement = 'connectionsManagement',
  DesktopFlow = 'desktopFlow',
  DesktopFlowsManagementServices = 'desktopFlowManagementServices',
  DigitalSupplyChain = 'digitalSupplyChain',
  MakerShell = 'makerShell',
  ModernAppDesigner = 'modernAppDesigner',
  ModernCommandDesigner = 'modernCommandDesigner',
  PAEngExcellence = 'PAEngExcellence',
  PerfInterface = 'perfInterface',
  Pipelines = 'pipelines',
  PipelinesHost = 'pipelinesHost',
  PortalSitewide = 'portalSitewide',
  PowerAutomate = 'powerAutomate',
  PowerCards = 'powerCards',
  PowerPages = 'powerPages',
  PowerPagesV2 = 'powerPagesV2',
  PowerPagesPackagesV1 = 'powerPagesPackagesV1',
  PowerPagesPackagesV2 = 'powerPagesPackagesV2',
  PowerUP2 = 'powerUP2',
  PowerUP2Admin = 'powerUP2Admin',
  PowerUP2NoSubAdmin = 'powerUP2NoSubAdmin',
  PowerUP2NonAdmin = 'powerUP2NonAdmin',
  PowerVA = 'powerVA',
  PowerVAExpiredLicense = 'powerVAExpiredLicense',
  PowerVANoEnvAccess = 'powerVANoEnvAccess',
  PowerVANoLicense = 'powerVANoLicense',
  PowerVATeams = 'powerVATeams',
  PowerVAOmnichannel = 'powerVAOmniChannel',
  PowerVAFRE = 'powerVAFRE',
  PowerVAA11y = 'powerVAA11y',
  PPAC = 'ppac',
  ProcessInsights = 'processInsights',
  SCI = 'sci',
  ServiceCopilot = 'serviceCopilot',
  // ... rest of list
}
Adding a New Application#
To add a new application to the EnvironmentType enum, you need to update the common.ts file in the playwright-solution package.
- Navigate to the - common.tsfile in the- playwright-solutionpackage. You can find it here.
- Add a new line to the - EnvironmentTypeenum with the camelCase name of your new application, like so:
export enum EnvironmentType {
  // ... existing entries ...
  YourNewApp = 'yourNewApp',
}
Run Environments#
All possible run environments like ‘dev’, ‘test’, ‘preview’, ‘preprod’, ‘prod’, etc. are defined in the RunEnvironment enum in common.ts file in the playwright-solution package.:
export enum RunEnvironment {
  Unknown = 'unknown',
  CI = 'ci',
  Dev = 'dev',
  Test = 'test',
  Preview = 'preview',
  PreProd = 'preprod',
  Prod = 'prod',
  Tip = 'tip',
}
Geographies of Run Environments#
All possible geographies for production environment like ‘asia’, ‘australia’, ‘brazil’, ‘canada’, etc. are defined in the RunGeo enum in common.ts file in the playwright-solution package.:
export enum RunGeo {
  Asia = 'asia',
  Australia = 'australia',
  Brazil = 'brazil',
  Canada = 'canada',
  China = 'china',
  EMEA = 'emea',
  Europe = 'europe',
  France = 'france',
  GCC = 'gcc',
  GCCH = 'gcch',
  Germany = 'germany',
  India = 'india',
  Japan = 'japan',
  Korea = 'korea',
  Norway = 'norway',
  Preview = 'preview',
  Singapore = 'singapore',
  SouthAfrica = 'southafrica',
  SouthAmerica = 'southamerica',
  Switzerland = 'switzerland',
  UAE = 'unitedarabemirates',
  UK = 'uk',
  USA = 'us',
  DOD = 'dod',
}
