Skip to content
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
2 changes: 2 additions & 0 deletions .github/workflows/devs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
NEXT_PUBLIC_APP_ENV=TEST
DCUP_PARSER=http://localhost:9000
NEXTAUTH_URL=http://localhost:3000
DROPBOX_CLIENT_ID=xxxxxxx
DROPBOX_CLIENT_SECRET=xxxxx
REDIS_DB_ADDRESS=localhost
REDIS_DB_PORT=6379
REDIS_DB_PASSWORD=
Expand Down
1 change: 0 additions & 1 deletion DataSource/Dropbox/setDropboxConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { connections } from "@/db/schemas/connections";
import { eq } from "drizzle-orm";
import { connectionConfig } from "../utils";


export const setDropboxConnection = async (formData: FormData) => {
const config = connectionConfig.safeParse({
connectionId: formData.get("connectionId"),
Expand Down
2 changes: 1 addition & 1 deletion app/api/connections/dropbox/callback/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ export async function GET(request: Request) {
}
return NextResponse.redirect(`${process.env.NEXTAUTH_URL}/connections`);
} catch (error) {
return NextResponse.json({ error: 'Failed to authenticate' }, { status: 500 });
return NextResponse.json({ error: 'Failed to authenticate' }, { status: 401 });
}
}
10 changes: 5 additions & 5 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ export const metadata: Metadata = {
};

if (process.env.NEXT_PUBLIC_APP_ENV === 'TEST') {
if (!(global as any).__MSW_SERVER_STARTED__) {
console.log('🔧 MSW mock server starting...');
mockServer.listen();
(global as any).__MSW_SERVER_STARTED__ = true;
}
console.log('🔧🔧🔧 MSW mock server starting...🔧🔧🔧');
mockServer.listen({
onUnhandledRequest: 'bypass',
});
(global as any).__MSW_SERVER_STARTED__ = true;
}

export default async function Layout({ children }: { children: ReactNode }) {
Expand Down
18 changes: 13 additions & 5 deletions components/ConfigConnection/ConfigConnection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type ConnectionProps = {
export const ConfigConnection = ({ connection, directory, status, open, setOpen, showPicker }: ConnectionProps) => {
const [isConfigSet, setIsConfigSet] = useState(connection.isConfigSet)
const [pending, startTransition] = useTransition()
const isTest = process.env.NEXT_PUBLIC_APP_ENV === 'TEST'

// Service-specific text configuration
const serviceLabels = {
Expand All @@ -55,9 +56,15 @@ export const ConfigConnection = ({ connection, directory, status, open, setOpen,

const handleSetConfig = (data: FormData) => {
data.set("connectionId", connection.id)
data.set("folderName", directory.name)
data.set("service", connection.service)

if (directory?.id) data.set("folderId", directory.id)
if (isTest) {
const folderName = data.get("folderName")
data.set("folderId", folderName || "")
} else {
data.set("folderName", directory.name)
}
startTransition(async () => {
const setConfig = async () => {
try {
Expand Down Expand Up @@ -121,11 +128,12 @@ export const ConfigConnection = ({ connection, directory, status, open, setOpen,
<label className="block text-sm font-medium">Folder</label>
<div className="flex items-center gap-2">
<Input
value={directory?.name || connection.folderName || ""}
name='folderName'
value={isTest ? undefined : directory?.name || connection.folderName || ""}
placeholder={getServiceLabel('placeholder')}
disabled={connection.isSyncing || connection.isConfigSet}
onClick={showPicker} type='button'
readOnly
onClick={isTest ? undefined : showPicker}
type={isTest ? 'text' : 'button'}
readOnly={!isTest}
/>
<Button onClick={showPicker} type="button" disabled={connection.isSyncing || connection.isConfigSet} >
{getServiceLabel('selectButton')}
Expand Down
6 changes: 3 additions & 3 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const qdrant_collection_name = "documents"
const qdrantCLient = new QdrantClient({ url: process.env.QDRANT_DB_URL!, apiKey: process.env.QDRANT_DB_KEY });

export default defineConfig({
retries: {
runMode: 2,
openMode: 0
retries: {
runMode: 3,
openMode: 0
},
chromeWebSecurity: false,
watchForFileChanges: false,
Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/connections.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { connections } from "@/db/schemas/connections"

describe.skip('connect to google drive', () => {
describe('connect to google drive', () => {
const fakeUser = {
name: "test man",
email: "tester@dcup.dev",
Expand All @@ -10,9 +10,9 @@ describe.skip('connect to google drive', () => {
}

beforeEach(() => {
// login
cy.visit('/')
cy.wait(1000)
cy.task("createCollection")

// login
cy.loginNextAuth(fakeUser)
Expand Down Expand Up @@ -42,6 +42,7 @@ describe.skip('connect to google drive', () => {

afterEach(() => {
cy.task('deleteUser', { email: fakeUser.email })
cy.task("deleteCollection")
})


Expand Down
5 changes: 2 additions & 3 deletions cypress/e2e/directUpload.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,8 @@ describe("Direct Upload UI", () => {
cy.get('[data-test="folderName"]').should('contain.text', "*")
cy.get('[data-test="processedFile"]').should('contain.text', 1)
cy.get('[data-test="processedPage"]').should('contain.text', 2)

// remove the only pdf file
// with 3 pages and now we have space it should processed smail one

// remove the only stored pdf file
cy.get('[data-test="btn-config"]')
.click()

Expand Down
Loading