Integration Test Wrapper Function#

The integrationTest wrapper function configures Playwright tests in the PPUX repository with TMS (Test Management System) integration, replacing the older non-TMS approach.

TMS-Enabled Test Configuration#

integrationTest(
  {
    // Test environment configuration
    envTypes: [EnvironmentType.MakerShell],
    runTypes: [RunType.Runner],
    runEnvironments: [
      [RunEnvironment.Prod, Severity.S3],
      [RunEnvironment.Preview, Severity.S3],
    ],
    runGeos: [RunGeo.USA, RunGeo.Asia],
  },
  Team.Shell, // Team ownership
  (format) => {
    // Test function that receives a format function
    test(format("Create Canvas App"), async ({ page, tms }) => {
      // Test implementation with TMS fixture
      const makerPage = new MakerPage(page);

      await test.step("Navigate to maker portal", async () => {
        await makerPage.goToMakerPage();
      });

      // Use TMS data when needed
      console.log("TMS scenario:", tms.scenario);
    });
  }
);

Important

The older non-TMS approach is deprecated. Always use the TMS-integrated version shown above.

Configuration Parameters#

Test Configuration#

The testConfiguration parameter defines how and where the test will run:

{
  envTypes: [EnvironmentType.MakerShell],
  runTypes: [RunType.Runner],
  runEnvironments: [[RunEnvironment.Test, Severity.S3]],
  runGeos: [RunGeo.USA],
}

Key configuration options:

  • envTypes: Target environment types (MakerShell, WebAuthoring, etc.)

  • runTypes: When tests should run (Runner, Pr, Nightly, etc.)

  • runEnvironments: Target environments with severity levels

  • runGeos: Geographical regions for testing

Team Ownership#

The team parameter identifies which team owns the test:

Team.Shell;

Working with TMS#

The TMS integration provides:

  1. User authentication through TMS scenarios

  2. Access to TMS data via the tms fixture

  3. Consistent test naming using the format function

TMS Configuration Example#

// config.json
{
  "tms": [
    {
      "name": "PowerAppsMaker",
      "env": "test",
      "region": "wus",
      "cluster": "201",
      "serviceTreeId": "12345",
      "scenarioId": "67890",
      "defaultAlias": "MakerUser",
      "userScenarios": [
        {
          "alias": "AdminUser",
          "scenarioId": "54321"
        }
      ]
    }
  ]
}

Running TMS Tests Locally in DevBox#

# Set TMS scenario
export TMS_SCENARIO=PowerAppsMaker

# Login using TMS authentication
npm run login-tms

# Run tests
npm run int-test

Test Steps#

Use test.step to organize actions into logical steps:

await test.step("Step description", async () => {
  // Actions for this step
});

For steps owned by other teams, add a team tag:

await test.step("@Grids - Configure grid", async () => {
  // Grid-specific actions
});

Multiple Tests with Shared Configuration#

integrationTest(
  {
    envTypes: [EnvironmentType.MakerShell],
    runTypes: [RunType.Runner],
    runEnvironments: [[RunEnvironment.Test, Severity.S3]],
    runGeos: [RunGeo.USA],
  },
  Team.Shell,
  (format) => {
    test(format("Create Canvas App"), async ({ page, tms }) => {
      // Test implementation
    });

    test(format("Create Model-driven App"), async ({ page, tms }) => {
      // Second test with same configuration
    });
  }
);

Tip

Use the format function for all test titles to ensure consistent naming and TMS integration.