Rayrun
← Back to Discord Forum

How to access test environment through VPN

Hi all. I' wondering how I can access our test environment through VPN. Is this done in Playwirght as part of the setup or config file, or is it done in Github Actions when setting up the CI environment? It basically needs to be validated with a certificate to work. It's hard to find documentation about this. We're using Azure VPN. Hope you can help, thanks.

This thread is trying to answer question "How can I access our test environment through VPN? Is this done in Playwright as part of the setup or config file, or is it done in Github Actions when setting up the CI environment?"

0 replies

Answer

Sure, you can set up a VPN connection for your Playwright tests either in the setup or config file or within GitHub Actions.

Setup in Playwright

In your playwright.config.ts file, include the necessary VPN connection details and settings. Here's an example:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: {
    browserContextOptions: {
      proxy: {
        server: 'vpn.ray.run',
        username: 'your-username',
        password: 'your-password',
      },
    },
  },
});

Setup in GitHub Actions

Alternatively, you can establish a VPN connection in GitHub Actions before running your Playwright tests. Modify your workflow file as follows:

name: Run Tests

on:
  push:
    branches:
      • main

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      • name: Set up VPN Connection
        uses: some-vpn-action@v1
        with:
          vpn-server-url: vpn.ray.run
          username-secret-name: vpn-username-secret
          password-secret-name: vpn-password-secret

      • name: Install Dependencies and Run Tests with Playwright
        run: |
          npm ci
          npx playwright install --with-deps
          npx playwright test

Replace some-vpn-action with the actual VPN connection action from the GitHub Actions marketplace. Also, provide the appropriate VPN server URL and secrets for username and password.

Remember to adjust these examples based on your specific VPN setup and requirements.

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].