Skip to content

Commit

Permalink
Remove topNav feature flag modal, fix https/http check (#1460)
Browse files Browse the repository at this point in the history
* Remove topNav feature flag modal, fix https/http check

* Remove top nav modal test

* Remove unused import
  • Loading branch information
Alex-Tideman authored Jun 29, 2023
1 parent 667cd4d commit 5626eab
Show file tree
Hide file tree
Showing 27 changed files with 5 additions and 121 deletions.
2 changes: 0 additions & 2 deletions cypress/integration/banner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import cluster from '../fixtures/cluster.json';
describe('Banner', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.visit('/');
});

Expand Down
1 change: 0 additions & 1 deletion cypress/integration/event-history-empty-states.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const workflowUrl = `/namespaces/default/workflows/${workflowId}/${runId}`;
describe('Workflow Executions List', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.intercept(
Cypress.env('VITE_API_HOST') +
Expand Down
2 changes: 0 additions & 2 deletions cypress/integration/event-history.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const { workflowId, runId } =
describe('Workflow Events', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.intercept(
Cypress.env('VITE_API_HOST') +
Expand Down Expand Up @@ -50,7 +49,6 @@ describe('Workflow Events', () => {

it('default to the summary page when visiting a workflow', () => {
cy.clearLocalStorage();
cy.setTopNavFeatureTag();

cy.visit(`/namespaces/default/workflows/${workflowId}/${runId}`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const { workflowId, runId } = workflow.execution;
describe('Fallback to Ascending Ordering of Event History on Older Versions of Temporal Server', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.intercept(
Cypress.env('VITE_API_HOST') +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const { workflowId, runId } = workflow.execution;
describe('Fallback to Ascending Ordering of Event History on Older Versions of Temporal Server', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.intercept(
Cypress.env('VITE_API_HOST') +
Expand Down
1 change: 0 additions & 1 deletion cypress/integration/namespace.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
describe('Namespace page', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.visit('/namespaces/default');

Expand Down
3 changes: 0 additions & 3 deletions cypress/integration/namespaces.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const namespaces = ['default', 'some-other-namespace'];
describe('Namespaces page', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.visit('/namespaces');

Expand All @@ -28,7 +27,6 @@ describe('Namespaces page', () => {
describe('Namespaces button', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.visit('/namespaces/default/workflows');

Expand Down Expand Up @@ -57,7 +55,6 @@ describe('Namespaces button', () => {
describe('Namespace Select', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.visit('/namespaces/default/workflows');

Expand Down
1 change: 0 additions & 1 deletion cypress/integration/query.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const { workflowId, runId } =
describe('Query', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.intercept(
Cypress.env('VITE_API_HOST') +
Expand Down
4 changes: 0 additions & 4 deletions cypress/integration/schedules.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const {
describe('Schedules List', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.visit('/namespaces/default/schedules');

Expand All @@ -30,7 +29,6 @@ describe('Schedules List', () => {
describe('Schedules View', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.visit('/namespaces/default/schedules');

Expand Down Expand Up @@ -58,7 +56,6 @@ describe('Schedules View', () => {
describe('Schedules Edit', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.visit('/namespaces/default/schedules');

Expand Down Expand Up @@ -91,7 +88,6 @@ describe('Schedules Edit', () => {
describe('Schedules Create', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.visit('/namespaces/default/schedules');

Expand Down
1 change: 0 additions & 1 deletion cypress/integration/task-queues.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import atq from '../fixtures/activity-task-queues.json';
describe('Task Queues Page', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.visit(`/namespaces/default/task-queues/a-task-queue`);

Expand Down
4 changes: 0 additions & 4 deletions cypress/integration/workers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const { name } = workflowCompletedFixture.executionConfig.taskQueue;
describe('Workflow Workers', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.intercept(
Cypress.env('VITE_API_HOST') +
Expand Down Expand Up @@ -48,7 +47,6 @@ describe('Workflow Workers', () => {
describe.skip('Navigate to Workflow Workers', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.intercept(
Cypress.env('VITE_API_HOST') +
Expand Down Expand Up @@ -112,7 +110,6 @@ describe.skip('Navigate to Workflow Workers', () => {
describe('Workflow Workers - Workflow Worker Only', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.intercept(
Cypress.env('VITE_API_HOST') +
Expand Down Expand Up @@ -157,7 +154,6 @@ describe('Workflow Workers - Workflow Worker Only', () => {
describe('Workflow Workers - Activity Worker Only', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.intercept(
Cypress.env('VITE_API_HOST') +
Expand Down
2 changes: 0 additions & 2 deletions cypress/integration/workflow-actions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const { workflowId, runId } =
describe('Workflow Actions', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.intercept(
Cypress.env('VITE_API_HOST') +
Expand Down Expand Up @@ -115,7 +114,6 @@ describe('Workflow Actions', () => {
describe('Write Actions Disabled', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();
cy.intercept(Cypress.env('VITE_API_HOST') + `/api/v1/settings?`, {
fixture: 'settings.write-actions-disabled.json',
}).as('settings-api');
Expand Down
1 change: 0 additions & 1 deletion cypress/integration/workflow-executions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const statuses = [
describe('Workflow Executions List', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();
cy.visit('/namespaces/default/workflows');

cy.wait('@workflows-api');
Expand Down
1 change: 0 additions & 1 deletion cypress/integration/workflow-input-and-results.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const { workflowId, runId } = workflow.execution;
describe('Workflow Input and Results', () => {
beforeEach(() => {
cy.interceptApi();
cy.setTopNavFeatureTag();

cy.intercept(
Cypress.env('VITE_API_HOST') +
Expand Down
9 changes: 0 additions & 9 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,3 @@ Cypress.Commands.add(
cy.interceptResetWorkflowApi();
},
);

Cypress.Commands.add('setTopNavFeatureTag', () => {
cy.window().then((window) => {
window.localStorage.setItem(
'viewedFeatureTags',
JSON.stringify(['topNav']),
);
});
});
44 changes: 0 additions & 44 deletions src/lib/holocene/main-content-container.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<script lang="ts">
import Icon from '$lib/holocene/icon/icon.svelte';
import Modal from '$lib/holocene/modal.svelte';
import ScrollToTop from '$lib/holocene/scroll-to-top.svelte';
import { viewedFeatureTags, viewFeature } from '$lib/stores/new-feature-tags';
import { onMount } from 'svelte';
let overlayModal: Modal;
let scrollToTopHidden = true;
let showScrollToTopOn = 150; // pixels
Expand All @@ -22,18 +17,6 @@
const top = scrollEvent.scrollTop;
scrollToTopHidden = Boolean(top < showScrollToTopOn);
}
onMount(() => {
const viewed = $viewedFeatureTags?.includes('topNav');
if (!viewed) {
overlayModal.open();
viewFeature('topNav');
}
});
const onClose = () => {
overlayModal.close();
};
</script>

<main
Expand All @@ -44,30 +27,3 @@
<slot />
<ScrollToTop hidden={scrollToTopHidden} {onScrollToTopClick} />
</main>

<Modal
bind:this={overlayModal}
id="overlay-modal"
data-testid="overlay-modal"
cancelText="Got it!"
on:cancelModal={onClose}
on:confirmModal={onClose}
hideConfirm
large
hightlightNav
>
<h1 slot="title" data-testid="overlay-title">
Check out the new top navigation!
</h1>
<div slot="content" class="flex flex-col gap-4">
<div class="flex gap-4 text-base">
<div><Icon name="namespace-switcher" class="scale-100" /></div>
Easily switch between Namespaces and know which Namespace you are currently
on.
</div>
<div class="flex gap-4 text-base">
<Icon name="transcoder-on" status="configured" />
Set your Codec Server settings and view its status.
</div>
</div>
</Modal>
4 changes: 2 additions & 2 deletions src/lib/utilities/is-http.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const validateHttps = (endpoint: string): boolean => {
return endpoint.substring(0, 8) === 'https://';
return endpoint?.substring(0, 8) === 'https://';
};

export const validateHttp = (endpoint: string): boolean => {
return endpoint.substring(0, 7) === 'http://';
return endpoint?.substring(0, 7) === 'http://';
};

export const validateHttpOrHttps = (endpoint: string): boolean => {
Expand Down
4 changes: 1 addition & 3 deletions static/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,5 @@
"date-and-time": "Date & Time",
"event": "Event",
"collapse-all": "Collapse All",
"expand-all": "Expand All",
"unlimited": "Unlimited",
"no-expiration": "No Expiration"
"expand-all": "Expand All"
}
2 changes: 0 additions & 2 deletions tests/accessibility/empty-states.accessibility.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';
import { setLocalStorage } from '$utilities/mock-local-storage';

test.beforeEach(async ({ page }) => {
await page.routeFromHAR(
Expand All @@ -13,7 +12,6 @@ test.beforeEach(async ({ page }) => {
url: '**/api/v1/**',
},
);
await setLocalStorage('viewedFeatureTags', JSON.stringify(['topNav']), page);
});

const pages = [
Expand Down
1 change: 0 additions & 1 deletion tests/accessibility/with-schedules.accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ test.beforeEach(async ({ page }) => {
url: '**/api/v1/**',
},
);
await setLocalStorage('viewedFeatureTags', JSON.stringify(['topNav']), page);
});

const pages = [
Expand Down
1 change: 0 additions & 1 deletion tests/accessibility/with-workflows.accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ test.beforeEach(async ({ page }) => {
url: '**/api/v1/**',
},
);
await setLocalStorage('viewedFeatureTags', JSON.stringify(['topNav']), page);
});

const workflowId =
Expand Down
7 changes: 1 addition & 6 deletions tests/e2e/storageState.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
"origins": [
{
"origin": "http://localhost:3000",
"localStorage": [
{
"name": "viewedFeatureTags",
"value": "[\"topNav\"]"
}
]
"localStorage": []
}
]
}
1 change: 0 additions & 1 deletion tests/global-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ async function globalSetup(config: FullConfig) {
}

await page.goto(baseURL);
await setLocalStorage('viewedFeatureTags', JSON.stringify(['topNav']), page);

await page
.context()
Expand Down
7 changes: 1 addition & 6 deletions tests/integration/storageState.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
"origins": [
{
"origin": "http://localhost:3333",
"localStorage": [
{
"name": "viewedFeatureTags",
"value": "[\"topNav\"]"
}
]
"localStorage": []
}
]
}
17 changes: 0 additions & 17 deletions tests/integration/workflow-navigation.spec.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
import { test, expect } from '@playwright/test';
import { mockWorkflowsApis } from '~/test-utilities/mock-apis';
import { setLocalStorage } from '~/test-utilities/mock-local-storage';

test.beforeEach(async ({ page, baseURL }) => {
await page.goto(baseURL);
await mockWorkflowsApis(page);
});

test('New Top Navigation modal overlay is present', async ({ page }) => {
await setLocalStorage('viewedFeatureTags', JSON.stringify([]), page);
await expect(page.getByTestId('overlay-modal')).toBeVisible();
await expect(page.getByTestId('overlay-title')).toBeVisible();
await expect(page.getByTestId('overlay-title')).toHaveText(
'Check out the new top navigation!',
);
await expect(
page.getByRole('button', { name: 'Got it!' }).first(),
).toBeVisible();
await page.getByRole('button', { name: 'Got it!' }).first().click();

await expect(page.getByTestId('overlay-modal')).toBeHidden();
});

test('Top Navigation current namespace is present', async ({ page }) => {
await expect(page.getByTestId('namespace-select-button')).toBeVisible();
await page.getByTestId('namespace-select-button').click();
Expand Down Expand Up @@ -76,7 +60,6 @@ test('Top Navigation current namespace is present and has other namespaces to se
test('Top Navigation current namespace is not present on non-namespace specific pages', async ({
page,
}) => {
await setLocalStorage('viewedFeatureTags', JSON.stringify(['topNav']), page);
await expect(page.getByTestId('namespace-select-button')).toBeVisible();

await page.getByRole('link', { name: 'Namespaces' }).click();
Expand Down
Loading

1 comment on commit 5626eab

@vercel
Copy link

@vercel vercel bot commented on 5626eab Jun 29, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

holocene – ./

holocene.preview.thundergun.io
holocene-git-main.preview.thundergun.io

Please sign in to comment.