diff --git a/test/system/post_test.rb b/test/system/post_test.rb index 1b1bd0914b..3a8ff11a62 100644 --- a/test/system/post_test.rb +++ b/test/system/post_test.rb @@ -5,14 +5,17 @@ class PostTest < ApplicationSystemTestCase include ActiveJob::TestHelper Capybara.default_max_wait_time = 60 - test 'posting from the editor' do + def setup visit '/' - click_on 'Login' - fill_in("username-login", with: "Bob") + find(".nav-link.loginToggle").click() + fill_in("username-login", with: "jeff") fill_in("password-signup", with: "secretive") - click_on "Log in" + find(".login-modal-form #login-button").click() + end + + test 'posting from the editor' do visit '/post' fill_in("title-input", with: "My new post") @@ -20,27 +23,17 @@ class PostTest < ApplicationSystemTestCase el = find(".wk-wysiwyg") # rich text input el.set("All about this interesting stuff") - assert_page_reloads do - find('.ple-publish').click - assert_selector('h1', text: "My new post") - assert_selector('#content', text: "All about this interesting stuff") - assert_selector('.alert-success', text: "×\nSuccess! Thank you for contributing open research, and thanks for your patience while your post is approved by community moderators and we'll email you when it is published. In the meantime, if you have more to contribute, feel free to do so.") - - end + find('.ple-publish').click() + assert_selector('h1', text: "My new post") + assert_selector('#content', text: "All about this interesting stuff") + assert_selector('.alert-success', text: "×\nResearch note published. Get the word out on the discussion lists!") end test 'adding tags to the post' do visit '/wiki/wiki-page-path/comments' - find('a[data-target="#loginModal"]', text: 'Login').click() - - fill_in 'user_session[username]', with: 'jeff' - fill_in 'user_session[password]', with: 'secretive' - - find(".login-modal-form #login-button").click() - find('a#tags-open').click() find('.tag-input').set('nature').native.send_keys(:return) @@ -53,13 +46,6 @@ class PostTest < ApplicationSystemTestCase test 'removing tags from the post' do visit '/wiki/wiki-page-path/comments' - find('a[data-target="#loginModal"]', text: 'Login').click() - - fill_in 'user_session[username]', with: 'jeff' - fill_in 'user_session[password]', with: 'secretive' - - find(".login-modal-form #login-button").click() - find('a#tags-open').click() find('.tag-input').set('nature').native.send_keys(:return) @@ -75,13 +61,6 @@ class PostTest < ApplicationSystemTestCase test 'like button on the post' do visit '/wiki/wiki-page-path/comments' - find('a[data-target="#loginModal"]', text: 'Login').click() - - fill_in 'user_session[username]', with: 'jeff' - fill_in 'user_session[password]', with: 'secretive' - - click_on 'Log in' - like_button = find('.btn-like').click(); # Make sure that star is toggled @@ -109,11 +88,7 @@ def assert_page_does_not_reload(message = "page should not reload") test "edit wiki" do visit '/wiki/wiki-page-path/' - click_on "Login" - fill_in 'user_session[username]', with: 'jeff' - fill_in 'user_session[password]', with: 'secretive' - click_on "Log in" find('a.btn-circle:first-of-type .fa-pencil').click() fill_in("body", with: "Test for editing wikis!") @@ -131,11 +106,6 @@ def assert_page_does_not_reload(message = "page should not reload") Capybara.ignore_hidden_elements = false visit '/wiki/new' - find('.login-page-form #username-login').set('jeff') - find('.login-page-form #password-signup').set('secretive') - - find('.login-page-form #login-button').click() - # Upload the image drop_in_dropzone("#{Rails.root.to_s}/public/images/pl.png")