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

start with empty route - fixes #1093 #1114

Merged
merged 5 commits into from
May 28, 2024
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
Expand Up @@ -15,6 +15,7 @@ describe('Test for Multi route actions from the canvas', () => {
it('User shows and hides a route', () => {
cy.addNewRoute();
cy.addNewRoute();
cy.addNewRoute();

cy.get('[data-testid="flows-list-route-count"]').should('have.text', '1/3');

Expand Down Expand Up @@ -59,6 +60,7 @@ describe('Test for Multi route actions from the canvas', () => {
cy.openDesignPage();
cy.addNewRoute();
cy.addNewRoute();
cy.addNewRoute();
cy.showAllRoutes();

cy.get('[data-testid="flows-list-route-count"]').should('have.text', '3/3');
Expand Down Expand Up @@ -94,7 +96,6 @@ describe('Test for Multi route actions from the canvas', () => {

it('User creates multiple CamelRoute type routes in canvas', () => {
// Camel Route is set as default type - simply add new routes
cy.deleteRoute(0);
cy.addNewRoute();
cy.addNewRoute();
cy.addNewRoute();
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-tests/cypress/support/next-commands/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Cypress.Commands.add('openHomePage', () => {
cy.get('[data-testid="loading-catalogs"]').should('be.visible');
cy.get('[data-testid="loading-catalogs"]').should('not.exist');

cy.get('[data-kind="graph"]').should('exist');
cy.get('[data-testid="visualization-empty-state"]').should('exist');
// Wait for the element to become visible
cy.get('[data-kind="graph"]').should('be.visible');
cy.get('[data-testid="visualization-empty-state"]').should('be.visible');
});

Cypress.Commands.add('expandVisualization', () => {
Expand All @@ -25,7 +25,7 @@ Cypress.Commands.add('expandVisualization', () => {
Cypress.Commands.add('openDesignPage', () => {
cy.expandVisualization();
cy.get('[data-testid="Design"]').click();
cy.get('[data-test-id="topology"]').should('be.visible');
cy.get('.pf-topology-container').should('be.visible');
});

Cypress.Commands.add('openSourceCode', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ exports[`Canvas Empty state should render empty state when there is no visual en
<button
aria-expanded="false"
class="pf-v5-c-menu-toggle__button"
data-testid="dsl-list-dropdown"
data-testid="viz-dsl-list-dropdown"
type="button"
>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const FlowTypeSelectorWithContext: React.FunctionComponent<{ currentSchemaType?:
describe('FlowTypeSelector.tsx', () => {
test('component renders', () => {
const wrapper = render(<FlowTypeSelectorWithContext />);
const toggle = wrapper.queryByTestId('dsl-list-dropdown');
const toggle = wrapper.queryByTestId('viz-dsl-list-dropdown');
expect(toggle).toBeInTheDocument();
});

Expand Down Expand Up @@ -70,7 +70,7 @@ describe('FlowTypeSelector.tsx', () => {

test('should toggle list of DSLs', async () => {
const wrapper = render(<FlowTypeSelectorWithContext />);
const toggle = await wrapper.findByTestId('dsl-list-dropdown');
const toggle = await wrapper.findByTestId('viz-dsl-list-dropdown');

/** Open Select */
act(() => {
Expand All @@ -90,7 +90,7 @@ describe('FlowTypeSelector.tsx', () => {

test('should show list of DSLs', async () => {
const wrapper = render(<FlowTypeSelectorWithContext />);
const toggle = await wrapper.findByTestId('dsl-list-dropdown');
const toggle = await wrapper.findByTestId('viz-dsl-list-dropdown');

/** Open Select */
act(() => {
Expand All @@ -103,7 +103,7 @@ describe('FlowTypeSelector.tsx', () => {

test('should disable a SelectOption if is already selected and does not support multiple flows', async () => {
const wrapper = render(<FlowTypeSelectorWithContext currentSchemaType={SourceSchemaType.Pipe} />);
const toggle = await wrapper.findByTestId('dsl-list-dropdown');
const toggle = await wrapper.findByTestId('viz-dsl-list-dropdown');

/** Open Select */
act(() => {
Expand All @@ -119,7 +119,7 @@ describe('FlowTypeSelector.tsx', () => {

test('should show selected value', async () => {
const wrapper = render(<FlowTypeSelectorWithContext />);
const toggle = await wrapper.findByTestId('dsl-list-dropdown');
const toggle = await wrapper.findByTestId('viz-dsl-list-dropdown');

/** Open Select */
act(() => {
Expand All @@ -144,7 +144,7 @@ describe('FlowTypeSelector.tsx', () => {

test('should not have anything selected if "isStatic=true"', async () => {
const wrapper = render(<FlowTypeSelectorWithContext />);
const toggle = await wrapper.findByTestId('dsl-list-dropdown');
const toggle = await wrapper.findByTestId('viz-dsl-list-dropdown');

/** Open Select */
act(() => {
Expand All @@ -170,7 +170,7 @@ describe('FlowTypeSelector.tsx', () => {

test('should have selected DSL if provided', async () => {
const wrapper = render(<FlowTypeSelectorWithContext />);
const toggle = await wrapper.findByTestId('dsl-list-dropdown');
const toggle = await wrapper.findByTestId('viz-dsl-list-dropdown');

/** Open Select */
act(() => {
Expand All @@ -186,7 +186,7 @@ describe('FlowTypeSelector.tsx', () => {

test('should close Select when pressing ESC', async () => {
const wrapper = render(<FlowTypeSelectorWithContext />);
const toggle = await wrapper.findByTestId('dsl-list-dropdown');
const toggle = await wrapper.findByTestId('viz-dsl-list-dropdown');

/** Open Select */
act(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const FlowTypeSelector: FunctionComponent<ISourceTypeSelector> = (props)

const toggle = (toggleRef: Ref<MenuToggleElement>) => (
<MenuToggle
data-testid="dsl-list-dropdown"
data-testid="viz-dsl-list-dropdown"
ref={toggleRef}
onClick={onToggleClick}
isExpanded={isOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('NewFlow.tsx', () => {

it('should render all of the types', async () => {
const wrapper = renderWithContext();
const trigger = await wrapper.findByTestId('dsl-list-dropdown');
const trigger = await wrapper.findByTestId('viz-dsl-list-dropdown');

/** Open Select */
act(() => {
Expand All @@ -69,7 +69,7 @@ describe('NewFlow.tsx', () => {

it('should warn the user when adding a different type of flow', async () => {
const wrapper = renderWithContext();
const trigger = await wrapper.findByTestId('dsl-list-dropdown');
const trigger = await wrapper.findByTestId('viz-dsl-list-dropdown');

/** Open Select */
act(() => {
Expand Down
3 changes: 1 addition & 2 deletions packages/ui/src/layout/Shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { FunctionComponent, PropsWithChildren, useCallback, useContext, useEffec
import { useLocalStorage } from '../hooks/local-storage.hook';
import { LocalStorageKeys } from '../models';
import { SourceCodeApiContext } from '../providers/source-code.provider';
import { camelRouteYaml } from '../stubs/camel-route';
import { EventNotifier } from '../utils/event-notifier';
import { Navigation } from './Navigation';
import './Shell.scss';
Expand All @@ -24,7 +23,7 @@ export const Shell: FunctionComponent<PropsWithChildren> = (props) => {
* as we just want to set the initial values
*/
useEffect(() => {
const localSourceCode = localStorage.getItem(LocalStorageKeys.SourceCode) ?? camelRouteYaml;
const localSourceCode = localStorage.getItem(LocalStorageKeys.SourceCode) ?? '[]';
sourceCodeApiContext.setCodeAndNotify(localSourceCode);
}, [sourceCodeApiContext]);

Expand Down
Loading