Skip to content

Commit be47c23

Browse files
committed
omit: selenium ui (for now)
1 parent b1df462 commit be47c23

File tree

11 files changed

+159
-255
lines changed

11 files changed

+159
-255
lines changed

client/src/app/store.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const store = configureStore({
1515
middleware: (getDefaultMiddleware) =>
1616
getDefaultMiddleware().concat(apiSlice.middleware),
1717

18+
//import.meta.env.MODE
1819
devTools: process.env.NODE_ENV === "production" ? false : true,
1920
});
2021

client/src/features/auth/Login.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, {useState, useEffect} from 'react'
22
import { useLoginMutation } from './authApiSlice';
33
import { useDispatch } from 'react-redux';
44
import { setCredentials } from './authSlice';
5-
import { useNavigate } from 'react-router';
5+
import { useNavigate } from 'react-router-dom';
66
import usePersist from '../../hooks/usePersist';
77
import { Form, Button, } from 'react-bootstrap';
88
import AuthFormContainer from './AuthFormContainer';

client/src/features/auth/PrefetchEvents.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useEffect } from 'react'
2-
import { Outlet } from 'react-router'
2+
import { Outlet } from 'react-router-dom'
33
import { store } from '../../app/store';
44
import { eventsApiSlice } from '../event/eventsApiSlice';
55

client/src/features/event/eventsApiSlice.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ export const eventsApiSlice = apiSlice.injectEndpoints({
167167

168168
const serializedEvent = newEvent;
169169

170-
console.log(
171-
"serializedEvent from postNewEvent slice: ",
172-
serializedEvent
173-
);
170+
// console.log(
171+
// "serializedEvent from postNewEvent slice: ",
172+
// serializedEvent
173+
// );
174174
return eventsAdapter.setOne(eventsInitialState, serializedEvent);
175175
},
176176

client/src/features/volun/volunteersApiSlice.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { createEntityAdapter, createSelector } from "@reduxjs/toolkit";
22
import { apiSlice } from "../../app/api/apiSlice";
33
import { setSearchedVolunteers, setSortedVolunteers } from "./volunteersSlice";
4-
import { logOut } from "../auth/authSlice";
54

65
export const volunteersAdapter = createEntityAdapter();
76

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@
3737
"keywords": [],
3838
"author": "Kaung Zin Hein",
3939
"license": "ISC",
40-
"description": ""
40+
"description": "Volunteer Management MERN App"
4141
}

server/src/__tests__/ui/events.filter.test.js

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 151 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,156 @@
1-
require("dotenv").config();
2-
const { Builder, By, Key, until, Capabilities, Options } = require("selenium-webdriver");
3-
const mongoose = require("mongoose");
4-
const Event = require("../../models/Event");
5-
const connectDB = require("../../config/db");
6-
const chrome = require('selenium-webdriver/chrome')
7-
require('chromedriver')
1+
// require("dotenv").config();
2+
// const { Builder, By, Key, until, Capabilities, Options } = require("selenium-webdriver");
3+
// const mongoose = require("mongoose");
4+
// const Event = require("../../models/Event");
5+
// const connectDB = require("../../config/db");
6+
// const chrome = require('selenium-webdriver/chrome')
7+
// require('chromedriver')
88

9-
describe("/events/search", () => {
10-
let driver;
9+
// describe("/events/search", () => {
10+
// let driver;
1111

12-
beforeAll(async () => {
13-
jest.setTimeout(30000);
12+
// beforeAll(async () => {
13+
// jest.setTimeout(30000);
1414

15-
// let chromeCapabilities = Capabilities.chrome();
15+
// // let chromeCapabilities = Capabilities.chrome();
1616

17-
// const chromeOptions = {
18-
// args: [
19-
// "--window-size=1920,1080",
20-
// // "--headless"
21-
// "--disable-dev-shm-usage",
22-
// "--no-sandbox"
23-
// ],
24-
// };
25-
26-
let options = new chrome.Options()
27-
options.addArguments(
28-
'headless',
29-
'window-size=1920,1080',
30-
'disable-dev-shm-usage',
31-
'no-sandbox'
32-
)
17+
// // const chromeOptions = {
18+
// // args: [
19+
// // "--window-size=1920,1080",
20+
// // // "--headless"
21+
// // "--disable-dev-shm-usage",
22+
// // "--no-sandbox"
23+
// // ],
24+
// // };
25+
26+
// let options = new chrome.Options()
27+
// options.addArguments(
28+
// 'headless',
29+
// 'window-size=1920,1080',
30+
// 'disable-dev-shm-usage',
31+
// 'no-sandbox'
32+
// )
3333

34-
// chromeCapabilities.set("goog:chromeOptions", chromeOptions);
35-
36-
driver = new Builder()
37-
.forBrowser("chrome")
38-
.setChromeOptions(options)
39-
// .withCapabilities(chromeCapabilities)
40-
.build();
41-
42-
const events = [
43-
{
44-
eventName: "Event 1",
45-
eventDescription: "Description 1",
46-
eventDates: [new Date("2023-01-01T00:00")],
47-
shifts: [
48-
{
49-
shiftStart: new Date("2023-01-01T09:00:00"),
50-
shiftEnd: new Date("2023-01-01T17:00:00"),
51-
shiftPositions: 5,
52-
},
53-
],
54-
55-
eventVenue: "Venue 1",
56-
},
57-
58-
{
59-
eventName: "Event 3",
60-
eventDescription: "Description 3",
61-
eventDates: [
62-
new Date("2024-06-01T00:00"),
63-
new Date("2024-07-02T00:00"),
64-
],
65-
shifts: [
66-
{
67-
shiftStart: new Date("2024-06-01T09:00:00"),
68-
shiftEnd: new Date("2024-06-01T17:00:00"),
69-
shiftPositions: 5,
70-
},
71-
{
72-
shiftStart: new Date("2024-07-02T09:00:00"),
73-
shiftEnd: new Date("2024-07-02T17:00:00"),
74-
shiftPositions: 5,
75-
},
76-
],
77-
// openPositions: 10,
78-
eventVenue: "Venue 3",
79-
},
80-
81-
{
82-
eventName: "Event 2",
83-
eventDescription: "Description 2",
84-
eventDates: [
85-
new Date("2024-02-01T00:00"),
86-
new Date("2024-02-02T00:00"),
87-
],
88-
shifts: [
89-
{
90-
shiftStart: new Date("2024-02-01T09:00:00"),
91-
shiftEnd: new Date("2024-02-01T17:00:00"),
92-
shiftPositions: 10,
93-
},
94-
{
95-
shiftStart: new Date("2024-02-02T09:00:00"),
96-
shiftEnd: new Date("2024-02-02T17:00:00"),
97-
shiftPositions: 4,
98-
},
99-
],
100-
// openPositions: 10,
101-
eventVenue: "Venue 2",
102-
},
103-
];
104-
105-
connectDB();
106-
const createdEvents = await Event.create(events);
107-
108-
console.log("connect db name for test: ", mongoose.connection.name);
109-
// console.log('created Events: ', createdEvents);
110-
console.log("test allowed origin: ", process.env.TEST_ALLOWED_ORIGIN);
111-
console.log("type of test allowedOrigin ",typeof process.env.TEST_ALLOWED_ORIGIN === 'string');
112-
113-
});
114-
115-
afterAll(async () => {
116-
await driver.close();
117-
await Event.deleteMany();
118-
await mongoose.disconnect();
119-
await mongoose.connection.close();
120-
});
121-
122-
it("should return search results", async () => {
123-
const searchTerm = "event";
124-
125-
// console.log("driver: ", driver);
126-
await driver.get(`${process.env.TEST_ALLOWED_ORIGIN}/events`);
127-
await driver
128-
.findElement(By.id("search-bar"))
129-
.findElement(By.css("input"))
130-
.sendKeys(searchTerm, Key.ENTER);
131-
await driver.wait(until.urlContains(`/search?q=${searchTerm}`));
132-
133-
const headingsRow = await driver.findElements(By.css("tr"));
134-
135-
const firstRow = await headingsRow[0].getText();
136-
expect(firstRow.toLowerCase()).toBe("event name venue description when?");
137-
138-
const searchResults = await driver.findElements(By.id("search-result"));
139-
140-
const resultsText = await Promise.all(
141-
searchResults.map(async (result) => await result.getText())
142-
);
143-
144-
resultsText.forEach((text) => {
145-
expect(text.toLowerCase()).toContain(searchTerm);
146-
// expect(text.toLowerCase()).toEqual(expect.stringContaining(searchTerm))
147-
});
148-
}, 10000);
149-
});
34+
// // chromeCapabilities.set("goog:chromeOptions", chromeOptions);
35+
36+
// driver = new Builder()
37+
// .forBrowser("chrome")
38+
// .setChromeOptions(options)
39+
// // .withCapabilities(chromeCapabilities)
40+
// .build();
41+
42+
// const events = [
43+
// {
44+
// eventName: "Event 1",
45+
// eventDescription: "Description 1",
46+
// eventDates: [new Date("2023-01-01T00:00")],
47+
// shifts: [
48+
// {
49+
// shiftStart: new Date("2023-01-01T09:00:00"),
50+
// shiftEnd: new Date("2023-01-01T17:00:00"),
51+
// shiftPositions: 5,
52+
// },
53+
// ],
54+
55+
// eventVenue: "Venue 1",
56+
// },
57+
58+
// {
59+
// eventName: "Event 3",
60+
// eventDescription: "Description 3",
61+
// eventDates: [
62+
// new Date("2024-06-01T00:00"),
63+
// new Date("2024-07-02T00:00"),
64+
// ],
65+
// shifts: [
66+
// {
67+
// shiftStart: new Date("2024-06-01T09:00:00"),
68+
// shiftEnd: new Date("2024-06-01T17:00:00"),
69+
// shiftPositions: 5,
70+
// },
71+
// {
72+
// shiftStart: new Date("2024-07-02T09:00:00"),
73+
// shiftEnd: new Date("2024-07-02T17:00:00"),
74+
// shiftPositions: 5,
75+
// },
76+
// ],
77+
// // openPositions: 10,
78+
// eventVenue: "Venue 3",
79+
// },
80+
81+
// {
82+
// eventName: "Event 2",
83+
// eventDescription: "Description 2",
84+
// eventDates: [
85+
// new Date("2024-02-01T00:00"),
86+
// new Date("2024-02-02T00:00"),
87+
// ],
88+
// shifts: [
89+
// {
90+
// shiftStart: new Date("2024-02-01T09:00:00"),
91+
// shiftEnd: new Date("2024-02-01T17:00:00"),
92+
// shiftPositions: 10,
93+
// },
94+
// {
95+
// shiftStart: new Date("2024-02-02T09:00:00"),
96+
// shiftEnd: new Date("2024-02-02T17:00:00"),
97+
// shiftPositions: 4,
98+
// },
99+
// ],
100+
// // openPositions: 10,
101+
// eventVenue: "Venue 2",
102+
// },
103+
// ];
104+
105+
// connectDB();
106+
// const createdEvents = await Event.create(events);
107+
108+
// console.log("connect db name for test: ", mongoose.connection.name);
109+
// // console.log('created Events: ', createdEvents);
110+
// console.log("test allowed origin: ", process.env.TEST_ALLOWED_ORIGIN);
111+
// console.log("type of test allowedOrigin ",typeof process.env.TEST_ALLOWED_ORIGIN === 'string');
112+
113+
// });
114+
115+
// afterAll(async () => {
116+
// await driver.close();
117+
// await Event.deleteMany();
118+
// await mongoose.disconnect();
119+
// await mongoose.connection.close();
120+
// });
121+
122+
// it("should return search results", async () => {
123+
// const searchTerm = "event";
124+
125+
// // console.log("driver: ", driver);
126+
// await driver.get(`${process.env.TEST_ALLOWED_ORIGIN}/events`);
127+
// await driver
128+
// .findElement(By.id("search-bar"))
129+
// .findElement(By.css("input"))
130+
// .sendKeys(searchTerm, Key.ENTER);
131+
// await driver.wait(until.urlContains(`/search?q=${searchTerm}`));
132+
133+
// const headingsRow = await driver.findElements(By.css("tr"));
134+
135+
// const firstRow = await headingsRow[0].getText();
136+
// expect(firstRow.toLowerCase()).toBe("event name venue description when?");
137+
138+
// const searchResults = await driver.findElements(By.id("search-result"));
139+
140+
// const resultsText = await Promise.all(
141+
// searchResults.map(async (result) => await result.getText())
142+
// );
143+
144+
// resultsText.forEach((text) => {
145+
// expect(text.toLowerCase()).toContain(searchTerm);
146+
// // expect(text.toLowerCase()).toEqual(expect.stringContaining(searchTerm))
147+
// });
148+
// }, 10000);
149+
// });
150+
describe('/events/search', () => {
151+
152+
it('should return', () => {
153+
154+
expect(true).toBe(true)
155+
})
156+
})

server/src/controllers/eventsControllers.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ const objKeysIncludes = require("../helpers/objKeysIncludes");
1717

1818
const { FILTER_OPTIONS } = require("../config/filterOptions");
1919
const { SORT_OBJECT } = require("../config/sortOptions");
20-
const filterArrSortLoose = require("../helpers/filterArrSortLoose");
2120
const sortUpcomingEventsDates = require("../helpers/sortUpcomingEventsDates");
22-
const elemObjPropValIncludes = require("../helpers/elemObjPropValIncludes");
2321
const {
2422
getAllEvents,
2523
createNewEvent,

0 commit comments

Comments
 (0)