{"id":42198351,"url":"https://github.com/polylang/e2e-test-utils","last_synced_at":"2026-01-27T00:20:35.719Z","repository":{"id":285739456,"uuid":"959169580","full_name":"polylang/e2e-test-utils","owner":"polylang","description":"End-to-end test utilities for Polylang projects.","archived":false,"fork":false,"pushed_at":"2026-01-16T11:33:15.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-17T01:16:53.353Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/polylang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-02T11:30:54.000Z","updated_at":"2026-01-16T11:33:16.000Z","dependencies_parsed_at":"2026-01-16T15:17:57.970Z","dependency_job_id":null,"html_url":"https://github.com/polylang/e2e-test-utils","commit_stats":null,"previous_names":["polylang/e2e-test-utils"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/polylang/e2e-test-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polylang%2Fe2e-test-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polylang%2Fe2e-test-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polylang%2Fe2e-test-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polylang%2Fe2e-test-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polylang","download_url":"https://codeload.github.com/polylang/e2e-test-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polylang%2Fe2e-test-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28792786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-27T00:20:34.961Z","updated_at":"2026-01-27T00:20:35.649Z","avatar_url":"https://github.com/polylang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧪 Polylang E2E Test Utils\n\nThis package provides shared E2E testing utilities for Polylang projects.\n\n## 📦 Installation\n\n```bash\nnpm install --save-dev polylang/e2e-test-utils\n```\n\n## 🚀 Usage\n\n### ⚙️ Playwright configuration\n\nCreate a `playwright.config.js` file in your project's root:\n\n```javascript\nimport { getPlaywrightConfig } from '@wpsyntex/e2e-test-utils';\n\nexport default getPlaywrightConfig( {\n  // Override any default configuration here\n  use: {\n    // Custom use options\n    globalSetup: require.resolve( 'path-to-your/global.setup.js' ), // Falls back to the packaged one.\n  },\n  webServer: {\n    // Custom webServer options\n  }\n} );\n```\n\n#### Configuration Options\n\nThe `getPlaywrightConfig` function accepts an options object that can override any of the default configuration:\n\n- `use`: Override default Playwright use options\n- `webServer`: Override default webServer configuration\n- Any other Playwright configuration options\n\n#### Default Configuration\n\nThe default configuration includes:\n\n- Chrome browser setup\n- HTML reporter\n- CI-specific settings\n- Default storage state path\n- Local development server configuration\n\n### 📚 API Documentation\n\n#### 🌐 Language Management Functions\n\n##### `getAllLanguages( requestUtils )`\nRetrieves a list of all configured languages in Polylang.\n- **Parameters:**\n  - `requestUtils`: Gutenberg request utils object\n- **Returns:** Promise resolving to the list of languages\n\n##### `getLanguage( requestUtils, slug )`\nRetrieves a specific language by its slug.\n- **Parameters:**\n  - `requestUtils`: Gutenberg request utils object\n  - `slug`: Language slug to retrieve\n- **Returns:** Promise resolving to the language data\n\n##### `createLanguage( requestUtils, locale )`\nCreates a new language in Polylang.\n- **Parameters:**\n  - `requestUtils`: Gutenberg request utils object\n  - `locale`: Language locale to create (e.g., 'fr_FR')\n- **Returns:** Promise resolving to the created language\n\n##### `deleteLanguage( requestUtils, slug )`\nDeletes a specific language by its slug.\n- **Parameters:**\n  - `requestUtils`: Gutenberg request utils object\n  - `slug`: Language slug to delete\n- **Returns:** Promise resolving to the deletion result\n\n##### `deleteAllLanguages( requestUtils )`\nDeletes all configured languages except the default one.\n- **Parameters:**\n  - `requestUtils`: Gutenberg request utils object\n- **Returns:** Promise resolving to the deletion results\n\n#### ⚙️ Settings Management Functions\n\n##### `getSettings( requestUtils )`\nRetrieves all Polylang plugin settings.\n- **Parameters:**\n  - `requestUtils`: Gutenberg request utils object\n- **Returns:** Promise resolving to the settings object\n\n##### `setSetting( requestUtils, settingKey, settingValue )`\nUpdates a specific plugin setting.\n- **Parameters:**\n  - `requestUtils`: Gutenberg request utils object\n  - `settingKey`: The key of the setting to update\n  - `settingValue`: The new value for the setting\n- **Returns:** Promise resolving to the updated setting\n\n##### `resetAllSettings( requestUtils )`\nResets all plugin settings to their default values.\n- **Parameters:**\n  - `requestUtils`: Gutenberg request utils object\n- **Returns:** Promise resolving to the reset operation result\n- **Note:** Preserves the default language setting\n\n#### 🏷️ Taxonomy Management Functions\n\n##### `getAllTerms( requestUtils, taxonomy )`\nRetrieves all terms for a specific taxonomy.\n- **Parameters:**\n  - `requestUtils`: Gutenberg request utils object\n  - `taxonomy`: Taxonomy slug\n- **Returns:** Promise resolving to the list of terms\n\n##### `getTermBySlug( requestUtils, taxonomy, slug )`\nRetrieves a specific term by its slug within a taxonomy.\n- **Parameters:**\n  - `requestUtils`: Gutenberg request utils object\n  - `taxonomy`: Taxonomy slug\n  - `slug`: Term slug to retrieve\n- **Returns:** Promise resolving to the term data\n\n##### `deleteAllTerms( requestUtils, taxonomy )`\nDeletes all terms within a specific taxonomy.\n- **Parameters:**\n  - `requestUtils`: Gutenberg request utils object\n  - `taxonomy`: Taxonomy slug\n- **Returns:** Promise resolving to the deletion results\n\n#### 📄 XLIFF Export Functions\n\n##### `fillInXliffExportForm( page, options )`\nFills in the XLIFF export form for bulk translation export.\n- **Parameters:**\n  - `page`: Playwright page object\n  - `options`: Configuration object\n    - `postId`: Post ID to export\n    - `postTitle`: Post title to select\n    - `languageName`: Target language name\n- **Returns:** Promise that resolves when the export form is submitted\n- **Note:** Page should be on the post list table\n\n##### `getXliffRegex( sourceLocale, targetLocale )`\nReturns a regex pattern to match XLIFF file names with the specified locales and timestamp.\n- **Parameters:**\n  - `sourceLocale`: Source language locale (e.g., 'en_US')\n  - `targetLocale`: Target language locale (e.g., 'fr_FR')\n- **Returns:** RegExp object to match XLIFF file names\n- **Note:** Converts underscores to hyphens in locales and matches timestamp pattern\n\n#### 📥 Download Utilities\n\n##### `getDownload( page, submitButtonOptions )`\nReturns a download promise by clicking a submit button and waiting for the download to start.\n- **Parameters:**\n  - `page`: Playwright page object\n  - `submitButtonOptions`: Submit button options (default: `{ name: 'Submit' }`)\n- **Returns:** Promise resolving to the download object\n\n##### `getStringFromFile( filePath )`\nReads a file and returns its contents as a string.\n- **Parameters:**\n  - `filePath`: The file path to read\n- **Returns:** String content of the file\n\n#### 🔧 Additional Exports\n\n##### `globalSetup`\n\nGlobal setup function for Playwright tests. Ensures fixtures are deleted and global context is set up properly.\n\n#### 💡 Usage Example\n\n```javascript\nimport {\n  createLanguage,\n  setSetting,\n  getAllTerms\n} from '@wpsyntex/e2e-test-utils';\n\n// Create a new language\nawait createLanguage( requestUtils, 'fr_FR' );\n\n// Update a setting\nawait setSetting( requestUtils, 'hide_default', true );\n\n// Get all terms from a taxonomy\nconst terms = await getAllTerms( requestUtils, 'category' );\n```\n\nAll these functions are designed to work with the Gutenberg request utils object and follow REST API patterns for interacting with Polylang's functionality. They provide a comprehensive set of tools for managing languages, settings, and taxonomies in E2E tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolylang%2Fe2e-test-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolylang%2Fe2e-test-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolylang%2Fe2e-test-utils/lists"}