Flaky Spec Fix:Remove js:true From Local Timestamp Checks and js Fix attempt code (#11087)

This commit is contained in:
Molly Struve 2020-10-26 11:20:51 -04:00 committed by GitHub
parent 97affe5571
commit dbfed77f37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 18 deletions

View file

@ -1,10 +0,0 @@
<% if Rails.env.test? %>
//= require timemachine.js
// Ensure that locale time in JavaScript matches the Timezone on
// our server during testing
timemachine.config({
dateString: '<%= Time.current.iso8601 %>',
tick: true
});
<% end %>

View file

@ -129,7 +129,6 @@
"sass-loader": "^10.0.3",
"style-loader": "^2.0.0",
"svgo": "1.3.2",
"timemachine": "^0.3.2",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {

View file

@ -27,7 +27,11 @@ RSpec.describe "Views an article", type: :system do
end
describe "when showing the date" do
it "shows the readable publish date", js: true do
# TODO: @sre ideally this spec should have js:true enabled since we use
# js helpers to ensure the datetime is locale. However, testing locale
# datetimes has proven to be very flaky which is why the js is not included
# here
it "shows the readable publish date" do
visit article.path
expect(page).to have_selector("article time", text: article.readable_publish_date)
end
@ -51,7 +55,11 @@ RSpec.describe "Views an article", type: :system do
end
end
it "shows the identical readable publish dates in each page", js: true do
# TODO: @sre ideally this spec should have js:true enabled since we use
# js helpers to ensure the datetime is locale. However, testing locale
# datetimes has proven to be very flaky which is why the js is not included
# here
it "shows the identical readable publish dates in each page" do
visit first_article.path
expect(page).to have_selector("article time", text: first_article.readable_publish_date)
expect(page).to have_selector(".crayons-card--secondary time", text: first_article.readable_publish_date)

View file

@ -17240,11 +17240,6 @@ thunky@^1.0.2:
resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d"
integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==
timemachine@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/timemachine/-/timemachine-0.3.2.tgz#83c594d0271c3608d5fab13636cd3b7c979ea2c5"
integrity sha512-JNKeKZXQJc8UC19JcIq0XziBud+fNNJfatZ57lwk+o1O9mpW2FmzWvRw7FTTOKuN6M0zsjGIlNi0O0QrF5WVRA==
timers-browserify@^2.0.4:
version "2.0.11"
resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.11.tgz#800b1f3eee272e5bc53ee465a04d0e804c31211f"