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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minitest spec expectations #309

Open
davekaro opened this issue Oct 9, 2024 · 3 comments · May be fixed by #321
Open

Minitest spec expectations #309

davekaro opened this issue Oct 9, 2024 · 3 comments · May be fixed by #321

Comments

@davekaro
Copy link

davekaro commented Oct 9, 2024

Simple description about the feature

Add Minitest spec expectations for parity with rspec

Usecase / Motivation

I'm using Minitest spec in my project and trying to figure out what is needed to enable tests like the rspec examples on https://playwright-ruby-client.vercel.app/docs/article/guides/rspec_integration

I think the desired outcome would be something similar to capybara's expectations here https://github.com/teamcapybara/capybara/blob/master/lib/capybara/minitest/spec.rb

For example,

it 'should show username after login' do
  page.fill('input[name="username"]', 'playwright')
  page.fill('input[name="password"]', 'password123')
  page.expect_navigation do
    page.locator('button[type="submit"]').click
  end

  dashboard_container = page.locator('.dashboard')

  # Web-first assertion
  expect(dashboard_container).must_have_text('Hi, playwright!')
end

I'm happy to try and make a PR for this work, but wondered if any thought has already been done on how to handle, or maybe it already works and I just don't know the right syntax.

@YusukeIwaki
Copy link
Owner

@davekaro Hi, I haven't worked for MiniTest integration at this moment, however Pull Request is really welcome.

Probably, https://github.com/YusukeIwaki/playwright-ruby-client/blob/1.47.0/lib/playwright/test.rb#L65-L76 this is RSpec-specific matcher. We have to define minitest matcher when minitest is used.

@gma
Copy link

gma commented Nov 26, 2024

I checked for an issue just like this one; I'd like to be able to write web-first assertions for an app that uses minitest. Are you actively working on it @davekaro?

@davekaro
Copy link
Author

Not at the moment. If you want to jump on it please do. I might not get to it for a while

@alex-brook alex-brook linked a pull request Dec 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants