-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Create post_test.rb to test posting at /post #5605
Changes from 16 commits
e81c46a
dc3ae63
a184374
2960393
b537c1f
f58eb88
9d17253
f4d0511
5975695
3e93806
a368207
ac3cc72
51e67f7
141becd
8f3fc8f
cd3ad49
8610bbb
9b5dd73
1b053a8
febcf33
70a7a1e
61895c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,32 @@ | ||||||||||||||||||||||
require "application_system_test_case" | ||||||||||||||||||||||
# https://guides.rubyonrails.org/testing.html#implementing-a-system-test | ||||||||||||||||||||||
|
||||||||||||||||||||||
class PostTest < ApplicationSystemTestCase | ||||||||||||||||||||||
|
||||||||||||||||||||||
def setup | ||||||||||||||||||||||
activate_authlogic | ||||||||||||||||||||||
end | ||||||||||||||||||||||
|
||||||||||||||||||||||
test 'posting from the editor' do | ||||||||||||||||||||||
visit '/' | ||||||||||||||||||||||
|
||||||||||||||||||||||
click_on 'Login' | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree on redundant, but I'm not sure how to create a session we can use to test logged-in stuff. I tried doing as we do in other tests, with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
My biggest interests in system tests are:
But yeah... lots of other possibilities. |
||||||||||||||||||||||
fill_in("username-login", with: "Bob") | ||||||||||||||||||||||
fill_in("password-signup", with: "secretive") | ||||||||||||||||||||||
click_on "Log in" | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are logging in first and then going to '/post What do you suggest Jeff? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmm, good idea... let me try... |
||||||||||||||||||||||
|
||||||||||||||||||||||
visit '/post' | ||||||||||||||||||||||
|
||||||||||||||||||||||
fill_in("Title", with: "My new post") | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fill_in(x, with: Y) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. X is ... i can't remember the term... maybe a |
||||||||||||||||||||||
fill_in("text-input", with: "All about this interesting stuff") | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, we need a better way to select the right field. Maybe this is because we're in wysiwyg and not markdown mode? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||
|
||||||||||||||||||||||
find('.ple-publish').click | ||||||||||||||||||||||
|
||||||||||||||||||||||
assert_response :redirect | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, here... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line 26 is not right, we shouldn't have to click twice. Not sure why this isn't working... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. i used Capycorder to try this but it didn't get everything:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But in fact on stable, posting is not working, so maybe this is just because the functionality is broken? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i see a 500 on https://stable.publiclab.org/post,
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this 500 possibly due to email not sending? I thought we'd resolved this but who knows... hmm. We may need to try to pull the logs here since this is not failing in tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, think I resolved the 500 on stable... testing.... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's resolved on stable. Still not here, though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I realized that it's not doing a real redirect... it's JS sending us to a new page. So, I'm using a snippet from https://stackoverflow.com/questions/20243208/how-can-i-test-in-capybara-that-a-page-has-not-reloaded-javascript-onclick-in to show that |
||||||||||||||||||||||
follow_redirect! | ||||||||||||||||||||||
|
||||||||||||||||||||||
assert_selector('h1', text: 'My new post') | ||||||||||||||||||||||
assert_selector('#notice', 'User was successfully created.') | ||||||||||||||||||||||
end | ||||||||||||||||||||||
|
||||||||||||||||||||||
end |
This comment was marked as resolved.
Sorry, something went wrong.