Skip to content

Commit

Permalink
Merge branch 'RevampedItinerary' of https://github.com/COS301-SE-2024…
Browse files Browse the repository at this point in the history
…/AI-Trip-Creator into feature/ChangesToRevampedItinerary
  • Loading branch information
Rampa47 committed Oct 8, 2024
2 parents bfc2998 + f226092 commit 1303264
Show file tree
Hide file tree
Showing 28 changed files with 4,487 additions and 1,453 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ on:
push:
branches: [main, develop]

env:
CI: false
REACT_APP_OPEN_AI_KEY : ${{ secrets.REACT_APP_OPEN_AI_KEY }}
REACT_APP_FIREBASE_APIKEY : ${{ secrets.REACT_APP_FIREBASE_APIKEY }}
jobs:
build:
name: Build
Expand All @@ -19,6 +23,8 @@ jobs:
- name: Build
env:
CI: false
REACT_APP_OPEN_AI_KEY: ${{ secrets.REACT_APP_OPEN_AI_KEY }}
REACT_APP_FIREBASE_APIKEY: ${{ secrets.REACT_APP_FIREBASE_APIKEY }}
run: |
cd ai-trip-creator
npm run build
Expand Down Expand Up @@ -48,4 +54,8 @@ jobs:
with:
args: deploy --only hosting
env:
CI: false
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
REACT_APP_OPEN_AI_KEY : ${{ secrets.REACT_APP_OPEN_AI_KEY }}
REACT_APP_FIREBASE_APIKEY : ${{ secrets.REACT_APP_FIREBASE_APIKEY }}

Binary file added Architectural Document.pdf
Binary file not shown.
Binary file added Coding Standards.pdf
Binary file not shown.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ At a high level, the web application should achieve the following:
### Demo 2 Documentation: https://drive.google.com/drive/folders/1FdCSEWLEiCJMx1wZnsEbrxyj8pMCxOQv?usp=drive_link
### Demo 3 Documentation: https://docs.google.com/document/d/1WftryvZLKDnwDYBZSdE5w6eT0XxTaJnezaBwjwcu9R0/edit?usp=sharing

### Demo 4 Documentation:

https://github.com/COS301-SE-2024/AI-Trip-Creator/blob/main/Architectural%20Document.pdf

https://github.com/COS301-SE-2024/AI-Trip-Creator/blob/main/Coding%20Standards.pdf

https://github.com/COS301-SE-2024/AI-Trip-Creator/blob/main/Reliability%20Test%20Report.pdf

https://github.com/COS301-SE-2024/AI-Trip-Creator/blob/main/Usability%20Test%20Report.pdf

https://github.com/COS301-SE-2024/AI-Trip-Creator/blob/main/User%20manual.pdf

https://github.com/COS301-SE-2024/AI-Trip-Creator/blob/main/Technical%20Installation%20Guide.pdf

### Technical Installation https://github.com/COS301-SE-2024/AI-Trip-Creator/blob/Documentation/Technical_installation.pdf

### User manual https://github.com/COS301-SE-2024/AI-Trip-Creator/blob/Documentation/User_manual.pdf
Expand Down
Binary file added Reliability Test Report.pdf
Binary file not shown.
Binary file added Technical Installation Guide.pdf
Binary file not shown.
Binary file added Usability Test Report.pdf
Binary file not shown.
Binary file added User manual.pdf
Binary file not shown.
Binary file added ai-trip-creator/Testing_Policy.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions ai-trip-creator/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ import Help from './components/dashboard/help';
import SavedItineraries from './components/dashboard/SavedItineraries';
import Analytics from './components/dashboard/analytics';
import Itinerary from './components/dashboard/Itinerary';
import ItineraryForm from './components/dashboard/ItineraryForm';
import ItineraryDisplay from './components/dashboard/ItineraryDisplay';
import Accommodations from './components/dashboard/accommodation';
import { UserProvider } from './components/UserContext/UserContext';
import { ThemeProviderWrapper } from './components/themeContext/themeContext';
Expand Down Expand Up @@ -202,6 +204,9 @@ const App = () => {
</div>
}
/>
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/itineraryForm" element={<ItineraryForm />} />
<Route path="/itineraryDisplay" element={<ItineraryDisplay />} />
<Route path="/profile" element={<Profile />} />
<Route path="/settings" element={<Settings />} />
<Route path="/flights" element={<Flights />} />
Expand Down
75 changes: 68 additions & 7 deletions ai-trip-creator/src/__tests__/loginComponent.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,62 @@
// loginComponent.test.js
// // loginComponent.test.js

// import React from "react";
// import { render, screen, fireEvent } from "@testing-library/react";
// import Login from "../components/auth/login";
// import { BrowserRouter as Router } from "react-router-dom";
// import { initializeApp } from "firebase/app";
// import { getAuth } from "firebase/auth";
// import { getFirestore } from "firebase/firestore";

// // Mock Firebase initialization
// jest.mock("firebase/app", () => ({
// initializeApp: jest.fn(),
// }));

// // Mock Firebase auth and firestore functions
// jest.mock("firebase/auth", () => ({
// getAuth: jest.fn(),
// }));

// jest.mock("firebase/firestore", () => ({
// getFirestore: jest.fn(),
// }));

// jest.mock('../firebase/firebase-config');

// describe("Login Component", () => {
// beforeEach(() => {
// jest.clearAllMocks(); // Clear all mocks before each test
// });

// test("renders Login component", () => {
// // Mock Firebase initialization
// initializeApp.mockReturnValue({}); // Mock an empty Firebase app object
// const auth = getAuth();

// render(
// <Router>
// <Login
// setIsLoggedIn={jest.fn()}
// closeLogin={jest.fn()}
// openSignup={jest.fn()}
// />
// </Router>,
// );

// // Check if all elements are rendered correctly
// expect(screen.getByLabelText(/Email/i)).toBeInTheDocument();
// expect(screen.getByLabelText(/Password/i)).toBeInTheDocument();
// expect(screen.getByRole("button", { name: /Login/i })).toBeInTheDocument();
// expect(screen.getByText(/Don't have an account/i)).toBeInTheDocument();
// expect(screen.getByText(/Forgot your password/i)).toBeInTheDocument();
// });

// // Add more tests as needed
// });

import React from "react";
import { render, screen, fireEvent } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import Login from "../components/auth/login";
import { BrowserRouter as Router } from "react-router-dom";
import { initializeApp } from "firebase/app";
Expand All @@ -22,24 +77,30 @@ jest.mock("firebase/firestore", () => ({
getFirestore: jest.fn(),
}));

// Mock the firebase-config.js to prevent real Firebase initialization
jest.mock("../firebase/firebase-config", () => ({
app: {}, // Mock the Firebase app object
auth: {}, // Mock Firebase Auth
firestore: {}, // Mock Firestore
db: {}, // Mock Firestore instance
analytics: {}, // Mock Analytics
}));

describe("Login Component", () => {
beforeEach(() => {
jest.clearAllMocks(); // Clear all mocks before each test
initializeApp.mockReturnValue({}); // Mock an empty Firebase app object
});

test("renders Login component", () => {
// Mock Firebase initialization
initializeApp.mockReturnValue({}); // Mock an empty Firebase app object
const auth = getAuth();

render(
<Router>
<Login
setIsLoggedIn={jest.fn()}
closeLogin={jest.fn()}
openSignup={jest.fn()}
/>
</Router>,
</Router>
);

// Check if all elements are rendered correctly
Expand Down
75 changes: 68 additions & 7 deletions ai-trip-creator/src/__tests__/signupComponents.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,57 @@
// import React from "react";
// import { render, screen } from "@testing-library/react";
// import Signup from "../components/auth/signup";
// import { BrowserRouter as Router } from "react-router-dom";
// import { initializeApp } from "firebase/app";
// import { getAuth } from "firebase/auth";
// import { getFirestore } from "firebase/firestore";

// // Mock Firebase initialization
// jest.mock("firebase/app", () => ({
// initializeApp: jest.fn(),
// }));

// // Mock Firebase auth and firestore functions
// jest.mock("firebase/auth", () => ({
// getAuth: jest.fn(),
// createUserWithEmailAndPassword: jest.fn(),
// updateProfile: jest.fn(),
// }));

// jest.mock("firebase/firestore", () => ({
// getFirestore: jest.fn(),
// doc: jest.fn(),
// setDoc: jest.fn(),
// }));

// jest.mock('../firebase/firebase-config');


// describe("Signup Component", () => {
// beforeEach(() => {
// jest.clearAllMocks(); // Clear all mocks before each test
// initializeApp.mockReturnValue({}); // Mock an empty Firebase app object
// getAuth.mockReturnValue({});
// getFirestore.mockReturnValue({});
// });

// test("renders Signup component", () => {
// render(
// <Router>
// <Signup closeSignup={jest.fn()} openLogin={jest.fn()} />
// </Router>,
// );

// // Check if all elements are rendered correctly

// // Check other elements
// expect(screen.getByRole("button", { name: /Signup/i })).toBeInTheDocument();
// expect(screen.getByText(/Already have an account?/i)).toBeInTheDocument();
// });

// // Add more tests as needed
// });

import React from "react";
import { render, screen } from "@testing-library/react";
import Signup from "../components/auth/signup";
Expand All @@ -24,12 +78,21 @@ jest.mock("firebase/firestore", () => ({
setDoc: jest.fn(),
}));

// Mock the firebase-config.js file to avoid real Firebase initialization
jest.mock('../firebase/firebase-config', () => ({
app: {}, // Mock the Firebase app object
auth: {}, // Mock Firebase Auth object
firestore: {}, // Mock Firestore
db: {}, // Mock Firestore instance
analytics: {}, // Mock Analytics object
}));

describe("Signup Component", () => {
beforeEach(() => {
jest.clearAllMocks(); // Clear all mocks before each test
initializeApp.mockReturnValue({}); // Mock an empty Firebase app object
getAuth.mockReturnValue({});
getFirestore.mockReturnValue({});
getAuth.mockReturnValue({}); // Mock Firebase Auth return object
getFirestore.mockReturnValue({}); // Mock Firestore return object
});

test("renders Signup component", () => {
Expand All @@ -39,12 +102,10 @@ describe("Signup Component", () => {
</Router>,
);

// Check if all elements are rendered correctly

// Check other elements
// Check if the Signup form elements are rendered correctly
expect(screen.getByRole("button", { name: /Signup/i })).toBeInTheDocument();
expect(screen.getByText(/Already have an account?/i)).toBeInTheDocument();
expect(screen.getByText(/Already have an account\?/i)).toBeInTheDocument();
});

// Add more tests as needed
// Additional tests can be added here as needed
});
79 changes: 67 additions & 12 deletions ai-trip-creator/src/__tests__/splashComponent.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,55 @@
// import React from "react";
// import { render, screen } from "@testing-library/react";
// import Splash from "../components/splash/splash";
// import { BrowserRouter as Router } from "react-router-dom";
// import { initializeApp } from "firebase/app";
// import {
// getAuth,
// signInWithEmailAndPassword,
// sendPasswordResetEmail,
// } from "firebase/auth";
// import { getFirestore } from "firebase/firestore";

// // Mock Firebase initialization and methods
// jest.mock("firebase/app", () => ({
// initializeApp: jest.fn(),
// }));

// jest.mock("firebase/auth", () => ({
// getAuth: jest.fn(),
// signInWithEmailAndPassword: jest.fn(),
// sendPasswordResetEmail: jest.fn(),
// }));

// jest.mock("firebase/firestore", () => ({
// getFirestore: jest.fn(),
// }));

// describe("Splash Component", () => {
// beforeEach(() => {
// jest.clearAllMocks();
// });

// test("renders Splash component", () => {
// render(
// <Router>
// <Splash />
// </Router>,
// );

// // Check if all elements are rendered correctly
// //expect(screen.getByText(/Trip Creator/i)).toBeInTheDocument(); // Update the text check as needed
// });

// // Add more tests as needed
// });

import React from "react";
import { render, screen } from "@testing-library/react";
import Splash from "../components/splash/splash";
import { BrowserRouter as Router } from "react-router-dom";
import { initializeApp } from "firebase/app";
import {
getAuth,
signInWithEmailAndPassword,
sendPasswordResetEmail,
} from "firebase/auth";
import { getFirestore } from "firebase/firestore";

// Mock Firebase initialization and methods

// Mock Firebase modules and services
jest.mock("firebase/app", () => ({
initializeApp: jest.fn(),
}));
Expand All @@ -25,6 +64,19 @@ jest.mock("firebase/firestore", () => ({
getFirestore: jest.fn(),
}));

jest.mock("firebase/analytics", () => ({
getAnalytics: jest.fn(), // Mock analytics since it's throwing an error
}));

// Mock your Firebase config file
jest.mock("../firebase/firebase-config", () => ({
app: {}, // Mock empty app object
auth: {},
firestore: {},
db: {},
analytics: {},
}));

describe("Splash Component", () => {
beforeEach(() => {
jest.clearAllMocks();
Expand All @@ -34,11 +86,14 @@ describe("Splash Component", () => {
render(
<Router>
<Splash />
</Router>,
</Router>
);

// Check if all elements are rendered correctly
//expect(screen.getByText(/Trip Creator/i)).toBeInTheDocument(); // Update the text check as needed
// Check if specific elements are rendered
expect(screen.getByText(/AI Trip Creator/i)).toBeInTheDocument();
expect(screen.getByText(/Plan Your Perfect Trip/i)).toBeInTheDocument();
expect(screen.getByText(/Get Started/i)).toBeInTheDocument();
expect(screen.getByText(/Login/i)).toBeInTheDocument();
});

// Add more tests as needed
Expand Down
Loading

0 comments on commit 1303264

Please sign in to comment.