Skip to content

Commit

Permalink
Hide it under showFeaturesLagging
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleJu committed Dec 19, 2024
1 parent 91c1655 commit 86c4021
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
19 changes: 17 additions & 2 deletions e2e/tests/stats-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,26 @@ test.beforeEach(async ({page}) => {
});

test('matches the screenshot', async ({page}) => {
await page.goto('http://localhost:5555/stats');
await page.goto('http://localhost:5555/stats?');

// Wait for the chart container to exist
// Wait for the chart container to exist.
await page.waitForSelector('#global-feature-support-chart-container');

const pageContainer = page.locator('.page-container');
await expect(pageContainer).toHaveScreenshot();
});

test('matches the screenshot with missing one implementation chart', async ({
page,
}) => {
await page.goto('http://localhost:5555/stats?show_features_lagging=true');

// Wait for the global feature support chart container to exist.
await page.waitForSelector('#global-feature-support-chart-container');

// Wait for the missing one implementatoin chart container to exist.
await page.waitForSelector('#features-lagging');

const pageContainer = page.locator('.page-container');
await expect(pageContainer).toHaveScreenshot();
});
14 changes: 12 additions & 2 deletions frontend/src/static/js/components/webstatus-stats-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@

import {consume} from '@lit/context';
import {Task} from '@lit/task';
import {LitElement, type TemplateResult, html, CSSResultGroup, css} from 'lit';
import {
LitElement,
type TemplateResult,
html,
CSSResultGroup,
css,
nothing,
} from 'lit';
import {customElement, state} from 'lit/decorators.js';
import {SHARED_STYLES} from '../css/shared-css.js';
import {SlMenu, SlMenuItem} from '@shoelace-style/shoelace/dist/shoelace.js';
Expand All @@ -29,6 +36,7 @@ import {
type BrowserReleaseFeatureMetric,
} from '../api/client.js';
import {apiClientContext} from '../contexts/api-client-context.js';
import {getFeaturesLaggingFlag} from '../utils/urls.js';

import './webstatus-gchart';
import {WebStatusDataObj} from './webstatus-gchart.js';
Expand Down Expand Up @@ -528,7 +536,9 @@ export class StatsPage extends LitElement {
return html`
<div class="vbox">
${this.renderTitleAndControls()} ${this.renderGlobalFeatureSupport()}
${this.renderFeaturesLagging()}
${getFeaturesLaggingFlag(window.location)
? this.renderFeaturesLagging()
: nothing}
<div class="hbox">
${this.renderBaselineFeatures()} ${this.renderTimeToAvailability()}
</div>
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/static/js/utils/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export function getWPTMetricView(location: {search: string}): string {
return getQueryParam(location.search, 'wpt_metric_view');
}

export function getFeaturesLaggingFlag(location: {search: string}): boolean {
return Boolean(getQueryParam(location.search, 'show_features_lagging'));
}

export interface DateRange {
start?: Date;
end?: Date;
Expand Down

0 comments on commit 86c4021

Please sign in to comment.