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: add back 'Done' text on the button #3487

Merged
merged 1 commit into from Aug 10, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions packages/renderer/src/lib/kube/KubePlayYAML.spec.ts
Expand Up @@ -140,3 +140,33 @@ test('error: When pressing the Play button, expect us to show the errors to the
const error = screen.getByText('The following pods were created but failed to start: error 1, error 2');
expect(error).toBeInTheDocument();
});

test('expect done button is there at the end', async () => {
(window as any).playKube = vi.fn().mockResolvedValue({
Pods: [],
});

// Render the component
setup();
render(KubePlayYAML, {});

// Simulate selecting a file
const fileInput = screen.getByRole('textbox', { name: 'Kubernetes YAML file' });
expect(fileInput).toBeInTheDocument();
await userEvent.click(fileInput);

// Simulate selecting a runtime
const runtimeOption = screen.getByText('Using a Podman container engine');
expect(runtimeOption).toBeInTheDocument();

// Simulate clicking the "Play" button
const playButton = screen.getByRole('button', { name: 'Play' });
expect(playButton).toBeInTheDocument();
await userEvent.click(playButton);

// search the done button
const doneButton = screen.getByRole('button', { name: 'Done' });
expect(doneButton).toBeInTheDocument();
// check that text value is also 'Done'
expect(doneButton).toHaveTextContent('Done');
});
2 changes: 1 addition & 1 deletion packages/renderer/src/lib/kube/KubePlayYAML.svelte
Expand Up @@ -318,7 +318,7 @@ async function getKubernetesfileLocation() {
{/if}

{#if runFinished}
<Button on:click="{() => goBackToHistory()}" class="pt-4 w-full" title="Done" type="primary" />
<Button on:click="{() => goBackToHistory()}" class="pt-4 w-full">Done</Button>
{/if}
</div>
</div>
Expand Down