protractor-skill
Generates Protractor E2E tests for Angular/AngularJS apps in JS/TS. NOTE: Protractor is officially deprecated — recommend Playwright or Cypress. Use when user mentions "Protractor", "element(by.model())", "Angular E2E". Triggers on: "Protractor", "element(by.model)", "Angular E2E test", "protractor.conf".
What this skill does
# Protractor Automation Skill (Deprecated)
> **Protractor reached end-of-life in 2023.** Angular team recommends Playwright or Cypress.
For TestMu AI cloud execution, see [reference/cloud-integration.md](reference/cloud-integration.md) and [shared/testmu-cloud-reference.md](../shared/testmu-cloud-reference.md).
## Core Patterns
### Basic Test
```javascript
describe('Login', () => {
beforeEach(async () => {
await browser.get('/login');
});
it('should login with valid credentials', async () => {
await element(by.model('email')).sendKeys('[email protected]');
await element(by.model('password')).sendKeys('password123');
await element(by.css('button[type="submit"]')).click();
expect(await browser.getCurrentUrl()).toContain('/dashboard');
expect(await element(by.css('.welcome')).getText()).toContain('Welcome');
});
it('should show error for invalid credentials', async () => {
await element(by.model('email')).sendKeys('[email protected]');
await element(by.model('password')).sendKeys('wrong');
await element(by.css('button[type="submit"]')).click();
expect(await element(by.css('.error')).isDisplayed()).toBe(true);
});
});
```
### Angular-Specific Locators
```javascript
element(by.model('ctrl.email')); // ng-model
element(by.binding('ctrl.username')); // Angular binding
element(by.exactBinding('ctrl.name')); // Exact binding
element(by.repeater('item in items')); // ng-repeat
element.all(by.repeater('item in items')).count(); // Count repeater
element(by.cssContainingText('.item', 'Active')); // CSS + text
element(by.buttonText('Submit')); // Button text
element(by.partialButtonText('Sub')); // Partial text
```
### Page Objects
```javascript
class LoginPage {
constructor() {
this.emailInput = element(by.model('email'));
this.passwordInput = element(by.model('password'));
this.loginButton = element(by.css('button[type="submit"]'));
this.errorMessage = element(by.css('.error'));
}
async login(email, password) {
await this.emailInput.sendKeys(email);
await this.passwordInput.sendKeys(password);
await this.loginButton.click();
}
}
// Usage
const loginPage = new LoginPage();
await loginPage.login('[email protected]', 'password123');
```
### protractor.conf.js
```javascript
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['specs/**/*.spec.js'],
capabilities: { browserName: 'chrome' },
jasmineNodeOpts: { defaultTimeoutInterval: 30000 },
onPrepare: () => {
browser.waitForAngularEnabled(true);
}
};
```
### Migration Guide
| Protractor | Playwright |
|-----------|------------|
| `element(by.model('x'))` | `page.locator('[ng-model="x"]')` |
| `element(by.css('#id'))` | `page.locator('#id')` |
| `browser.get(url)` | `page.goto(url)` |
| `element.sendKeys(text)` | `locator.fill(text)` |
| `browser.sleep(ms)` | `page.waitForTimeout(ms)` |
| `browser.waitForAngular()` | Not needed (auto-wait) |
### Cloud Execution on TestMu AI
Set environment variables: `LT_USERNAME`, `LT_ACCESS_KEY`
```javascript
// conf.js
exports.config = {
seleniumAddress: `https://${process.env.LT_USERNAME}:${process.env.LT_ACCESS_KEY}@hub.lambdatest.com/wd/hub`,
capabilities: {
browserName: 'chrome',
'LT:Options': {
user: process.env.LT_USERNAME,
accessKey: process.env.LT_ACCESS_KEY,
build: 'Protractor Build',
name: 'Protractor Test',
platformName: 'Windows 11',
video: true,
console: true,
network: true,
},
},
};
```
## Run: `npx protractor conf.js` (deprecated, use Playwright/Cypress instead)
## Deep Patterns
For advanced patterns, debugging guides, CI/CD integration, and best practices,
see `reference/playbook.md`.
Related in e2e-testing
playwright-skill
IncludedGenerates production-grade Playwright automation scripts and E2E tests in TypeScript, JavaScript, Python, Java, or C#. Supports local execution and TestMu AI cloud across 3000+ browser/OS combinations and real mobile devices. Use when the user asks to write Playwright tests, automate browsers, run cross-browser tests, test on real devices, debug flaky tests, mock APIs, or do visual regression. Triggers on: "Playwright", "E2E test", "browser test", "run on cloud", "cross-browser", "TestMu", "LambdaTest", "test my app", "test on mobile", "real device".
selenium-skill
IncludedGenerates production-grade Selenium WebDriver automation scripts and tests in Java, Python, JavaScript, C#, Ruby, or PHP. Supports local execution and TestMu AI cloud with 3000+ browser/OS combinations. Use when the user asks to write Selenium tests, automate with WebDriver, run cross-browser tests on Selenium Grid, or mentions "Selenium", "WebDriver", "RemoteWebDriver", "ChromeDriver", "GeckoDriver". Triggers on: "Selenium", "WebDriver", "browser automation", "Selenium Grid", "cross-browser", "TestMu", "LambdaTest".
cypress-skill
IncludedGenerates production-grade Cypress E2E and component tests in JavaScript or TypeScript. Supports local execution and TestMu AI cloud. Use when the user asks to write Cypress tests, set up Cypress, test with cy commands, or mentions "Cypress", "cy.visit", "cy.get", "cy.intercept". Triggers on: "Cypress", "cy.", "component test", "E2E test", "TestMu", "LambdaTest".
test-framework-migration-skill
IncludedMigrates and converts test automation scripts between Selenium, Playwright, Puppeteer, and Cypress. Use when the user asks to migrate, convert, or port tests from one framework to another; rewrite tests in a different framework; or switch from Selenium to Playwright, Playwright to Selenium, Puppeteer to Playwright, Cypress to Playwright, or vice versa. Triggers on: "migrate", "convert", "port", "selenium to playwright", "playwright to selenium", "puppeteer to playwright", "cypress to playwright", "rewrite tests in", "switch from [framework] to [framework]".
robot-framework-skill
IncludedGenerates Robot Framework tests in keyword-driven syntax with Python. Supports SeleniumLibrary, RequestsLibrary, and custom keywords. Use when user mentions "Robot Framework", "*** Test Cases ***", "SeleniumLibrary", ".robot file". Triggers on: "Robot Framework", "*** Test Cases ***", ".robot", "SeleniumLibrary", "keyword-driven test".
laravel-dusk-skill
IncludedGenerates Laravel Dusk browser tests in PHP. Chrome-based E2E testing for Laravel apps. Use when user mentions "Dusk", "Laravel Dusk", "$browser->visit", "DuskTestCase". Triggers on: "Laravel Dusk", "Dusk test", "$browser->visit", "DuskTestCase".