Skip to content

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

Open
@msayed98

Description

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions