diff --git a/.eslintrc.js b/.eslintrc.js
index 8912b06dc..da7dbdaeb 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -12,13 +12,43 @@ const stylistic = require("@stylistic/eslint-plugin");
const customizedStylistic = stylistic.configs.customize({
"indent": 2,
- "quotes": "double",
"jsx": false,
"quote-props": "always",
"semi": "always",
"brace-style": "1tbs",
});
+const cypressRules = {
+ "cypress/no-assigning-return-values": "error",
+ "cypress/no-unnecessary-waiting": "off", // TODO: fix this issue
+ "cypress/assertion-before-screenshot": "warn",
+ "cypress/no-force": "warn",
+ "cypress/no-async-tests": "error",
+ "cypress/no-pause": "error",
+};
+
+const ignoreFilesWithSprocketRequireSyntax = [
+ "app/assets/javascripts/application.js",
+ "app/assets/config/manifest.js",
+ "app/assets/javascripts/edit_clicker_assets.js",
+ "app/assets/javascripts/show_clicker_assets.js",
+ "app/assets/javascripts/geogebra_assets.js",
+ "vendor/assets/javascripts/thredded_timeago.js",
+];
+
+const customGlobals = {
+ TomSelect: "readable",
+ bootstrap: "readable",
+
+ // Rails globals
+ Routes: "readable",
+ App: "readable",
+ ActionCable: "readable",
+
+ // Common global methods
+ initBootstrapPopovers: "readable",
+};
+
module.exports = {
root: true,
parserOptions: {
@@ -26,18 +56,32 @@ module.exports = {
sourceType: "module",
},
env: {
- node: true,
- browser: true,
- jquery: true,
+ "node": true,
+ "browser": true,
+ "jquery": true,
+ "cypress/globals": true,
},
extends: [
"eslint:recommended",
// Allow linting of ERB files, see https://github.com/Splines/eslint-plugin-erb
"plugin:erb/recommended",
],
- plugins: ["@stylistic", "erb"],
+ globals: customGlobals,
+ plugins: ["@stylistic", "erb", "cypress"],
rules: {
...customizedStylistic.rules,
- "no-unused-vars": "warn",
+ "no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
+ ...cypressRules,
+ // see https://github.com/eslint-stylistic/eslint-stylistic/issues/254
+ "@stylistic/quotes": ["error", "double", { avoidEscape: true }],
},
+ ignorePatterns: [
+ "node_modules/",
+ "pdfcomprezzor/",
+ "tmp/",
+ "public/packs/",
+ "public/packs-test/",
+ "public/uploads/",
+ ...ignoreFilesWithSprocketRequireSyntax,
+ ],
};
diff --git a/app/assets/javascripts/_selectize_turbolinks_fix.js b/app/assets/javascripts/_selectize_turbolinks_fix.js
index eaef1d817..dfe418cf2 100644
--- a/app/assets/javascripts/_selectize_turbolinks_fix.js
+++ b/app/assets/javascripts/_selectize_turbolinks_fix.js
@@ -5,130 +5,140 @@
// transfer knowledge about selected items from selectize to html options
var resetSelectized;
-resetSelectized = function(index, select) {
+resetSelectized = function (index, select) {
var i, len, selectedValue, val;
selectedValue = select.tomselect.getValue();
select.tomselect.destroy();
- $(select).find('option').attr('selected', null);
- if ($(select).prop('multiple')) {
+ $(select).find("option").attr("selected", null);
+ if ($(select).prop("multiple")) {
for (i = 0, len = selectedValue.length; i < len; i++) {
val = selectedValue[i];
- if (val !== '') {
- $(select).find("option[value='" + val + "']").attr('selected', true);
+ if (val !== "") {
+ $(select).find("option[value='" + val + "']").attr("selected", true);
}
}
- } else {
- if (selectedValue !== '') {
- $(select).find("option[value='" + selectedValue + "']").attr('selected', true);
+ }
+ else {
+ if (selectedValue !== "") {
+ $(select).find("option[value='" + selectedValue + "']").attr("selected", true);
}
}
};
-this.fillOptionsByAjax = function($selectizedSelection) {
- $selectizedSelection.each(function() {
- var courseId, existing_values, fill_path, loaded, locale, model_select, plugins, send_data, parent;
- if (this.dataset.drag === 'true') {
- plugins = ['remove_button', 'drag_drop'];
- } else {
- plugins = ['remove_button'];
+function fillOptionsByAjax($selectizedSelection) {
+ // TODO: this function definitely needs some refactoring
+ $selectizedSelection.each(function () {
+ let plugins = [];
+ let send_data = false;
+ let fill_path = "";
+ let courseId = 0;
+ let loaded = false;
+ let locale = null;
+
+ if (this.dataset.drag === "true") {
+ plugins = ["remove_button", "drag_drop"];
+ }
+ else {
+ plugins = ["remove_button"];
}
- if (this.dataset.ajax === 'true' && this.dataset.filled === 'false') {
- model_select = this;
+ if (this.dataset.ajax === "true" && this.dataset.filled === "false") {
+ const model_select = this;
courseId = 0;
- placeholder = this.dataset.placeholder;
- no_result_msg = this.dataset.noResults;
- existing_values = Array.apply(null, model_select.options).map(function(o) {
- return o.value;
- });
+ const placeholder = this.dataset.placeholder;
+ const no_result_msg = this.dataset.noResults;
send_data = false;
loaded = false;
- parent = this.dataset.modal === undefined ? document.body : null;
- if (this.dataset.model === 'tag') {
+ if (this.dataset.model === "tag") {
locale = this.dataset.locale;
fill_path = Routes.fill_tag_select_path({
- locale: locale
+ locale: locale,
});
send_data = true;
- } else if (this.dataset.model === 'user') {
+ }
+ else if (this.dataset.model === "user") {
fill_path = Routes.fill_user_select_path();
send_data = true;
- } else if (this.dataset.model === 'user_generic') {
+ }
+ else if (this.dataset.model === "user_generic") {
fill_path = Routes.list_generic_users_path();
- } else if (this.dataset.model === 'teachable') {
+ }
+ else if (this.dataset.model === "teachable") {
fill_path = Routes.fill_teachable_select_path();
- } else if (this.dataset.model === 'medium') {
+ }
+ else if (this.dataset.model === "medium") {
fill_path = Routes.fill_media_select_path();
- } else if (this.dataset.model === 'course_tag') {
+ }
+ else if (this.dataset.model === "course_tag") {
courseId = this.dataset.course;
fill_path = Routes.fill_course_tags_path();
}
- (function() {
- class MinimumLengthSelect extends TomSelect{
-
- refreshOptions(triggerDropdown=true){
+ (function () {
+ class MinimumLengthSelect extends TomSelect {
+ refreshOptions(triggerDropdown = true) {
var query = this.inputValue();
- if( query.length < 2){
+ if (query.length < 2) {
this.close(false);
return;
}
super.refreshOptions(triggerDropdown);
}
-
}
new MinimumLengthSelect("#" + model_select.id, {
- plugins: plugins,
- valueField: 'value',
- labelField: 'name',
- searchField: 'name',
- maxOptions: null,
- placeholder: placeholder,
- closeAfterSelect: true,
- load: function(query, callback) {
- var url;
- if (send_data || !loaded) {
- url = fill_path + "?course_id=" + courseId + "&q=" + encodeURIComponent(query);
- fetch(url).then(function(response) {
- return response.json();
- }).then(function(json) {
- loaded = true;
- return callback(json.map(function(item) {
- return {
- name: item.text,
- value: item.value
- };
- }));
- })["catch"](function() {
- callback();
- });
- }
- callback();
- },
- render: {
- option: function(data, escape) {
- return '
' + '' + escape(data.name) + '' + '
';
+ plugins: plugins,
+ valueField: "value",
+ labelField: "name",
+ searchField: "name",
+ maxOptions: null,
+ placeholder: placeholder,
+ closeAfterSelect: true,
+ load: function (query, callback) {
+ var url;
+ if (send_data || !loaded) {
+ url = fill_path + "?course_id=" + courseId + "&q=" + encodeURIComponent(query);
+ fetch(url).then(function (response) {
+ return response.json();
+ }).then(function (json) {
+ loaded = true;
+ return callback(json.map(function (item) {
+ return {
+ name: item.text,
+ value: item.value,
+ };
+ }));
+ })["catch"](function () {
+ callback();
+ });
+ }
+ callback();
},
- item: function(item, escape) {
- return '' + escape(item.name) + '
';
+ render: {
+ option: function (data, escape) {
+ return "" + '' + escape(data.name) + "" + "
";
+ },
+ item: function (item, escape) {
+ return '' + escape(item.name) + "
";
+ },
+ no_results: function (data, escape) {
+ return '' + escape(no_result_msg) + "
";
+ },
},
- no_results: function(data, escape) {
- return ''+ escape(no_result_msg) + '
';
- }
- }
- });
- })();} else {
+ });
+ })();
+ }
+ else {
return new TomSelect("#" + this.id, {
plugins: plugins,
- maxOptions: null
+ maxOptions: null,
});
}
});
-};
+}
-$(document).on('turbolinks:before-cache', function() {
- $('.tomselected').each(resetSelectized);
+$(document).on("turbolinks:before-cache", function () {
+ $(".tomselected").each(resetSelectized);
});
-$(document).on('turbolinks:load', function() {
- fillOptionsByAjax($('.selectize'));
+$(document).on("turbolinks:load", function () {
+ fillOptionsByAjax($(".selectize"));
});
diff --git a/app/assets/javascripts/bootstrap_modal_turbolinks_fix.js b/app/assets/javascripts/bootstrap_modal_turbolinks_fix.js
index d050707d7..15f5d432d 100644
--- a/app/assets/javascripts/bootstrap_modal_turbolinks_fix.js
+++ b/app/assets/javascripts/bootstrap_modal_turbolinks_fix.js
@@ -1,16 +1,16 @@
-$(document).on('turbolinks:load', function () {
- // show all active modals
- $('.activeModal').modal('show');
- // remove active status (this needs to be reestablished before caching)
- $('.activeModal').removeClass('activeModal');
+$(document).on("turbolinks:load", function () {
+ // show all active modals
+ $(".activeModal").modal("show");
+ // remove active status (this needs to be reestablished before caching)
+ $(".activeModal").removeClass("activeModal");
});
-$(document).on('turbolinks:before-cache', function () {
- // if some modal is open
- if ($('body').hasClass('modal-open')) {
- $('.modal.show').addClass('activeModal');
- $('.modal.show').modal('hide');
- // remove the greyed out background
- $('.modal-backdrop').remove();
- }
+$(document).on("turbolinks:before-cache", function () {
+ // if some modal is open
+ if ($("body").hasClass("modal-open")) {
+ $(".modal.show").addClass("activeModal");
+ $(".modal.show").modal("hide");
+ // remove the greyed out background
+ $(".modal-backdrop").remove();
+ }
});
diff --git a/app/assets/javascripts/bootstrap_popovers.js b/app/assets/javascripts/bootstrap_popovers.js
index 8bc3d7cd9..16cfe7d5c 100644
--- a/app/assets/javascripts/bootstrap_popovers.js
+++ b/app/assets/javascripts/bootstrap_popovers.js
@@ -1,18 +1,18 @@
-$(document).on('turbolinks:load', function () {
- initBootstrapPopovers();
+$(document).on("turbolinks:load", function () {
+ initBootstrapPopovers();
});
/**
* Initializes all Bootstrap popovers on the page.
- *
+ *
* This function might be used for the first initialization of popovers as well
* as for reinitialization on page changes.
*
* See: https://getbootstrap.com/docs/5.3/components/popovers/#enable-popovers
*/
function initBootstrapPopovers() {
- const popoverHtmlElements = document.querySelectorAll('[data-bs-toggle="popover"]');
- for (const element of popoverHtmlElements) {
- new bootstrap.Popover(element);
- }
-}
\ No newline at end of file
+ const popoverHtmlElements = document.querySelectorAll('[data-bs-toggle="popover"]');
+ for (const element of popoverHtmlElements) {
+ new bootstrap.Popover(element);
+ }
+}
diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js
index 739aa5f02..170e304a6 100644
--- a/app/assets/javascripts/cable.js
+++ b/app/assets/javascripts/cable.js
@@ -1,13 +1,15 @@
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
//
+// disable eslint
+/* eslint-disable */
//= require action_cable
//= require_self
//= require_tree ./channels
+/* eslint-enable */
-(function() {
+(function () {
this.App || (this.App = {});
App.cable = ActionCable.createConsumer();
-
}).call(this);
diff --git a/app/assets/javascripts/datetimepicker.js b/app/assets/javascripts/datetimepicker.js
index 7730f99a1..9d6376d70 100644
--- a/app/assets/javascripts/datetimepicker.js
+++ b/app/assets/javascripts/datetimepicker.js
@@ -1,126 +1,129 @@
+/* global tempusDominus */
+
// Initialize on page load (when js file is dynamically loaded)
$(document).ready(startInitialization);
// On page change (e.g. go back and forth in browser)
-$(document).on('turbolinks:before-cache', () => {
- // Remove stale datetimepickers
- $('.tempus-dominus-widget').remove();
+$(document).on("turbolinks:before-cache", () => {
+ // Remove stale datetimepickers
+ $(".tempus-dominus-widget").remove();
});
function startInitialization() {
- const pickerElements = $('.td-picker');
- if (pickerElements.length == 0) {
- console.error('No datetimepicker element found on page, although requested.');
- return;
- }
+ const pickerElements = $(".td-picker");
+ if (pickerElements.length == 0) {
+ console.error("No datetimepicker element found on page, although requested.");
+ return;
+ }
- pickerElements.each((i, element) => {
- element = $(element);
- const datetimePicker = initDatetimePicker(element);
- registerErrorHandlers(datetimePicker, element);
- registerFocusHandlers(datetimePicker, element);
- });
+ pickerElements.each((i, element) => {
+ element = $(element);
+ const datetimePicker = initDatetimePicker(element);
+ registerErrorHandlers(datetimePicker, element);
+ registerFocusHandlers(datetimePicker, element);
+ });
}
function getDateTimePickerIcons() {
- // At the moment: continue to use FontAwesome 5 icons
- // see https://getdatepicker.com/6/plugins/fa5.html
- // see https://github.com/Eonasdan/tempus-dominus/blob/master/dist/plugins/fa-five.js
- return {
- type: 'icons',
- time: 'fas fa-clock',
- date: 'fas fa-calendar',
- up: 'fas fa-arrow-up',
- down: 'fas fa-arrow-down',
- previous: 'fas fa-chevron-left',
- next: 'fas fa-chevron-right',
- today: 'fas fa-calendar-check',
- clear: 'fas fa-trash',
- close: 'fas fa-times',
- }
+ // At the moment: continue to use FontAwesome 5 icons
+ // see https://getdatepicker.com/6/plugins/fa5.html
+ // see https://github.com/Eonasdan/tempus-dominus/blob/master/dist/plugins/fa-five.js
+ return {
+ type: "icons",
+ time: "fas fa-clock",
+ date: "fas fa-calendar",
+ up: "fas fa-arrow-up",
+ down: "fas fa-arrow-down",
+ previous: "fas fa-chevron-left",
+ next: "fas fa-chevron-right",
+ today: "fas fa-calendar-check",
+ clear: "fas fa-trash",
+ close: "fas fa-times",
+ };
}
function initDatetimePicker(element) {
- // see https://getdatepicker.com
- return new tempusDominus.TempusDominus(
- element.get(0),
- {
- display: {
- sideBySide: true, // clock to the right of the calendar
- icons: getDateTimePickerIcons(),
- },
- localization: {
- startOfTheWeek: 1,
- // choose format to be compliant with backend time format
- format: 'yyyy-MM-dd HH:mm',
- hourCycle: 'h23',
- }
- }
- );
+ // see https://getdatepicker.com
+ return new tempusDominus.TempusDominus(
+ element.get(0),
+ {
+ display: {
+ sideBySide: true, // clock to the right of the calendar
+ icons: getDateTimePickerIcons(),
+ },
+ localization: {
+ startOfTheWeek: 1,
+ // choose format to be compliant with backend time format
+ format: "yyyy-MM-dd HH:mm",
+ hourCycle: "h23",
+ },
+ },
+ );
}
function registerErrorHandlers(datetimePicker, element) {
- // Catch Tempus Dominus error when user types in invalid date
- // this is rather hacky at the moment, see this discussion:
- // https://github.com/Eonasdan/tempus-dominus/discussions/2656
- datetimePicker.dates.oldParseInput = datetimePicker.dates.parseInput;
- datetimePicker.dates.parseInput = (input) => {
- try {
- return datetimePicker.dates.oldParseInput(input);
- } catch (err) {
- const errorMsg = element.find('.td-error').data('td-invalid-date');
- element.find('.td-error').text(errorMsg).show();
- datetimePicker.dates.clear();
- }
- };
+ // Catch Tempus Dominus error when user types in invalid date
+ // this is rather hacky at the moment, see this discussion:
+ // https://github.com/Eonasdan/tempus-dominus/discussions/2656
+ datetimePicker.dates.oldParseInput = datetimePicker.dates.parseInput;
+ datetimePicker.dates.parseInput = (input) => {
+ try {
+ return datetimePicker.dates.oldParseInput(input);
+ }
+ catch (err) {
+ const errorMsg = element.find(".td-error").data("td-invalid-date");
+ element.find(".td-error").text(errorMsg).show();
+ datetimePicker.dates.clear();
+ }
+ };
- datetimePicker.subscribe(tempusDominus.Namespace.events.change, (e) => {
- // see https://getdatepicker.com/6/namespace/events.html#change
+ datetimePicker.subscribe(tempusDominus.Namespace.events.change, (e) => {
+ // see https://getdatepicker.com/6/namespace/events.html#change
- // Clear error message
- if (e.isValid && !e.isClear) {
- element.find('.td-error').empty();
- }
+ // Clear error message
+ if (e.isValid && !e.isClear) {
+ element.find(".td-error").empty();
+ }
- // If date was selected, close datetimepicker.
- // However: leave the datetimepicker open if user only changed time
- if (e.oldDate && e.date && !hasUserChangedDate(e.oldDate, e.date)) {
- datetimePicker.hide();
- }
- });
+ // If date was selected, close datetimepicker.
+ // However: leave the datetimepicker open if user only changed time
+ if (e.oldDate && e.date && !hasUserChangedDate(e.oldDate, e.date)) {
+ datetimePicker.hide();
+ }
+ });
}
function hasUserChangedDate(oldDate, newDate) {
- return oldDate.getHours() != newDate.getHours()
- || oldDate.getMinutes() != newDate.getMinutes();
+ return oldDate.getHours() != newDate.getHours()
+ || oldDate.getMinutes() != newDate.getMinutes();
}
function registerFocusHandlers(datetimePicker, element) {
- // Show datetimepicker when user clicks in text field next to button
- // or when input field receives focus
- var isButtonInvokingFocus = false;
+ // Show datetimepicker when user clicks in text field next to button
+ // or when input field receives focus
+ var isButtonInvokingFocus = false;
- element.find('.td-input').on('click focusin', (e) => {
- try {
- if (!isButtonInvokingFocus) {
- datetimePicker.show();
- }
- }
- finally {
- isButtonInvokingFocus = false;
- }
- });
+ element.find(".td-input").on("click focusin", (_e) => {
+ try {
+ if (!isButtonInvokingFocus) {
+ datetimePicker.show();
+ }
+ }
+ finally {
+ isButtonInvokingFocus = false;
+ }
+ });
- element.find('.td-picker-button').on('click', () => {
- isButtonInvokingFocus = true;
- element.find('.td-input').focus();
- });
+ element.find(".td-picker-button").on("click", () => {
+ isButtonInvokingFocus = true;
+ element.find(".td-input").focus();
+ });
- // Hide datetimepicker when input field loses focus
- element.find('.td-input').blur((e) => {
- if (!e.relatedTarget) {
- return;
- }
- datetimePicker.hide();
- });
+ // Hide datetimepicker when input field loses focus
+ element.find(".td-input").blur((e) => {
+ if (!e.relatedTarget) {
+ return;
+ }
+ datetimePicker.hide();
+ });
}
diff --git a/app/assets/javascripts/footer_modal.js b/app/assets/javascripts/footer_modal.js
index 28d02804f..523aa3785 100644
--- a/app/assets/javascripts/footer_modal.js
+++ b/app/assets/javascripts/footer_modal.js
@@ -1,5 +1,5 @@
document.addEventListener("turbolinks:load", () => {
- if (window.location.hash == "#sponsors") {
- $('#sponsors').modal('show');
- }
+ if (window.location.hash == "#sponsors") {
+ $("#sponsors").modal("show");
+ }
});
diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js
index 5c9da133f..0586df987 100644
--- a/app/javascript/packs/application.js
+++ b/app/javascript/packs/application.js
@@ -7,7 +7,6 @@
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
// layout file, like app/views/layouts/application.html.erb
-
// Uncomment to copy all static images under ../images to the output folder and reference
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
// or the `imagePath` JavaScript helper below.
@@ -16,40 +15,39 @@
// const imagePath = (name) => images(name, true)
import {
- WidgetInstance
+ WidgetInstance,
} from "friendly-challenge";
-var friendlyChallengeWidgetInstance = WidgetInstance
document.addEventListener("turbolinks:load", function () {
- var doneCallback, element, options, widget;
+ var doneCallback, element, options;
- doneCallback = function (solution) {
- console.log(solution);
- document.querySelector("#register-user").disabled = false;
+ doneCallback = function (solution) {
+ console.log(solution);
+ document.querySelector("#register-user").disabled = false;
+ };
+ const errorCallback = (err) => {
+ console.log("There was an error when trying to solve the Captcha.");
+ console.log(err);
+ };
+ element = document.querySelector("#captcha-widget");
+ if (element != null) {
+ options = {
+ doneCallback: doneCallback,
+ errorCallback,
+ puzzleEndpoint: $("#captcha-widget").data("captcha-url"),
+ startMode: "auto",
+ language: $("#captcha-widget").data("lang"),
};
- const errorCallback = (err) => {
- console.log('There was an error when trying to solve the Captcha.');
- console.log(err);
- }
- element = document.querySelector('#captcha-widget');
- if (element != null) {
- options = {
- doneCallback: doneCallback,
- errorCallback,
- puzzleEndpoint: $('#captcha-widget').data("captcha-url"),
- startMode: "auto",
- language: $('#captcha-widget').data("lang")
- };
- console.log(options)
- widget = new WidgetInstance(element, options);
- //DO not uncomment, evil
- // widget.reset();
- }
+ console.log(options);
+ new WidgetInstance(element, options);
+ // DO not uncomment, evil
+ // widget.reset();
+ }
- // Init Masonry grid system
- // see https://getbootstrap.com/docs/5.0/examples/masonry/
- // and official documentation: https://masonry.desandro.com/
- $('.masonry-grid').masonry({
- percentPosition: true
- });
-})
\ No newline at end of file
+ // Init Masonry grid system
+ // see https://getbootstrap.com/docs/5.0/examples/masonry/
+ // and official documentation: https://masonry.desandro.com/
+ $(".masonry-grid").masonry({
+ percentPosition: true,
+ });
+});
diff --git a/app/views/assignments/new.js.erb b/app/views/assignments/new.js.erb
index c7872b491..3f1853678 100644
--- a/app/views/assignments/new.js.erb
+++ b/app/views/assignments/new.js.erb
@@ -1,18 +1,18 @@
-$('#newAssignmentButton').hide();
+$("#newAssignmentButton").hide();
-$('#assignmentListHeader').show()
- .after('<%= j render partial: "assignments/form", locals: { assignment: @assignment } %>');
+$("#assignmentListHeader").show()
+ .after("<%= j render partial: "assignments/form", locals: { assignment: @assignment } %>");
-new TomSelect('#assignment_medium_id_', {
+new TomSelect("#assignment_medium_id_", {
sortField: {
- field: 'text',
- direction: 'asc'
+ field: "text",
+ direction: "asc",
},
render: {
- no_results: function(data, escape) {
+ no_results: function (_data, _escape) {
return '<%= t("basics.no_results") %>
';
- }
- }
+ },
+ },
});
-$('#assignment_medium_id_').val(null).trigger('change');
+$("#assignment_medium_id_").val(null).trigger("change");
diff --git a/app/views/commontator/comments/cancel.js.erb b/app/views/commontator/comments/cancel.js.erb
index d9f34dcc6..71688f1d6 100644
--- a/app/views/commontator/comments/cancel.js.erb
+++ b/app/views/commontator/comments/cancel.js.erb
@@ -1,15 +1,15 @@
<% if @comment.nil? || @comment.new_record? %>
- <%
+<%
id = @comment.nil? || @comment.parent.nil? ?
"commontator-thread-#{@commontator_thread.id}-new-comment" :
"commontator-comment-#{@comment.parent.id}-reply"
%>
- $("#<%= id %>").hide();
+$("#<%= id %>").hide();
- $("#<%= id %>-link").fadeIn();
+$("#<%= id %>-link").fadeIn();
<% else %>
- $("#commontator-comment-<%= @comment.id %>-body").html("<%= escape_javascript(
+$("#commontator-comment-<%= @comment.id %>-body").html("<%= escape_javascript(
render partial: 'body', locals: { comment: @comment }
) %>");
<% end %>
diff --git a/app/views/commontator/comments/create.js.erb b/app/views/commontator/comments/create.js.erb
index 4754a6fef..3d9cbb2e1 100644
--- a/app/views/commontator/comments/create.js.erb
+++ b/app/views/commontator/comments/create.js.erb
@@ -18,11 +18,11 @@
%>
<% if @commontator_new_comment.nil? %>
- $("#<%= id %>").hide();
+$("#<%= id %>").hide();
- $("#<%= id %>-link").fadeIn();
+$("#<%= id %>-link").fadeIn();
<% else %>
- $("#<%= id %>").html("<%= escape_javascript(
+$("#<%= id %>").html("<%= escape_javascript(
render partial: 'form', locals: {
comment: @commontator_new_comment, thread: @commontator_thread
}
@@ -30,12 +30,12 @@
<% end %>
<% if @update_icon %>
-$('#commentsIcon').addClass('new-comment');
+$("#commentsIcon").addClass("new-comment");
<% end %>
var commontatorComment = $("#commontator-comment-<%= @comment.id %>").hide().fadeIn();
-$('html, body').animate(
- { scrollTop: commontatorComment.offset().top - window.innerHeight/2 }, 'fast'
+$("html, body").animate(
+ { scrollTop: commontatorComment.offset().top - window.innerHeight / 2 }, "fast",
);
<%= javascript_proc %>
diff --git a/app/views/commontator/comments/edit.js.erb b/app/views/commontator/comments/edit.js.erb
index 4bb3f28e0..0714bd3e3 100644
--- a/app/views/commontator/comments/edit.js.erb
+++ b/app/views/commontator/comments/edit.js.erb
@@ -2,6 +2,6 @@ $("#commontator-comment-<%= @comment.id %>-body").html("<%= escape_javascript(
render partial: 'form', locals: { comment: @comment }
) %>");
-$('#commontator-comment-<%= @comment.id %>-edit-body').focus();
+$("#commontator-comment-<%= @comment.id %>-edit-body").focus();
<%= javascript_proc %>
diff --git a/app/views/commontator/comments/new.js.erb b/app/views/commontator/comments/new.js.erb
index 0ec489036..38ad2afbe 100644
--- a/app/views/commontator/comments/new.js.erb
+++ b/app/views/commontator/comments/new.js.erb
@@ -6,11 +6,11 @@
var commontatorForm = $("#<%= id %>").html("<%= escape_javascript(
render partial: 'form', locals: { comment: @comment, thread: @commontator_thread }
) %>").hide().fadeIn();
-$('html, body').animate({ scrollTop: commontatorForm.offset().top - window.innerHeight/2 }, 'fast');
+$("html, body").animate({ scrollTop: commontatorForm.offset().top - window.innerHeight / 2 }, "fast");
-initBootstrapPopovers()
+initBootstrapPopovers();
$("#<%= id %>-link").hide();
-$('#<%= id %>-body').focus();
+$("#<%= id %>-body").focus();
<%= javascript_proc %>
diff --git a/app/views/commontator/comments/show.js.erb b/app/views/commontator/comments/show.js.erb
index 0274f80c9..ca0dc8332 100644
--- a/app/views/commontator/comments/show.js.erb
+++ b/app/views/commontator/comments/show.js.erb
@@ -1,8 +1,8 @@
var commontatorOldCommentIds = $("#commontator-comment-<%=
@comment.id
-%>-children").children().map(function() {
- return '#' + $(this).attr('id');
-}).toArray().join(',');
+%>-children").children().map(function () {
+ return "#" + $(this).attr("id");
+}).toArray().join(",");
<%=
render partial: 'show', locals: {
@@ -17,8 +17,8 @@ var commontatorOldCommentIds = $("#commontator-comment-<%=
var commontatorNewComments = $("#commontator-comment-<%=
@comment.id
%>-children").children().not(commontatorOldCommentIds).hide().fadeIn();
-$('html, body').animate(
- { scrollTop: commontatorNewComments.offset().top - window.innerHeight/2 }, 'fast'
+$("html, body").animate(
+ { scrollTop: commontatorNewComments.offset().top - window.innerHeight / 2 }, "fast",
);
<%= javascript_proc %>
diff --git a/app/views/commontator/threads/_hide_show_links.js.erb b/app/views/commontator/threads/_hide_show_links.js.erb
index 2d5dd862d..8b8f405d4 100644
--- a/app/views/commontator/threads/_hide_show_links.js.erb
+++ b/app/views/commontator/threads/_hide_show_links.js.erb
@@ -3,19 +3,19 @@
thread
%>
-$("#commontator-thread-<%= thread.id %>-hide-link").click(function() {
+$("#commontator-thread-<%= thread.id %>-hide-link").click(function () {
$("#commontator-thread-<%= thread.id %>-content").hide();
var commontatorLink = $("#commontator-thread-<%= thread.id %>-show").fadeIn();
- $('html, body').animate(
- { scrollTop: commontatorLink.offset().top - window.innerHeight/2 }, 'fast'
+ $("html, body").animate(
+ { scrollTop: commontatorLink.offset().top - window.innerHeight / 2 }, "fast",
);
});
-$("#commontator-thread-<%= thread.id %>-show-link").click(function() {
+$("#commontator-thread-<%= thread.id %>-show-link").click(function () {
var commontatorThread = $("#commontator-thread-<%= thread.id %>-content").fadeIn();
- $('html, body').animate(
- { scrollTop: commontatorThread.offset().top - window.innerHeight/2 }, 'fast'
+ $("html, body").animate(
+ { scrollTop: commontatorThread.offset().top - window.innerHeight / 2 }, "fast",
);
$("#commontator-thread-<%= thread.id %>-show").hide();
diff --git a/app/views/commontator/threads/_show.js.erb b/app/views/commontator/threads/_show.js.erb
index 8c94ea3d7..777c19d0c 100644
--- a/app/views/commontator/threads/_show.js.erb
+++ b/app/views/commontator/threads/_show.js.erb
@@ -6,7 +6,6 @@
show_all
%>
-
$("#commontator-thread-<%= thread.id %>").html("<%= escape_javascript(
render partial: 'commontator/threads/show', formats: [ :html ], locals: {
user: user, thread: thread, page: page, show_all: show_all
diff --git a/app/views/submissions/select_tutorial.js.erb b/app/views/submissions/select_tutorial.js.erb
index c4ddc36c8..ad613dc6f 100644
--- a/app/views/submissions/select_tutorial.js.erb
+++ b/app/views/submissions/select_tutorial.js.erb
@@ -1,17 +1,17 @@
$('.submission-actions[data-id="<%= @submission.id %>"]').empty()
- .append('<%= j render partial: "submissions/select_tutorial",
+ .append("<%= j render partial: "submissions/select_tutorial",
locals: { submission: @submission,
lecture: @lecture,
- tutorial: @tutorial } %>');
+ tutorial: @tutorial } %>");
-new TomSelect('#submission_tutorial_id-<%= @submission.id %>', {
+new TomSelect("#submission_tutorial_id-<%= @submission.id %>", {
sortField: {
- field: 'text',
- direction: 'asc'
+ field: "text",
+ direction: "asc",
},
render: {
- no_results: function(data, escape) {
+ no_results: function (_data, _escape) {
return '<%= t("basics.no_results") %>
';
- }
- }
-});
\ No newline at end of file
+ },
+ },
+});
diff --git a/app/views/watchlist_entries/create.js.erb b/app/views/watchlist_entries/create.js.erb
index e3cdb6d1f..49d835f99 100644
--- a/app/views/watchlist_entries/create.js.erb
+++ b/app/views/watchlist_entries/create.js.erb
@@ -1,5 +1,6 @@
-if(<%= @success%>) {
+if (<%= @success%>) {
location.reload(true);
-} else {
- $('#watchlistSelectForm').html("<%= j render partial: 'watchlists/select_form', locals: { watchlist_entry: @watchlist_entry, watchlist: @watchlist, medium: @medium } %>")
-}
\ No newline at end of file
+}
+else {
+ $("#watchlistSelectForm").html("<%= j render partial: 'watchlists/select_form', locals: { watchlist_entry: @watchlist_entry, watchlist: @watchlist, medium: @medium } %>");
+}
diff --git a/app/views/watchlists/create.js.erb b/app/views/watchlists/create.js.erb
index 98d45f075..c50cd99c8 100644
--- a/app/views/watchlists/create.js.erb
+++ b/app/views/watchlists/create.js.erb
@@ -1,27 +1,28 @@
-if(<%= @success %>) {
- if(<%= @medium.present? %>) {
+if (<%= @success %>) {
+ if (<%= @medium.present? %>) {
+ $("#collapseNewWatchlist").collapse("hide");
- $('#collapseNewWatchlist').collapse('hide');
-
- $('#watchlist-select-form').html("<%= j render partial: 'watchlists/select_form',
+ $("#watchlist-select-form").html("<%= j render partial: 'watchlists/select_form',
locals: { watchlist_entry: @watchlist_entry,
watchlist: @watchlist,
medium: @medium } %>");
- $('#collapseNewWatchlist').html("<%= j render partial: 'watchlists/new_form',
+ $("#collapseNewWatchlist").html("<%= j render partial: 'watchlists/new_form',
locals: { watchlist_entry: @watchlist_entry,
watchlist: @watchlist,
medium: @medium } %>");
-
- $('#watchlistEntrySubmitButton').attr("disabled", false);
- $('#watchlistEntrySubmitButton').removeAttr("data-confirm");
- $('#watchlistSelectForm').append("<%= t('watchlist.creation_success')%>");
- setTimeout(function() {
- $('#watchlistModalBody').find('.bg-success').remove();
+ $("#watchlistEntrySubmitButton").attr("disabled", false);
+ $("#watchlistEntrySubmitButton").removeAttr("data-confirm");
+
+ $("#watchlistSelectForm").append("<%= t('watchlist.creation_success')%>");
+ setTimeout(function () {
+ $("#watchlistModalBody").find(".bg-success").remove();
}, 2000);
- } else {
+ }
+ else {
location.reload(true);
}
-} else {
- $('#newWatchlistForm').html("<%= j render partial: 'watchlists/new_form', locals: { watchlist_entry: @watchlist_entry, watchlist: @watchlist, medium: @medium } %>")
-}
\ No newline at end of file
+}
+else {
+ $("#newWatchlistForm").html("<%= j render partial: 'watchlists/new_form', locals: { watchlist_entry: @watchlist_entry, watchlist: @watchlist, medium: @medium } %>");
+}
diff --git a/app/views/watchlists/update.js.erb b/app/views/watchlists/update.js.erb
index ea7390b1d..c97268851 100644
--- a/app/views/watchlists/update.js.erb
+++ b/app/views/watchlists/update.js.erb
@@ -1,5 +1,6 @@
-if(<%= @success %>) {
- location.reload(true)
-} else {
- $('#changeWatchlistForm').html("<%= j render partial: 'watchlists/change_form', locals: { watchlist: @watchlist } %>")
-}
\ No newline at end of file
+if (<%= @success %>) {
+ location.reload(true);
+}
+else {
+ $("#changeWatchlistForm").html("<%= j render partial: 'watchlists/change_form', locals: { watchlist: @watchlist } %>");
+}
diff --git a/babel.config.js b/babel.config.js
index 4df194934..fc95d2831 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -1,70 +1,70 @@
-module.exports = function(api) {
- var validEnv = ['development', 'test', 'production']
- var currentEnv = api.env()
- var isDevelopmentEnv = api.env('development')
- var isProductionEnv = api.env('production')
- var isTestEnv = api.env('test')
+module.exports = function (api) {
+ var validEnv = ["development", "test", "production"];
+ var currentEnv = api.env();
+ var isDevelopmentEnv = api.env("development");
+ var isProductionEnv = api.env("production");
+ var isTestEnv = api.env("test");
if (!validEnv.includes(currentEnv)) {
throw new Error(
- 'Please specify a valid `NODE_ENV` or ' +
- '`BABEL_ENV` environment variables. Valid values are "development", ' +
- '"test", and "production". Instead, received: ' +
- JSON.stringify(currentEnv) +
- '.'
- )
+ "Please specify a valid `NODE_ENV` or "
+ + '`BABEL_ENV` environment variables. Valid values are "development", '
+ + '"test", and "production". Instead, received: '
+ + JSON.stringify(currentEnv)
+ + ".",
+ );
}
return {
presets: [
isTestEnv && [
- '@babel/preset-env',
+ "@babel/preset-env",
{
targets: {
- node: 'current'
- }
- }
+ node: "current",
+ },
+ },
],
(isProductionEnv || isDevelopmentEnv) && [
- '@babel/preset-env',
+ "@babel/preset-env",
{
forceAllTransforms: true,
- useBuiltIns: 'entry',
+ useBuiltIns: "entry",
corejs: 3,
modules: false,
- exclude: ['transform-typeof-symbol']
- }
- ]
+ exclude: ["transform-typeof-symbol"],
+ },
+ ],
].filter(Boolean),
plugins: [
- 'babel-plugin-macros',
- '@babel/plugin-syntax-dynamic-import',
- isTestEnv && 'babel-plugin-dynamic-import-node',
- '@babel/plugin-transform-destructuring',
+ "babel-plugin-macros",
+ "@babel/plugin-syntax-dynamic-import",
+ isTestEnv && "babel-plugin-dynamic-import-node",
+ "@babel/plugin-transform-destructuring",
[
- '@babel/plugin-proposal-class-properties',
+ "@babel/plugin-proposal-class-properties",
{
- loose: true
- }
+ loose: true,
+ },
],
[
- '@babel/plugin-proposal-object-rest-spread',
+ "@babel/plugin-proposal-object-rest-spread",
{
- useBuiltIns: true
- }
+ useBuiltIns: true,
+ },
],
[
- '@babel/plugin-transform-runtime',
+ "@babel/plugin-transform-runtime",
{
- helpers: false
- }
+ helpers: false,
+ },
],
[
- '@babel/plugin-transform-regenerator',
+ "@babel/plugin-transform-regenerator",
{
- async: false
- }
- ]
- ].filter(Boolean)
- }
-}
+ async: false,
+ },
+ ],
+ ].filter(Boolean),
+ };
+};
diff --git a/config/webpack/development.js b/config/webpack/development.js
index e097071fb..0a408cc8f 100644
--- a/config/webpack/development.js
+++ b/config/webpack/development.js
@@ -1,6 +1,6 @@
-process.env.NODE_ENV = process.env.NODE_ENV || 'development'
+process.env.NODE_ENV = process.env.NODE_ENV || "development";
-const environment = require('./environment')
+const environment = require("./environment");
const config = environment.toWebpackConfig();
-config.output.filename = "js/[name]-[hash].js"
-module.exports = config
+config.output.filename = "js/[name]-[hash].js";
+module.exports = config;
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
index 6289f57d7..8e88f17c1 100644
--- a/config/webpack/environment.js
+++ b/config/webpack/environment.js
@@ -1,10 +1,9 @@
-const { environment } = require('@rails/webpacker')
-const coffee = require('./loaders/coffee')
-const css = require('./loaders/css')
+const { environment } = require("@rails/webpacker");
+const coffee = require("./loaders/coffee");
+const css = require("./loaders/css");
+environment.loaders.prepend("coffee", coffee);
-environment.loaders.prepend('coffee', coffee)
+environment.loaders.prepend("css", css);
-environment.loaders.prepend('css', css)
-
-module.exports = environment
+module.exports = environment;
diff --git a/config/webpack/loaders/coffee.js b/config/webpack/loaders/coffee.js
index 4666716dc..1cfb3e04b 100644
--- a/config/webpack/loaders/coffee.js
+++ b/config/webpack/loaders/coffee.js
@@ -1,6 +1,6 @@
module.exports = {
test: /\.coffee(\.erb)?$/,
use: [{
- loader: 'coffee-loader'
- }]
-}
+ loader: "coffee-loader",
+ }],
+};
diff --git a/config/webpack/loaders/css.js b/config/webpack/loaders/css.js
index 3a49e838a..e64f63151 100644
--- a/config/webpack/loaders/css.js
+++ b/config/webpack/loaders/css.js
@@ -1,6 +1,6 @@
module.exports = {
- test: /\.css(\.erb)?$/,
- use: [{
- loader: 'css-loader'
- }]
- }
\ No newline at end of file
+ test: /\.css(\.erb)?$/,
+ use: [{
+ loader: "css-loader",
+ }],
+};
diff --git a/config/webpack/loaders/scss.js b/config/webpack/loaders/scss.js
index ab3a4d506..cb6b844a7 100644
--- a/config/webpack/loaders/scss.js
+++ b/config/webpack/loaders/scss.js
@@ -1,6 +1,6 @@
module.exports = {
- test: /\.sass(\.erb)?$/,
- use: [{
- loader: 'sass-loader'
- }]
- }
\ No newline at end of file
+ test: /\.sass(\.erb)?$/,
+ use: [{
+ loader: "sass-loader",
+ }],
+};
diff --git a/config/webpack/production.js b/config/webpack/production.js
index be0f53aac..73d924d83 100644
--- a/config/webpack/production.js
+++ b/config/webpack/production.js
@@ -1,5 +1,5 @@
-process.env.NODE_ENV = process.env.NODE_ENV || 'production'
+process.env.NODE_ENV = process.env.NODE_ENV || "production";
-const environment = require('./environment')
+const environment = require("./environment");
-module.exports = environment.toWebpackConfig()
+module.exports = environment.toWebpackConfig();
diff --git a/config/webpack/test.js b/config/webpack/test.js
index c5edff94a..7f3342f96 100644
--- a/config/webpack/test.js
+++ b/config/webpack/test.js
@@ -1,5 +1,5 @@
-process.env.NODE_ENV = process.env.NODE_ENV || 'development'
+process.env.NODE_ENV = process.env.NODE_ENV || "development";
-const environment = require('./environment')
+const environment = require("./environment");
-module.exports = environment.toWebpackConfig()
+module.exports = environment.toWebpackConfig();
diff --git a/package.json b/package.json
index 37d734e0d..0ffb3fcf9 100644
--- a/package.json
+++ b/package.json
@@ -17,12 +17,10 @@
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.15.1"
},
- "scripts": {
- "lint": "eslint ."
- },
"devDependencies": {
"@stylistic/eslint-plugin": "^1.5.0",
"eslint": "^8.55.0",
+ "eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-erb": "^1.1.0"
}
}
diff --git a/postcss.config.js b/postcss.config.js
index aa5998a80..37626ee68 100644
--- a/postcss.config.js
+++ b/postcss.config.js
@@ -1,12 +1,12 @@
module.exports = {
plugins: [
- require('postcss-import'),
- require('postcss-flexbugs-fixes'),
- require('postcss-preset-env')({
+ require("postcss-import"),
+ require("postcss-flexbugs-fixes"),
+ require("postcss-preset-env")({
autoprefixer: {
- flexbox: 'no-2009'
+ flexbox: "no-2009",
},
- stage: 3
- })
- ]
-}
+ stage: 3,
+ }),
+ ],
+};
diff --git a/spec/cypress.config.js b/spec/cypress.config.js
index 3b2ff73f9..e289330b7 100644
--- a/spec/cypress.config.js
+++ b/spec/cypress.config.js
@@ -1,13 +1,13 @@
-const { defineConfig } = require('cypress')
+const { defineConfig } = require("cypress");
module.exports = defineConfig({
- e2e:{
- "baseUrl": "http://localhost:3000",
- "defaultCommandTimeout": 10000,
- "projectId": "v45wg9",
- "retries": {
- "runMode": 2,
- "openMode": 0
- }
- }
-})
\ No newline at end of file
+ e2e: {
+ baseUrl: "http://localhost:3000",
+ defaultCommandTimeout: 10000,
+ projectId: "v45wg9",
+ retries: {
+ runMode: 2,
+ openMode: 0,
+ },
+ },
+});
diff --git a/spec/cypress/e2e/admin_spec.cy.js b/spec/cypress/e2e/admin_spec.cy.js
index 42c442607..8730b8257 100644
--- a/spec/cypress/e2e/admin_spec.cy.js
+++ b/spec/cypress/e2e/admin_spec.cy.js
@@ -1,63 +1,62 @@
describe("Authentication", function () {
- beforeEach(() => {
- cy.app("clean");
+ beforeEach(() => {
+ cy.app("clean");
+ });
+ describe("admin", () => {
+ it("can login", () => {
+ // call a scenario in app_commands/scenarios
+ cy.appScenario("admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("administrator@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
+ cy.url().should("contain", "main/start");
+ cy.contains("Veranstaltungen").should("exist");
});
- describe("admin", () => {
- it("can login", () => {
- //call a scenario in app_commands/scenarios
- cy.appScenario("admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("administrator@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- cy.url().should("contain", "main/start");
- cy.contains("Veranstaltungen").should("exist");
- });
- it("can set profile image", () => {
- cy.appScenario("admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("administrator@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- cy.visit(`/administration/profile`);
- cy.contains("Profile Image").should("exist");
- const yourFixturePath = 'cypress/fixtures/files/image.png';
- cy.get('#upload-image').selectFile(yourFixturePath,{force:true});
- cy.wait(100);
- cy.contains("Upload").click();
- cy.wait(100);
- cy.contains("Speichern").click();
- cy.contains("image.png").should("exist");
- });
+ it("can set profile image", () => {
+ cy.appScenario("admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("administrator@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
+ cy.visit("/administration/profile");
+ cy.contains("Profile Image").should("exist");
+ const yourFixturePath = "cypress/fixtures/files/image.png";
+ cy.get("#upload-image").selectFile(yourFixturePath, { force: true });
+ cy.wait(100);
+ cy.contains("Upload").click();
+ cy.wait(100);
+ cy.contains("Speichern").click();
+ cy.contains("image.png").should("exist");
});
+ });
});
describe("Clicker Admin", function () {
- beforeEach(() => {
- cy.app("clean");
- cy.appScenario("admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("administrator@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
-
- it("can create clicker", () => {
- cy.visit("/administration");
- cy.get('a[title="Clicker anlegen"]').click();
- cy.get('input[name="clicker[title]"]').type("ErsterClicker");
- cy.get("div#new-clicker-area").contains("Speichern").click();
- cy.contains("ErsterClicker").should("exist");
- });
+ beforeEach(() => {
+ cy.app("clean");
+ cy.appScenario("admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("administrator@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
+ });
- it("can show clicker qr", () => {
- cy.appFactories([
- ['create', 'clicker', 'with_editor']
- ]).then((clickers) => {
- cy.visit(`/clickers/${clickers[0].id}/edit`);
- cy.contains("QR-Code zeigen").click();
- cy.get("li#clickerQRCode").should("exist");
- });
+ it("can create clicker", () => {
+ cy.visit("/administration");
+ cy.get('a[title="Clicker anlegen"]').click();
+ cy.get('input[name="clicker[title]"]').type("ErsterClicker");
+ cy.get("div#new-clicker-area").contains("Speichern").click();
+ cy.contains("ErsterClicker").should("exist");
+ });
+ it("can show clicker qr", () => {
+ cy.appFactories([
+ ["create", "clicker", "with_editor"],
+ ]).then((clickers) => {
+ cy.visit(`/clickers/${clickers[0].id}/edit`);
+ cy.contains("QR-Code zeigen").click();
+ cy.get("li#clickerQRCode").should("exist");
});
-});
\ No newline at end of file
+ });
+});
diff --git a/spec/cypress/e2e/courses_spec.cy.js b/spec/cypress/e2e/courses_spec.cy.js
index 7ac0166fa..833a7bb92 100644
--- a/spec/cypress/e2e/courses_spec.cy.js
+++ b/spec/cypress/e2e/courses_spec.cy.js
@@ -1,164 +1,163 @@
describe("Courses", function () {
+ beforeEach(() => {
+ cy.app("clean");
+ cy.appScenario("setup");
+ });
+ describe("admin user", () => {
beforeEach(() => {
- cy.app("clean");
- cy.appScenario("setup");
+ cy.appScenario("admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("administrator@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
});
- describe("admin user", () => {
- beforeEach(() => {
- cy.appScenario("admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("administrator@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- it("can add tag to course", () => {
- cy.appFactories([
- ['create', 'course']
- ]).then((records) => {
- cy.visit('/courses/1/edit');
- cy.get('#new-tag-button').click();
- cy.get('#tag_notions_attributes_0_title').type('Geometrie');
- cy.wait(100);
- cy.get('#tag_notions_attributes_1_title').type('Geometry');
- cy.get('.col-12 > .btn-primary').click();
- cy.wait(100);
- cy.contains('Geometrie');
- })
- });
- it("can set editor in course", () => {
- cy.appFactories([
- ['create', 'course']
- ]).then((records) => {
- cy.visit('/courses/1/edit');
- cy.get('#course_editor_ids-ts-control').click();
- cy.get('#course_editor_ids-ts-control').type('ad');
- cy.contains('administrator@mampf.edu').click();
- cy.get('.btn-primary').click();
- cy.contains("Admin");
- })
- });
- it("can create module", () => {
- cy.visit('/administration');
- cy.get('i[title="Modul anlegen"]').click();
- cy.get('input[name="course[title]"]').type("Lineare Algebra I");
- cy.get('input[name="course[short_title]"]').type("LA I");
- cy.get('input[type="submit"]').click();
- //cy.visit('/administration');
- cy.contains("Lineare Algebra I").should("exist");
- });
- it("can set course image", ()=>{
- cy.appFactories([
- ['create', 'course'],
- ['create', 'term'],
- ['create', 'lecture',{'term_id':1, 'course_id':1}]
- ]).then((records)=>{
- cy.visit(`/courses/${records[0].id}/edit`);
- cy.contains("Bild").should("exist");
- cy.get("#image_heading").contains("Ein-/Ausklappen").click();
- const yourFixturePath = 'cypress/fixtures/files/image.png';
- cy.get('#upload-image').selectFile(yourFixturePath,{force: true});
- cy.contains("Upload").click();
- cy.wait(100);
- cy.contains("Speichern").click();
- cy.get("#image_heading").contains("Ein-/Ausklappen").click();
- cy.contains("image.png").should("exist");
- });
- });
- it("can create lecture", () => {
- cy.appFactories([
- ['create', 'course'],
- ['create', 'term'],
- ['create','editable_user_join',{
- 'editable_id': 1,
- 'editable_type':'Course',
- 'user_id':1
- }]
- ]).then((records) => {
- cy.visit('/administration');
- cy.get('a[title="Veranstaltung anlegen"]').click();
-
- cy.get("#lecture_course_id-ts-control").type(records[0].title).type("{enter}");
- cy.get("div#new-lecture-area").contains("Speichern").click();
- cy.contains(records[0].title).should("exist");
- cy.contains(`${records[1].season} ${records[1].year}`).should("exist");
- });
- });
+ it("can add tag to course", () => {
+ cy.appFactories([
+ ["create", "course"],
+ ]).then((_records) => {
+ cy.visit("/courses/1/edit");
+ cy.get("#new-tag-button").click();
+ cy.get("#tag_notions_attributes_0_title").type("Geometrie");
+ cy.wait(100);
+ cy.get("#tag_notions_attributes_1_title").type("Geometry");
+ cy.get(".col-12 > .btn-primary").click();
+ cy.wait(100);
+ cy.contains("Geometrie");
+ });
+ });
+ it("can set editor in course", () => {
+ cy.appFactories([
+ ["create", "course"],
+ ]).then((_records) => {
+ cy.visit("/courses/1/edit");
+ cy.get("#course_editor_ids-ts-control").click();
+ cy.get("#course_editor_ids-ts-control").type("ad");
+ cy.contains("administrator@mampf.edu").click();
+ cy.get(".btn-primary").click();
+ cy.contains("Admin");
+ });
+ });
+ it("can create module", () => {
+ cy.visit("/administration");
+ cy.get('i[title="Modul anlegen"]').click();
+ cy.get('input[name="course[title]"]').type("Lineare Algebra I");
+ cy.get('input[name="course[short_title]"]').type("LA I");
+ cy.get('input[type="submit"]').click();
+ // cy.visit('/administration');
+ cy.contains("Lineare Algebra I").should("exist");
+ });
+ it("can set course image", () => {
+ cy.appFactories([
+ ["create", "course"],
+ ["create", "term"],
+ ["create", "lecture", { term_id: 1, course_id: 1 }],
+ ]).then((records) => {
+ cy.visit(`/courses/${records[0].id}/edit`);
+ cy.contains("Bild").should("exist");
+ cy.get("#image_heading").contains("Ein-/Ausklappen").click();
+ const yourFixturePath = "cypress/fixtures/files/image.png";
+ cy.get("#upload-image").selectFile(yourFixturePath, { force: true });
+ cy.contains("Upload").click();
+ cy.wait(100);
+ cy.contains("Speichern").click();
+ cy.get("#image_heading").contains("Ein-/Ausklappen").click();
+ cy.contains("image.png").should("exist");
+ });
+ });
+ it("can create lecture", () => {
+ cy.appFactories([
+ ["create", "course"],
+ ["create", "term"],
+ ["create", "editable_user_join", {
+ editable_id: 1,
+ editable_type: "Course",
+ user_id: 1,
+ }],
+ ]).then((records) => {
+ cy.visit("/administration");
+ cy.get('a[title="Veranstaltung anlegen"]').click();
+ cy.get("#lecture_course_id-ts-control").type(records[0].title).type("{enter}");
+ cy.get("div#new-lecture-area").contains("Speichern").click();
+ cy.contains(records[0].title).should("exist");
+ cy.contains(`${records[1].season} ${records[1].year}`).should("exist");
+ });
+ });
+ });
+ describe("teacher", () => {
+ beforeEach(() => {
+ cy.appScenario("non_admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("max@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
+ });
+ it("can subscribe to unpublished on page", () => {
+ cy.appFactories([
+ ["create", "lecture", {
+ teacher_id: 1,
+ }],
+ ]).then((courses) => {
+ cy.visit(`/lectures/${courses[0].id}`);
+ cy.contains("Achtung").should("exist");
+ cy.contains("Veranstaltung abonnieren").click();
+ cy.contains("Vorlesungsinhalt").should("exist");
+ });
});
- describe("teacher", () => {
- beforeEach(() => {
- cy.appScenario("non_admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("max@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- it("can subscribe to unpublished on page", () => {
- cy.appFactories([
- ["create", "lecture", {
- "teacher_id": 1
- }]
- ]).then((courses) => {
- cy.visit(`/lectures/${courses[0].id}`);
- cy.contains("Achtung").should("exist");
- cy.contains("Veranstaltung abonnieren").click();
- cy.contains("Vorlesungsinhalt").should("exist");
- });
- });
+ });
+ describe("simple user", () => {
+ beforeEach(() => {
+ cy.appScenario("non_admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("max@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
});
- describe("simple user", () => {
- beforeEach(() => {
- cy.appScenario("non_admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("max@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- it("can subscribe", () => {
- //call a scenario in app_commands/scenarios
+ it("can subscribe", () => {
+ // call a scenario in app_commands/scenarios
- cy.appFactories([
- ['create_list', 'lecture', 6, 'released_for_all']
- ]).then((records) => {
- cy.visit("/main/start");
- //cy.get('input[name="search[fulltext]"]').type(records[0][0].title)
- cy.contains("Veranstaltungssuche").click();
- cy.contains("Suche").click();
- cy.get('[title="abonnieren"]').first().click();
- cy.get('[title="abbestellen"]').should("exist");
- });
- });
- it("can subscribe on page", () => {
- cy.appFactories([
- ["create", "lecture", "released_for_all"]
- ]).then((courses) => {
- cy.visit(`/lectures/${courses[0].id}`);
- cy.contains("Achtung").should("exist");
- cy.contains("Veranstaltung abonnieren").click();
- cy.contains("Vorlesungsinhalt").should("exist");
- });
- });
- it("is blocked to subscribe on page", () => {
- cy.appFactories([
- ["create", "lecture", {
- "released": "locked",
- "passphrase": "passphrase"
- }]
- ]).then((courses) => {
- cy.visit(`/lectures/${courses[0].id}`);
- cy.contains("Achtung").should("exist");
- cy.contains("Veranstaltung abonnieren").click();
- cy.contains("Vorlesungsinhalt").should("not.exist");
- cy.contains("Achtung").should("exist");
- });
- });
- it("can not subscribe on page to unpublished", () => {
- cy.appFactories([
- ["create", "lecture"]
- ]).then((courses) => {
- cy.visit(`/lectures/${courses[0].id}`);
- cy.contains("Du bist nicht berechtigt").should("exist");
- });
- });
+ cy.appFactories([
+ ["create_list", "lecture", 6, "released_for_all"],
+ ]).then((_records) => {
+ cy.visit("/main/start");
+ // cy.get('input[name="search[fulltext]"]').type(records[0][0].title)
+ cy.contains("Veranstaltungssuche").click();
+ cy.contains("Suche").click();
+ cy.get('[title="abonnieren"]').first().click();
+ cy.get('[title="abbestellen"]').should("exist");
+ });
+ });
+ it("can subscribe on page", () => {
+ cy.appFactories([
+ ["create", "lecture", "released_for_all"],
+ ]).then((courses) => {
+ cy.visit(`/lectures/${courses[0].id}`);
+ cy.contains("Achtung").should("exist");
+ cy.contains("Veranstaltung abonnieren").click();
+ cy.contains("Vorlesungsinhalt").should("exist");
+ });
+ });
+ it("is blocked to subscribe on page", () => {
+ cy.appFactories([
+ ["create", "lecture", {
+ released: "locked",
+ passphrase: "passphrase",
+ }],
+ ]).then((courses) => {
+ cy.visit(`/lectures/${courses[0].id}`);
+ cy.contains("Achtung").should("exist");
+ cy.contains("Veranstaltung abonnieren").click();
+ cy.contains("Vorlesungsinhalt").should("not.exist");
+ cy.contains("Achtung").should("exist");
+ });
+ });
+ it("can not subscribe on page to unpublished", () => {
+ cy.appFactories([
+ ["create", "lecture"],
+ ]).then((courses) => {
+ cy.visit(`/lectures/${courses[0].id}`);
+ cy.contains("Du bist nicht berechtigt").should("exist");
+ });
});
-});
\ No newline at end of file
+ });
+});
diff --git a/spec/cypress/e2e/media_spec.cy.js b/spec/cypress/e2e/media_spec.cy.js
index 0173b59d8..f199f69fd 100644
--- a/spec/cypress/e2e/media_spec.cy.js
+++ b/spec/cypress/e2e/media_spec.cy.js
@@ -1,410 +1,409 @@
describe("Media", () => {
+ beforeEach(() => {
+ cy.app("clean");
+ });
+ describe("Simple User", () => {
+ beforeEach(() => {
+ cy.app("clean");
+ cy.appScenario("non_admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("max@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
+ });
+ it("can view media", () => {
+ cy.appFactories([
+ [
+ "create", "lesson_medium", "with_manuscript", "released",
+ ],
+ ["create", "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ }]]).then((records) => {
+ console.log(records);
+ cy.visit(`/media/${records[0].id}`);
+ cy.contains(records[0].description).should("exist");
+ });
+ });
+ it("can comment media", () => {
+ cy.appFactories([
+
+ [
+ "create", "lesson_medium", "with_manuscript", "released",
+ ],
+ ["create", "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ }]]).then((records) => {
+ console.log(records);
+ cy.visit(`/media/${records[0].id}`);
+ cy.contains(records[0].description).should("exist");
+ cy.contains("Neuer Kommentar").click();
+ cy.get('textarea[name="comment[body]"]').type("Dies ist ein super Test Kommentar");
+ cy.contains("Kommentar speichern").click();
+ cy.contains("Test Kommentar").should("exist");
+ });
+ });
+ });
+ describe("Admin", () => {
beforeEach(() => {
- cy.app("clean");
+ cy.app("clean");
+ cy.appScenario("admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("administrator@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
});
- describe("Simple User",()=>{
- beforeEach(() => {
- cy.app("clean");
- cy.appScenario("non_admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("max@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- it("can view media",()=>{
- cy.appFactories([
-
- [
- "create","lesson_medium", "with_manuscript","released"
- ],
- ["create", "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }]]).then((records)=>{
- console.log(records);
- cy.visit(`/media/${records[0].id}`);
- cy.contains(records[0].description).should("exist");
- });
- });
- it("can comment media",()=>{
- cy.appFactories([
-
- [
- "create","lesson_medium", "with_manuscript","released"
- ],
- ["create", "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }]]).then((records)=>{
- console.log(records);
- cy.visit(`/media/${records[0].id}`);
- cy.contains(records[0].description).should("exist");
- cy.contains("Neuer Kommentar").click();
- cy.get('textarea[name="comment[body]"]').type("Dies ist ein super Test Kommentar");
- cy.contains("Kommentar speichern").click();
- cy.contains("Test Kommentar").should("exist");
- });
- })
- })
- describe("Admin", () => {
- beforeEach(() => {
- cy.app("clean");
- cy.appScenario("admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("administrator@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- it("can create medium & release it scheduled", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- "teacher_id": 1,
- "released": "all"
- }
- ]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}/edit`);
- cy.contains("Medium anlegen").should("exist");
- cy.contains("Medium anlegen").click();
- cy.get('input[name="medium[description]"]').type("Media 1");
- cy.contains("Speichern und bearbeiten").click();
- cy.contains("Media 1").should("exist");
- cy.contains("Veröffentlichen").click();
- cy.wait(100);
- cy.contains("zum folgenden Zeitpunkt").click();
-
- var date = new Date();
- date.setDate(date.getDate() + 7);
- console.log(date);
- cy.wait(100);
- cy.get('input[name="medium[release_date]"]').click().clear().type(date.toLocaleString("de").replace(",",""));
- cy.wait(100);
- cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
- cy.get("#publishMediumModal").contains("Speichern").click();
- cy.wait(100);
- cy.contains("Dieses Medium wird planmäßig").should("exist");
- });
- });
- it("can create medium & release it.", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- "teacher_id": 1,
- "released": "all"
- }
- ],
- ["create",
- "lecture_user_join", {
- "user_id": 1,
- "lecture_id": 1
- }
- ]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}/edit`);
- cy.contains("Medium anlegen").should("exist");
- cy.contains("Medium anlegen").click();
- cy.get('input[name="medium[description]"]').type("Media 1");
- cy.wait(100);
- cy.contains("Speichern und bearbeiten").click();
- cy.contains("Media 1").should("exist");
- cy.contains("Veröffentlichen").click();
- cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
- cy.get("#publishMediumModal").contains("Speichern").click();
- cy.wait(100);
- cy.visit(`lectures/${lectures[0].id}/food?project=kaviar`);
- cy.contains("Media 1").should("exist");
- });
- });
- it("can create medium & release it scheduled with submission", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- "teacher_id": 1,
- "released": "all"
- }
- ]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}/edit`);
- cy.contains("Medium anlegen").should("exist");
- cy.contains("Medium anlegen").click();
- cy.wait(1000);
- cy.get('input[name="medium[description]"]').type("Media 1");
- cy.wait(100);
- cy.get('select[name="medium[sort]"]').select("Übung");
- cy.contains("Speichern und bearbeiten").click();
- cy.contains("Media 1").should("exist");
- cy.contains("Veröffentlichen").click();
- cy.wait(100);
- cy.contains("zum folgenden Zeitpunkt").click();
- cy.contains("Hausaufgabe zu diesem Medium anlegen").click();
+ it("can create medium & release it scheduled", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ released: "all",
+ },
+ ],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}/edit`);
+ cy.contains("Medium anlegen").should("exist");
+ cy.contains("Medium anlegen").click();
+ cy.get('input[name="medium[description]"]').type("Media 1");
+ cy.contains("Speichern und bearbeiten").click();
+ cy.contains("Media 1").should("exist");
+ cy.contains("Veröffentlichen").click();
+ cy.wait(100);
+ cy.contains("zum folgenden Zeitpunkt").click();
- var date = new Date();
- date.setDate(date.getDate() + 7);
- console.log(date);
- cy.get('input[name="medium[release_date]"]').click().clear().type(date.toLocaleString("de")).type('{enter}');
- date.setDate(date.getDate() + 8);
- cy.get('input[name="medium[assignment_deadline]"]').click().clear().type(date.toLocaleString("de"));
- cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
- cy.get("#publishMediumModal").contains("Speichern").click();
- cy.contains("Dieses Medium wird planmäßig").should("exist");
- });
- });
+ var date = new Date();
+ date.setDate(date.getDate() + 7);
+ console.log(date);
+ cy.wait(100);
+ cy.get('input[name="medium[release_date]"]').click().clear().type(date.toLocaleString("de").replace(",", ""));
+ cy.wait(100);
+ cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
+ cy.get("#publishMediumModal").contains("Speichern").click();
+ cy.wait(100);
+ cy.contains("Dieses Medium wird planmäßig").should("exist");
+ });
+ });
+ it("can create medium & release it.", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ released: "all",
+ },
+ ],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}/edit`);
+ cy.contains("Medium anlegen").should("exist");
+ cy.contains("Medium anlegen").click();
+ cy.get('input[name="medium[description]"]').type("Media 1");
+ cy.wait(100);
+ cy.contains("Speichern und bearbeiten").click();
+ cy.contains("Media 1").should("exist");
+ cy.contains("Veröffentlichen").click();
+ cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
+ cy.get("#publishMediumModal").contains("Speichern").click();
+ cy.wait(100);
+ cy.visit(`lectures/${lectures[0].id}/food?project=kaviar`);
+ cy.contains("Media 1").should("exist");
+ });
+ });
+ it("can create medium & release it scheduled with submission", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ released: "all",
+ },
+ ],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}/edit`);
+ cy.contains("Medium anlegen").should("exist");
+ cy.contains("Medium anlegen").click();
+ cy.wait(1000);
+ cy.get('input[name="medium[description]"]').type("Media 1");
+ cy.wait(100);
+ cy.get('select[name="medium[sort]"]').select("Übung");
+ cy.contains("Speichern und bearbeiten").click();
+ cy.contains("Media 1").should("exist");
+ cy.contains("Veröffentlichen").click();
+ cy.wait(100);
+ cy.contains("zum folgenden Zeitpunkt").click();
+ cy.contains("Hausaufgabe zu diesem Medium anlegen").click();
+
+ var date = new Date();
+ date.setDate(date.getDate() + 7);
+ console.log(date);
+ cy.get('input[name="medium[release_date]"]').click().clear().type(date.toLocaleString("de")).type("{enter}");
+ date.setDate(date.getDate() + 8);
+ cy.get('input[name="medium[assignment_deadline]"]').click().clear().type(date.toLocaleString("de"));
+ cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
+ cy.get("#publishMediumModal").contains("Speichern").click();
+ cy.contains("Dieses Medium wird planmäßig").should("exist");
+ });
+ });
+ });
+ describe("Non-Admin Teacher", () => {
+ beforeEach(() => {
+ cy.app("clean");
+ cy.appScenario("teacher");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("teacher@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
});
- describe("Non-Admin Teacher", () => {
- beforeEach(() => {
- cy.app("clean");
- cy.appScenario("teacher");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("teacher@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- it("can create medium & release it scheduled", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- "teacher_id": 1,
- "released": "all"
- }
- ]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}/edit`);
- cy.contains("Medium anlegen").should("exist");
- cy.contains("Medium anlegen").click();
- cy.get('input[name="medium[description]"]').type("Media 1");
- cy.contains("Speichern und bearbeiten").click();
- cy.contains("Media 1").should("exist");
- cy.contains("Veröffentlichen").click();
- cy.wait(100);
- cy.contains("zum folgenden Zeitpunkt").click();
-
- var date = new Date();
- date.setDate(date.getDate() + 7);
- console.log(date);
- cy.wait(100);
- cy.get('input[name="medium[release_date]"]').click().clear().type(date.toLocaleString("de").replace(",",""));
- cy.wait(100);
- cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
- cy.get("#publishMediumModal").contains("Speichern").click();
- cy.wait(100);
- cy.contains("Dieses Medium wird planmäßig").should("exist");
- });
- });
- it("can create medium & release it.", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- "teacher_id": 1,
- "released": "all"
- }
- ],
- ["create",
- "lecture_user_join", {
- "user_id": 1,
- "lecture_id": 1
- }
- ]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}/edit`);
- cy.contains("Medium anlegen").should("exist");
- cy.contains("Medium anlegen").click();
- cy.get('input[name="medium[description]"]').type("Media 1");
- cy.wait(100);
- cy.contains("Speichern und bearbeiten").click();
- cy.contains("Media 1").should("exist");
- cy.contains("Veröffentlichen").click();
- cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
- cy.get("#publishMediumModal").contains("Speichern").click();
- cy.wait(100);
- cy.visit(`lectures/${lectures[0].id}/food?project=kaviar`);
- cy.contains("Media 1").should("exist");
- });
- });
- it("can create medium & release it scheduled with submission", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- "teacher_id": 1,
- "released": "all"
- }
- ]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}/edit`);
- cy.contains("Medium anlegen").should("exist");
- cy.contains("Medium anlegen").click();
- cy.get('input[name="medium[description]"]').type("Media 1");
- cy.wait(100);
- cy.get('select[name="medium[sort]"]').select("Übung");
- cy.contains("Speichern und bearbeiten").click();
- cy.contains("Media 1").should("exist");
- cy.contains("Veröffentlichen").click();
- cy.wait(100);
- cy.contains("Hausaufgabe zu diesem Medium anlegen").click();
+ it("can create medium & release it scheduled", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ released: "all",
+ },
+ ],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}/edit`);
+ cy.contains("Medium anlegen").should("exist");
+ cy.contains("Medium anlegen").click();
+ cy.get('input[name="medium[description]"]').type("Media 1");
+ cy.contains("Speichern und bearbeiten").click();
+ cy.contains("Media 1").should("exist");
+ cy.contains("Veröffentlichen").click();
+ cy.wait(100);
+ cy.contains("zum folgenden Zeitpunkt").click();
- var date = new Date();
- date.setDate(date.getDate() + 7);
- cy.wait(100);
- console.log(date);
- cy.get('input[name="medium[release_date]"]').click().clear().type(date.toLocaleString("de")).type('{enter}');
- date.setDate(date.getDate() + 8);
- cy.get('input[name="medium[assignment_deadline]"]').click().clear().type(date.toLocaleString("de"));
- cy.get('select[name="medium[assignment_deletion_date]"]').should("exist");
- cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
- cy.get("#publishMediumModal").contains("Speichern").click();
- cy.contains("Dieses Medium wird planmäßig").should("exist");
- });
- });
- it("can create medium & release it with submission", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- "teacher_id": 1,
- "released": "all"
- }
- ]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}/edit`);
- cy.contains("Medium anlegen").should("exist");
- cy.contains("Medium anlegen").click();
- cy.get('input[name="medium[description]"]').type("Media 1");
- cy.wait(100);
- cy.get('select[name="medium[sort]"]').select("Übung");
- cy.contains("Speichern und bearbeiten").click();
- cy.contains("Media 1").should("exist");
- cy.contains("Veröffentlichen").click();
- cy.wait(100);
- cy.contains("Hausaufgabe zu diesem Medium anlegen").click();
- var date = new Date();
- date.setDate(date.getDate() + 8);
- cy.wait(100);
- cy.get('input[name="medium[assignment_deadline]"]').click().clear().type(date.toLocaleString("de"));
- cy.get('select[name="medium[assignment_deletion_date]"]').should("exist");
- cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
- cy.get("#publishMediumModal").contains("Speichern").click();
- cy.contains("Dieses Medium wird planmäßig").should("not.exist");
- cy.wait(500);
- cy.contains("zur Veranstaltung").click();
- cy.get('#assignments_heading').click();
- cy.contains("Media 1").should("exist");
- });
- });
+ var date = new Date();
+ date.setDate(date.getDate() + 7);
+ console.log(date);
+ cy.wait(100);
+ cy.get('input[name="medium[release_date]"]').click().clear().type(date.toLocaleString("de").replace(",", ""));
+ cy.wait(100);
+ cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
+ cy.get("#publishMediumModal").contains("Speichern").click();
+ cy.wait(100);
+ cy.contains("Dieses Medium wird planmäßig").should("exist");
+ });
+ });
+ it("can create medium & release it.", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ released: "all",
+ },
+ ],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}/edit`);
+ cy.contains("Medium anlegen").should("exist");
+ cy.contains("Medium anlegen").click();
+ cy.get('input[name="medium[description]"]').type("Media 1");
+ cy.wait(100);
+ cy.contains("Speichern und bearbeiten").click();
+ cy.contains("Media 1").should("exist");
+ cy.contains("Veröffentlichen").click();
+ cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
+ cy.get("#publishMediumModal").contains("Speichern").click();
+ cy.wait(100);
+ cy.visit(`lectures/${lectures[0].id}/food?project=kaviar`);
+ cy.contains("Media 1").should("exist");
+ });
+ });
+ it("can create medium & release it scheduled with submission", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ released: "all",
+ },
+ ],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}/edit`);
+ cy.contains("Medium anlegen").should("exist");
+ cy.contains("Medium anlegen").click();
+ cy.get('input[name="medium[description]"]').type("Media 1");
+ cy.wait(100);
+ cy.get('select[name="medium[sort]"]').select("Übung");
+ cy.contains("Speichern und bearbeiten").click();
+ cy.contains("Media 1").should("exist");
+ cy.contains("Veröffentlichen").click();
+ cy.wait(100);
+ cy.contains("Hausaufgabe zu diesem Medium anlegen").click();
+
+ var date = new Date();
+ date.setDate(date.getDate() + 7);
+ cy.wait(100);
+ console.log(date);
+ cy.get('input[name="medium[release_date]"]').click().clear().type(date.toLocaleString("de")).type("{enter}");
+ date.setDate(date.getDate() + 8);
+ cy.get('input[name="medium[assignment_deadline]"]').click().clear().type(date.toLocaleString("de"));
+ cy.get('select[name="medium[assignment_deletion_date]"]').should("exist");
+ cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
+ cy.get("#publishMediumModal").contains("Speichern").click();
+ cy.contains("Dieses Medium wird planmäßig").should("exist");
+ });
+ });
+ it("can create medium & release it with submission", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ released: "all",
+ },
+ ],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}/edit`);
+ cy.contains("Medium anlegen").should("exist");
+ cy.contains("Medium anlegen").click();
+ cy.get('input[name="medium[description]"]').type("Media 1");
+ cy.wait(100);
+ cy.get('select[name="medium[sort]"]').select("Übung");
+ cy.contains("Speichern und bearbeiten").click();
+ cy.contains("Media 1").should("exist");
+ cy.contains("Veröffentlichen").click();
+ cy.wait(100);
+ cy.contains("Hausaufgabe zu diesem Medium anlegen").click();
+ var date = new Date();
+ date.setDate(date.getDate() + 8);
+ cy.wait(100);
+ cy.get('input[name="medium[assignment_deadline]"]').click().clear().type(date.toLocaleString("de"));
+ cy.get('select[name="medium[assignment_deletion_date]"]').should("exist");
+ cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
+ cy.get("#publishMediumModal").contains("Speichern").click();
+ cy.contains("Dieses Medium wird planmäßig").should("not.exist");
+ cy.wait(500);
+ cy.contains("zur Veranstaltung").click();
+ cy.get("#assignments_heading").click();
+ cy.contains("Media 1").should("exist");
+ });
+ });
+ });
+ describe("Editor", () => {
+ beforeEach(() => {
+ cy.app("clean");
+ cy.appScenario("editor");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("editor@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
+ });
+ it("can create medium & release it scheduled", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ editor_ids: [1],
+ released: "all",
+ },
+ ],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}/edit`);
+ cy.contains("Medium anlegen").should("exist");
+ cy.contains("Medium anlegen").click();
+ cy.get('input[name="medium[description]"]').type("Media 1");
+ cy.contains("Speichern und bearbeiten").click();
+ cy.contains("Media 1").should("exist");
+ cy.contains("Veröffentlichen").click();
+ cy.wait(100);
+ cy.contains("zum folgenden Zeitpunkt").click();
+
+ var date = new Date();
+ date.setDate(date.getDate() + 7);
+ console.log(date);
+ cy.wait(100);
+ cy.get('input[name="medium[release_date]"]').click().clear().type(date.toLocaleString("de").replace(",", ""));
+ cy.wait(100);
+ cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
+ cy.get("#publishMediumModal").contains("Speichern").click();
+ cy.wait(100);
+ cy.contains("Dieses Medium wird planmäßig").should("exist");
+ });
+ });
+ it("can create medium & release it.", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ editor_ids: [1],
+ released: "all",
+ },
+ ],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}/edit`);
+ cy.contains("Medium anlegen").should("exist");
+ cy.contains("Medium anlegen").click();
+ cy.get('input[name="medium[description]"]').type("Media 1");
+ cy.wait(100);
+ cy.contains("Speichern und bearbeiten").click();
+ cy.contains("Media 1").should("exist");
+ cy.contains("Veröffentlichen").click();
+ cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
+ cy.get("#publishMediumModal").contains("Speichern").click();
+ cy.wait(100);
+ cy.visit(`lectures/${lectures[0].id}/food?project=kaviar`);
+ cy.contains("Media 1").should("exist");
+ });
});
- describe("Editor", () => {
- beforeEach(() => {
- cy.app("clean");
- cy.appScenario("editor");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("editor@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- it("can create medium & release it scheduled", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- "editor_ids": [1],
- "released": "all"
- }
- ],
- ["create",
- "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }
- ]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}/edit`);
- cy.contains("Medium anlegen").should("exist");
- cy.contains("Medium anlegen").click();
- cy.get('input[name="medium[description]"]').type("Media 1");
- cy.contains("Speichern und bearbeiten").click();
- cy.contains("Media 1").should("exist");
- cy.contains("Veröffentlichen").click();
- cy.wait(100);
- cy.contains("zum folgenden Zeitpunkt").click();
-
- var date = new Date();
- date.setDate(date.getDate() + 7);
- console.log(date);
- cy.wait(100);
- cy.get('input[name="medium[release_date]"]').click().clear().type(date.toLocaleString("de").replace(",",""));
- cy.wait(100);
- cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
- cy.get("#publishMediumModal").contains("Speichern").click();
- cy.wait(100);
- cy.contains("Dieses Medium wird planmäßig").should("exist");
- });
- });
- it("can create medium & release it.", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- "editor_ids": [1],
- "released": "all"
- }
- ],
- ["create",
- "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }
- ]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}/edit`);
- cy.contains("Medium anlegen").should("exist");
- cy.contains("Medium anlegen").click();
- cy.get('input[name="medium[description]"]').type("Media 1");
- cy.wait(100);
- cy.contains("Speichern und bearbeiten").click();
- cy.contains("Media 1").should("exist");
- cy.contains("Veröffentlichen").click();
- cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
- cy.get("#publishMediumModal").contains("Speichern").click();
- cy.wait(100);
- cy.visit(`lectures/${lectures[0].id}/food?project=kaviar`);
- cy.contains("Media 1").should("exist");
- });
- });
- it("can create medium & release it scheduled with submission", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- "editor_ids": [1],
- "released": "all"
- }
- ],
- ["create",
- "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }
- ]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}/edit`);
- cy.contains("Medium anlegen").should("exist");
- cy.contains("Medium anlegen").click();
- cy.get('input[name="medium[description]"]').type("Media 1");
- cy.wait(100);
- cy.get('select[name="medium[sort]"]').select("Übung");
- cy.contains("Speichern und bearbeiten").click();
- cy.contains("Media 1").should("exist");
- cy.contains("Veröffentlichen").click();
- cy.wait(100);
- cy.contains("zum folgenden Zeitpunkt").click();
- cy.contains("Hausaufgabe zu diesem Medium anlegen").click();
+ it("can create medium & release it scheduled with submission", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ editor_ids: [1],
+ released: "all",
+ },
+ ],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}/edit`);
+ cy.contains("Medium anlegen").should("exist");
+ cy.contains("Medium anlegen").click();
+ cy.get('input[name="medium[description]"]').type("Media 1");
+ cy.wait(100);
+ cy.get('select[name="medium[sort]"]').select("Übung");
+ cy.contains("Speichern und bearbeiten").click();
+ cy.contains("Media 1").should("exist");
+ cy.contains("Veröffentlichen").click();
+ cy.wait(100);
+ cy.contains("zum folgenden Zeitpunkt").click();
+ cy.contains("Hausaufgabe zu diesem Medium anlegen").click();
- var date = new Date();
- date.setDate(date.getDate() + 7);
- console.log(date);
- cy.get('input[name="medium[release_date]"]').click().clear().type(date.toLocaleString("de")).type('{enter}');;
- date.setDate(date.getDate() + 8);
- cy.get('input[name="medium[assignment_deadline]"]').click().clear().type(date.toLocaleString("de"));
- cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
- cy.get("#publishMediumModal").contains("Speichern").click();
- cy.contains("Dieses Medium wird planmäßig").should("exist");
- });
- });
+ var date = new Date();
+ date.setDate(date.getDate() + 7);
+ console.log(date);
+ cy.get('input[name="medium[release_date]"]').click().clear().type(date.toLocaleString("de")).type("{enter}");
+ date.setDate(date.getDate() + 8);
+ cy.get('input[name="medium[assignment_deadline]"]').click().clear().type(date.toLocaleString("de"));
+ cy.contains("Ich bestätige hiermit, dass durch die Veröffentlichung des Mediums auf der MaMpf-Plattform keine Rechte Dritter verletzt werden.").click();
+ cy.get("#publishMediumModal").contains("Speichern").click();
+ cy.contains("Dieses Medium wird planmäßig").should("exist");
+ });
});
-});
\ No newline at end of file
+ });
+});
diff --git a/spec/cypress/e2e/search_spec.cy.js b/spec/cypress/e2e/search_spec.cy.js
index 2ab57da10..c443b3c79 100644
--- a/spec/cypress/e2e/search_spec.cy.js
+++ b/spec/cypress/e2e/search_spec.cy.js
@@ -1,41 +1,40 @@
describe("Media", () => {
-
- beforeEach(() => {
+ beforeEach(() => {
+ cy.app("clean");
+ });
+ describe("Simple User", () => {
+ describe("Media search", () => {
+ beforeEach(() => {
cy.app("clean");
+ cy.appScenario("non_admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("max@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
+ });
+ /* it("can search released media", () => {
+ cy.appFactories([
+ ["create", "lesson_medium", "with_manuscript", "released"],
+ ["create", "lesson_medium", "with_manuscript"],
+ ]).then((_records) => {
+ cy.get("#mediaSearchLink").click();
+ cy.get("#collapseMediaSearch > .card-body > form > .row > .col-12 > .btn").click();
+ cy.get("#media-search-results").get(".col-12 > .card").should("have.length", 1);
+ });
+ }); */
+ it("can filter for tags", () => {
+ cy.appFactories([
+ ["create", "lesson_medium", "with_manuscript", "released", "with_tags"],
+ ["create", "lesson_medium", "with_manuscript", "released"],
+ ]).then((records) => {
+ cy.get("#mediaSearchLink").click();
+ cy.get("#media_fulltext").type(records[0].description);
+ cy.wait(1000);
+ cy.get("#collapseMediaSearch > .card-body > form > .row > .col-12 > .btn").click();
+ cy.get("#media-search-results").get(".col-12 > .card").should("have.length", 1);
+ cy.get("#media-search-results").get(".col-12 > .card").contains(records[0].description);
+ });
+ });
});
- describe("Simple User",()=>{
- describe("Media search",()=>{
- beforeEach(() => {
- cy.app("clean");
- cy.appScenario("non_admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("max@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- /*it("can search released media",()=>{
- cy.appFactories([
- ["create","lesson_medium", "with_manuscript","released"],
- ["create","lesson_medium", "with_manuscript"]
- ]).then((records)=>{
- cy.get('#mediaSearchLink').click();
- cy.get('#collapseMediaSearch > .card-body > form > .row > .col-12 > .btn').click();
- cy.get('#media-search-results').get('.col-12 > .card').should('have.length',1);
- });
- });*/
- it("can filter for tags",()=>{
- cy.appFactories([
- ["create","lesson_medium", "with_manuscript","released","with_tags"],
- ["create","lesson_medium", "with_manuscript","released"]
- ]).then((records)=>{
- cy.get('#mediaSearchLink').click();
- cy.get('#media_fulltext').type(records[0].description);
- cy.wait(1000);
- cy.get('#collapseMediaSearch > .card-body > form > .row > .col-12 > .btn').click();
- cy.get('#media-search-results').get('.col-12 > .card').should('have.length',1);
- cy.get('#media-search-results').get('.col-12 > .card').contains(records[0].description);
- });
- });
- });
- });
-});
\ No newline at end of file
+ });
+});
diff --git a/spec/cypress/e2e/submissions_spec.cy.js b/spec/cypress/e2e/submissions_spec.cy.js
index e1f7f5fa1..adcd0b5f6 100644
--- a/spec/cypress/e2e/submissions_spec.cy.js
+++ b/spec/cypress/e2e/submissions_spec.cy.js
@@ -1,155 +1,153 @@
describe("Submissions", () => {
-
+ beforeEach(() => {
+ cy.app("clean");
+ });
+ describe("Administration", () => {
beforeEach(() => {
- cy.app("clean");
+ cy.app("clean");
+ cy.appScenario("admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("administrator@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
});
- describe("Administration", () => {
- beforeEach(() => {
- cy.app("clean");
- cy.appScenario("admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("administrator@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- it("can create tutorial", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- "teacher_id": 1
- }
- ],
- ["create", "user", "auto_confirmed"]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}/edit`);
- cy.contains("Tutorien").should("exist");
- cy.contains("Tutorien").click();
- cy.contains("Neues Tutorium anlegen").click();
- cy.get('input[name="tutorial[title]"]').type("Tutorium A");
- cy.get('#tutorial_tutor_ids_-ts-control').type(lectures[1].name);
- cy.contains(lectures[1].name).click();
- cy.get("#exercises_collapse").contains("Speichern").click();
- });
- })
- it("can create assignment", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- "teacher_id": 1
- }
- ],
- [
- "create", "tutorial", {
- "lecture_id": 1
- }
- ]
- ]).then((tutorials) => {
- console.log(tutorials[1]);
- cy.visit(`/lectures/${tutorials[1].lecture_id}/edit`);
- cy.contains("Hausaufgaben").should("exist");
- cy.contains("Hausaufgaben").click();
- cy.contains("Neue Hausaufgabe anlegen").click();
- cy.get('input[name="assignment[title]"]').type("Assignment A");
- cy.get('input[name="assignment[deadline]"]').type((new Date()).toLocaleTimeString("de"));
- cy.get("#assignments_collapse").contains("Speichern").click();
- cy.contains("Assignment A").should("exist");
- });
- });
+ it("can create tutorial", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ },
+ ],
+ ["create", "user", "auto_confirmed"],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}/edit`);
+ cy.contains("Tutorien").should("exist");
+ cy.contains("Tutorien").click();
+ cy.contains("Neues Tutorium anlegen").click();
+ cy.get('input[name="tutorial[title]"]').type("Tutorium A");
+ cy.get("#tutorial_tutor_ids_-ts-control").type(lectures[1].name);
+ cy.contains(lectures[1].name).click();
+ cy.get("#exercises_collapse").contains("Speichern").click();
+ });
});
- describe("User", () => {
- beforeEach(() => {
- cy.app("clean");
- cy.appScenario("non_admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("max@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
-
- cy.appFactories([
- ["create", "lecture", "released_for_all"],
- ["create", "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }]
- ]).then((lectures) => {});
- });
- it("can create submission", () => {
- cy.appFactories([
- [
- "create",
- "tutorial", "with_tutors", {
- lecture_id: 1
- }
- ],
- [
- "create", "assignment", {
- lecture_id: 1
- }
- ]
- ]).then((assignments) => {
- cy.visit(`lectures/${assignments[0].lecture_id}/submissions`);
- cy.contains("Anlegen").click();
- const yourFixturePath = 'cypress/fixtures/files/manuscript.pdf';
- cy.get('#upload-userManuscript').selectFile(yourFixturePath,{force: true});
- cy.get('input[type="checkbox"]').check();
- cy.contains("Hochladen").click();
- cy.get(".submissionFooter").contains("Speichern").click();
- cy.contains("Du").should("exist");
- });
- });
- it("can process multiple files", () => {
- cy.appFactories([
- [
- "create",
- "tutorial", "with_tutors", {
- lecture_id: 1
- }
- ],
- [
- "create", "assignment", {
- lecture_id: 1
- }
- ]
- ]).then((assignments) => {
- cy.visit(`lectures/${assignments[0].lecture_id}/submissions`);
- cy.contains("Anlegen").click();
- const yourFixturePath = 'cypress/fixtures/files/manuscript.pdf';
- cy.get('#upload-userManuscript').selectFile([yourFixturePath,yourFixturePath,yourFixturePath],{force: true});
- cy.get('#userManuscript-merge-btn').should("exist");
- cy.get('#userManuscript-merge-btn').click();
- cy.get('#multiple-files-selected').should("have.attr", "style", "display: none;");
- cy.get('input[type="checkbox"]').check();
- cy.get('#userManuscript-uploadButton-call').click();
- cy.get('#userManuscript-uploadButton-call').contains("Erfolgreich hochgeladen")
- });
- })
- it("can join submission", () => {
- cy.appFactories([
- [
- "create",
- "tutorial", "with_tutors", {
- lecture_id: 1
- }
- ],
- [
- "create", "assignment", {
- lecture_id: 1
- }
- ],
- ["create", "submission", "with_users", "with_manuscript", {
- assignment_id: 1,
- tutorial_id: 1
- }]
- ]).then((assignments) => {
- cy.visit(`lectures/${assignments[0].lecture_id}/submissions`);
- cy.contains("Beitreten").click();
- cy.contains("Code").should("exist");
- console.log(assignments[2]);
- cy.get('input[name="join[code]"]').type(assignments[2].token);
- cy.contains("Beitreten").click();
- cy.contains("Du").should("exist");
- });
- });
+ it("can create assignment", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ },
+ ],
+ [
+ "create", "tutorial", {
+ lecture_id: 1,
+ },
+ ],
+ ]).then((tutorials) => {
+ console.log(tutorials[1]);
+ cy.visit(`/lectures/${tutorials[1].lecture_id}/edit`);
+ cy.contains("Hausaufgaben").should("exist");
+ cy.contains("Hausaufgaben").click();
+ cy.contains("Neue Hausaufgabe anlegen").click();
+ cy.get('input[name="assignment[title]"]').type("Assignment A");
+ cy.get('input[name="assignment[deadline]"]').type((new Date()).toLocaleTimeString("de"));
+ cy.get("#assignments_collapse").contains("Speichern").click();
+ cy.contains("Assignment A").should("exist");
+ });
});
+ });
+ describe("User", () => {
+ beforeEach(() => {
+ cy.app("clean");
+ cy.appScenario("non_admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("max@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
-});
\ No newline at end of file
+ cy.appFactories([
+ ["create", "lecture", "released_for_all"],
+ ["create", "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ }],
+ ]).then((_lectures) => {});
+ });
+ it("can create submission", () => {
+ cy.appFactories([
+ [
+ "create",
+ "tutorial", "with_tutors", {
+ lecture_id: 1,
+ },
+ ],
+ [
+ "create", "assignment", {
+ lecture_id: 1,
+ },
+ ],
+ ]).then((assignments) => {
+ cy.visit(`lectures/${assignments[0].lecture_id}/submissions`);
+ cy.contains("Anlegen").click();
+ const yourFixturePath = "cypress/fixtures/files/manuscript.pdf";
+ cy.get("#upload-userManuscript").selectFile(yourFixturePath, { force: true });
+ cy.get('input[type="checkbox"]').check();
+ cy.contains("Hochladen").click();
+ cy.get(".submissionFooter").contains("Speichern").click();
+ cy.contains("Du").should("exist");
+ });
+ });
+ it("can process multiple files", () => {
+ cy.appFactories([
+ [
+ "create",
+ "tutorial", "with_tutors", {
+ lecture_id: 1,
+ },
+ ],
+ [
+ "create", "assignment", {
+ lecture_id: 1,
+ },
+ ],
+ ]).then((assignments) => {
+ cy.visit(`lectures/${assignments[0].lecture_id}/submissions`);
+ cy.contains("Anlegen").click();
+ const yourFixturePath = "cypress/fixtures/files/manuscript.pdf";
+ cy.get("#upload-userManuscript").selectFile([yourFixturePath, yourFixturePath, yourFixturePath], { force: true });
+ cy.get("#userManuscript-merge-btn").should("exist");
+ cy.get("#userManuscript-merge-btn").click();
+ cy.get("#multiple-files-selected").should("have.attr", "style", "display: none;");
+ cy.get('input[type="checkbox"]').check();
+ cy.get("#userManuscript-uploadButton-call").click();
+ cy.get("#userManuscript-uploadButton-call").contains("Erfolgreich hochgeladen");
+ });
+ });
+ it("can join submission", () => {
+ cy.appFactories([
+ [
+ "create",
+ "tutorial", "with_tutors", {
+ lecture_id: 1,
+ },
+ ],
+ [
+ "create", "assignment", {
+ lecture_id: 1,
+ },
+ ],
+ ["create", "submission", "with_users", "with_manuscript", {
+ assignment_id: 1,
+ tutorial_id: 1,
+ }],
+ ]).then((assignments) => {
+ cy.visit(`lectures/${assignments[0].lecture_id}/submissions`);
+ cy.contains("Beitreten").click();
+ cy.contains("Code").should("exist");
+ console.log(assignments[2]);
+ cy.get('input[name="join[code]"]').type(assignments[2].token);
+ cy.contains("Beitreten").click();
+ cy.contains("Du").should("exist");
+ });
+ });
+ });
+});
diff --git a/spec/cypress/e2e/thredded_spec.cy.js b/spec/cypress/e2e/thredded_spec.cy.js
index 192f04d06..21d1ba512 100644
--- a/spec/cypress/e2e/thredded_spec.cy.js
+++ b/spec/cypress/e2e/thredded_spec.cy.js
@@ -1,88 +1,88 @@
-describe('Thredded', function() {
+describe("Thredded", function () {
+ beforeEach(() => {
+ cy.app("clean");
+ });
+ describe("Administration", () => {
beforeEach(() => {
- cy.app("clean");
+ cy.app("clean");
+ cy.appScenario("admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("administrator@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
+ });
+ it("can access managment", () => {
+ cy.appFactories([
+ ["create", "course"],
+ ["create",
+ "lecture", "released_for_all", {
+ teacher_id: 1,
+ course_id: 1,
+ },
+ ], ["create", "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ }],
+ ]).then((records) => {
+ cy.visit(`/lectures/${records[1].id}/edit`);
+ cy.contains("Forum").click();
+ cy.contains("Forum anlegen").click();
+ cy.contains("Forum").click();
+ cy.contains("Forum löschen").should("exist");
+ cy.visit("/forum");
+ cy.wait(100);
+ cy.contains(records[0].title).click();
+ cy.get('input[name="topic[title]').click().type("Test");
+ cy.get('textarea[name="topic[content]').click().type("Test");
+ cy.contains("Erstelle eine neue Diskussion").click();
+ cy.visit("/forum");
+ cy.contains("Verwaltung").click();
+ cy.contains("Ausstehend").should("exist");
+ });
+ });
+ it("can create forum", () => {
+ cy.appFactories([
+ ["create", "course"],
+ ["create",
+ "lecture", "released_for_all", {
+ teacher_id: 1,
+ course_id: 1,
+ },
+ ], ["create", "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ }],
+ ]).then((records) => {
+ cy.visit(`/lectures/${records[1].id}/edit`);
+ cy.contains("Forum").click();
+ cy.contains("Forum anlegen").click();
+ cy.contains("Forum").click();
+ cy.contains("Forum löschen").should("exist");
+ cy.visit("/forum");
+ console.log(records[0]);
+ cy.wait(100);
+ cy.contains(records[0].title).should("exist");
+ });
});
- describe("Administration", () => {
- beforeEach(() => {
- cy.app("clean");
- cy.appScenario("admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("administrator@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- it("can access managment",()=>{
- cy.appFactories([
- ["create","course"],
- ["create",
- "lecture","released_for_all", {
- "teacher_id": 1,
- "course_id":1
- }
- ],["create", "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }]
- ]).then((records)=>{
- cy.visit(`/lectures/${records[1].id}/edit`);
- cy.contains("Forum").click();
- cy.contains("Forum anlegen").click();
- cy.contains("Forum").click();
- cy.contains("Forum löschen").should("exist");
- cy.visit(`/forum`);
- cy.wait(100);
- cy.contains(records[0].title).click();
- cy.get('input[name="topic[title]').click().type("Test");
- cy.get('textarea[name="topic[content]').click().type("Test");
- cy.contains("Erstelle eine neue Diskussion").click();
- cy.visit('/forum');
- cy.contains("Verwaltung").click();
- cy.contains("Ausstehend").should("exist");
- });
- });
- it('can create forum',()=>{
- cy.appFactories([
- ["create","course"],
- ["create",
- "lecture","released_for_all", {
- "teacher_id": 1,
- "course_id":1
- }
- ],["create", "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }]
- ]).then((records)=>{
- cy.visit(`/lectures/${records[1].id}/edit`);
- cy.contains("Forum").click();
- cy.contains("Forum anlegen").click();
- cy.contains("Forum").click();
- cy.contains("Forum löschen").should("exist");
- cy.visit(`/forum`);
- console.log(records[0])
- cy.wait(100);
- cy.contains(records[0].title).should("exist");
- });
- });
- it('can delete forum',()=>{
- cy.appFactories([
- ["create","course"],
- ["create",
- "lecture","released_for_all", "with_forum", {
- "teacher_id": 1,
- "course_id":1
- }
- ],["create", "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }]
- ]).then((records)=>{
- cy.visit(`/lectures/${records[1].id}/edit`);
- cy.contains("Forum").click();
- cy.contains("Forum löschen").click();
- cy.contains("Forum").click();
- cy.contains("Forum anlegen").should("exist");
- });
- });
+ it("can delete forum", () => {
+ cy.appFactories([
+ ["create", "course"],
+ ["create",
+ "lecture", "released_for_all", "with_forum", {
+ teacher_id: 1,
+ course_id: 1,
+ },
+ ], ["create", "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ }],
+ ]).then((records) => {
+ cy.visit(`/lectures/${records[1].id}/edit`);
+ cy.contains("Forum").click();
+ cy.contains("Forum löschen").click();
+ cy.contains("Forum").click();
+ cy.contains("Forum anlegen").should("exist");
+ });
});
});
+});
diff --git a/spec/cypress/e2e/tutorials_spec.cy.js b/spec/cypress/e2e/tutorials_spec.cy.js
index da2213d1b..3bf2a13dd 100644
--- a/spec/cypress/e2e/tutorials_spec.cy.js
+++ b/spec/cypress/e2e/tutorials_spec.cy.js
@@ -1,312 +1,311 @@
describe("Tutorials", () => {
-
+ beforeEach(() => {
+ cy.app("clean");
+ });
+ describe("Teacher", () => {
beforeEach(() => {
- cy.app("clean");
+ cy.app("clean");
+ cy.appScenario("teacher");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("teacher@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
});
- describe("Teacher", () => {
- beforeEach(() => {
- cy.app("clean");
- cy.appScenario("teacher");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("teacher@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- it("can view tutorials", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- teacher_id: 1
- }
- ],
- ["create",
- "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }
- ],
- ["create",
- "tutorial", "with_tutors", {
- lecture_id: 1
- }
- ],
- ["create",
- "assignment", {
- lecture_id: 1
- }
- ],
- ["create", "submission", "with_users", "with_manuscript", "with_correction", {
- assignment_id: 1,
- tutorial_id: 1
- }]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}`);
- cy.contains("Tutorien").should("exist");
- cy.contains("Tutorien").click();
- cy.get('main > .dropdown > .btn').contains("Tutorien").should("exist");
- cy.get('main > .dropdown > .btn').contains("Tutorien").click();
- cy.get('main > .dropdown > .dropdown-menu > .dropdown-item').contains(lectures[2].title).click();
- cy.reload();
- cy.contains("Übersicht").should("exist");
- });
- });
- it("can view tutorials if tutor", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- teacher_id: 1
- }
- ],
- ["create",
- "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }
- ],
- ["create",
- "tutorial", {
- lecture_id: 1,
- tutor_ids: [1]
- }
- ],
- ["create",
- "tutorial", "with_tutors", {
- lecture_id: 1
- }
- ],
- ["create",
- "assignment", {
- lecture_id: 1
- }
- ],
- ["create", "submission", "with_users", "with_manuscript", "with_correction", {
- assignment_id: 1,
- tutorial_id: 1
- }]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}`);
- cy.contains("Tutorien").should("exist");
- cy.contains("Tutorien").click();
- cy.get('main').contains("Übersicht").should("exist");
- cy.get('main').contains("Übersicht").click();
- cy.get('main > .dropdown > .btn').contains("Tutorien").click();
- cy.contains('Eigene Tutorien').should('exist');
- cy.contains('Sonstige Tutorien').should('exist');
- cy.get('.dropdown-menu').contains(lectures[2].title).should("exist");
- cy.get('.dropdown-menu').contains(lectures[3].title).should("exist");
- });
- });
- it("can create correction if tutor", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- teacher_id: 1
- }
- ],
- ["create",
- "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }
- ],
- ["create",
- "tutorial", {
- lecture_id: 1,
- tutor_ids: [1]
- }
- ],
- ["create",
- "assignment", "inactive", {
- lecture_id: 1
- }
- ],
- ["create",
- "assignment", {
- lecture_id: 1
- }
- ],
- ["create", "submission", "with_users", "with_manuscript", {
- assignment_id: 1,
- tutorial_id: 1
- }],
- ["create", "submission", "with_users", "with_manuscript", {
- assignment_id: 2,
- tutorial_id: 1
- }]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}`);
- cy.contains("Tutorien").click();
- cy.contains("Achtung").should("exist");
- cy.contains(lectures[4].title).click();
- cy.contains(lectures[3].title).click();
- cy.contains("Akzeptieren").click();
- cy.reload();
- cy.get(".correction-column").contains("Hochladen").click();
- const yourFixturePath = 'cypress/fixtures/files/manuscript.pdf';
- cy.get(".correction-column").contains("Datei").click();
- cy.get(`#upload-correction-${lectures[5].id}`).selectFile(yourFixturePath,{force:true});
- cy.contains("Upload").click();
- cy.get('.correction-upload > .mt-2 > .col-12 > .btn-primary').contains("Speichern").click();
- cy.reload();
- cy.get('.correction-action-area > [data-turbolinks="false"]').should("exist");
- });
- });
- it("can move submission if tutor", () => {
- cy.appFactories([
- ["create",
- "lecture", {
- teacher_id: 1
- }
- ],
- ["create",
- "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }
- ],
- ["create",
- "tutorial", {
- lecture_id: 1,
- tutor_ids: [1]
- }
- ],
- ["create",
- "tutorial", {
- lecture_id: 1
- }
- ],
- ["create",
- "assignment", {
- lecture_id: 1
- }
- ],
- ["create", "submission", "with_users", "with_manuscript", {
- assignment_id: 1,
- tutorial_id: 1
- }],
- ["create", "submission", "with_users", "with_manuscript", {
- assignment_id: 1,
- tutorial_id: 2
- }]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}`);
- cy.contains("Tutorien").click();
- cy.contains("Verschieben").click();
- cy.get('.ts-control').type(lectures[3].title);
- cy.get('.ts-control').type('{enter}');
- cy.get('.submission-actions > form > .mt-2 > .col-12 > .btn-primary').contains("Speichern").should("exist");
- cy.get('.submission-actions > form > .mt-2 > .col-12 > .btn-primary').contains("Speichern").click();
- cy.get('.submission-actions > form > .mt-2 > .col-12 > .btn-primary').contains("Speichern").click();
- cy.reload();
- cy.contains("Zu dieser Hausaufgabe liegen in diesem Tutorium keine Abgaben vor.").should("exist");
- });
- });
+ it("can view tutorials", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ },
+ ],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ["create",
+ "tutorial", "with_tutors", {
+ lecture_id: 1,
+ },
+ ],
+ ["create",
+ "assignment", {
+ lecture_id: 1,
+ },
+ ],
+ ["create", "submission", "with_users", "with_manuscript", "with_correction", {
+ assignment_id: 1,
+ tutorial_id: 1,
+ }],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}`);
+ cy.contains("Tutorien").should("exist");
+ cy.contains("Tutorien").click();
+ cy.get("main > .dropdown > .btn").contains("Tutorien").should("exist");
+ cy.get("main > .dropdown > .btn").contains("Tutorien").click();
+ cy.get("main > .dropdown > .dropdown-menu > .dropdown-item").contains(lectures[2].title).click();
+ cy.reload();
+ cy.contains("Übersicht").should("exist");
+ });
});
- describe("Tutor", () => {
- beforeEach(() => {
- cy.app("clean");
- cy.appScenario("non_admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("max@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- it("can upload correction if assignment inactive", () => {
- cy.appFactories([
- ["create",
- "lecture"
- ],
- ["create",
- "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }
- ],
- ["create",
- "tutorial", {
- lecture_id: 1,
- tutor_ids: [1]
- }
- ],
- ["create",
- "assignment", {
- lecture_id: 1
- }
- ],
- ["create",
- "assignment", "inactive", {
- lecture_id: 1
- }
- ],
- ["create", "submission", "with_users", "with_manuscript", {
- assignment_id: 1,
- tutorial_id: 1
- }],
- ["create", "submission", "with_users", "with_manuscript", {
- assignment_id: 2,
- tutorial_id: 1
- }]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}`);
- cy.contains("Tutorien").click();
- cy.contains("Tutorien").should("exist");
- cy.contains("Achtung").should("exist");
- cy.contains(lectures[3].title).click();
- cy.contains(lectures[4].title).click();
- cy.contains("Akzeptieren").click();
- cy.reload();
- cy.get(".correction-column").contains("Hochladen").click();
- const yourFixturePath = 'cypress/fixtures/files/manuscript.pdf';
- cy.get(`#upload-correction-${lectures[6].id}`).selectFile(yourFixturePath,{force:true});
- cy.contains("Upload").click();
- cy.get('.correction-upload > .mt-2 > .col-12 > .btn-primary').contains("Speichern").click();
- cy.reload();
- cy.get('.correction-action-area > [data-turbolinks="false"]').should("exist");
- });
- });
- it("can move submission", () => {
- cy.appFactories([
- ["create",
- "lecture"
- ],
- ["create",
- "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }
- ],
- ["create",
- "tutorial", {
- lecture_id: 1,
- tutor_ids: [1]
- }
- ],
- ["create",
- "tutorial", {
- lecture_id: 1
- }
- ],
- ["create",
- "assignment", {
- lecture_id: 1
- }
- ],
- ["create", "submission", "with_users", "with_manuscript", {
- assignment_id: 1,
- tutorial_id: 1
- }]
- ]).then((lectures) => {
- cy.visit(`lectures/${lectures[0].id}`);
- cy.contains("Tutorien").click();
- cy.contains("Verschieben").click();
- cy.get('.ts-control').type(lectures[3].title);
- cy.get('.ts-control').type('{enter}');
- cy.get('.submission-actions > form > .mt-2 > .col-12 > .btn-primary').contains("Speichern").should("exist");
- cy.get('.submission-actions > form > .mt-2 > .col-12 > .btn-primary').contains("Speichern").click();
- cy.get('.submission-actions > form > .mt-2 > .col-12 > .btn-primary').contains("Speichern").click();
- cy.reload();
- cy.contains("Zu dieser Hausaufgabe liegen in diesem Tutorium keine Abgaben vor.").should("exist");
- });
- });
+ it("can view tutorials if tutor", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ },
+ ],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ["create",
+ "tutorial", {
+ lecture_id: 1,
+ tutor_ids: [1],
+ },
+ ],
+ ["create",
+ "tutorial", "with_tutors", {
+ lecture_id: 1,
+ },
+ ],
+ ["create",
+ "assignment", {
+ lecture_id: 1,
+ },
+ ],
+ ["create", "submission", "with_users", "with_manuscript", "with_correction", {
+ assignment_id: 1,
+ tutorial_id: 1,
+ }],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}`);
+ cy.contains("Tutorien").should("exist");
+ cy.contains("Tutorien").click();
+ cy.get("main").contains("Übersicht").should("exist");
+ cy.get("main").contains("Übersicht").click();
+ cy.get("main > .dropdown > .btn").contains("Tutorien").click();
+ cy.contains("Eigene Tutorien").should("exist");
+ cy.contains("Sonstige Tutorien").should("exist");
+ cy.get(".dropdown-menu").contains(lectures[2].title).should("exist");
+ cy.get(".dropdown-menu").contains(lectures[3].title).should("exist");
+ });
});
-});
\ No newline at end of file
+ it("can create correction if tutor", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ },
+ ],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ["create",
+ "tutorial", {
+ lecture_id: 1,
+ tutor_ids: [1],
+ },
+ ],
+ ["create",
+ "assignment", "inactive", {
+ lecture_id: 1,
+ },
+ ],
+ ["create",
+ "assignment", {
+ lecture_id: 1,
+ },
+ ],
+ ["create", "submission", "with_users", "with_manuscript", {
+ assignment_id: 1,
+ tutorial_id: 1,
+ }],
+ ["create", "submission", "with_users", "with_manuscript", {
+ assignment_id: 2,
+ tutorial_id: 1,
+ }],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}`);
+ cy.contains("Tutorien").click();
+ cy.contains("Achtung").should("exist");
+ cy.contains(lectures[4].title).click();
+ cy.contains(lectures[3].title).click();
+ cy.contains("Akzeptieren").click();
+ cy.reload();
+ cy.get(".correction-column").contains("Hochladen").click();
+ const yourFixturePath = "cypress/fixtures/files/manuscript.pdf";
+ cy.get(".correction-column").contains("Datei").click();
+ cy.get(`#upload-correction-${lectures[5].id}`).selectFile(yourFixturePath, { force: true });
+ cy.contains("Upload").click();
+ cy.get(".correction-upload > .mt-2 > .col-12 > .btn-primary").contains("Speichern").click();
+ cy.reload();
+ cy.get('.correction-action-area > [data-turbolinks="false"]').should("exist");
+ });
+ });
+ it("can move submission if tutor", () => {
+ cy.appFactories([
+ ["create",
+ "lecture", {
+ teacher_id: 1,
+ },
+ ],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ["create",
+ "tutorial", {
+ lecture_id: 1,
+ tutor_ids: [1],
+ },
+ ],
+ ["create",
+ "tutorial", {
+ lecture_id: 1,
+ },
+ ],
+ ["create",
+ "assignment", {
+ lecture_id: 1,
+ },
+ ],
+ ["create", "submission", "with_users", "with_manuscript", {
+ assignment_id: 1,
+ tutorial_id: 1,
+ }],
+ ["create", "submission", "with_users", "with_manuscript", {
+ assignment_id: 1,
+ tutorial_id: 2,
+ }],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}`);
+ cy.contains("Tutorien").click();
+ cy.contains("Verschieben").click();
+ cy.get(".ts-control").type(lectures[3].title);
+ cy.get(".ts-control").type("{enter}");
+ cy.get(".submission-actions > form > .mt-2 > .col-12 > .btn-primary").contains("Speichern").should("exist");
+ cy.get(".submission-actions > form > .mt-2 > .col-12 > .btn-primary").contains("Speichern").click();
+ cy.get(".submission-actions > form > .mt-2 > .col-12 > .btn-primary").contains("Speichern").click();
+ cy.reload();
+ cy.contains("Zu dieser Hausaufgabe liegen in diesem Tutorium keine Abgaben vor.").should("exist");
+ });
+ });
+ });
+ describe("Tutor", () => {
+ beforeEach(() => {
+ cy.app("clean");
+ cy.appScenario("non_admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("max@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
+ });
+ it("can upload correction if assignment inactive", () => {
+ cy.appFactories([
+ ["create",
+ "lecture",
+ ],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ["create",
+ "tutorial", {
+ lecture_id: 1,
+ tutor_ids: [1],
+ },
+ ],
+ ["create",
+ "assignment", {
+ lecture_id: 1,
+ },
+ ],
+ ["create",
+ "assignment", "inactive", {
+ lecture_id: 1,
+ },
+ ],
+ ["create", "submission", "with_users", "with_manuscript", {
+ assignment_id: 1,
+ tutorial_id: 1,
+ }],
+ ["create", "submission", "with_users", "with_manuscript", {
+ assignment_id: 2,
+ tutorial_id: 1,
+ }],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}`);
+ cy.contains("Tutorien").click();
+ cy.contains("Tutorien").should("exist");
+ cy.contains("Achtung").should("exist");
+ cy.contains(lectures[3].title).click();
+ cy.contains(lectures[4].title).click();
+ cy.contains("Akzeptieren").click();
+ cy.reload();
+ cy.get(".correction-column").contains("Hochladen").click();
+ const yourFixturePath = "cypress/fixtures/files/manuscript.pdf";
+ cy.get(`#upload-correction-${lectures[6].id}`).selectFile(yourFixturePath, { force: true });
+ cy.contains("Upload").click();
+ cy.get(".correction-upload > .mt-2 > .col-12 > .btn-primary").contains("Speichern").click();
+ cy.reload();
+ cy.get('.correction-action-area > [data-turbolinks="false"]').should("exist");
+ });
+ });
+ it("can move submission", () => {
+ cy.appFactories([
+ ["create",
+ "lecture",
+ ],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ["create",
+ "tutorial", {
+ lecture_id: 1,
+ tutor_ids: [1],
+ },
+ ],
+ ["create",
+ "tutorial", {
+ lecture_id: 1,
+ },
+ ],
+ ["create",
+ "assignment", {
+ lecture_id: 1,
+ },
+ ],
+ ["create", "submission", "with_users", "with_manuscript", {
+ assignment_id: 1,
+ tutorial_id: 1,
+ }],
+ ]).then((lectures) => {
+ cy.visit(`lectures/${lectures[0].id}`);
+ cy.contains("Tutorien").click();
+ cy.contains("Verschieben").click();
+ cy.get(".ts-control").type(lectures[3].title);
+ cy.get(".ts-control").type("{enter}");
+ cy.get(".submission-actions > form > .mt-2 > .col-12 > .btn-primary").contains("Speichern").should("exist");
+ cy.get(".submission-actions > form > .mt-2 > .col-12 > .btn-primary").contains("Speichern").click();
+ cy.get(".submission-actions > form > .mt-2 > .col-12 > .btn-primary").contains("Speichern").click();
+ cy.reload();
+ cy.contains("Zu dieser Hausaufgabe liegen in diesem Tutorium keine Abgaben vor.").should("exist");
+ });
+ });
+ });
+});
diff --git a/spec/cypress/e2e/watchlists_spec.cy.js b/spec/cypress/e2e/watchlists_spec.cy.js
index f9d773671..4f6cedaa0 100644
--- a/spec/cypress/e2e/watchlists_spec.cy.js
+++ b/spec/cypress/e2e/watchlists_spec.cy.js
@@ -1,209 +1,208 @@
describe("Watchlists", () => {
-
+ beforeEach(() => {
+ cy.app("clean");
+ });
+ describe("User", () => {
beforeEach(() => {
- cy.app("clean");
+ cy.app("clean");
+ cy.appScenario("non_admin");
+ cy.visit("/users/sign_in");
+ cy.get('input[type="email"]').type("max@mampf.edu");
+ cy.get('input[type="password"]').type("test123456");
+ cy.get('input[type="submit"]').click();
});
- describe("User", () => {
- beforeEach(() => {
- cy.app("clean");
- cy.appScenario("non_admin");
- cy.visit("/users/sign_in");
- cy.get('input[type="email"]').type("max@mampf.edu");
- cy.get('input[type="password"]').type("test123456");
- cy.get('input[type="submit"]').click();
- });
- // it("can create and add to watchlist in lecture", () => {
- // cy.appFactories([
- // ["create", "lecture_medium", "with_manuscript", "released"],
- // ["create",
- // "lecture_user_join", {
- // user_id: 1,
- // lecture_id: 1
- // }
- // ]
- // ]).then((data) => {
- // cy.visit(`lectures/${data[0].id}`);
- // cy.get('.nav > :nth-child(6) > .nav-link').click();
- // cy.get('div.text-light > .fa-list').click();
- // cy.get('#openNewWatchlistForm').click();
- // cy.get('#watchlistNameField').type('Lernliste');
- // cy.get(100);
- // cy.get('#createWatchlistBtn').click();
- // cy.get('#watchlistEntrySubmitButton').click();
- // cy.wait(100);
- // cy.get('div.text-light > .fa-list').click();
- // cy.get('#watchlistEntrySubmitButton').click();
- // cy.get('.invalid-feedback').should('exist');
- // cy.wait(200);
- // cy.get('.close > span').click();
- // cy.wait(100);
- // cy.get('#watchlistsIcon').click();
- // cy.get('#card-title').should('exist');
- // });
- // });
- it("can change watchlist", () => {
- cy.appFactories([
- ["create", "watchlist", {
- user_id: 1
- }]
- ]).then((data) => {
- cy.visit(`watchlists/1`);
- cy.get('#changeWatchlistBtn').click();
- cy.get('#watchlistNameField').should('have.value', `${data[0].name}`);
- cy.get('#watchlistNameField').clear();
- cy.wait(500);
- cy.get('#watchlistNameField').type('Lernliste');
- cy.get('#watchlistDescriptionField').type('Dies ist eine Lernliste.');
- cy.get('#confirmChangeWatchlistButton').click();
- cy.wait(100);
- cy.get('#watchlistButton').contains('Lernliste');
- cy.get('#descriptionButton').click();
- cy.get('.card').contains('Dies ist eine Lernliste.')
- });
- })
- it("can create new watchlist in watchlist view", () => {
- cy.appFactories([
- ]).then((data) => {
- cy.get('#watchlistsIcon').click();
- cy.get('#openNewWatchlistForm').click();
- cy.get('#watchlistNameField').type('Lernliste');
- cy.get('#newWatchlistButton').click();
- cy.wait(100);
- cy.get('#watchlistButton').contains('Lernliste');
- });
- });
- it("can use bookmark", () => {
- cy.appFactories([
- ["create", "watchlist", {
- user_id: 1
- }],
- ["create", "watchlist_entry", "with_medium", {
- watchlist_id: 1
- }],
- ["create",
- "lecture_user_join", {
- user_id: 1,
- lecture_id: 1
- }
- ]
- ]).then((data) => {
- cy.visit('lectures/1');
- cy.get('#watchlistsIcon').click();
- cy.get('#watchlistButton').contains(`${data[0].name}`).should('exist');
- });
- });
- it("can change visibility of watchlist", () => {
- cy.appFactories([
- ["create", "watchlist", {
- user_id: 1
- }]
- ]).then((data) => {
- cy.visit(`watchlists/1`);
- cy.get('#watchlistVisiblityCheck').should('not.be.checked');
- cy.get('#watchlistVisiblityCheck').click();
- cy.reload();
- cy.get('#watchlistVisiblityCheck').should('be.checked');
- });
- });
- it("can view public watchlist of other user", () => {
- cy.appFactories([
- ["create", "watchlist", "with_user", {
- public: true
- }]
- ]).then((data) => {
- cy.visit(`watchlists/1`);
- cy.get('#watchlistButton').should('exist');
- });
- });
- it("can not view private watchlist of other user", () => {
- cy.appFactories([
- ["create", "watchlist", "with_user", {
- public: false
- }]
- ]).then((data) => {
- cy.visit(`watchlists/1`);
- cy.get(':nth-child(3) > .row > .col-12 > :nth-child(2)').contains('Du bist nicht berechtigt').should('exist');
- });
- });
- it("can filter watchlist_entries", () => {
- cy.appFactories([
- ["create", "watchlist", {
- user_id: 1
- }],
- ["create_list", "watchlist_entry", 5, "with_medium", {
- watchlist_id: 1
- }]
- ]).then((data) => {
- cy.get('#watchlistsIcon').click();
- cy.get('#reverseButton').click();
- cy.wait(100);
- cy.get('#perPageButton').click();
- cy.get('[href="/watchlists/1?page=1&per=3&reverse=true"]').click();
- cy.wait(100);
- cy.get('#allButton').click();
- cy.get('#watchlistButton').should('exist');
- cy.get('.active > .page-link').should('not.exist');
- });
- });
- it("can drag and drop watchlist_entry", () => {
- cy.appFactories([
- ["create", "watchlist", {
- user_id: 1
- }],
- ["create", "watchlist_entry", "with_medium", {
- watchlist_id: 1
- }],
- ["create", "watchlist_entry", "with_medium", {
- watchlist_id: 1
- }],
- ["create", "watchlist_entry", "with_medium", {
- watchlist_id: 1
- }]
- ]).then((data) => {
- cy.get('#watchlistsIcon').click();
- cy.get(':nth-child(1) > .card > .card-header').trigger('mousedown', { which: 1 });
- cy.wait(100);
- cy.get(':nth-child(3) > .card > .card-header').trigger('mousemove', 0, 0);
- cy.wait(100);
- cy.get(':nth-child(1) > .card > .card-header').trigger('mouseup');
- cy.reload();
- cy.wait(100);
- cy.get(':nth-child(1) > .card > .card-header > :nth-child(1) > #card-title').contains(`${data[2].medium_id}`).should('exist');
- });
- });
- it("can delete watchlist_entry from watchlist", () => {
- cy.appFactories([
- ["create", "watchlist", {
- user_id: 1
- }],
- ["create", "watchlist_entry", "with_medium", {
- watchlist_id: 1
- }]
- ]).then((data) => {
- cy.get('#watchlistsIcon').click();
- cy.get('div.text-light > .fas').click();
- cy.get('.alert-secondary').should('exist');
- cy.get('#watchlistButton').contains(`${data[0].name}`).should('exist');
- });
- });
- it("can delete watchlist", () => {
- cy.appFactories([
- ["create", "lecture_medium", "released"],
- ["create", "watchlist", {
- user_id: 1
- }],
- ["create", "watchlist", {
- user_id: 1
- }]
- ]).then((data) => {
- cy.get('#watchlistsIcon').click();
- cy.contains(`${data[1].name}`).click();
- cy.contains(`${data[2].name}`).click();
- cy.wait(100);
- cy.get('#deleteWatchlistBtn').click();
- cy.contains(`${data[1].name}`).should('exist');
- cy.get('.alert-secondary').should('exist');
- });
- });
+ /* it("can create and add to watchlist in lecture", () => {
+ cy.appFactories([
+ ["create", "lecture_medium", "with_manuscript", "released"],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ]).then((data) => {
+ cy.visit(`lectures/${data[0].id}`);
+ cy.get(".nav > :nth-child(6) > .nav-link").click();
+ cy.get("div.text-light > .fa-list").click();
+ cy.get("#openNewWatchlistForm").click();
+ cy.get("#watchlistNameField").type("Lernliste");
+ cy.get(100);
+ cy.get("#createWatchlistBtn").click();
+ cy.get("#watchlistEntrySubmitButton").click();
+ cy.wait(100);
+ cy.get("div.text-light > .fa-list").click();
+ cy.get("#watchlistEntrySubmitButton").click();
+ cy.get(".invalid-feedback").should("exist");
+ cy.wait(200);
+ cy.get(".close > span").click();
+ cy.wait(100);
+ cy.get("#watchlistsIcon").click();
+ cy.get("#card-title").should("exist");
+ });
+ }); */
+ it("can change watchlist", () => {
+ cy.appFactories([
+ ["create", "watchlist", {
+ user_id: 1,
+ }],
+ ]).then((data) => {
+ cy.visit("watchlists/1");
+ cy.get("#changeWatchlistBtn").click();
+ cy.get("#watchlistNameField").should("have.value", `${data[0].name}`);
+ cy.get("#watchlistNameField").clear();
+ cy.wait(500);
+ cy.get("#watchlistNameField").type("Lernliste");
+ cy.get("#watchlistDescriptionField").type("Dies ist eine Lernliste.");
+ cy.get("#confirmChangeWatchlistButton").click();
+ cy.wait(100);
+ cy.get("#watchlistButton").contains("Lernliste");
+ cy.get("#descriptionButton").click();
+ cy.get(".card").contains("Dies ist eine Lernliste.");
+ });
});
-});
\ No newline at end of file
+ it("can create new watchlist in watchlist view", () => {
+ cy.appFactories([
+ ]).then((_data) => {
+ cy.get("#watchlistsIcon").click();
+ cy.get("#openNewWatchlistForm").click();
+ cy.get("#watchlistNameField").type("Lernliste");
+ cy.get("#newWatchlistButton").click();
+ cy.wait(100);
+ cy.get("#watchlistButton").contains("Lernliste");
+ });
+ });
+ it("can use bookmark", () => {
+ cy.appFactories([
+ ["create", "watchlist", {
+ user_id: 1,
+ }],
+ ["create", "watchlist_entry", "with_medium", {
+ watchlist_id: 1,
+ }],
+ ["create",
+ "lecture_user_join", {
+ user_id: 1,
+ lecture_id: 1,
+ },
+ ],
+ ]).then((data) => {
+ cy.visit("lectures/1");
+ cy.get("#watchlistsIcon").click();
+ cy.get("#watchlistButton").contains(`${data[0].name}`).should("exist");
+ });
+ });
+ it("can change visibility of watchlist", () => {
+ cy.appFactories([
+ ["create", "watchlist", {
+ user_id: 1,
+ }],
+ ]).then((_data) => {
+ cy.visit("watchlists/1");
+ cy.get("#watchlistVisiblityCheck").should("not.be.checked");
+ cy.get("#watchlistVisiblityCheck").click();
+ cy.reload();
+ cy.get("#watchlistVisiblityCheck").should("be.checked");
+ });
+ });
+ it("can view public watchlist of other user", () => {
+ cy.appFactories([
+ ["create", "watchlist", "with_user", {
+ public: true,
+ }],
+ ]).then((_data) => {
+ cy.visit("watchlists/1");
+ cy.get("#watchlistButton").should("exist");
+ });
+ });
+ it("can not view private watchlist of other user", () => {
+ cy.appFactories([
+ ["create", "watchlist", "with_user", {
+ public: false,
+ }],
+ ]).then((_data) => {
+ cy.visit("watchlists/1");
+ cy.get(":nth-child(3) > .row > .col-12 > :nth-child(2)").contains("Du bist nicht berechtigt").should("exist");
+ });
+ });
+ it("can filter watchlist_entries", () => {
+ cy.appFactories([
+ ["create", "watchlist", {
+ user_id: 1,
+ }],
+ ["create_list", "watchlist_entry", 5, "with_medium", {
+ watchlist_id: 1,
+ }],
+ ]).then((_data) => {
+ cy.get("#watchlistsIcon").click();
+ cy.get("#reverseButton").click();
+ cy.wait(100);
+ cy.get("#perPageButton").click();
+ cy.get('[href="/watchlists/1?page=1&per=3&reverse=true"]').click();
+ cy.wait(100);
+ cy.get("#allButton").click();
+ cy.get("#watchlistButton").should("exist");
+ cy.get(".active > .page-link").should("not.exist");
+ });
+ });
+ it("can drag and drop watchlist_entry", () => {
+ cy.appFactories([
+ ["create", "watchlist", {
+ user_id: 1,
+ }],
+ ["create", "watchlist_entry", "with_medium", {
+ watchlist_id: 1,
+ }],
+ ["create", "watchlist_entry", "with_medium", {
+ watchlist_id: 1,
+ }],
+ ["create", "watchlist_entry", "with_medium", {
+ watchlist_id: 1,
+ }],
+ ]).then((data) => {
+ cy.get("#watchlistsIcon").click();
+ cy.get(":nth-child(1) > .card > .card-header").trigger("mousedown", { which: 1 });
+ cy.wait(100);
+ cy.get(":nth-child(3) > .card > .card-header").trigger("mousemove", 0, 0);
+ cy.wait(100);
+ cy.get(":nth-child(1) > .card > .card-header").trigger("mouseup");
+ cy.reload();
+ cy.wait(100);
+ cy.get(":nth-child(1) > .card > .card-header > :nth-child(1) > #card-title").contains(`${data[2].medium_id}`).should("exist");
+ });
+ });
+ it("can delete watchlist_entry from watchlist", () => {
+ cy.appFactories([
+ ["create", "watchlist", {
+ user_id: 1,
+ }],
+ ["create", "watchlist_entry", "with_medium", {
+ watchlist_id: 1,
+ }],
+ ]).then((data) => {
+ cy.get("#watchlistsIcon").click();
+ cy.get("div.text-light > .fas").click();
+ cy.get(".alert-secondary").should("exist");
+ cy.get("#watchlistButton").contains(`${data[0].name}`).should("exist");
+ });
+ });
+ it("can delete watchlist", () => {
+ cy.appFactories([
+ ["create", "lecture_medium", "released"],
+ ["create", "watchlist", {
+ user_id: 1,
+ }],
+ ["create", "watchlist", {
+ user_id: 1,
+ }],
+ ]).then((data) => {
+ cy.get("#watchlistsIcon").click();
+ cy.contains(`${data[1].name}`).click();
+ cy.contains(`${data[2].name}`).click();
+ cy.wait(100);
+ cy.get("#deleteWatchlistBtn").click();
+ cy.contains(`${data[1].name}`).should("exist");
+ cy.get(".alert-secondary").should("exist");
+ });
+ });
+ });
+});
diff --git a/spec/cypress/plugins/index.js b/spec/cypress/plugins/index.js
index 8dd144a6c..3596c1897 100644
--- a/spec/cypress/plugins/index.js
+++ b/spec/cypress/plugins/index.js
@@ -15,7 +15,7 @@
/**
* @type {Cypress.PluginConfig}
*/
-module.exports = (on, config) => {
+module.exports = (_on, _config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
};
diff --git a/spec/cypress/support/e2e.js b/spec/cypress/support/e2e.js
index 3f5a4b829..06682f943 100644
--- a/spec/cypress/support/e2e.js
+++ b/spec/cypress/support/e2e.js
@@ -1,2 +1,2 @@
-import './commands'
-import './on-rails'
\ No newline at end of file
+import "./commands";
+import "./on-rails";
diff --git a/spec/cypress/support/index.js b/spec/cypress/support/index.js
index d19205882..4253b2efb 100644
--- a/spec/cypress/support/index.js
+++ b/spec/cypress/support/index.js
@@ -14,8 +14,8 @@
// ***********************************************************
// Import commands.js using ES2015 syntax:
-import './commands';
-import './on-rails';
+import "./commands";
+import "./on-rails";
// Alternatively you can use CommonJS syntax:
// require('./commands')
diff --git a/spec/cypress/support/on-rails.js b/spec/cypress/support/on-rails.js
index 337ae52da..cda668f24 100644
--- a/spec/cypress/support/on-rails.js
+++ b/spec/cypress/support/on-rails.js
@@ -1,37 +1,37 @@
// CypressOnRails: dont remove these command
-Cypress.Commands.add('appCommands', function (body) {
+Cypress.Commands.add("appCommands", function (body) {
cy.log("APP: " + JSON.stringify(body));
return cy.request({
- method: 'POST',
+ method: "POST",
url: "/__cypress__/command",
body: JSON.stringify(body),
log: true,
- failOnStatusCode: true
+ failOnStatusCode: true,
}).then((response) => {
return response.body;
});
});
-Cypress.Commands.add('app', function (name, command_options) {
- return cy.appCommands({name: name, options: command_options}).then((body) => {
+Cypress.Commands.add("app", function (name, command_options) {
+ return cy.appCommands({ name: name, options: command_options }).then((body) => {
return body[0];
});
});
-Cypress.Commands.add('appScenario', function (name, options = {}) {
- return cy.app('scenarios/' + name, options);
+Cypress.Commands.add("appScenario", function (name, options = {}) {
+ return cy.app("scenarios/" + name, options);
});
-Cypress.Commands.add('appEval', function (code) {
- return cy.app('eval', code);
+Cypress.Commands.add("appEval", function (code) {
+ return cy.app("eval", code);
});
-Cypress.Commands.add('appFactories', function (options) {
- return cy.app('factory_bot', options);
+Cypress.Commands.add("appFactories", function (options) {
+ return cy.app("factory_bot", options);
});
-Cypress.Commands.add('appFixtures', function (options) {
- cy.app('activerecord_fixtures', options);
+Cypress.Commands.add("appFixtures", function (options) {
+ cy.app("activerecord_fixtures", options);
});
Cypress.Commands.add("dragTo", { prevSubject: "element" }, (subject, targetEl) => {
@@ -46,13 +46,13 @@ Cypress.Commands.add("dragTo", { prevSubject: "element" }, (subject, targetEl) =
// });
// comment this out if you do not want to attempt to log additional info on test fail
-Cypress.on('fail', (err, runnable) => {
+Cypress.on("fail", (err, runnable) => {
// allow app to generate additional logging data
Cypress.$.ajax({
- url: '/__cypress__/command',
- data: JSON.stringify({name: 'log_fail', options: {error_message: err.message, runnable_full_title: runnable.fullTitle() }}),
+ url: "/__cypress__/command",
+ data: JSON.stringify({ name: "log_fail", options: { error_message: err.message, runnable_full_title: runnable.fullTitle() } }),
async: false,
- method: 'POST'
+ method: "POST",
});
throw err;
diff --git a/yarn.lock b/yarn.lock
index 9ef709e2c..a32b4e906 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3242,6 +3242,13 @@ escape-string-regexp@^4.0.0:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
+eslint-plugin-cypress@^2.15.1:
+ version "2.15.1"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-cypress/-/eslint-plugin-cypress-2.15.1.tgz#336afa7e8e27451afaf65aa359c9509e0a4f3a7b"
+ integrity sha512-eLHLWP5Q+I4j2AWepYq0PgFEei9/s5LvjuSqWrxurkg1YZ8ltxdvMNmdSf0drnsNo57CTgYY/NIHHLRSWejR7w==
+ dependencies:
+ globals "^13.20.0"
+
eslint-plugin-erb@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-erb/-/eslint-plugin-erb-1.1.0.tgz#ac0ac8d5b5e75602c0e41016ff525748cc66d95e"
@@ -3902,6 +3909,13 @@ globals@^13.19.0:
dependencies:
type-fest "^0.20.2"
+globals@^13.20.0:
+ version "13.24.0"
+ resolved "https://registry.yarnpkg.com/globals/-/globals-13.24.0.tgz#8432a19d78ce0c1e833949c36adb345400bb1171"
+ integrity sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==
+ dependencies:
+ type-fest "^0.20.2"
+
globalthis@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf"