Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce playwright locator #4255

Merged
merged 7 commits into from
Mar 19, 2024
Merged

feat: introduce playwright locator #4255

merged 7 commits into from
Mar 19, 2024

Conversation

kobenguyent
Copy link
Collaborator

@kobenguyent kobenguyent commented Mar 16, 2024

Motivation/Description of the PR

  • Introduce the playwright locator: _react, _vue, data-testid attribute:
Scenario('using playwright locator @Playwright', () => {
  I.amOnPage('https://codecept.io/test-react-calculator/');
  I.click('7');
  I.click({ pw: '_react=t[name = "="]' });
  I.seeElement({ pw: '_react=t[value = "7"]' });
  I.click({ pw: '_react=t[name = "+"]' });
  I.click({ pw: '_react=t[name = "3"]' });
  I.click({ pw: '_react=t[name = "="]' });
  I.seeElement({ pw: '_react=t[value = "10"]' });
});
Scenario('using playwright data-testid attribute @Playwright', () => {
    await I.amOnPage('/');
    const webElements = await I.grabWebElements({ pw: '[data-testid="welcome"]' });
    assert.equal(webElements[0]._selector, '[data-testid="welcome"] >> nth=0');
    assert.equal(webElements.length, 1);
});

Applicable helpers:

  • Playwright

Type of change

  • 馃殌 New functionality

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

Copy link
Contributor

@DavertMik DavertMik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kobenguyent how about having an alias as pw as a shorthand?

click({ pw: '_react=' })

@kobenguyent
Copy link
Collaborator Author

@kobenguyent how about having an alias as pw as a shorthand?

click({ pw: '_react=' })

Sure, let me update it.

@kobenguyent kobenguyent merged commit 1aff923 into 3.x Mar 19, 2024
12 of 13 checks passed
@kobenguyent kobenguyent deleted the feat-playwright-locator branch March 19, 2024 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playwright to codecept locator conversion
3 participants