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

The backdoor for testing doesn't work with follow redirects #985

Open
msayed98 opened this issue Oct 16, 2022 · 2 comments
Open

The backdoor for testing doesn't work with follow redirects #985

msayed98 opened this issue Oct 16, 2022 · 2 comments

Comments

@msayed98
Copy link

When using the clearance backdoor for testing, and using as user, when following redirects by clicking on links, it doesn't continue with the same user, making this backdoor useless, and you can't use as in follow_redirect! or click_on for example
here is a simple test that that is created by using the rails scaffold generator, and it fails because click on leads to a redirect

test "creating a Car" do
    visit cars_url(as: @user)
    click_on "New Car"

    fill_in "Make", with: @car.make
    fill_in "Model", with: @car.model
    fill_in "Year", with: @car.year
    click_on "Create Car"

    assert_text "Car was successfully created"
    click_on "Back"
  end

and here is a repository I created for reproducing this issue, it contains just a minimal created rails app with users and cars scaffold, you can just run the tests by ralis test:system and it would fail

@coorasse
Copy link

coorasse commented Feb 2, 2023

I am facing the same issue upon upgrading to Rails7

@avk
Copy link

avk commented May 15, 2024

Just hit the same issue. Not clear how to make clearance work with system tests…

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

No branches or pull requests

3 participants