Merge branch 'next-minor' into develop

This commit is contained in:
Jonne Haß 2019-05-03 17:18:53 +02:00
commit dfeea521f5
7 changed files with 187 additions and 156 deletions

View file

@ -17,7 +17,7 @@
## Refactor
* Enable paranoid mode for devise [#8003](https://github.com/diaspora/diaspora/pull/8003)
* Refactor likes cucumber test [#8002](https://github.com/diaspora/diaspora/pull/8002)
## Bug fixes
## Features

View file

@ -16,13 +16,14 @@ Feature: Liking posts
Scenario: Liking and unliking a post from the stream
Then I should not have activated notifications for the post
When I like the post "I like unicorns" in the stream
Then I should see "Unlike" within ".stream-element .feedback"
And I should see a ".likes .media" within "#main-stream .stream-element"
Then the post "I like unicorns" should have the "Unlike" action available
And the post "I like unicorns" should have 1 like
And the post "I like unicorns" should have a like from "Alice Smith"
And I should have activated notifications for the post
When I unlike the post "I like unicorns" in the stream
Then I should see "Like" within ".stream-element .feedback"
And I should not see a ".likes .media" within "#main-stream .stream-element"
Then the post "I like unicorns" should have the "Like" action available
And the post "I like unicorns" shouldn't have any likes
Scenario: Liking and unliking a post from a single post page
@ -39,4 +40,6 @@ Feature: Liking posts
When I like the post "I like unicorns" in the stream
And I sign out
And I sign in as "bob@bob.bob"
Then I should see a ".likes" within "#main-stream .stream-element"
Then the post "I like unicorns" should have the "Like" action available
And the post "I like unicorns" should have 1 like
And the post "I like unicorns" should have a like from "Alice Smith"

View file

@ -61,18 +61,6 @@ And /^I submit the form$/ do
find("input[type='submit']").click
end
And /^I expand the publisher$/ do
click_publisher
end
And /^I close the publisher$/ do
find("#publisher .md-cancel").click
end
Then /^the publisher should be expanded$/ do
find("#publisher")["class"].should_not include("closed")
end
Then /^the text area wrapper mobile should be with attachments$/ do
find("#publisher-textarea-wrapper")["class"].should include("with_attachments")
end
@ -88,50 +76,6 @@ And /^I hover over the "([^"]+)"$/ do |element|
find("#{element}", match: :first).hover
end
When /^I prepare the deletion of the first post$/ do
find(".stream .stream-element", match: :first).hover
within(find(".stream .stream-element", match: :first)) do
ctrl = find(".control-icons")
ctrl.hover
ctrl.find(".remove_post").click
end
end
When /^I prepare hiding the first post$/ do
find(".stream .stream-element", match: :first).hover
within(find(".stream .stream-element", match: :first)) do
ctrl = find(".control-icons")
ctrl.hover
ctrl.find(".hide_post").click
end
end
When /^I click to delete the first post$/ do
accept_alert do
step "I prepare the deletion of the first post"
end
expect(find(".stream")).to have_no_css(".stream-element.loaded.deleting")
end
When /^I click to hide the first post$/ do
accept_alert do
step "I prepare hiding the first post"
end
end
When /^I click to delete the first comment$/ do
within("div.comment", match: :first) do
find(".comment_delete", visible: false).click
end
end
When /^I click to delete the first uploaded photo$/ do
page.execute_script("$('#photodropzone .x').css('display', 'block');")
image_count = all(".publisher_photo img", wait: false).count
find("#photodropzone .x", match: :first).trigger "click"
page.assert_selector(".publisher_photo img", count: image_count - 1)
end
And /^I click on selector "([^"]*)"$/ do |selector|
find(selector).click
end
@ -229,15 +173,7 @@ When /^I resize my window to 800x600$/ do
page.driver.resize(800, 600)
end
Then 'I should see an image attached to the post' do
step %(I should see a "img" within ".stream-element div.photo-attachments")
end
Then 'I press the attached image' do
step %(I press the 1st "img" within ".stream-element div.photo-attachments")
end
And "I wait for the popovers to appear" do
And /^I wait for the popovers to appear$/ do
expect(page).to have_selector(".popover", count: 3)
end
@ -290,22 +226,6 @@ When /^I focus the "([^"]+)" field$/ do |field|
find_field(field).click
end
Given /^I have configured a Bitcoin address$/ do
AppConfig.settings.bitcoin_address = "AAAAAA"
end
Then /^I should see the Bitcoin address$/ do
find("#bitcoin_address")['value'].should == "AAAAAA"
end
Given /^I have configured a Liberapay username$/ do
AppConfig.settings.liberapay_username = "BBBBBB"
end
Then /^I should see the Liberapay donate button$/ do
find("#liberapay-button")["href"].should == "https://liberapay.com/BBBBBB/donate"
end
Given /^"([^"]*)" is hidden$/ do |selector|
page.should have_selector(selector, visible: false)
page.should_not have_selector(selector)

View file

@ -0,0 +1,23 @@
# frozen_string_literal: true
When /^(?:|I )click on "([^"]*)" navbar title$/ do |title|
with_scope(".info-bar") do
find("h5", text: title).click
end
end
Given /^I have configured a Bitcoin address$/ do
AppConfig.settings.bitcoin_address = "AAAAAA"
end
Then /^I should see the Bitcoin address$/ do
find("#bitcoin_address")["value"].should == "AAAAAA"
end
Given /^I have configured a Liberapay username$/ do
AppConfig.settings.liberapay_username = "BBBBBB"
end
Then /^I should see the Liberapay donate button$/ do
find("#liberapay-button")["href"].should == "https://liberapay.com/BBBBBB/donate"
end

View file

@ -8,36 +8,6 @@ Then /^the post should be expanded$/ do
first_post_expanded?
end
Then /^I should see an uploaded image within the photo drop zone$/ do
expect(find("#photodropzone img")["src"]).to include("uploads/images")
end
Then /^I should not see an uploaded image within the photo drop zone$/ do
page.should_not have_css "#photodropzone img"
end
Then /^I should not see any posts in my stream$/ do
expect(page).not_to have_selector("#paginate .loader")
expect(page).not_to have_selector(".stream-element .media")
expect(page).to have_selector(".stream-element .no-posts-info")
end
Then /^I should not see any picture in my stream$/ do
expect(page).to have_selector(".photo_area img", count: 0)
end
Then /^I should see (\d+) pictures in my stream$/ do |count|
expect(page).to have_selector(".photo_area img", count: count)
end
Then /^I should not be able to submit the publisher$/ do
expect(publisher_submittable?).to be false
end
Then /^I should see "([^"]*)" in the publisher$/ do |text|
expect(page).to have_field("status_message[text]", with: text)
end
Given /^I have a limited post with text "([^\"]*)" in the aspect "([^"]*)"$/ do |text, aspect_name|
@me.post :status_message, text: text, to: @me.aspects.where(name: aspect_name).first.id
end
@ -83,10 +53,6 @@ And /^the post with text "([^"]*)" is reshared by "([^"]*)"$/ do |text, email|
user.post(:reshare, :root_guid => root.guid, :public => true, :to => user.aspect_ids)
end
And /^I submit the publisher$/ do
submit_publisher
end
When /^I click on the first block button/ do
find(".stream-element", match: :first).hover
find(".block_user").click
@ -100,40 +66,14 @@ When /^I expand the post$/ do
expand_first_post
end
When /^I click the publisher and post "([^"]*)"$/ do |text|
click_and_post(text)
end
When /^I post an extremely long status message$/ do
click_and_post("I am a very interesting message " * 64)
end
When /^I write the status message "([^"]*)"$/ do |text|
write_in_publisher(text)
end
When /^I insert an extremely long status message$/ do
write_in_publisher("I am a very interesting message " * 64)
end
When /^I append "([^"]*)" to the publisher$/ do |text|
append_to_publisher(text)
end
When /^I attach "([^"]*)" to the publisher$/ do |path|
upload_file_with_publisher(path)
end
When /^I open the show page of the "([^"]*)" post$/ do |post_text|
visit post_path_by_content(post_text)
end
When /^I select "([^"]*)" on the aspect dropdown$/ do |text|
page.execute_script(
"$('#publisher .dropdown .dropdown_list, #publisher .aspect-dropdown .dropdown-menu')
.find('li').each(function(i,el){
var elem = $(el);
if ('" + text + "' == $.trim(elem.text()) ) {
elem.click();
}});")
Then /^I should see an image attached to the post$/ do
step %(I should see a "img" within ".stream-element div.photo-attachments")
end
Then /^I press the attached image$/ do
step %(I press the 1st "img" within ".stream-element div.photo-attachments")
end

View file

@ -0,0 +1,75 @@
# frozen_string_literal: true
Then /^I expand the publisher$/ do
click_publisher
end
And /^I close the publisher$/ do
find("#publisher .md-cancel").click
end
Then /^the publisher should be expanded$/ do
find("#publisher")["class"].should_not include("closed")
end
When /^I click to delete the first uploaded photo$/ do
page.execute_script("$('#photodropzone .x').css('display', 'block');")
image_count = all(".publisher_photo img", wait: false).count
find("#photodropzone .x", match: :first).trigger "click"
page.assert_selector(".publisher_photo img", count: image_count - 1)
end
Then /^I should see an uploaded image within the photo drop zone$/ do
expect(find("#photodropzone img")["src"]).to include("uploads/images")
end
Then /^I should not see an uploaded image within the photo drop zone$/ do
page.should_not have_css "#photodropzone img"
end
Then /^I should not be able to submit the publisher$/ do
expect(publisher_submittable?).to be false
end
Then /^I should see "([^"]*)" in the publisher$/ do |text|
expect(page).to have_field("status_message[text]", with: text)
end
When /^I write the status message "([^"]*)"$/ do |text|
write_in_publisher(text)
end
When /^I insert an extremely long status message$/ do
write_in_publisher("I am a very interesting message " * 64)
end
When /^I append "([^"]*)" to the publisher$/ do |text|
append_to_publisher(text)
end
When /^I attach "([^"]*)" to the publisher$/ do |path|
upload_file_with_publisher(path)
end
And /^I submit the publisher$/ do
submit_publisher
end
When /^I click the publisher and post "([^"]*)"$/ do |text|
click_and_post(text)
end
When /^I post an extremely long status message$/ do
click_and_post("I am a very interesting message " * 64)
end
When /^I select "([^"]*)" on the aspect dropdown$/ do |text|
page.execute_script(
"$('#publisher .dropdown .dropdown_list, #publisher .aspect-dropdown .dropdown-menu')
.find('li').each(function(i,el){
var elem = $(el);
if ('" + text + "' == $.trim(elem.text()) ) {
elem.click();
}});"
)
end

View file

@ -4,6 +4,31 @@ When /^I (?:like|unlike) the post "([^"]*)" in the stream$/ do |post_text|
like_stream_post(post_text)
end
Then /^the post "([^"]*)" should have the "([^"]*)" action available$/ do |post_text, action_text|
within_post(post_text) do
find(".feedback").should have_content(action_text)
end
end
Then /^the post "([^"]*)" shouldn't have any likes$/ do |post_text|
within_post(post_text) do
find(".likes").should have_no_css(".avatar", visible: true)
end
end
Then /^the post "([^"]*)" should have (\d+) like(?:s|)$/ do |post_text, likes_number|
within_post(post_text) do
find(".expand-likes").should have_content(likes_number)
end
end
Then /^the post "([^"]*)" should have a like from "([^"]*)"$/ do |post_text, username|
within_post(post_text) do
find(".expand-likes").click
find(".likes .avatar")["data-original-title"].should have_content(username)
end
end
Then /^I should see an image in the publisher$/ do
photo_in_publisher.should be_present
end
@ -24,8 +49,53 @@ Then /^I should have (\d+) nsfw posts$/ do |num_posts|
page.should have_css(".nsfw-shield", count: num_posts.to_i)
end
When /^(?:|I )click on "([^"]*)" navbar title$/ do |title|
with_scope(".info-bar") do
find("h5", text: title).click
When /^I prepare the deletion of the first post$/ do
find(".stream .stream-element", match: :first).hover
within(find(".stream .stream-element", match: :first)) do
ctrl = find(".control-icons")
ctrl.hover
ctrl.find(".remove_post").click
end
end
When /^I prepare hiding the first post$/ do
find(".stream .stream-element", match: :first).hover
within(find(".stream .stream-element", match: :first)) do
ctrl = find(".control-icons")
ctrl.hover
ctrl.find(".hide_post").click
end
end
When /^I click to delete the first post$/ do
accept_alert do
step "I prepare the deletion of the first post"
end
expect(find(".stream")).to have_no_css(".stream-element.loaded.deleting")
end
When /^I click to hide the first post$/ do
accept_alert do
step "I prepare hiding the first post"
end
end
When /^I click to delete the first comment$/ do
within("div.comment", match: :first) do
find(".comment_delete", visible: false).click
end
end
Then /^I should not see any posts in my stream$/ do
expect(page).not_to have_selector("#paginate .loader")
expect(page).not_to have_selector(".stream-element .media")
expect(page).to have_selector(".stream-element .no-posts-info")
end
Then /^I should not see any picture in my stream$/ do
expect(page).to have_selector(".photo_area img", count: 0)
end
Then /^I should see (\d+) pictures in my stream$/ do |count|
expect(page).to have_selector(".photo_area img", count: count)
end