Skip to content

Commit

Permalink
[ci] Migrate tests for user home page to rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
bgeuken committed Mar 24, 2016
1 parent fe8c565 commit 09c9e6e
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
47 changes: 47 additions & 0 deletions src/api/spec/features/webui/users/user_home_page.rb
@@ -0,0 +1,47 @@
require "browser_helper"

RSpec.feature "User's home project creation", type: :feature, js: true do
let!(:user) {
create(:confirmed_user, {
login: "Jim",
realname: "Jim Knopf",
email: "jim.knopf@puppenkiste.com"
})
}

before do
login user
visit home_path
end

scenario "view home page" do
expect(page).to have_css("#home-realname", text: "Jim Knopf")
expect(page).to have_css("a[href='mailto:jim.knopf@puppenkiste.com']", text: "jim.knopf@puppenkiste.com")

expect(page).to have_text("Edit your account")
expect(page).to have_text("Change your password")

expect(page).to have_link("Involved Packages")
expect(page).to have_link("Involved Projects")
expect(page).to have_link("Owned Project/Packages")

expect(page).to have_link("Incoming Requests")
expect(page).to have_link("Outgoing Requests")
expect(page).to have_link("Declined Requests")
expect(page).to have_link("All Requests")

expect(page).not_to have_link("Maintenance Requests")
end

scenario "edit account information" do
click_link("Edit your account")

fill_in "realname", with: "John Doe"
fill_in "email", with: "john.doe@opensuse.org"
click_button("Ok")

expect(page).to have_text("User data for user 'Jim' successfully updated.")
expect(page).to have_css("#home-realname", text: "John Doe")
expect(page).to have_css("a[href='mailto:john.doe@opensuse.org']", text: "john.doe@opensuse.org")
end
end
6 changes: 3 additions & 3 deletions src/api/test/functional/webui/login_test.rb
Expand Up @@ -70,23 +70,23 @@ def test_login_invalid_entry # spec/features/webui/login_spec.rb
flash_message_type.must_equal :alert
end

def test_change_real_name_for_user
def test_change_real_name_for_user # spec/features/webui/users/user_home_page.rb
use_js

login_Iggy
open_home
change_user_real_name Faker::Name.name
end

def test_remove_user_real_name
def test_remove_user_real_name # spec/features/webui/users/user_home_page.rb
use_js

login_Iggy
open_home
change_user_real_name ""
end

def test_real_name_stays_changed
def test_real_name_stays_changed # spec/features/webui/users/user_home_page.rb
use_js

login_Iggy
Expand Down

0 comments on commit 09c9e6e

Please sign in to comment.