debian-mirror-gitlab/spec/features/dashboard/datetime_on_tooltips_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.6 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-04-23 21:23:45 +05:30
RSpec.describe 'Tooltips on .timeago dates', :js, feature_category: :user_profile do
2020-11-24 15:15:51 +05:30
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, name: 'test', namespace: user.namespace) }
2021-09-30 23:02:18 +05:30
2020-11-24 15:15:51 +05:30
let(:created_date) { 1.day.ago.beginning_of_minute - 1.hour }
before_all do
project.add_maintainer(user)
end
2023-04-23 21:23:45 +05:30
before do
stub_feature_flags(profile_tabs_vue: false)
end
context 'on the activity tab' do
before do
2023-01-13 00:05:48 +05:30
Event.create!(project: project, author_id: user.id, action: :joined,
updated_at: created_date, created_at: created_date)
2017-09-10 17:25:29 +05:30
sign_in user
2018-12-05 23:21:45 +05:30
visit user_activity_path(user)
2019-03-02 22:35:43 +05:30
wait_for_requests
end
it 'has the datetime formated correctly' do
2020-11-24 15:15:51 +05:30
expect(page).to have_selector('.js-timeago', text: '1 day ago')
page.find('.js-timeago').hover
expect(datetime_in_tooltip).to eq(created_date)
end
end
context 'on the snippets tab' do
before do
create(:snippet, author: user, updated_at: created_date, created_at: created_date)
2017-09-10 17:25:29 +05:30
sign_in user
visit user_snippets_path(user)
2019-03-02 22:35:43 +05:30
wait_for_requests
end
2023-04-23 21:23:45 +05:30
it 'has the datetime formated correctly', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/334481' do
2022-11-25 23:54:43 +05:30
expect(page).to have_selector('[data-testid=snippet-created-at] .js-timeago', text: '1 day ago')
2020-11-24 15:15:51 +05:30
2022-11-25 23:54:43 +05:30
page.find('[data-testid=snippet-created-at] .js-timeago').hover
2020-11-24 15:15:51 +05:30
expect(datetime_in_tooltip).to eq(created_date)
end
end
2020-11-24 15:15:51 +05:30
def datetime_in_tooltip
2021-01-29 00:20:46 +05:30
datetime_text = page.find('.tooltip').text
2020-11-24 15:15:51 +05:30
DateTime.parse(datetime_text)
end
end