-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
feat(launchpad): Directory Upload in Global Mode #18165
feat(launchpad): Directory Upload in Global Mode #18165
Conversation
Thanks for taking the time to open a PR!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, but I have to check it out and run it manually still.
Currently we add a project with the directories path. Technically I don't think it's the biggest deal if we can only select a file because we can chop off the file and send the directory path to the addProject mutation. From a DX perspective it may be a bit confusing on what file the developer is supposed to drag into this field. Does it really matter if we chop off the file from the path? Is it better to go with the cypress.json file for consistency? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments
watch(files, (newVal) => { | ||
const uploadLength = newVal.length; | ||
const latestUpload = newVal[uploadLength - 1] | ||
selectProject(latestUpload) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a null check here (maybe, maybe not?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the selectProject
function is up and running, here we should probably validate that the directory that was dragged in is actually a Cypress project, and go to an error state if it's not.
Though if we don't have that flow in another ticket yet, maybe now's the time to pin down that interaction?
|
||
onMounted(() => { | ||
// TODO: remove this when vue3-file-selector supports setting this attribute | ||
document.querySelector('input[type=file]')?.setAttribute('webkitdirectory', 'webkitdirectory') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to avoid potentially accidentally selecting another file input, we could scope the query to this component with a template ref:
<template>
<div ref="root">
<!-- ... -->
</div>
</template>
<script setup>
const root = ref<HTMLDivElement>()
onMounted(() => {
root.value?.querySelector('input')
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this seems good, done
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
@ImCesar In this situation people will be able to drag in a directory, I edited the PR to use that wording as it was unclear before. The main issue is that currently, using the drag feature, they could also upload any other regular file. During manual upload, they can only pick directories, so it's going to force them to pick the project folder. But I could totally see somebody dragging a cypress.json file in as a 'project'. We might need to explain somewhere that a "project" means "directory containing a cypress.json", or whatever our exact rules are. Or just, if we get a path that's not a directory, check the parent like you suggest. That validation can happen here and get some feedback to the user about why their upload didn't work, though it may go well with the ticket that implements the addProject functionality, since I guess there you are already doing things that would reveal if the path was not a real project. |
Weird, not sure why circle is not running here. Code looks good though. |
* unified-desktop-gui: (48 commits) refactor: remove nexus-decorators, add data context (#18211) fix mountFragment tests fix(unified-desktop-gui branch): initial installation on windows (#18247) fix(unify): fixing icons and supporting router within the shared cypress commands package (#18237) feat(launchpad): improve layout and design (#18238) feat(launchpad): add design tokens from Figma (#18223) fix(unify): appveyor windows issue + better icon types (#18226) fixing broken ct tests fix types remove old code chore: bump deps (#18213) feat(app): icon library supporting Cy's custom icons (#18195) feat(app): adding navigation, pages, router, and layout (#18194) chore: Update Chrome (stable) to 94.0.4606.54 (#18196) fix(launchpad): fix bugs introduced by urql/graphcache (#18193) chore: bump yarn.lock (#18204) feat: add gulp makePackage, begin to scaffold data-context (#18186) feat(launchpad): Directory Upload in Global Mode (#18165) chore(tests): fix flake in net stubbing/xhr/proxy logging tests (#18163) chore: remove nxs.gen.ts - should be created by codegen (#18184) ...
How has the user experience changed?
No visible change. But directory upload is now possible by
How to test
Upload a project folder by dragging it to the drop zone or manually adding it. A hidden
<div>
element with the test idupload-name
should be populated with the name of your project.Additional Information
When dragging, this allows users to drag any file in, not specifically directories. If the manual upload feature is used, this does currently only allow directories. Not sure if that issue for drag is something we want to dig into in this PR. It may be better handled when we add the general handling of uploaded files and go to whatever error state is needed when the upload was not a cypress project.
PR Tasks