Skip to content
Open
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: 1 addition & 1 deletion Frontend/src/components/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ export default {
},
trigger_unjoin () {
// unjoin event
//this.$parent.unjoinEvent(this.event_selection);
this.$parent.unjoinEvent(this.event_selection);
this.unjoin_panel_off();
}
},
Expand Down
31 changes: 30 additions & 1 deletion Frontend/src/pages/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@
<div class="popup" id="popup-join-event">
<div class="overlay"></div>
<div class="content">
<div class="close-btn" @click="togglePopupJoinEvent()">&times;</div>
<div id="closeJoinEvent" class="close-btn" @click="togglePopupJoinEvent()">&times;</div>
<div
style="
width: 100%;
Expand Down Expand Up @@ -2716,6 +2716,35 @@ export default {
return;
});
},
unjoinEvent(event) {
// let eventid = this.eventlist.find(
// (element) => element.title == this.eventSelected
// );
let params = {
eventID: event._id,
attendeeID: this.studentid,
};
let AXIOS = axios.create({
baseURL: backendUrl,
headers: { "auth-token": localStorage.getItem("auth_key") },
// headers: {'Access-Control-Allow-Origin': frontendUrl}
});
AXIOS.post("/api/event/unjoinEvent", params)
.then((response) => {
this.errorUnjoinEvent = "";
this.successJoinEvent = "Successfully unjoined event";
this.updatePage();

// this.eventSelected = "";
})
.catch((e) => {
e = e.response.data ? e.response.data : e;
this.errorUnjoinEvent = e;
this.successUnjoinEvent = "";
console.log(e);
return;
});
},
togglePopupCreate() {
this.errorCreateTask = "";
this.successCreateTask = "";
Expand Down
2 changes: 1 addition & 1 deletion Frontend/test/e2e/nightwatch.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var config = require('../../config')

// http://nightwatchjs.org/gettingstarted#settings-file
module.exports = {
src_folders: ['test/e2e/specs/crud_reminder'],
src_folders: ['test/e2e/specs/unjoinEvent'],
output_folder: 'test/e2e/reports',
custom_assertions_path: ['test/e2e/custom-assertions'],

Expand Down
32 changes: 32 additions & 0 deletions Frontend/test/e2e/specs/UnjoinEvent/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const config = {
url: "http://127.0.0.1:8087/#/Login",
destinationUrl_Signup: "http://127.0.0.1:8087/#/Signup",
destinationUrl_Home: "http://127.0.0.1:8087/#/Home",
name: "UnjoinEvent",
id: {
username: "#field_uname",
password: "#field_password",
login: "#login_button",
createEvent: "#createEventButton",
eventTitle: "#title-create-event",
eventStartDate: "#startdate-create-event",
eventEndDate: "#enddate-create-event",
eventDescription: "#description-create-event",
eventLocation: "#location-create-event",
createEventButton: "#createeventbtn",
joinEvent: "#joinEventButton",
eventSelect: "#event",
joinEventButton: "#btnjoinevent",
success: "#success-join-event",
deleteEvent: "#deleteButton",
deleteEventButton: "#btndeleteevent",
// eventButton: "#",
// unjoinEventButton: "#unjoinButton"
},
time: {
pause: 1500,
visible: 1500
}
}

module.exports = config;
115 changes: 115 additions & 0 deletions Frontend/test/e2e/specs/UnjoinEvent/unjoinEvent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
const config = require('./config.js');

module.exports = {
'Test join event': function (client) {
const users = [
{
username: "oli",
password: "password",
},
];

const events = [
{
title: "testing event",
// startDate: "2021\t03041030a",
// endDate: "2021\t03041130a",
// description: "Description",
// location: "Mtl"
}
]

client.windowMaximize()

//Login
client
.url(config.url)
.waitForElementVisible('body', config.time.visible)
.setValue(config.id.username, users[0].username)
.pause(config.time.pause)
.setValue(config.id.password, users[0].password)
.pause(config.time.pause)
.click(config.id.login)
.pause(config.time.pause)
.waitForElementVisible('body', config.time.visible)

// //Create event
// client
// .click(config.id.createEvent)
// .pause(config.time.pause)
// .setValue(config.id.eventTitle, events[0].title)
// .pause(config.time.pause)
// .setValue(config.id.eventStartDate, events[0].startDate)
// .pause(config.time.pause)
// .setValue(config.id.eventEndDate, events[0].endDate)
// .pause(config.time.pause)
// .setValue(config.id.eventDescription, events[0].description)
// .pause(config.time.pause)
// .setValue(config.id.eventLocation, events[0].location)
// .pause(config.time.pause)
// .click(config.id.createEventButton)
// .pause(config.time.pause)
// .waitForElementVisible('body', config.time.visible)

// //Login with new account
// client
// .url(config.url)
// .waitForElementVisible('body', config.time.visible)
// .setValue(config.id.username, users[1].username)
// .pause(config.time.pause)
// .setValue(config.id.password, users[1].password)
// .pause(config.time.pause)
// .click(config.id.login)
// .pause(config.time.pause)
// .waitForElementVisible('body', config.time.visible)

//Join Event
client
.click(config.id.joinEvent)
.pause(config.time.pause)
.setValue(config.id.eventSelect, events[0].title)
.pause(config.time.pause)
.click(config.id.joinEventButton)
.pause(config.time.pause)
.assert.containsText(config.id.success, "Successfully joined event")
.pause(config.time.pause)
.click("#closeJoinEvent")

//Unjoin Event
client
.useXpath().click("//*[contains(text(), 'testing event')]")
.useCss()
.pause(config.time.pause)
.assert.visible("#unjoinButton")
.pause(config.time.pause)
.click("#unjoinButton")
.waitForElementVisible('body', config.time.visible)
.pause(config.time.pause)
.pause(config.time.pause)

// //Login with old account
// client
// .url(config.url)
// .waitForElementVisible('body', config.time.visible)
// .setValue(config.id.username, users[0].username)
// .pause(config.time.pause)
// .setValue(config.id.password, users[0].password)
// .pause(config.time.pause)
// .click(config.id.login)
// .pause(config.time.pause)
// .waitForElementVisible('body', config.time.visible)

// //Delete event
// client
// .useXpath().click("//*[contains(text(), '" + events[0].title + "')]")
// .useCss()
// .pause(config.time.pause)
// .click(config.id.deleteEvent)
// .pause(config.time.pause)
// .click(config.id.deleteEventButton)
// .pause(config.time.pause)
// .waitForElementVisible('body', config.time.visible)

client.end()
},
}