### Example: Installing Joomla with Custom Configuration (Cypress) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This example provides a detailed configuration object for `cy.installJoomla`, specifying site name, administrator credentials, and database connection parameters including type, host, port, user, password, name, and prefix. It showcases a typical setup for a new Joomla installation. ```javascript const config = { sitename: "Sample Joomla Site", name: "Joomla Administrator", username: "admin", password: "admin-password", email: "sampleuser@example.com", db_type: "MySQLi", db_host: "localhost", db_port: "3316", db_user: "joomla", db_password: "joomla-db-user-password", db_name: "sample_joomla", db_prefix: "sjs_" } cy.installJoomla(config); ``` -------------------------------- ### Installing Joomla Extension from URL (Example) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This example demonstrates installing a Joomla extension from a remote URL. It logs in an administrator and then uses `cy.installExtensionFromUrl()` with the direct download link of the extension package. This automates the process of fetching and installing. ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); cy.installExtensionFromUrl("https://server.org/download/joomla-module.zip"); ``` -------------------------------- ### Installing Joomla Extension from Folder (Example) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This example shows how to install a Joomla extension from a local folder. It logs in an administrator and then calls `cy.installExtensionFromFolder()` with the path to the extension's source directory, as it would be mounted in a Docker image. ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); cy.installExtensionFromFolder("/joomla-module/src"); // as mounted in docker image ``` -------------------------------- ### Cloning Joomla-Cypress Module and Installing Dependencies Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This snippet details the steps to clone the `joomla-cypress` NPM module's repository and install its JavaScript dependencies. This is the initial setup required to work with and test the module itself. ```shell git clone https://github.com/joomla-projects/joomla-cypress cd joomla-cypress npm ci ``` -------------------------------- ### Installing Joomla Extension from URL (Usage) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command installs a Joomla extension by downloading it from a given URL. It navigates to the extension installer, selects 'Install from URL', inputs the URL, and completes the installation. Requires an authenticated Joomla administrator. ```javascript cy.installExtensionFromUrl(url, type) ``` -------------------------------- ### Installing Joomla Extension via File Upload (Usage) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command installs a Joomla extension by uploading a package file from the Cypress Test Runner environment. It navigates to the extension installer, selects 'Upload Package File', provides the file path, and completes the installation. It relies on `cypress-file-upload` and requires an authenticated Joomla administrator. ```javascript cy.installExtensionFromFileUpload(file, type) ``` -------------------------------- ### Installing Joomla Extension from Folder (Usage) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command installs a Joomla extension from a specified server folder. It navigates to the extension installer, selects 'Install from Folder', inputs the path, and completes the installation. Requires an authenticated Joomla administrator. ```javascript cy.installExtensionFromFolder(path, type) ``` -------------------------------- ### Installing Joomla Instance (Cypress) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command automates the entire Joomla installation process by executing all 'Joomla Installer' steps. It requires a comprehensive configuration object detailing site and database settings. The `/installation` folder is intentionally not deleted post-installation. ```javascript cy.installJoomla(config) ``` -------------------------------- ### Cloning Joomla CMS and Installing Dependencies Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This snippet provides the commands to clone the Joomla CMS repository and install its required PHP (via Composer) and JavaScript (via npm) dependencies. This setup is essential for providing the Joomla environment against which the `joomla-cypress` module will be tested. ```shell git clone https://github.com/joomla/joomla-cms --depth 1 cd joomla-cms composer install npm ci ``` -------------------------------- ### Example: Verifying Frontend Login and Welcome Message (Cypress) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This example demonstrates using `cy.doFrontendLogin` with default credentials, then chaining `visit` and `contains` commands to navigate to the homepage and assert the visibility of the user's welcome message. It showcases a common post-login verification flow. ```javascript cy.doFrontendLogin() .visit("/") .contains(`Hi ${Cypress.env('name')}`).should('be.visible'); ``` -------------------------------- ### Installing a Multilingual Joomla Site with Cypress Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This snippet demonstrates how to install a multilingual Joomla site using the `cy.installJoomlaMultilingualSite` command. It defines a configuration object for site settings, administrator credentials, and database details, along with an array of desired languages. This command automates the entire installation process. ```javascript const config = { sitename: "Sample Joomla Site", name: "Joomla Administrator", username: "admin", password: "admin-password", email: "sampleuser@example.com", db_type: "MySQLi", db_host: "localhost", db_port: "3316", db_user: "joomla", db_password: "joomla-db-user-password", db_name: "sample_joomla", db_prefix: "sjs_" } const languages = ["German", "Japanese", "Spanish", "Ukrainian"]; cy.installJoomlaMultilingualSite(config, languages); ``` -------------------------------- ### Example: Creating a User After Administrator Login (Cypress) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This example demonstrates creating a new user 'Alice in Wonderland' with specific credentials. It highlights the prerequisite of being logged in as an administrator via `cy.doAdministratorLogin()` before attempting user creation. ```javascript cy.doAdministratorLogin() .createUser("Alice in Wonderland", "alice", "CheshireSmile", "alice@in.wonderland"); ``` -------------------------------- ### Installing Joomla Cypress Package Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This snippet provides the npm command to install the `joomla-cypress` package. It should be installed as a development dependency (`devDependencies`) in your project, enabling its use for writing end-to-end tests with Cypress for Joomla CMS. ```bash npm install --save-dev @testing-library/joomla-cypress ``` -------------------------------- ### Cancelling Joomla Welcome Tour (Example) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This example demonstrates the usage of `cy.cancelTour()` after logging into the Joomla administrator backend. It ensures the guided tour overlay is closed, allowing further interaction with the dashboard. A Joomla administrator must be logged in to execute this command. ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); cy.cancelTour(); ``` -------------------------------- ### Installing Multilingual Joomla Site (Cypress) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command extends `installJoomla` by continuing the 'Joomla Installer' to include additional language installations. Unlike `installJoomla`, it ensures the `/installation` folder is deleted after completion, making it a one-time execution command. ```javascript cy.installJoomlaMultilingualSite(config, languages) ``` -------------------------------- ### Example: Chaining Frontend Login and Logout (Cypress) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This example illustrates a complete authentication cycle, logging in with `cy.doFrontendLogin` (disabling snapshot caching) and then immediately logging out using `cy.doFrontendLogout`. It demonstrates how these commands can be chained for test scenarios. ```javascript cy.doFrontendLogin(null, null, false) .doFrontendLogout(); ``` -------------------------------- ### Installing Extension from File Upload in JavaScript Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This snippet demonstrates the process of logging into the Joomla administrator panel and subsequently installing an extension by uploading a zip file. It serves as a foundational step for managing Joomla extensions programmatically. ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); cy.installExtensionFromFileUpload("manual-examples.zip"); ``` -------------------------------- ### Restoring Joomla Installation Folder Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This command sequence is used to restore the Joomla `installation` folder, which is deleted by the `installJoomlaMultilingualSite` custom command during testing. It ensures the `installation` folder is present and its JavaScript dependencies are reinstalled for subsequent test runs. ```shell git checkout installation npm ci ``` -------------------------------- ### Cancelling Joomla Welcome Tour (Usage) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command closes the 'Welcome to Joomla!' guided tour overlay window that appears on first login. It's crucial for interacting with the backend content. This command can only be executed once after installation and is available from Joomla 5.1 onwards. ```javascript cy.cancelTour() ``` -------------------------------- ### Running JBT Tests with Local Cypress GUI (macOS/Linux) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This command launches the Cypress GUI for `joomla-cypress` tests using JBT for Joomla 5.2 on macOS or Linux. It provides an interactive environment for visual testing and debugging, leveraging JBT's pre-configured setup. ```shell scripts/cypress 52 joomla-cypress local ``` -------------------------------- ### Running JBT Test Suite Headless for Joomla 5.2 Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This command executes the `joomla-cypress` test suite headless using JBT for a specific Joomla version (5.2). JBT simplifies the setup by providing Joomla, databases, and Cypress, streamlining the testing process for different Joomla versions. ```shell scripts/test 52 joomla-cypress ``` -------------------------------- ### Creating Cypress Configuration File Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This command creates the Cypress configuration file (`cypress.config.mjs`) from a distribution template. This file is crucial for defining test parameters, environment variables, and paths necessary for Cypress to interact with the Joomla installation. ```shell cp tests/cypress.config.dist.mjs tests/cypress.config.mjs ``` -------------------------------- ### Setting CYPRESS_SERVER_UPLOAD_FOLDER for Extension Installation (Shell) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This snippet demonstrates how to set the `CYPRESS_SERVER_UPLOAD_FOLDER` environment variable on Unix-based systems. This variable is crucial when the `installExtensionFromFolder()` test fails because the Joomla web server cannot locate the `mod_hello_world` package folder, ensuring the server can find the necessary upload directory. ```Shell export CYPRESS_SERVER_UPLOAD_FOLDER=/users/alice/joomla-cypress/tests/fixtures/mod_hello_world ``` -------------------------------- ### Running Specific Cypress Test Spec Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This command allows running a single, specific Cypress test spec file (`user.cy.js` in this example) with a designated configuration file. This is beneficial for focused development, debugging, or re-running failed tests efficiently. ```shell npx cypress run --spec tests/e2e/user.cy.js --config-file tests/cypress.config.mjs ``` -------------------------------- ### Running Tests Skipping Language Installation (Windows PowerShell) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This snippet provides the commands for Windows PowerShell to run the test suite while skipping tests that involve language package installations. This is useful if the language package is not yet available or if you want to focus on other tests. ```powershell $env:CYPRESS_SKIP_INSTALL_LANGUAGES=1 npm test ``` -------------------------------- ### Running JBT Tests with Cypress GUI Skipping Language Installation (WSL2) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This command runs `joomla-cypress` tests with the Cypress GUI via JBT for Joomla 6.0 on Windows 11 WSL2 Ubuntu, specifically skipping tests that install languages. This combines the benefits of a graphical interface with the flexibility to bypass certain test types. ```shell CYPRESS_SKIP_INSTALL_LANGUAGES=1 scripts/cypress 60 joomla-cypress ``` -------------------------------- ### Logging into Joomla Administrator Backend Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This example shows how to use the `cy.doAdministratorLogin` custom command to log into the Joomla backend. It takes a username, password, and a boolean flag to control session caching. In this specific example, the session is not saved across specs, forcing a fresh login for each test. ```javascript // Admin login without saving the session cy.doAdministratorLogin("admin-user", "admin-user-password", false); ``` -------------------------------- ### Setting Joomla Error Reporting to Development (Example) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This example demonstrates setting Joomla's error reporting to 'Maximum'. It first logs in an administrator and then executes `cy.setErrorReportingToDevelopment()` to apply the setting. This is useful for development and debugging purposes. ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); cy.setErrorReportingToDevelopment(); ``` -------------------------------- ### Running JBT Tests Skipping Language Installation (Unix) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This command for Unix-based systems runs JBT tests for Joomla versions 5.3 and 6.0, while skipping tests that install language packages. This is useful when language packages are not yet available or to expedite testing of other functionalities. ```shell CYPRESS_SKIP_INSTALL_LANGUAGES=1 scripts/test 53 60 joomla-cypress ``` -------------------------------- ### Installing Joomla Language Pack in JavaScript Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command installs a language pack within Joomla. It requires the Joomla administrator to be logged in. If the language pack is already present, the command executes a reinstall. The `languageName` argument can be either the language's full name or its language tag. ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); // Install German for Switzerland with language tag cy.installLanguage("de-CH"); // or install with language name // cy.installLanguage("German, Switzerland"); ``` -------------------------------- ### Creating Joomla Menu Items with Cypress Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md The `createMenuItem` command facilitates the creation of a new menu item in Joomla. It requires the `menuTitle`, `menuCategory`, and `menuItem` type. Optional parameters include the `menu` (default 'Main Menu') and `language` (default 'All'), which supports multilingual Joomla setups by accepting either the language name or tag. ```javascript cy.createMenuItem(menuTitle, menuCategory, menuItem, menu, language) ``` ```javascript // Create Japanese menu item 'Spotlight Stories' cy.doAdministratorLogin("admin-user", "admin-user-password"); .createMenuItem('スポットライト・ストーリー', 'Articles', 'Featured Articles', 'Menu 日本語', 'ja-JP'); ``` -------------------------------- ### Patching Joomla-Cypress with JBT Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This command demonstrates how to apply a specific patch (e.g., from a pull request like '#37') to the `joomla-cypress` module within a JBT (Joomla Build Tools) installation. This is useful for testing proposed changes or fixes before they are merged. ```shell scripts/patch installation joomla-cypress-37 ``` -------------------------------- ### Disabling Joomla Statistics Plugin (Example) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This example shows how to disable the Joomla Statistics plugin. It first logs in an administrator and then calls `cy.disableStatistics()` to remove the related system message from the dashboard. This command can be run repeatedly. ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); cy.disableStatistics(); ``` -------------------------------- ### Skipping Language Installation Tests for Development Versions (Shell) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This snippet shows how to set the `CYPRESS_SKIP_INSTALL_LANGUAGES` environment variable to `1` on Unix-based systems. This is used to exclude the `installLanguage` and `installJoomlaMultilingualSite` tests, which typically fail for Joomla development versions due to unavailable language packages, preventing 'Unable to detect manifest file' errors. ```Shell export CYPRESS_SKIP_INSTALL_LANGUAGES=1 ``` -------------------------------- ### Running Tests with Local Cypress GUI Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This command launches the Cypress Test Runner GUI, providing an interactive interface to run, debug, and inspect tests locally. It's ideal for development and visual verification of test execution. ```shell npm run open ``` -------------------------------- ### Running All Tests Headless Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This command executes the entire `joomla-cypress` test suite in a headless environment, meaning without a graphical user interface. It's typically used for automated testing, continuous integration, or when visual feedback is not required. ```shell npm test ``` -------------------------------- ### Registering Joomla Cypress Custom Commands Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This JavaScript snippet demonstrates how to extend the `cypress/support/index.js` file to import necessary modules. It registers `cypress-file-upload` for file upload capabilities and then registers all custom commands provided by the `joomla-cypress` npm module, making them available globally within Cypress tests. ```javascript // Add attachFile() command, which is used in installExtensionFromFileUpload() import 'cypress-file-upload'; // Register Joomla Cypress custom commands from npm module 'joomla-cypress' import { registerCommands } from "joomla-cypress"; registerCommands(); ``` -------------------------------- ### Running Specific JBT Test Spec with NoVNC Source: https://github.com/joomla-projects/joomla-cypress/blob/main/tests/README.md This command runs a specific `joomla-cypress` test spec (`user.cy.js`) using JBT for Joomla 5.2, with the added option to watch the progress via NoVNC. NoVNC provides a remote graphical interface, allowing visual monitoring of headless test runs. ```shell scripts/test 52 joomla-cypress tests/e2e/user.cy.js novnc ``` -------------------------------- ### Searching and Selecting Items in Joomla Lists with Cypress Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md The `searchForItem` command searches for a specific item by name within a Joomla list and selects its corresponding checkbox. This command requires the list to be open beforehand and utilizes the search field to avoid pagination issues. The `name` argument is the string of the item to search for, defaulting to null. ```javascript cy.searchForItem(name) ``` ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); cy.visit('/administrator/index.php?option=com_plugins'); cy.searchForItem(pluginName); ``` -------------------------------- ### Creating a New Joomla User (Cypress) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command creates a new user entry within Joomla. It requires the user's full name, username, password, and email, with an optional user group. User creation will fail if the specified username already exists. ```javascript cy.createUser(name, username, password, email, userGroup) ``` -------------------------------- ### Logging out and Verifying Admin Login Action Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This snippet illustrates the use of `cy.doAdministratorLogout` to explicitly log out from the Joomla backend, clearing all session data. It then demonstrates a subsequent login using `cy.doAdministratorLogin` and verifies the login action by navigating to the action logs and asserting the presence of a specific log entry. ```javascript // Do explicit logout to start with new login cy.doAdministratorLogout(); // Check login action log cy.doAdministratorLogin("admin-user", "admin-user-password") .visit('/administrator/index.php?option=com_actionlogs&view=actionlogs') .contains('User admin-user logged in to admin'); ``` -------------------------------- ### Logging into Joomla Frontend (Cypress) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command logs a user into the Joomla frontend. It accepts optional user credentials and a boolean flag to control session caching across specs. It's a foundational command for tests requiring a logged-in frontend user. ```javascript cy.doFrontendLogin(user, password, useSnapshot) ``` -------------------------------- ### Clicking Joomla Backend Toolbar Button in JavaScript Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command simulates a click on a Joomla backend toolbar button by utilizing an internal mapping table for CSS selectors. An optional `subselector` can be provided for more precise targeting within the button element. The `button` argument is the case-insensitive name of the button. ```javascript cy.clickToolbarButton('Save & Close'); ``` -------------------------------- ### Enabling Joomla Plugin in JavaScript Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command activates a specified Joomla plugin, making it operational within the system. It requires the Joomla administrator to be logged in. Note that the command will fail if the target plugin is already activated. ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); cy.enablePlugin("Authentication - LDAP"); ``` -------------------------------- ### Logging out from Joomla Frontend (Cypress) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command initiates the frontend logout process, clearing all session data for both backend and frontend users. Note: The provided usage snippet in the source text is `cy.doFrontendLogin()`, which appears to be a typo; the command's purpose is logout. ```javascript cy.doFrontendLogin() ``` -------------------------------- ### Displaying Joomla Module on All Pages in JavaScript Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command configures the menu assignment for a specified Joomla module to ensure it is displayed across all pages of the website. It requires the Joomla administrator to be logged in to perform this action. The `module` argument identifies the target module. ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); cy.displayModuleOnAllPages("Login Form"); ``` -------------------------------- ### Selecting All Items in Joomla Lists with Cypress Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md The `checkAllResults` command selects all entries in a Joomla list by checking the main selection box in the list view's heading. This command is used for performing bulk actions and requires the list view to be open and contain at least one entry. ```javascript cy.checkAllResults() ``` ```javascript // Trash all 'Test' tags cy.visit('/administrator/index.php?option=com_tags'); cy.searchForItem('Test'); cy.checkAllResults(); cy.clickToolbarButton('Action'); cy.contains('Trash').click(); ``` -------------------------------- ### Interacting with Iframes in Cypress (JavaScript) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command provides a mechanism to interact with elements nested inside an iframe. It ensures the iframe is fully loaded before resolving with its body content, allowing subsequent Cypress commands to query and manipulate elements within the iframe's DOM. This enables seamless testing of content hosted within embedded frames. ```javascript cy.get('iframe').iframe() ``` ```javascript cy.get('iframe').iframe().then($body => { // You can now interact with the iframe's body as a Cypress element cy.wrap($body).find('selector-within-iframe').click(); }); ``` -------------------------------- ### Setting Joomla Error Reporting to Development (Usage) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command configures the 'Error Reporting' setting in Joomla's 'Global Configuration' to 'Maximum' (Development mode). It helps in debugging by displaying all errors and warnings. This command can be executed multiple times and requires an authenticated Joomla administrator. ```javascript cy.setErrorReportingToDevelopment() ``` -------------------------------- ### Publishing Joomla Module in JavaScript Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command makes a Joomla module active and visible on the website by setting its status to Published. It first ensures the module is set to 'Unpublished' to handle existing states consistently. The Joomla administrator must be logged in for this operation. ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); cy.publishModule("Breadcrumbs"); ``` -------------------------------- ### Checking for PHP Notices or Warnings in Cypress Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command checks for the presence of PHP notices or warnings on the page. It's typically used to ensure a clean execution environment without unexpected PHP output. ```javascript cy.checkForPhpNoticesOrWarnings() ``` ```javascript cy.checkForPhpNoticesOrWarnings(); ``` -------------------------------- ### Setting Filters on Joomla List Views with Cypress Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md The `setFilter` command applies a filter to a list view within the Joomla administrator interface. It takes the filter's `name` (e.g., 'state') and the `value` to set for that filter (e.g., 'Enabled'). This command helps in narrowing down list results for further actions or assertions. ```javascript cy.setFilter(name, value) ``` ```javascript // Using 'username' and 'password' from Cypress.env() cy.doAdministratorLogin() // Open user list .visit('/administrator/index.php?option=com_users') // Only enabled user entries .setFilter('state', 'Enabled'); ``` -------------------------------- ### Creating Joomla Categories with Cypress Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md The `createCategory` command creates a new category in Joomla with a specified title. Categories can be created for various content types, including articles, news feeds, banners, or contacts. The command will fail if a category with the same title and extension already exists. The `title` is required, and `extension` (default 'com_content') specifies the content type. ```javascript cy.createCategory(title, extension) ``` ```javascript // Create Monday banners category cy.doAdministratorLogin() .createCategory("Monday Banners", "com_banners"); ``` -------------------------------- ### Toggling Joomla Switch Field (Cypress, JavaScript) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command automates the toggling of a switch field in Joomla to a desired state. It takes the field's name and the target value (e.g., 'Yes', 'No') as arguments. This is useful for controlling boolean-like settings in the application's UI during tests. ```javascript cy.toggleSwitch(fieldName, valueName) ``` ```javascript cy.toggleSwitch("Published", "Yes"); ``` -------------------------------- ### Uninstalling Joomla Extension in JavaScript Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command removes a specified extension from Joomla, ensuring no warning messages after deletion and verifying its removal. It requires the Joomla administrator to be logged in. The `extensionName` argument specifies the name of the extension to be uninstalled. ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); cy.uninstallExtension("Joomla module tutorial"); ``` -------------------------------- ### Selecting Option in Joomla Fancy Select (Cypress, JavaScript) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command selects a specific option from a custom fancy select field within a Joomla application. It requires the CSS ID of the select element and the exact text of the option to be chosen. This facilitates automated testing of complex dropdown UI components. ```javascript cy.selectOptionInFancySelect(selectId, option) ``` ```javascript cy.selectOptionInFancySelect("#jform_countries", "Germany"); ``` -------------------------------- ### Setting Joomla Module Position in JavaScript Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command assigns a specific display position to a module within a Joomla template. It requires the Joomla administrator to be logged in. The `module` argument specifies the module name, and `position` (optional, defaults to 'position-7') defines where it should appear. ```javascript cy.doAdministratorLogin("admin-user", "admin-user-password"); cy.setModulePosition("module-name", "sidebar-right"); ``` -------------------------------- ### Checking for Joomla System Messages in Cypress Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md The `checkForSystemMessage` command verifies that a Joomla system message is present, visible, and contains a specified text. It's useful for asserting successful operations or expected notifications. The `contain` argument is a string that must be included in the system message. ```javascript cy.checkForSystemMessage(contain) ``` ```javascript cy.checkForSystemMessage('was successful'); ``` -------------------------------- ### Disabling Joomla Statistics Plugin (Usage) Source: https://github.com/joomla-projects/joomla-cypress/blob/main/README.md This command deactivates the 'System - Joomla! Statistics' plugin, removing the 'Enable Joomla Statistics?' system message from the backend dashboard. It can be executed multiple times without issues, and requires an authenticated Joomla administrator. ```javascript cy.disableStatistics() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.