diff --git a/frontend/frontend/cypress/page/addChangeAssignmentPage/AddChangeAssignmentPage.cy.tsx b/frontend/frontend/cypress/page/addChangeAssignmentPage/AddChangeAssignmentPage.cy.tsx
index 887df0a6..be946e49 100644
--- a/frontend/frontend/cypress/page/addChangeAssignmentPage/AddChangeAssignmentPage.cy.tsx
+++ b/frontend/frontend/cypress/page/addChangeAssignmentPage/AddChangeAssignmentPage.cy.tsx
@@ -1,56 +1,18 @@
-import {AddChangeAssignmentPage} from '../../../src/pages/addChangeAssignmentPage/AddChangeAssignmentPage'; // Check if the file path is correct and if the required module exists in the specified location.
-import {BrowserRouter} from 'react-router-dom';
-import fixtures from '../../fixtures/fixtures.json';
+import { AddChangeAssignmentPage } from '../../../src/pages/addChangeAssignmentPage/AddChangeAssignmentPage' // Check if the file path is correct and if the required module exists in the specified location.
+import { BrowserRouter } from 'react-router-dom'
+// This page fetches data from the backend.
+// So as far as the component test is concerned,
+// we can only show what shows up before the fetch.
+// This is why only the loading animation is checked.
+// The rest of the tests are in the integration tests.
describe('AddChangeAssignmentPage', () => {
-
it('renders assignment name', () => {
- cy.mount();
- // check if the header is rendered
- cy.get('#logo').should('exist');
- cy.get('#userMenu').should('exist');
- // title field
- cy.get('#titleField').should('have.attr', 'placeholder', 'Title');
- cy.get('#titleField').type('New title');
- cy.get('#titleField').should('have.value', 'New title');
- cy.get('#uploadButton').should('exist');
- // deadline field
- cy.get('#deadline').should('have.text', 'Deadline:');
- cy.get('#deadlineField').should('have.attr', 'placeholder', 'DD/MM/YYYY hh:mm');
- cy.get('#deadlineField').type('311220252359');
- cy.get('#deadlineField').should('have.value', '31/12/2025 23:59');
- // extra deadline field
- cy.get('#extraDeadline').should('have.text', 'Extra Deadline:');
- cy.get('#extraDeadlineField').should('have.attr', 'placeholder', 'DD/MM/YYYY hh:mm');
- cy.get('#extraDeadlineField').type('311220262359');
- cy.get('#extraDeadlineField').should('have.value', '31/12/2026 23:59');
- //description field
- cy.get('#descriptionField').should('have.attr', 'placeholder', 'Description');
- cy.get('#descriptionField').type('New description');
- cy.get('#descriptionField').should('have.value', 'New description');
- // restrictions field
- cy.get('#addRestrictionButton').should('exist').click();
- cy.get('#upload').should('exist');
- cy.get('#newScript').should('exist');
- cy.get('#fileExtensionCheck').should('exist');
- cy.get('#filesPresentCheck').should('exist');
- cy.get('#mustPassSwitch').should('exist');
- cy.get('#cancelButton').should('exist').click();
- // max score field
- cy.get('#maxScore').should('have.text', 'Max Score:');
- cy.get('#maxScoreField').should('have.value', '20');
- cy.get('#maxScoreField').clear().type('30');
- cy.get('#maxScoreField').should('have.value', '30');
- // all buttons
- cy.get('#visibilityOff').should('exist').click();
- cy.get('#visibilityOn').should('exist').click();
- cy.get('#cancel').should('exist').click();
- // these have popups
- cy.get('#submit').should('exist').click();
- cy.get('#cancelButton').should('exist').click();
- cy.get('#delete').should('exist').click();
- cy.get('#actionButton').should('exist').click();
-
- });
-
-});
\ No newline at end of file
+ cy.mount(
+
+
+
+ )
+ cy.get('[data-cy=loadingAnimation]').should('exist')
+ })
+})
diff --git a/frontend/frontend/cypress/page/addChangeAssignmentPage/AddRestrictionButton.cy.tsx b/frontend/frontend/cypress/page/addChangeAssignmentPage/AddRestrictionButton.cy.tsx
index fe324a96..b2a079d2 100644
--- a/frontend/frontend/cypress/page/addChangeAssignmentPage/AddRestrictionButton.cy.tsx
+++ b/frontend/frontend/cypress/page/addChangeAssignmentPage/AddRestrictionButton.cy.tsx
@@ -1,22 +1,21 @@
-import AddRestrictionButton from '../../../src/pages/addChangeAssignmentPage/AddRestrictionButton';
-import {BrowserRouter} from 'react-router-dom';
+import AddRestrictionButton from '../../../src/pages/addChangeAssignmentPage/AddRestrictionButton'
+import { BrowserRouter } from 'react-router-dom'
describe('AddRestrictionsButton', () => {
-
const mockProps = {
restrictions: [],
- setRestrictions: () => {}
- };
+ setRestrictions: () => {},
+ }
it('renders the restrictions add button', () => {
- cy.mount();
- cy.get('#addRestrictionButton').should('exist').click();
- cy.get('#upload').should('exist');
- cy.get('#newScript').should('exist');
- cy.get('#fileExtensionCheck').should('exist');
- cy.get('#filesPresentCheck').should('exist');
- cy.get('#mustPassSwitch').should('exist').click();
- cy.get('#cancelButton').should('exist').click();
- });
-
-});
\ No newline at end of file
+ cy.mount(
+
+
+
+ )
+ cy.get('#addRestrictionButton').should('exist').click()
+ cy.get('#upload').should('exist')
+ cy.get('#newScript').should('exist')
+ cy.get('#cancelButton').should('exist').click()
+ })
+})
diff --git a/frontend/frontend/cypress/page/addChangeAssignmentPage/RestrictionsDialog.cy.tsx b/frontend/frontend/cypress/page/addChangeAssignmentPage/RestrictionsDialog.cy.tsx
index 5e4859b1..4556bbc1 100644
--- a/frontend/frontend/cypress/page/addChangeAssignmentPage/RestrictionsDialog.cy.tsx
+++ b/frontend/frontend/cypress/page/addChangeAssignmentPage/RestrictionsDialog.cy.tsx
@@ -1,21 +1,31 @@
-import RestrictionsDialog from '../../../src/pages/addChangeAssignmentPage/RestrictionsDialog';
-import {BrowserRouter} from 'react-router-dom';
+import RestrictionsDialog from '../../../src/pages/addChangeAssignmentPage/RestrictionsDialog'
+import { BrowserRouter } from 'react-router-dom'
describe('RestrictionsDialog', () => {
-
const mockProps = {
+ userid: 1,
restrictions: [],
setRestrictions: () => {},
closeParentDialog: () => {},
- };
+ }
it('renders the dialog', () => {
- cy.mount();
- cy.get('#upload').should('exist');
- cy.get('#newScript').should('exist');
- cy.get('#fileExtensionCheck').should('exist');
- cy.get('#filesPresentCheck').should('exist');
- cy.get('#mustPassSwitch').should('exist').click();
- });
-
-});
\ No newline at end of file
+ cy.mount(
+
+
+
+ )
+ cy.get('[data-cy=new_scripts_section]').should('exist')
+ cy.get('#upload').should('exist')
+ cy.get('[data-cy=uploadInput]').should('exist')
+ cy.get('#newScript').should('exist')
+ cy.get('[data-cy=existing_scripts_section]').should('exist')
+ cy.get('#newScript').click()
+ cy.get('[data-cy=closeIcon]').should('exist')
+ cy.get('#scriptName').should('exist')
+ cy.get('#extension').should('exist')
+ cy.get('#saveTemplate').should('exist')
+ cy.get('#saveScript').should('exist')
+ cy.get('#scriptContent').should('exist')
+ })
+})
diff --git a/frontend/frontend/src/pages/addChangeAssignmentPage/AddChangeAssignmentPage.tsx b/frontend/frontend/src/pages/addChangeAssignmentPage/AddChangeAssignmentPage.tsx
index ee24807b..961b0146 100644
--- a/frontend/frontend/src/pages/addChangeAssignmentPage/AddChangeAssignmentPage.tsx
+++ b/frontend/frontend/src/pages/addChangeAssignmentPage/AddChangeAssignmentPage.tsx
@@ -486,7 +486,7 @@ export function AddChangeAssignmentPage() {
height: '100vh',
}}
>
-
+
) : (
diff --git a/frontend/frontend/src/pages/addChangeAssignmentPage/RestrictionsDialog.tsx b/frontend/frontend/src/pages/addChangeAssignmentPage/RestrictionsDialog.tsx
index d5a848ec..56221fd9 100644
--- a/frontend/frontend/src/pages/addChangeAssignmentPage/RestrictionsDialog.tsx
+++ b/frontend/frontend/src/pages/addChangeAssignmentPage/RestrictionsDialog.tsx
@@ -234,6 +234,7 @@ export default function RestrictionsDialog({
{/* File input for uploading files */}
{
@@ -242,7 +243,11 @@ export default function RestrictionsDialog({
multiple
/>
{/* Vertical button group */}
-
+
{t('make_new_script') + ':'}
@@ -255,7 +260,11 @@ export default function RestrictionsDialog({
{buttons}
-
+
{t('choose_existing') + ':'}