Skip to content

feat: Implement basic e2e scenario #7199

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

Closed
wants to merge 21 commits into from
Prev Previous commit
Next Next commit
Merge branch 'main' into 7154-basic-test-scenario
  • Loading branch information
mtojek committed Apr 28, 2023
commit b09d9ebd0ebe05bc5fbb7a059939591d7b8b9718
2 changes: 1 addition & 1 deletion site/e2e/pom/CreateTemplatePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class CreateTemplatePage extends BasePom {

async submitForm() {
await this.createTemplateForm
.getByTestId("form-template-upload")
.getByTestId("file-upload")
.setInputFiles("./e2e/testdata/docker.tar")
await this.createTemplateForm.getByLabel("Name *").fill("my-first-template")
await this.createTemplateForm
Expand Down
1 change: 1 addition & 0 deletions site/src/components/FileUpload/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export const FileUpload: FC<FileUploadProps> = ({
ref={inputRef}
className={styles.input}
accept={extension}
data-testid="file-upload"
onChange={(event) => {
const file = event.currentTarget.files?.[0]
if (file) {
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Resources/AgentVersion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const AgentVersion: FC<{
const { outdated } = getDisplayVersionStatus(agent.version, serverVersion)

if (!outdated) {
return <span data-testid="agent-version">{displayVersion}</span>
return <span data-testid="agent-version">Updated</span>
}

return (
Expand Down
53 changes: 7 additions & 46 deletions site/src/pages/CreateTemplatePage/TemplateUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,52 +21,13 @@ export const TemplateUpload: FC<TemplateUploadProps> = ({

const description = (
<>
<div
className={combineClasses({
[styles.root]: true,
[styles.disabled]: isUploading,
})}
{...clickable}
{...tarDrop}
>
<Stack alignItems="center" spacing={1}>
{isUploading ? (
<CircularProgress size={32} />
) : (
<UploadIcon className={styles.icon} />
)}

<Stack alignItems="center" spacing={0.5}>
<span className={styles.title}>{t("form.upload.title")}</span>
<span className={styles.description}>
The template has to be a .tar file. You can also use our{" "}
<Link
component={RouterLink}
to="/starter-templates"
// Prevent trigger the upload
onClick={(e) => {
e.stopPropagation()
}}
>
starter templates
</Link>{" "}
to getting started with Coder.
</span>
</Stack>
</Stack>
</div>

<input
type="file"
ref={inputRef}
className={styles.input}
accept=".tar"
data-testid="form-template-upload"
onChange={(event) => {
const file = event.currentTarget.files?.[0]
if (file) {
onUpload(file)
}
The template has to be a .tar file. You can also use our{" "}
<Link
component={RouterLink}
to="/starter-templates"
// Prevent trigger the upload
onClick={(e) => {
e.stopPropagation()
}}
>
starter templates
Expand Down
66 changes: 66 additions & 0 deletions site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,76 @@ export const CreateWorkspacePageView: FC<

return (
<FullPageHorizontalForm title="New workspace" onCancel={props.onCancel}>
<<<<<<< HEAD
<HorizontalForm
onSubmit={form.handleSubmit}
data-testid="form-create-workspace"
>
=======
<HorizontalForm onSubmit={form.handleSubmit}>
{Boolean(props.hasTemplateErrors) && (
<Stack>
{Boolean(
props.createWorkspaceErrors[
CreateWorkspaceErrors.GET_TEMPLATES_ERROR
],
) && (
<AlertBanner
severity="error"
error={
props.createWorkspaceErrors[
CreateWorkspaceErrors.GET_TEMPLATES_ERROR
]
}
/>
)}
{Boolean(
props.createWorkspaceErrors[
CreateWorkspaceErrors.GET_TEMPLATE_SCHEMA_ERROR
],
) && (
<AlertBanner
severity="error"
error={
props.createWorkspaceErrors[
CreateWorkspaceErrors.GET_TEMPLATE_SCHEMA_ERROR
]
}
/>
)}
{Boolean(
props.createWorkspaceErrors[
CreateWorkspaceErrors.GET_TEMPLATE_GITAUTH_ERROR
],
) && (
<AlertBanner
severity="error"
error={
props.createWorkspaceErrors[
CreateWorkspaceErrors.GET_TEMPLATE_GITAUTH_ERROR
]
}
/>
)}
</Stack>
)}

{Boolean(
props.createWorkspaceErrors[
CreateWorkspaceErrors.CREATE_WORKSPACE_ERROR
],
) && (
<AlertBanner
severity="error"
error={
props.createWorkspaceErrors[
CreateWorkspaceErrors.CREATE_WORKSPACE_ERROR
]
}
/>
)}

>>>>>>> main
{/* General info */}
<FormSection
title="General info"
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.