OpenParable
Skip to content
← Back to skills

Browserstack Tester

Testing & Quality
browserstack-tester

Browserstack Tester is an Agent Skill for testing & quality published in the mikopbx/Core repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Тестирование веб-интерфейса MikoPBX через BrowserStack. Запуск PHPUnit тестов с Selenium WebDriver в облачных браузерах. Использовать для автоматизированного тестирования админ-панели, проверки форм, навигации и интерактивных элементов.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/mikopbx/Core/blob/HEAD/.claude/skills/browserstack-tester/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/browserstack-tester, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

BrowserStack Web UI Tester

Тестирование веб-интерфейса MikoPBX через BrowserStack. Запуск PHPUnit тестов с Selenium WebDriver в облачных браузерах. Использовать для автоматизированного тестирования админ-панели, проверки форм, навигации и интерактивных элементов.

Prerequisites

BrowserStack Local must be running on the host machine:

# In a separate terminal on macOS host:
cd ~/PhpstormProjects/mikopbx/Core/tests/AdminCabinet
./start-browserstack-local.sh

This creates a secure tunnel between BrowserStack cloud browsers and local PBX server.

Running Tests

Basic Test Execution

# Run specific test file
docker exec -t mikopbx_tests-refactoring /bin/sh -c "
  cd /offload/rootfs/usr/www &&
  SERVER_PBX=https://172.16.33.72 \
  BROWSERSTACK_DAEMON_STARTED=true \
  BROWSERSTACK_LOCAL_IDENTIFIER=local_test \
  php vendor/bin/phpunit \
  --configuration tests/Unit/phpunit.xml \
  tests/AdminCabinet/Tests/YourTest.php"

Run Specific Test Method

docker exec -t mikopbx_tests-refactoring /bin/sh -c "
  cd /offload/rootfs/usr/www &&
  SERVER_PBX=https://172.16.33.72 \
  BROWSERSTACK_DAEMON_STARTED=true \
  BROWSERSTACK_LOCAL_IDENTIFIER=local_test \
  php vendor/bin/phpunit \
  --configuration tests/Unit/phpunit.xml \
  tests/AdminCabinet/Tests/NetworkInterfacesTest.php \
  --filter testAddNewVLAN"

Run Multiple Tests

# Use pipe (|) to run multiple test methods
--filter 'testAddNewVLAN|testStaticRoutes|testIPv6ManualConfiguration'

Environment Variables

VariableDescriptionDefault
SERVER_PBXPBX server URLhttps://172.16.33.72
BROWSERSTACK_DAEMON_STARTEDSkip local tunnel starttrue
BROWSERSTACK_LOCAL_IDENTIFIERTunnel identifierlocal_test

Test Structure

All tests extend MikoPBXTestsBase:

class MyFeatureTest extends MikoPBXTestsBase
{
    public function setUp(): void
    {
        parent::setUp();
        $this->setSessionName("Test: My Feature Name");
    }

    public function testMyFeature(): void
    {
        // Navigate to page
        $this->clickSidebarMenuItemByHref("/admin-cabinet/my-feature/modify/");
        $this->waitForAjax();

        // Interact with form
        $this->changeInputField('fieldName', 'value');
        $this->selectDropdownItem('dropdown-id', 'option-value');
        $this->changeCheckBoxState('checkbox-name', true);

        // Submit and verify
        $this->submitForm('form-id');
        $this->assertInputFieldValueEqual('fieldName', 'value');
    }
}

Key Helper Methods

Navigation

  • clickSidebarMenuItemByHref($href) - Navigate via sidebar menu
  • changeTabOnCurrentPage($tabId) - Switch tabs
  • waitForAjax() - Wait for AJAX requests to complete

Form Interactions

  • changeInputField($name, $value) - Set input field value
  • selectDropdownItem($id, $value) - Select dropdown option
  • changeCheckBoxState($name, $checked) - Toggle checkbox
  • submitForm($formId) - Submit form

Assertions

  • assertInputFieldValueEqual($name, $expected) - Check input value
  • assertCheckBoxStageIsEqual($name, $expected) - Check checkbox state
  • assertMenuItemSelected($id, $value) - Check dropdown selection

Test Files Location

  • Test classes: tests/AdminCabinet/Tests/
  • Base class: tests/AdminCabinet/Lib/MikoPBXTestsBase.php
  • PHPUnit config: tests/Unit/phpunit.xml
  • Test data factories: tests/AdminCabinet/Tests/Data/

BrowserStack Dashboard

View test recordings and logs at: https://automate.browserstack.com/dashboard/

Common Patterns

Wait for Element

self::$driver->wait(10, 500)->until(
    WebDriverExpectedCondition::visibilityOfElementLocated(
        WebDriverBy::id('element-id')
    )
);

Find Element by XPath

$element = self::$driver->findElement(
    WebDriverBy::xpath("//div[contains(@class, 'my-class')]")
);

CSS Selector

$rows = self::$driver->findElements(
    WebDriverBy::cssSelector('#my-table tbody tr:not(.template)')
);

References