Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test automation #15

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
498efdc
Add composite index for data migration (#13057)
marquestye Apr 19, 2024
81eae17
[#13060] Add beta 5 liquibase changelog and developers json (#13061)
ziqing26 Apr 19, 2024
0a0e7c9
[#12048] Update changelog docs and changelog name (#13062)
NicolasCwy Apr 20, 2024
10e96cb
[#12048] Migrate StudentCourseDetailsPageE2ETest (#13012)
cedricongjh Apr 20, 2024
76db4cc
[#11878] Account Request Indexing Script (#13076)
domoberzin Apr 22, 2024
6b83e4f
[#11878] Add CAPTCHA to ARF (#13081)
xenosf Apr 23, 2024
e738e25
[#13064] Use AccountRequestUpdateRequest as parameter (#13068)
Stain19 Apr 24, 2024
a2a9ef3
[#12048] Migrate FeedbackRubricQuestionsE2E (#13078)
yuanxi1 Apr 28, 2024
34248a0
[#12048] Migrate SubmitFeedbackResponseAction tests (#13033)
FergusMok May 2, 2024
1ea04f4
[#12900] Gradle task componentTests should not stop entirely when onl…
emrekenar May 12, 2024
06bfafd
[#12048] Remove null default section (#13040)
FergusMok May 12, 2024
7b75dad
[#13126] Fix failing component test cases (#13127)
dishenggg Jun 11, 2024
5ed1cf7
[#13126] Update timezone db (#13128)
wkurniawan07 Jun 11, 2024
ec1f276
[#13109] IndexOutOfBoundsException encountered by LogsProcessor (#13120)
Ashwinn11 Jun 12, 2024
6114677
[#13103] Account request form: No need to CC the email 'Acknowledgeme…
Ashwinn11 Jun 12, 2024
40350ef
Remove duplicate call to loadfeedbacksessionsforcourse (#13130)
Respirayson Jun 22, 2024
efeffd4
[#13102] Admin rejecting account request: give actual account in the …
Andy-W-Developer Jun 28, 2024
015b872
[#12901] Check if the search service is active in account request sea…
cliu585 Jun 28, 2024
b402863
[#13105] Admin managing account requests: use spinners to indicate ac…
Respirayson Jul 1, 2024
f604c11
[#12872] Warn instructors not to share link with students (#13137)
itstrueitstrueitsrealitsreal Jul 5, 2024
836f637
[#12578] `@` sign is shown as `@` when viewing essay question sub…
Respirayson Jul 7, 2024
399a5fa
[#12779] Fix notifications update logic (#13083)
marquestye Jul 8, 2024
c5af284
[#12894] Calculate msq totals by student email instead of name (#13141)
itstrueitstrueitsrealitsreal Jul 10, 2024
13a1891
[#12048] Migrate InstructorCourseStudentDetailsEditPageE2ETest (#13069)
weiquu Jul 10, 2024
3f5f68d
[#13104] Accounts request form: auto-unify country names (#13117)
franciscoSavala Jul 11, 2024
61df45a
[#12655] Instructor Edit Session Page: If make session visible is lat…
Respirayson Jul 15, 2024
67628fb
[#12749] Autosave and restore progress if user navigates away (#13140)
Respirayson Jul 23, 2024
6b7912c
[#12588] Test coverage improvements for InstructorResponsesViewBase (…
justinsegawa Jul 24, 2024
9181467
[#13147] Didn't Account for the Timezone in Session Edit Form compone…
Respirayson Jul 26, 2024
05f0e5e
Add check for closed issue
itstrueitstrueitsrealitsreal Jul 27, 2024
fca9e1f
Update message
itstrueitstrueitsrealitsreal Jul 27, 2024
f0c91b7
Rephrase message
itstrueitstrueitsrealitsreal Jul 27, 2024
699a00a
Add logging
itstrueitstrueitsrealitsreal Jul 27, 2024
d011c16
Test
itstrueitstrueitsrealitsreal Jul 27, 2024
bb3062e
Update pr.yml
itstrueitstrueitsrealitsreal Jul 27, 2024
03cc085
Update pr.yml
itstrueitstrueitsrealitsreal Jul 27, 2024
a39ba95
Update pr.yml
itstrueitstrueitsrealitsreal Jul 27, 2024
566a0a5
Update pr.yml
itstrueitstrueitsrealitsreal Jul 27, 2024
73d1393
Update pr.yml
itstrueitstrueitsrealitsreal Jul 27, 2024
42893ce
Update pr.yml
itstrueitstrueitsrealitsreal Jul 27, 2024
d05878e
Resolve merge conflicts
itstrueitstrueitsrealitsreal Jul 27, 2024
7c0c9ef
Update pr.yml
itstrueitstrueitsrealitsreal Jul 27, 2024
f4d428c
Resolve merge conflicts
itstrueitstrueitsrealitsreal Jul 27, 2024
26ee2b5
Add check for closed issue
itstrueitstrueitsrealitsreal Jul 27, 2024
686027b
[#13147] Didn't Account for the Timezone in Session Edit Form compone…
Respirayson Jul 26, 2024
cbb6e6f
Update pr.yml
itstrueitstrueitsrealitsreal Jul 27, 2024
f9ecd69
Merge branch 'automation' of https://github.com/itstrueitstrueitsreal…
itstrueitstrueitsrealitsreal Jul 27, 2024
01292f2
Update workflow
itstrueitstrueitsrealitsreal Jul 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
run: docker-compose run -d -p 8983:8983 solr
- name: Run Backend Tests
run: |
./gradlew createConfigs componentTests
./gradlew createConfigs componentTests --continue
./gradlew jacocoReport
- name: Generate Types
run: ./gradlew generateTypes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jdk17.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
- name: Run Solr search service
run: docker-compose run -d -p 8983:8983 solr
- name: Run Backend Tests
run: ./gradlew createConfigs componentTests
run: ./gradlew createConfigs componentTests --continue
2 changes: 1 addition & 1 deletion .github/workflows/jdk21.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
- name: Run Solr search service
run: docker-compose run -d -p 8983:8983 solr
- name: Run Backend Tests
run: ./gradlew createConfigs componentTests
run: ./gradlew createConfigs componentTests --continue
74 changes: 46 additions & 28 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,49 @@ jobs:
permissions:
pull-requests: write
steps:
- uses: actions/github-script@v7
with:
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
})
const isTitleValid = /^\[#\d+\] /.test(pr.data.title)
const isDescriptionValid = /([Ff]ix(es|ed)?|[Cc]lose(s|d)?|[Rr]esolve(s|d)?|[Pp]art [Oo]f) #\d+/.test(pr.data.body)
if (isTitleValid && isDescriptionValid) {
return
}
let body = `Hi @${pr.data.user.login}, thank you for your interest in contributing to TEAMMATES!
However, your PR does not appear to follow our [contribution guidelines](https://teammates.github.io/teammates/process.html#step-4-submit-a-pr):\n\n`
if (!isTitleValid) {
body += "- Title must start with the issue number the PR is fixing in square brackets, e.g. `[#<issue-number>]`\n"
}
if (!isDescriptionValid) {
body += "- Description must reference the issue number the PR is fixing, e.g. `Fixes #<issue-number>` (or `Part of #<issue-number>` if the PR does not address the issue fully)\n"
}
body += "\nPlease address the above before we proceed to review your PR."
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,
})
- uses: actions/github-script@v7
with:
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
})
const isTitleValid = /^\[#\d+\] /.test(pr.data.title)
const isDescriptionValid = /([Ff]ix(es|ed)?|[Cc]lose(s|d)?|[Rr]esolve(s|d)?|[Pp]art [Oo]f) #\d+/.test(pr.data.body)
const descriptionRegex = /(?:[Ff]ix(?:es|ed)?|[Cc]lose(?:s|d)?|[Rr]esolve(?:s|d)?|[Pp]art [Oo]f) #(\d+)/
const extractIssueNumber = (description) => {
const match = description.match(descriptionRegex)
return match ? parseInt(match[1]) : null
};
const issueNumber = extractIssueNumber(pr.data.body)
let isIssueOpen = false
if (issueNumber) {
const issue = await github.rest.issues.get({
owner: 'TEAMMATES',
repo: 'teammates',
issue_number: issueNumber
})
isIssueOpen = issue.data.state === 'open'
if (isTitleValid && isDescriptionValid && isIssueOpen) {
return
}
}
let body = `Hi @${pr.data.user.login}, thank you for your interest in contributing to TEAMMATES!
However, your PR does not appear to follow our [contribution guidelines](https://teammates.github.io/teammates/process.html#step-4-submit-a-pr):\n\n`
if (!isTitleValid) {
body += "- Title must start with the issue number the PR is fixing in square brackets, e.g. `[#<issue-number>]`\n"
}
if (!isDescriptionValid) {
body += "- Description must reference the issue number the PR is fixing, e.g. `Fixes #<issue-number>` (or `Part of #<issue-number>` if the PR does not address the issue fully)\n"
}
if (!isIssueOpen && issueNumber) {
body += "- The issue referenced in the description (#" + issueNumber + ") is not open.\n"
}
body += "\nPlease address the above before we proceed to review your PR."
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,
})
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ Back-end component tests follow this configuration:

Test suite | Command | Results can be viewed in
---|---|---
`Component tests` | `./gradlew componentTests` | `{project folder}/build/reports/tests/componentTests/index.html`
`Component tests` | `./gradlew componentTests --continue` | `{project folder}/build/reports/tests/componentTests/index.html`
Any individual component test | `./gradlew componentTests --tests TestClassName` | `{project folder}/build/reports/tests/componentTests/index.html`

You can generate the coverage data with `jacocoReport` task after running tests, e.g.:
Expand Down
3 changes: 2 additions & 1 deletion docs/schema-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ Here is a brief description of the activities defined for Liquibase
5. Generate snapshot of database by running `./gradlew liquibaseSnapshot -PrunList=snapshot`, the snapshot will be output to `liquibase-snapshot.json`
6. Checkout your branch and repeat steps 2 and 4 to generate the tables found on your branch
7. Run `./gradlew liquibaseDiffChangeLog -PrunList=diffMain` to generate changeLog to resolve database schema differences

8. Manually add a changeSet to tag the database using `release_number`. The tag should be named `<release_number` e.g `v9.0.0-beta.1` (See the last changeset in v9.0.0 for reference).
9. Include the new changelog file as the last entry in `changelog-root.xml` as this is the order which changelogs are executed! (See [liquibase include tag](https://docs.liquibase.com/change-types/include.html))
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"firebase": "^10.7.2",
"handsontable": "^14.1.0",
"intersection-observer": "^0.12.2",
"moment-timezone": "^0.5.43",
"moment-timezone": "^0.5.45",
"ng-dynamic-component": "^10.7.0",
"ng-in-viewport": "^16.1.0",
"ngx-captcha": "^13.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package teammates.client.scripts;

import java.util.List;

import jakarta.persistence.TypedQuery;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import jakarta.persistence.criteria.Root;

import teammates.client.util.BackDoor;
import teammates.client.util.ClientProperties;
import teammates.common.datatransfer.SqlDataBundle;
import teammates.common.exception.HttpRequestFailedException;
import teammates.common.util.HibernateUtil;
import teammates.storage.sqlentity.AccountRequest;

/**
* Script to trigger indexing for all account requests.
*/
public class UpdateAccountRequestIndexing {
public static void main(String[] args) {
UpdateAccountRequestIndexing updater = new UpdateAccountRequestIndexing();
updater.initSession();
updater.updateAccountRequestIndexing();
}

/**
* Initializes the Hibernate session.
*/
public void initSession() {
String connectionUrl = ClientProperties.SCRIPT_API_URL;
String username = ClientProperties.SCRIPT_API_NAME;
String password = ClientProperties.SCRIPT_API_PASSWORD;

HibernateUtil.buildSessionFactory(connectionUrl, username, password);
}

/**
* Updates the indexing for all account requests using the backdoor and batch processing.
*/
public void updateAccountRequestIndexing() {
int batchSize = 100;
int firstResult = 0;
HibernateUtil.beginTransaction();
CriteriaBuilder cb = HibernateUtil.getCriteriaBuilder();
CriteriaQuery<AccountRequest> cr = cb.createQuery(AccountRequest.class);
Root<AccountRequest> root = cr.from(AccountRequest.class);
cr.select(root);
TypedQuery<AccountRequest> query = HibernateUtil.createQuery(cr)
.setMaxResults(batchSize);

List<AccountRequest> accountRequests;

do {
query.setFirstResult(firstResult);
accountRequests = query.getResultList();
SqlDataBundle dataBundle = new SqlDataBundle();

for (AccountRequest accountRequest : accountRequests) {
dataBundle.accountRequests.put(accountRequest.getId().toString(), accountRequest);
}

insertDocs(dataBundle);
firstResult += batchSize;
} while (!accountRequests.isEmpty());

HibernateUtil.commitTransaction();
}

/**
* Inserts the document.
*/
public void insertDocs(SqlDataBundle dataBundle) {
try {
BackDoor.getInstance().putSqlDocuments(dataBundle);
} catch (HttpRequestFailedException e) {
System.out.println("Error occurred while inserting documents: " + e.getMessage());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package teammates.client.scripts.sql;

import com.googlecode.objectify.cmd.Query;

import teammates.client.scripts.DataMigrationEntitiesBaseScript;
import teammates.storage.entity.Course;

/**
* Index the newly-indexable fields of courses.
*/
public class IndexCourseFields extends DataMigrationEntitiesBaseScript<Course> {

public static void main(String[] args) {
new IndexCourseFields().doOperationRemotely();
}

@Override
protected Query<Course> getFilterQuery() {
return ofy().load().type(Course.class);
}

@Override
protected boolean isPreview() {
return true;
}

@Override
protected boolean isMigrationNeeded(Course course) {
return true;
}

@Override
protected void migrateEntity(Course course) {
// Save without any update; this will build the previously non-existing indexes
saveEntityDeferred(course);
}
}
Loading
Loading