Skip to content

Commit

Permalink
[#11878] Account request form (#13048)
Browse files Browse the repository at this point in the history
* Enable CI on account request form branch

* [#11878] Remove AccountRequest unique constraint (#12899)

* Remove AccountRequest unique constraint

* Remove EntityAlreadyExistsException from the throws clause

* Remove unused import of EntityAlreadyExistsException

* Fix failing checks

* Remove EntityAlreadyExistsException in dependents

* Remove assertion that is now incorrect

* Remove mysterious trailing whitespaces that appeared out of nowhere

* Remove parts in E2E test that are no longer relevant

* Remove unused import

* Improve clarity of test case

Co-authored-by: EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com>

---------

Co-authored-by: EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com>

* [#11878] Add status and comments to AccountRequest (#12898)

* Add AccountRequestStatus

* Add AccountRequest status attribute

* Add status to AccountRequest constructor

* Add AccountRequest comments attribute

* Add comments to AccountRequest constructor

* Wrap lines

* Remove mysterious unnecessary imports that appeared out of nowhere

* Use non-null placeholder

* Use literal placeholder

* [#11878] Add new account request alert email for admins (#12926)

* Add admin alert email

* Add email type

* Add subject

* Add email content

* Indicate that action is needed in the email subject

* [#11878] Add GetAllPendingAccountRequests API (#12927)

* add endpoint

* remove 'all' in class and method names

* fix checkstyle

* add it test

* fix checkstyle

* fix checkstyle

* fix failing test

* update endpoint url

* update it tests

* fix linting

* update param name

* update request param condition

* [#11878] Modify CreateAccountRequestAction (#12913)

* Add AccountCreateRequest instructorComments attribute

* Add new AccountRequestData attributes

* Remove check for registered instructor

* Remove sending of registration email

* Use AccountCreateRequest comments

* Change output of CreateAccountRequestAction to AccountRequestData

* Add CreateAccountRequestActionIT

* Test execute with null arguments

* Test execute with valid requests

* Test execute on invalid arguments

* Allow anybody to create an account request

* Fix architecture test

* Fix test

* Update tests to verify search indexing

* [#11878] Upgrade instructor request form UI (#12929)

* Add confirmation prompt

* Remove old form iframe

* Improve declaration view spacing

* Edit page heading phrasing for clarity

* Create request form

* Add validation messages

* Fix form validation

* Set up form submission confirmation

* Create submission acknowledgement view

* Fix URL checking regex

* Fix initial state

* Display placeholder when optional field is empty

* Fix code style

* Edit comment for clarity

* Fix institution and country combination

Co-authored-by: Jay Aljelo Ting <65202977+jayasting98@users.noreply.github.com>

* Fix naming

* Remove hard line break

* Add explanatory comment for regex

* Remove newline

* Add newlines at end of file

* Clear styles file

* Re-add styles file

* Include test

* Add test cases for requestSubmissionEvent

* Improve test case readability

* Edit test case name for clarity

* Add snapshot tests

* Revert "Add snapshot tests"

This reverts commit ec7395d.

* Fix lint errors

* Rename methods to be clearer

* Disable submit button when not ready to submit

---------

Co-authored-by: Jay Aljelo Ting <65202977+jayasting98@users.noreply.github.com>

* [#11878] Update Admin Home Page UI for ARF (#12933)

* create component for account request table

* cherry pick admin home page changes

* remove testing code

* fix lint and css issues

* fix admin home page snaps

* update admin home snaps

* remove edit approve and reject components

* modify css

* delete edit and reject modal components

* revert spec file changes

* integrate new types

* fix lint

* use enum for status

* fix lint

* fix css lint

* fix lint

* fix lint

* use enum and remove infinite scroll

* remove approve account request code

* remove extra div

* fix url

* modify comments

* revert extra formatting

* remove plural form and use date pipe

* fix naming

* fix spec file and update institute formatting

* fix lint

* combine institute and country columns

* [#11878] Admin Search UI Update for ARF (#12945)

* update admin search page to use acc req component

* fix selector for e2e test

* fix spec files and imports

* update e2e selector

* fix column numbers

* [#11878] Add methods to get an account request by ID (#12953)

* Add facade logic method to get an account request by ID

* Add storage method to get an account request by ID

* Add logic method to get an account request by ID

* [#11878] Add snapshot tests for instructor request form UI (#12942)

* Add snapshot tests

* Change double quotes to single quotes

* [#11878] Foundation for getting by ID in account request endpoints (#12957)

* Add account request ID query parameter

* Add account request ID to related front-end types

* Get account requests by ID in storage update method (#12955)

* Get an account request by ID in SQL injection tests (#12956)

* [#11878] Create instructor request acknowledgement email (#12944)

* Create instructor request acknowledgement email

* Add tests for acknowledgement email

* Fix test cases

* Fix comments in expected email

* Use config support email value in email template

* Fix email recipient

* Fix test expected emails

* Remove trailing space

* Use placeholder for support email

* Sanitize acknowledgement email

* Set acknowledgement email to bcc support

* [#11878] Merge master into account-request-form (#12972)

* Update chrome driver download link in e2e-testing.md (#12924)

* [#12048] Add SQL configuration into build.properties and build-dev.properties (#12917)

* Add production config

* Remove forgotten host and password

* Fix lint

---------

Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* [#12048] Add SQL description for postgres config (#12931)

* Add production config

* Remove forgotten host and password

* Fix lint

* Address changes, include production_user

* Linting

* [#12588] Improve test code coverage of core components - ToastComponent (#12916)

* add test cases

* add test case for isTemplate()

---------

Co-authored-by: Cedric Ong <67156011+cedricongjh@users.noreply.github.com>
Co-authored-by: Dominic Lim <46486515+domlimm@users.noreply.github.com>

* [#12588] Add unit tests to question edit answer form (#12935)

* add unit tests to constsum-options-question-edit-answer-form

* add unit tests to constsum-options-question-edit-answer-form

---------

Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* add delay to task queuer for indexing account request (#12936)

Co-authored-by: Nicolas <25302138+NicolasCwy@users.noreply.github.com>

* Make account req data migration script rerunnable (#12932)

* [#12048] Relax read notif verification for migration verification script (#12937)

* Fix account requests with wrong field during seed

* Relax account attributes verification

* Fix lint errors

* Fix order of account request variables

* [#12920] Create script to migrate noSQL test data to SQL schema format (#12922)

* Add classes to migrate test json data

* Add toposort  script

* Add function to remove foreign key data

* Cleanup

* WIP

* Simplify keys for students and instructors

* Fix lint issues

* Output SQL JSON in same folder as JSON

* Change output file name

* Fix bug: wrong jsonkey used

* Fix lint error

* Make section and team name unique

* Set read notification key to be unique

* Delete python file

* [#12588] Improve test code coverage of core components - ViewResultsPanelComponent (#12918)

* add test cases to ViewResultsPanelComponent

* fix lint errors

---------

Co-authored-by: Dominic Lim <46486515+domlimm@users.noreply.github.com>
Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* fix resetAccountAction (#12934)

Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* [#12048] Migrate Feedback Rank Option E2E test (#12902)

* Initial commit

* Fix lint

* Follow convention and add test

* Change file path

* Fix requested changes

* Fixed testcases

* Fix lint

* Add deepcopy

* Fixed e2e test

---------

Co-authored-by: Wei Qing <48304907+weiquu@users.noreply.github.com>
Co-authored-by: Cedric Ong <67156011+cedricongjh@users.noreply.github.com>

* [#12048] Migrate FeedbackMcqQuestionE2ETest (#12820)

* Migrate MCQ E2E

* Fix lint

* Fix lint

* Update xml

---------

Co-authored-by: Cedric Ong <67156011+cedricongjh@users.noreply.github.com>

* [#12048] Remove unnecessary loading of datastore entities in InstructorNotificationsPageE2ETest (#12911)

* migrate instructor notif e2e

---------

Co-authored-by: Cedric Ong <67156011+cedricongjh@users.noreply.github.com>

* [#12048] Migrate InstructorCourseDetailsPageE2ETest (#12908)

* Add teammates.e2e.cases.sql.InstructorCourseDetailsPageE2ETest

* Remove data properly to prevent clashes

* Add SQL data bundle

* Verify loaded details

* Use email address when getting a student row

* Check student links

* Verify the sending of invites

* Verify the reminding of all students to join

* Remove SQL data properly to prevent clashes

* Verify the downloading of the student list

* Implement helper methods for Student

* Add BaseTestCaseWithSqlDatabaseAccess::verifyAbsentInDatabase

* Add to testng-e2e-sql.xml

* Verify the deleting of students

* Verify the deleting of all the students

* Fix lint

* Remove duplicate equality check for students

* [#12588] add unit tests for question submission form (#12897)

Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* Update developers.json (#12958)

* Merge pull request #12960 from TEAMMATES/master (#12961)

* [#12048] Fix account request indexing (#12967)

* Add isTransactionNeeded method to Action

* Remove delay from taskqueuer

* Change CreateAccountRequest to handle own transactions

* configure agroal connection pool (#12971)

* Fix comment style for merge

* Remove unnecessary check for account request

---------

Co-authored-by: Nada Ayesh <nayesh10@students.iugaza.edu.ps>
Co-authored-by: FergusMok <FergusMok1@gmail.com>
Co-authored-by: Maureen Chang <76696006+techMedMau@users.noreply.github.com>
Co-authored-by: Cedric Ong <67156011+cedricongjh@users.noreply.github.com>
Co-authored-by: Dominic Lim <46486515+domlimm@users.noreply.github.com>
Co-authored-by: Nicolas <25302138+NicolasCwy@users.noreply.github.com>
Co-authored-by: Ching Ming Yuan <cmingyuan123@gmail.com>
Co-authored-by: Wei Qing <48304907+weiquu@users.noreply.github.com>
Co-authored-by: DS <yeodisheng@gmail.com>
Co-authored-by: Jay Aljelo Ting <65202977+jayasting98@users.noreply.github.com>

* [#11878] Change institute length limit (#12974)

* Change institute name max length to 128

* Edit test case for new length limit

* [#11878] Update SearchAccountRequests endpoint  (#12950)

* update search document and create-core script

* update it

* modify relevant classes to use id instead of (email, institute)

* remove duplicate method

* fix it tests

* fix failing tests

* remove unnecessary comment

* [#11878] Integrate instructor request form with API (#12943)

* Integrate instructor request form FE with API

* Remove redundant statement

* Move URL regex const to backend const file

* Fix import path

* Move URL regex to FieldValidator

* Add validators to match backend fields

* Add error message box

* Change submit button display when loading

* Combine final action into subscribe

* Add max length validators for institution and country

* Fix lint errors

* Add test cases to test submission

* Add specific error messages for form validation

* Remove home page URL field

* Fix lint errors

* Remove url regex from test

* Update snap

* Clean up test code

* Remove comment about home page URL

* Change canSubmit check to getter

* Fix form submit button not re-enabling on error

* Add name pattern validator to front-end

* Fix snapshot

* [#11878] Create Update Account Request Action (#12982)

* create update action and IT

* update javadocs

* update tests

* add more tests

* simplify logic

* remove unused string

* fix test

* allow null comments

* add more tests

* use EntityNotFoundException

* cleanup after create account requests test

* remove unncessary check

* [#11878] Fix Account Request Update Search Indexing (#12984)

* update account request indexing

* add methods to test access control

* refactoring for transactions

* [#11878] Add Edit and Approve Account Requests functionality (#12975)

* add edit and approve functionality

* remove rejection code

* fix snap

* integrate endpoint

* disable approve button for approved requests

* use comments instead of comment

* use searchString instead of searchQuery

* fix snap

* [#11878] Add AccountRequest Rejection email generator. (#12987)

* add rejection-email template and email generator method

* add javadoc for email generator method

* add test

* fix test method names

* fix test method name 2

* fix lint

* add bcc for rejection email

* [#11878] Create reject account request endpoint (#12985)

* Create account request rejection endpoint

* Add validation

* Add check for already rejected request when sending email

* Add integration test cases

* Set request method to post

* Fix lint errors

* Update tests list

* Update validation check

* Add test for validation

* Fix lint errors

* Fix validation comparison

* Fix error message test

* Add email sending

* Update test cases

* Refactor reason check code for clarity

* Remove unused modal (#12998)

* use transactions for reject account request action (#13001)

* [#11878] Create Rejection Modal for Account Requests (#12989)

* Create rejection modal

* fix lint and tests

* fix placeholders and lint

* remove title

* integrate api

* check undefined title and body

* fix trailing white spaces

* fix whitespace

* change error message

* re-add account request table on home page

* replace support email

* [#11878] Update DeleteAccountRequest to reference by ID (#12997)

* Update to delete by id

* fix lint

* fix lint

* fix frontend lint

* [#11878] Update ResetAccountRequest to reference by ID (#13002)

* Update reset to reference by id

* fix comments

* [#11878] Add Error Message for Approving Existing Account (#13004)

* add error message for duplicate account request

* add tests

* [#11878] Get account request by uuid (#13007)

* change GetAccountRequestAction to get by id

* fix tests

* remove unncessary todo

* [#11878] Handle Duplicate Approved Account Requests (#13009)

* [#11878] Merge master into feature (#13011)

* Update chrome driver download link in e2e-testing.md (#12924)

* [#12048] Add SQL configuration into build.properties and build-dev.properties (#12917)

* Add production config

* Remove forgotten host and password

* Fix lint

---------

Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* [#12048] Add SQL description for postgres config (#12931)

* Add production config

* Remove forgotten host and password

* Fix lint

* Address changes, include production_user

* Linting

* [#12588] Improve test code coverage of core components - ToastComponent (#12916)

* add test cases

* add test case for isTemplate()

---------

Co-authored-by: Cedric Ong <67156011+cedricongjh@users.noreply.github.com>
Co-authored-by: Dominic Lim <46486515+domlimm@users.noreply.github.com>

* [#12588] Add unit tests to question edit answer form (#12935)

* add unit tests to constsum-options-question-edit-answer-form

* add unit tests to constsum-options-question-edit-answer-form

---------

Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* add delay to task queuer for indexing account request (#12936)

Co-authored-by: Nicolas <25302138+NicolasCwy@users.noreply.github.com>

* Make account req data migration script rerunnable (#12932)

* [#12048] Relax read notif verification for migration verification script (#12937)

* Fix account requests with wrong field during seed

* Relax account attributes verification

* Fix lint errors

* Fix order of account request variables

* [#12920] Create script to migrate noSQL test data to SQL schema format (#12922)

* Add classes to migrate test json data

* Add toposort  script

* Add function to remove foreign key data

* Cleanup

* WIP

* Simplify keys for students and instructors

* Fix lint issues

* Output SQL JSON in same folder as JSON

* Change output file name

* Fix bug: wrong jsonkey used

* Fix lint error

* Make section and team name unique

* Set read notification key to be unique

* Delete python file

* [#12588] Improve test code coverage of core components - ViewResultsPanelComponent (#12918)

* add test cases to ViewResultsPanelComponent

* fix lint errors

---------

Co-authored-by: Dominic Lim <46486515+domlimm@users.noreply.github.com>
Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* fix resetAccountAction (#12934)

Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* [#12048] Migrate Feedback Rank Option E2E test (#12902)

* Initial commit

* Fix lint

* Follow convention and add test

* Change file path

* Fix requested changes

* Fixed testcases

* Fix lint

* Add deepcopy

* Fixed e2e test

---------

Co-authored-by: Wei Qing <48304907+weiquu@users.noreply.github.com>
Co-authored-by: Cedric Ong <67156011+cedricongjh@users.noreply.github.com>

* [#12048] Migrate FeedbackMcqQuestionE2ETest (#12820)

* Migrate MCQ E2E

* Fix lint

* Fix lint

* Update xml

---------

Co-authored-by: Cedric Ong <67156011+cedricongjh@users.noreply.github.com>

* [#12048] Remove unnecessary loading of datastore entities in InstructorNotificationsPageE2ETest (#12911)

* migrate instructor notif e2e

---------

Co-authored-by: Cedric Ong <67156011+cedricongjh@users.noreply.github.com>

* [#12048] Migrate InstructorCourseDetailsPageE2ETest (#12908)

* Add teammates.e2e.cases.sql.InstructorCourseDetailsPageE2ETest

* Remove data properly to prevent clashes

* Add SQL data bundle

* Verify loaded details

* Use email address when getting a student row

* Check student links

* Verify the sending of invites

* Verify the reminding of all students to join

* Remove SQL data properly to prevent clashes

* Verify the downloading of the student list

* Implement helper methods for Student

* Add BaseTestCaseWithSqlDatabaseAccess::verifyAbsentInDatabase

* Add to testng-e2e-sql.xml

* Verify the deleting of students

* Verify the deleting of all the students

* Fix lint

* Remove duplicate equality check for students

* [#12588] add unit tests for question submission form (#12897)

Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* Update developers.json (#12958)

* Merge pull request #12960 from TEAMMATES/master (#12961)

* [#12048] Fix account request indexing (#12967)

* Add isTransactionNeeded method to Action

* Remove delay from taskqueuer

* Change CreateAccountRequest to handle own transactions

* configure agroal connection pool (#12971)

* [#12048] Configure connection pool using hikari (#12978)

* Configure hikari

* Remove spacing

* Lint

* [#12048] Update liquibase configuration (#12930)

* Update gradle config

* Update liquibase config for v9

* Turn off table generate for prod

* Update of changelog file

* Add configuration for generating changelog

* Add schema migration docs

---------

Co-authored-by: FergusMok <FergusMok1@gmail.com>

* [#12048] Migrate AccountRequestsLogicTest (#12780)

* Migrate test cases for AccountRequestsLogic

* Remove test case

* Split test cases

* [#12048] Migrate AdminSearchPageE2ETest SQL (#12811)

* test e2e changes

* fix: reduce e2e test json file size

* fix student key

* fix course key

* fix instructor keys

* fix filepath

* fix e2e test

* remove extra data from bundle

* Add correct removal logic to avoid constraint violation

* Fix e2e tests and lint

fix reset google id test

fix e2e tests

fix e2e tests

fix tests

remove double click

fix unknown symbol

add toast check

change toast verification message

remove toast check

* fix: add null check

* move admin search page e2e test to sql cases

* Rename AdminSearchPageE2ETest_SQLEntities.json to AdminSearchPageE2ETest_SqlEntities.json

* fix failing test

* fix: remove extra null check

* fix: add test to e2e sql xml file

* fix function call

* remove unnecessary changes

* create new file for sql entities

* revert unnecessary changes

* remove trailing whitespace

* add teardown for account requests

---------

Co-authored-by: Cedric Ong <67156011+cedricongjh@users.noreply.github.com>

* [#12995] Create documentation for unit tests (#12996)

* Create documentation for unit tests

* Update docs/unit-testing.md

Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* Update docs/unit-testing.md

Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

---------

Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* [#12048] Remove feedbackSession attributes @fetch annotation (#12992)

* Remove feedbackSession @fetch annotation

* [#12048] create skeleton for sql LNP tests (#12994)

* create skelton for sql LNP tests

* allow lnp test to access sql storage and ensure sql lnp tests are independant of each other

---------

Co-authored-by: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>

* [#12048] Migrate FeedbackNumScaleQuestionE2ETest (#12940)

* Migrate num scale e2e

* Fix team id

* Fix bugs

* Add v9.0.0 tag to liquibase changelog (#13005)

* sort courses by id before comparison (#13003)

Co-authored-by: Dominic Lim <46486515+domlimm@users.noreply.github.com>

---------

Co-authored-by: Nada Ayesh <nayesh10@students.iugaza.edu.ps>
Co-authored-by: FergusMok <FergusMok1@gmail.com>
Co-authored-by: Maureen Chang <76696006+techMedMau@users.noreply.github.com>
Co-authored-by: Cedric Ong <67156011+cedricongjh@users.noreply.github.com>
Co-authored-by: Dominic Lim <46486515+domlimm@users.noreply.github.com>
Co-authored-by: Nicolas <25302138+NicolasCwy@users.noreply.github.com>
Co-authored-by: Ching Ming Yuan <cmingyuan123@gmail.com>
Co-authored-by: Wei Qing <48304907+weiquu@users.noreply.github.com>
Co-authored-by: DS <yeodisheng@gmail.com>
Co-authored-by: Jay Aljelo Ting <65202977+jayasting98@users.noreply.github.com>
Co-authored-by: Xenos F <git@xenosfio.com>
Co-authored-by: domoberzin <74132255+domoberzin@users.noreply.github.com>
Co-authored-by: Marques Tye Jia Jun <97437396+marquestye@users.noreply.github.com>

* [#11878] Add tests for Account Request Table (#12977)

* add component tests for account request table

* modify tests

* remove old tests

* remove comment

* remove unnecessary code

* add tests

* update disabled criteria

* remove extra builders and update snaps

* [#11878] Reference account requests by ID in tests (#13017)

* Reference by ID in GetCourseJoinStatusActionIT

* Reference by ID in AccountRequestsDbIT

* Reference by ID in AccountRequestsLogicIT

* Reference by ID in CreateAccountActionIT

* Reference by ID in BaseTestCaseWithSqlDatabaseAccess

* Remove now irrelevant reference by email address and institute

* [#11878] Fix Approval Email Bug (#13027)

* [#11878] Fix reject email content (#13029)

* [#11878] Add Toasts (#13028)

* add toasts

* lint

* [#11878] Remove mention of home page URL from confirmation email (#13030)

* fix highlighting and null statuses (#13031)

* [#11878] Fix Overlapping Tooltip (#13026)

* fix tooltip

* re-add removed lines

* update snap

* update snaps

* lint

* suppress warning

* lint

* [#11878] Check if account request is not created by admin before sending email (#13032)

* Add check if admin when creating account request

* Trim down test case

* [#11878] Add sort by created_at for getAllPendingRequests (#13038)

* feat: add order-by

* fix: fix failing test case

* fix: add missing created-at field

* fix: test case comment

* [#11878] Request Page E2E (#13015)

* Add E2E skeleton

* Fix test and lint

* Add verifyEmailSent

* fix fe tests

* Remove method from logic and db (#13044)

* [#11878] Migrate AccountRequestsLogic unit tests (#13043)

* Add get typical account request method

* Migrate AccountRequestsLogicTest

* Remove test for get by email address and institute

---------

Co-authored-by: Jay Aljelo Ting <65202977+jayasting98@users.noreply.github.com>

* [#11878] Add Admin E2E Tests (#13020)

* add admin e2e tests

* remove exception catching and update snaps

* fix snaps

* add comment verification

* fix test

* [#11878] Add SQLI tests (#13047)

* Revert "Enable CI on account request form branch" (#13049)

This reverts commit 186a97a.

---------

Co-authored-by: Jay Ting <65202977+jayasting98@users.noreply.github.com>
Co-authored-by: EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com>
Co-authored-by: Xenos F <git@xenosfio.com>
Co-authored-by: domoberzin <74132255+domoberzin@users.noreply.github.com>
Co-authored-by: Nada Ayesh <nayesh10@students.iugaza.edu.ps>
Co-authored-by: FergusMok <FergusMok1@gmail.com>
Co-authored-by: Maureen Chang <76696006+techMedMau@users.noreply.github.com>
Co-authored-by: Cedric Ong <67156011+cedricongjh@users.noreply.github.com>
Co-authored-by: Dominic Lim <46486515+domlimm@users.noreply.github.com>
Co-authored-by: Nicolas <25302138+NicolasCwy@users.noreply.github.com>
Co-authored-by: Ching Ming Yuan <cmingyuan123@gmail.com>
Co-authored-by: Wei Qing <48304907+weiquu@users.noreply.github.com>
Co-authored-by: DS <yeodisheng@gmail.com>
Co-authored-by: Marques Tye Jia Jun <97437396+marquestye@users.noreply.github.com>
  • Loading branch information
15 people committed Apr 18, 2024
1 parent f852286 commit da0a51c
Show file tree
Hide file tree
Showing 134 changed files with 6,515 additions and 1,411 deletions.
2 changes: 2 additions & 0 deletions solr/solr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ bin/solr create -c accountrequests -s 2 -rf 2
bin/solr config -c accountrequests -p 8983 -action set-user-property -property update.autoCreateFields -value false
curl -X POST -H 'Content-type: application/json' --data-binary '{"add-field": {"name": "email", "type": "string"}}' localhost:8983/solr/accountrequests/schema
curl -X POST -H 'Content-type: application/json' --data-binary '{"add-field": {"name": "institute", "type": "string"}}' localhost:8983/solr/accountrequests/schema
curl -X POST -H 'Content-type: application/json' --data-binary '{"add-field": {"name": "comments", "type": "string"}}' localhost:8983/solr/accountrequests/schema
curl -X POST -H 'Content-type: application/json' --data-binary '{"add-field": {"name": "status", "type": "string"}}' localhost:8983/solr/accountrequests/schema
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// CHECKSTYLE.OFF:ImportOrder
import com.googlecode.objectify.cmd.Query;

import teammates.common.datatransfer.AccountRequestStatus;
import jakarta.persistence.criteria.CriteriaDelete;

import teammates.common.util.HibernateUtil;
Expand Down Expand Up @@ -57,7 +58,9 @@ protected void migrateEntity(teammates.storage.entity.AccountRequest oldEntity)
AccountRequest newEntity = new AccountRequest(
oldEntity.getEmail(),
oldEntity.getName(),
oldEntity.getInstitute());
oldEntity.getInstitute(),
AccountRequestStatus.APPROVED,
null);

// set registration key to the old value if exists
if (oldEntity.getRegistrationKey() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import teammates.client.connector.DatastoreClient;
import teammates.client.util.ClientProperties;
import teammates.common.datatransfer.AccountRequestStatus;
import teammates.common.util.HibernateUtil;
import teammates.storage.entity.UsageStatistics;
import teammates.storage.sqlentity.Notification;
Expand Down Expand Up @@ -43,7 +44,9 @@ protected void verifySqlConnection() {
teammates.storage.sqlentity.AccountRequest newEntity = new teammates.storage.sqlentity.AccountRequest(
"dummy-teammates-account-request-email@gmail.com",
"dummy-teammates-account-request",
"dummy-teammates-institute");
"dummy-teammates-institute",
AccountRequestStatus.PENDING,
"dummy-comments");
HibernateUtil.beginTransaction();
HibernateUtil.persist(newEntity);
HibernateUtil.commitTransaction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Map;
import java.util.UUID;

import teammates.common.datatransfer.AccountRequestStatus;
import teammates.common.datatransfer.InstructorPermissionRole;
import teammates.common.datatransfer.attributes.AccountAttributes;
import teammates.common.datatransfer.attributes.AccountRequestAttributes;
Expand Down Expand Up @@ -128,7 +129,11 @@ protected Account convert(AccountAttributes accAttr) {
protected AccountRequest convert(AccountRequestAttributes accReqAttr) {
AccountRequest sqlAccountRequest = new AccountRequest(accReqAttr.getEmail(),
accReqAttr.getName(),
accReqAttr.getInstitute());
accReqAttr.getInstitute(), AccountRequestStatus.APPROVED, null);

if (accReqAttr.getRegisteredAt() != null) {
sqlAccountRequest.setStatus(AccountRequestStatus.REGISTERED);
}

sqlAccountRequest.setCreatedAt(accReqAttr.getCreatedAt());
sqlAccountRequest.setRegisteredAt(accReqAttr.getRegisteredAt());
Expand Down
26 changes: 0 additions & 26 deletions src/e2e/java/teammates/e2e/cases/AdminHomePageE2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import teammates.common.util.AppUrl;
import teammates.common.util.Const;
import teammates.e2e.pageobjects.AdminHomePage;
import teammates.storage.sqlentity.AccountRequest;

/**
* SUT: {@link Const.WebPageURIs#ADMIN_HOME_PAGE}.
Expand Down Expand Up @@ -47,31 +46,6 @@ public void testAll() {
String failureMessage = homePage.getMessageForInstructor(1);
assertTrue(failureMessage.contains(
"\"invalidemail\" is not acceptable to TEAMMATES as a/an email because it is not in the correct format."));

assertNotNull(BACKDOOR.getAccountRequest(email, institute));
BACKDOOR.deleteAccountRequest(email, institute);

______TS("Failure case: Instructor is already registered");
AccountRequest registeredAccountRequest = sqlTestData.accountRequests.get("AHome.instructor1OfCourse1");
homePage.queueInstructorForAdding(registeredAccountRequest.getName(),
registeredAccountRequest.getEmail(), registeredAccountRequest.getInstitute());

homePage.addAllInstructors();

failureMessage = homePage.getMessageForInstructor(2);
assertTrue(failureMessage.contains("Cannot create account request as instructor has already registered."));

______TS("Success case: Reset account request");

homePage.clickMoreInfoButtonForRegisteredInstructor(2);
homePage.clickResetAccountRequestLink();

successMessage = homePage.getMessageForInstructor(2);
assertTrue(successMessage.contains(
"Instructor \"" + registeredAccountRequest.getName() + "\" has been successfully created"));

assertNull(BACKDOOR.getAccountRequest(
registeredAccountRequest.getEmail(), registeredAccountRequest.getInstitute()).getRegisteredAt());
}

}
6 changes: 3 additions & 3 deletions src/e2e/java/teammates/e2e/cases/AdminSearchPageE2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void testAll() {
searchPage.inputSearchContent(searchContent);
searchPage.clickSearchButton();
searchPage.clickResetAccountRequestButton(accountRequest);
assertNull(BACKDOOR.getAccountRequest(accountRequest.getEmail(), accountRequest.getInstitute()).getRegisteredAt());
assertNull(BACKDOOR.getAccountRequest(accountRequest.getId()).getRegisteredAt());

______TS("Typical case: Delete account request successful");
accountRequest = sqlTestData.accountRequests.get("unregisteredInstructor1");
Expand All @@ -141,7 +141,7 @@ public void testAll() {
searchPage.inputSearchContent(searchContent);
searchPage.clickSearchButton();
searchPage.clickDeleteAccountRequestButton(accountRequest);
assertNull(BACKDOOR.getAccountRequest(accountRequest.getEmail(), accountRequest.getInstitute()));
assertNull(BACKDOOR.getAccountRequest(accountRequest.getId()));
}

private String getExpectedStudentDetails(StudentAttributes student) {
Expand Down Expand Up @@ -193,7 +193,7 @@ private String getExpectedInstructorManageAccountLink(InstructorAttributes instr
@AfterClass
public void classTeardown() {
for (AccountRequest request : sqlTestData.accountRequests.values()) {
BACKDOOR.deleteAccountRequest(request.getEmail(), request.getInstitute());
BACKDOOR.deleteAccountRequest(request.getId());
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/e2e/java/teammates/e2e/cases/BaseE2ETestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.UUID;

import org.testng.ITestContext;
import org.testng.annotations.AfterClass;
Expand Down Expand Up @@ -329,7 +330,7 @@ protected String getKeyForStudent(StudentAttributes student) {

@Override
protected AccountRequestAttributes getAccountRequest(AccountRequestAttributes accountRequest) {
return BACKDOOR.getAccountRequest(accountRequest.getEmail(), accountRequest.getInstitute());
return BACKDOOR.getAccountRequest(UUID.fromString(accountRequest.getId()));
}

NotificationAttributes getNotification(String notificationId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void testAll() {
______TS("Click join link: valid account request key");

String regKey = BACKDOOR
.getRegKeyForAccountRequest("ICJoinConf.newinstr@gmail.tmt", "TEAMMATES Test Institute 1");
.getRegKeyForAccountRequest(sqlTestData.accountRequests.get("ICJoinConf.newinstr").getId());

joinLink = createFrontendUrl(Const.WebPageURIs.JOIN_PAGE)
.withIsCreatingAccount("true")
Expand Down
55 changes: 55 additions & 0 deletions src/e2e/java/teammates/e2e/cases/sql/AdminHomePageE2ETest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package teammates.e2e.cases.sql;

import org.testng.annotations.Test;

import teammates.common.util.AppUrl;
import teammates.common.util.Const;
import teammates.e2e.pageobjects.AdminHomePage;

/**
* SUT: {@link Const.WebPageURIs#ADMIN_HOME_PAGE}.
*/
public class AdminHomePageE2ETest extends BaseE2ETestCase {

@Override
protected void prepareTestData() {
// not needed
}

@Test
@Override
public void testAll() {
AppUrl url = createFrontendUrl(Const.WebPageURIs.ADMIN_HOME_PAGE);
AdminHomePage homePage = loginAdminToPage(url, AdminHomePage.class);

______TS("Test adding instructors with both valid and invalid details");

String name = "AHPUiT Instrúctör WithPlusInEmail";
String email = "AHPUiT+++_.instr1!@gmail.tmt";
String institute = "TEAMMATES Test Institute 1";

homePage.queueInstructorForAdding(name, email, institute);

String singleLineDetails = "Instructor With Invalid Email | invalidemail | TEAMMATES Test Institute 1";

homePage.queueInstructorForAdding(singleLineDetails);

homePage.addAllInstructors();

String successMessage = homePage.getMessageForInstructor(0);
assertTrue(successMessage.contains(
"Instructor \"AHPUiT Instrúctör WithPlusInEmail\" has been successfully created"));

String failureMessage = homePage.getMessageForInstructor(1);
assertTrue(failureMessage.contains(
"\"invalidemail\" is not acceptable to TEAMMATES as a/an email because it is not in the correct format."));

homePage.reloadPage();

______TS("Verify that newly added instructor appears in account request table");

homePage.verifyInstructorInAccountRequestTable(name, email, institute);

}

}
107 changes: 102 additions & 5 deletions src/e2e/java/teammates/e2e/cases/sql/AdminSearchPageE2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

import teammates.common.datatransfer.AccountRequestStatus;
import teammates.common.util.AppUrl;
import teammates.common.util.Const;
import teammates.common.util.FieldValidator;
import teammates.common.util.StringHelperExtension;
import teammates.e2e.pageobjects.AdminSearchPage;
import teammates.e2e.util.TestProperties;
import teammates.storage.sqlentity.AccountRequest;
Expand Down Expand Up @@ -116,7 +119,7 @@ public void testAll() {
searchPage.inputSearchContent(searchContent);
searchPage.clickSearchButton();
searchPage.clickResetAccountRequestButton(accountRequest);
assertNull(BACKDOOR.getAccountRequest(accountRequest.getEmail(), accountRequest.getInstitute()).getRegisteredAt());
assertNull(BACKDOOR.getAccountRequest(accountRequest.getId()).getRegisteredAt());

______TS("Typical case: Delete account request successful");
accountRequest = testData.accountRequests.get("unregisteredInstructor1");
Expand All @@ -125,14 +128,108 @@ public void testAll() {
searchPage.inputSearchContent(searchContent);
searchPage.clickSearchButton();
searchPage.clickDeleteAccountRequestButton(accountRequest);
assertNull(BACKDOOR.getAccountRequest(accountRequest.getEmail(), accountRequest.getInstitute()));
assertNull(BACKDOOR.getAccountRequest(accountRequest.getId()));

______TS("Typical case: Edit account request successful");
accountRequest = testData.accountRequests.get("unregisteredInstructor2");
searchContent = accountRequest.getEmail();
searchPage.clearSearchBox();
searchPage.inputSearchContent(searchContent);
searchPage.clickSearchButton();
searchPage.clickEditAccountRequestButton(accountRequest);
searchPage.fillInEditModalFields("Different name", accountRequest.getEmail(),
accountRequest.getInstitute(), "New comment");
searchPage.clickSaveEditAccountRequestButton();
accountRequest.setName("Different name");
accountRequest.setComments("New comment");
searchPage.verifyAccountRequestRowContent(accountRequest);

______TS("Typical case: View comment of account request");
accountRequest = testData.accountRequests.get("unregisteredInstructor2");
searchContent = accountRequest.getEmail();
searchPage.clearSearchBox();
searchPage.inputSearchContent(searchContent);
searchPage.clickSearchButton();
searchPage.clickViewAccountRequestAndVerifyCommentsButton(accountRequest, "New comment");

______TS("Edit account request with invalid details");
accountRequest = testData.accountRequests.get("unregisteredInstructor2");
searchContent = accountRequest.getEmail();
searchPage.clearSearchBox();
searchPage.inputSearchContent(searchContent);
searchPage.clickSearchButton();
searchPage.clickEditAccountRequestButton(accountRequest);
searchPage.fillInEditModalFields(accountRequest.getName(), "invalid",
accountRequest.getInstitute(), "New comment");
searchPage.clickSaveEditAccountRequestButton();
String formattedErrorMessage = String.format("\"%s\" is not acceptable to TEAMMATES as a/an %s because it %s. "
+ "An email address contains some text followed by one '@' sign followed by some more text, "
+ "and should end with a top level domain address like .com. It cannot be longer than %d characters, "
+ "cannot be empty and cannot contain spaces.",
"invalid", FieldValidator.EMAIL_FIELD_NAME, FieldValidator.REASON_INCORRECT_FORMAT,
FieldValidator.EMAIL_MAX_LENGTH);
searchPage.verifyStatusMessage(formattedErrorMessage);

String name = StringHelperExtension.generateStringOfLength(FieldValidator.PERSON_NAME_MAX_LENGTH + 1);

searchPage.clickEditAccountRequestButton(accountRequest);
searchPage.fillInEditModalFields(name, accountRequest.getEmail(), accountRequest.getInstitute(), "New comment");
searchPage.clickSaveEditAccountRequestButton();
formattedErrorMessage = String.format("\"%s\" is not acceptable to TEAMMATES as a/an %s because it %s. "
+ "The value of a/an %s should be no longer than %d characters. It should not be empty.",
name, FieldValidator.PERSON_NAME_FIELD_NAME, FieldValidator.REASON_TOO_LONG,
FieldValidator.PERSON_NAME_FIELD_NAME, FieldValidator.PERSON_NAME_MAX_LENGTH);
searchPage.verifyStatusMessage(formattedErrorMessage);

______TS("Typical case: Approve account request successful");
accountRequest = testData.accountRequests.get("unregisteredInstructor2");
searchContent = accountRequest.getEmail();
searchPage.clearSearchBox();
searchPage.inputSearchContent(searchContent);
searchPage.clickSearchButton();
searchPage.clickApproveAccountRequestButton(accountRequest);
accountRequest.setStatus(AccountRequestStatus.APPROVED);
searchPage.verifyAccountRequestRowContent(accountRequest);

______TS("Typical case: Reject account request successfully");
accountRequest = testData.accountRequests.get("unregisteredInstructor3");
searchContent = accountRequest.getEmail();
searchPage.clearSearchBox();
searchPage.inputSearchContent(searchContent);
searchPage.clickSearchButton();
searchPage.clickRejectAccountRequestButton(accountRequest);
accountRequest.setStatus(AccountRequestStatus.REJECTED);
searchPage.verifyAccountRequestRowContent(accountRequest);

______TS("Reject account request with empty body");
accountRequest = testData.accountRequests.get("unregisteredInstructor5");
searchContent = accountRequest.getEmail();
searchPage.clearSearchBox();
searchPage.inputSearchContent(searchContent);
searchPage.clickSearchButton();
searchPage.clickRejectAccountRequestWithReasonButton(accountRequest);
searchPage.fillInRejectionModalBody("");
searchPage.clickConfirmRejectAccountRequest();
searchPage.verifyStatusMessage("Please provide an email body for the rejection email.");
searchPage.closeRejectionModal();

______TS("Typical case: Reject account request with reason successfully");
accountRequest = testData.accountRequests.get("unregisteredInstructor4");
searchContent = accountRequest.getEmail();
searchPage.clearSearchBox();
searchPage.inputSearchContent(searchContent);
searchPage.clickSearchButton();
searchPage.clickRejectAccountRequestWithReasonButton(accountRequest);
accountRequest.setStatus(AccountRequestStatus.REJECTED);
searchPage.verifyAccountRequestRowContent(accountRequest);
}

private String getExpectedStudentDetails(Student student) {
return String.format("%s [%s] (%s)", student.getCourse().getId(),
student.getSection() == null
? Const.DEFAULT_SECTION
: student.getSection().getName(), student.getTeam().getName());
? Const.DEFAULT_SECTION
: student.getSection().getName(),
student.getTeam().getName());
}

private String getExpectedStudentHomePageLink(Student student) {
Expand Down Expand Up @@ -179,7 +276,7 @@ private String getExpectedInstructorManageAccountLink(Instructor instructor) {
@AfterClass
public void classTeardown() {
for (AccountRequest request : testData.accountRequests.values()) {
BACKDOOR.deleteAccountRequest(request.getEmail(), request.getInstitute());
BACKDOOR.deleteAccountRequest(request.getId());
}
}
}
Loading

0 comments on commit da0a51c

Please sign in to comment.