Skip to content
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

fix(tests) Try to stabilize vitals snapshots #22696

Merged
merged 2 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import React from 'react';
import styled from '@emotion/styled';

import LoadingMask from 'app/components/loadingMask';

type Props = {
visible: boolean;
};
className?: string;
children?: React.ReactNode;
} & React.HTMLProps<HTMLDivElement>;

const TransparentLoadingMask = styled(LoadingMask)<Props>`
const TransparentLoadingMask = styled(
({className, visible, children, ...props}: Props) => {
const other = visible ? {...props, 'data-test-id': 'loading-placeholder'} : props;
return (
<LoadingMask className={className} {...other}>
{children}
</LoadingMask>
);
}
)<Props>`
Comment on lines +12 to +21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, I hate how noisy this can get when we're mostly just trying to add a prop. Wonder if we should add something like this emotion-js/emotion#821 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is a lot of ceremony for conditionally adding one property.

${p => !p.visible && 'display: none;'};
opacity: 0.4;
z-index: 1;
Expand Down
15 changes: 11 additions & 4 deletions tests/acceptance/test_performance_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def test_transaction_vitals(self, mock_now):
with self.feature(FEATURE_NAMES):
self.browser.get(vitals_path)
self.page.wait_until_loaded()
self.browser.wait_until_not('[data-test-id="stats-loading"]')

self.browser.snapshot("real user monitoring")

Expand All @@ -119,13 +118,20 @@ def test_transaction_vitals_filtering(self, mock_now):

vitals_path = u"/organizations/{}/performance/summary/vitals/?{}".format(
self.org.slug,
urlencode({"transaction": "/country_by_code/", "project": self.project.id}),
urlencode(
{
"transaction": "/country_by_code/",
"project": self.project.id,
"dataFilter": "exclude_outliers",
}
),
)

# Create transactions
for seconds in range(3):
event_data = load_data("transaction", timestamp=before_now(minutes=2))
event_data["contexts"]["trace"]["op"] = "pageload"
event_data["contexts"]["trace"]["id"] = ("c" * 31) + hex(seconds)[2:]
event_data["event_id"] = ("c" * 31) + hex(seconds)[2:]
event_data["measurements"]["fp"]["value"] = seconds * 10
event_data["measurements"]["fcp"]["value"] = seconds * 10
Expand All @@ -137,6 +143,7 @@ def test_transaction_vitals_filtering(self, mock_now):
# add anchor point
event_data = load_data("transaction", timestamp=before_now(minutes=1))
event_data["contexts"]["trace"]["op"] = "pageload"
event_data["contexts"]["trace"]["id"] = "a" * 32
event_data["event_id"] = "a" * 32
event_data["measurements"]["fp"]["value"] = 3000
event_data["measurements"]["fcp"]["value"] = 3000
Expand All @@ -148,6 +155,7 @@ def test_transaction_vitals_filtering(self, mock_now):
# add outlier
event_data = load_data("transaction", timestamp=before_now(minutes=1))
event_data["contexts"]["trace"]["op"] = "pageload"
event_data["contexts"]["trace"]["id"] = "b" * 32
event_data["event_id"] = "b" * 32
event_data["measurements"]["fp"]["value"] = 3000000000
event_data["measurements"]["fcp"]["value"] = 3000000000
Expand All @@ -161,14 +169,13 @@ def test_transaction_vitals_filtering(self, mock_now):
with self.feature(FEATURE_NAMES):
self.browser.get(vitals_path)
self.page.wait_until_loaded()
self.browser.wait_until_not('[data-test-id="stats-loading"]')

self.browser.snapshot("real user monitoring - exclude outliers")

self.browser.element(
xpath="//button//span[contains(text(), 'Exclude Outliers')]"
).click()

self.browser.element(xpath="//li//span[contains(text(), 'View All')]").click()
self.page.wait_until_loaded()

self.browser.snapshot("real user monitoring - view all data")