Skip to content

Commit

Permalink
Merge branch 'develop' into onboarding-profile-domain-config
Browse files Browse the repository at this point in the history
  • Loading branch information
BenHenning authored Nov 26, 2024
2 parents e8251c1 + 2f68639 commit f3f4c6d
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 11 deletions.
5 changes: 5 additions & 0 deletions scripts/assets/todo_open_exemptions.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,11 @@ todo_open_exemption {
line_number: 689
line_number: 737
line_number: 741
line_number: 790
line_number: 791
line_number: 792
line_number: 798
line_number: 800
}
todo_open_exemption {
exempted_file_path: "scripts/static_checks.sh"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ class GitHubClient(
val call = gitHubService.fetchOpenIssues(repoOwner, repoName, authorizationBearer, pageNumber)
// Deferred blocking I/O operation to the dedicated I/O dispatcher.
val response = withContext(Dispatchers.IO) { call.execute() }

check(response.isSuccessful()) {
"Failed to fetch issues at page $pageNumber: ${response.code()}\n${call.request()}" +
"\n${response.errorBody()}."
}
return@async checkNotNull(response.body()) {
"No issues response from GitHub for page: $pageNumber."
}
}.filter { it.pullRequest == null }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,18 @@ import com.squareup.moshi.JsonClass
* 'issues/' in an issue's GitHub URL)
*/
@JsonClass(generateAdapter = true)
data class GitHubIssue(@Json(name = "number") val number: Int)
data class GitHubIssue(
@Json(name = "number") val number: Int,
@Json(name = "pull_request") val pullRequest: PullRequestInfo? = null
)

/**
* Data class representing information about a pull request associated with a GitHub issue.
*
* @property url the URL of the pull request, if it exists. This provides the link to the specific
* pull request associated with the issue on GitHub.
*/
@JsonClass(generateAdapter = true)
data class PullRequestInfo(
@Json(name = "url") val url: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -777,11 +777,67 @@ class TodoOpenCheckTest {
assertThat(outContent.toString().trim()).isEqualTo(failureMessage)
}

private fun setUpGitHubService(issueNumbers: List<Int>) {
val issueJsons = issueNumbers.joinToString(separator = ",") { "{\"number\":$it}" }
@Test
fun testTodoCheck_PrPresent_checkShouldFail() {
setUpGitHubService(
issueNumbers = listOf(11004, 11003, 11002, 11001),
pullRequestNumbers = listOf(11005)
)
val tempFile1 = tempFolder.newFile("testfiles/TempFile1.kt")
val tempFile2 = tempFolder.newFile("testfiles/TempFile2.kt")
val testContent1 =
"""
// TODO(#11002): test summary 1.
# TODO(#11004): test summary 2.
# TODO(#11001): test summary 3.
test Todo
test TODO
""".trimIndent()
val testContent2 =
"""
// TODO(#11005): test summary 3.
todo
<!-- TODO(#11003): test summary 4-->
""".trimIndent()
tempFile1.writeText(testContent1)
tempFile2.writeText(testContent2)

val exception = assertThrows<Exception>() { runScript() }

assertThat(exception).hasMessageThat().contains(TODO_SYNTAX_CHECK_FAILED_OUTPUT_INDICATOR)
val failureMessage =
"""
TODOs not corresponding to open issues on GitHub:
- TempFile2.kt:1
$wikiReferenceNote
$regenerateNote
""".trimIndent()
assertThat(outContent.toString().trim()).isEqualTo(failureMessage)
}

private fun setUpGitHubService(
issueNumbers: List<Int>,
pullRequestNumbers: List<Int> = emptyList()
) {
// Create JSON for issues with "pull_request" set to null
val issueJsons = issueNumbers
.joinToString(separator = ",") { "{\"number\":$it,\"pull_request\":null}" }

// Create JSON for pull requests with "pull_request" as an empty object
val pullRequestJsons = pullRequestNumbers
.joinToString(separator = ",") { "{\"number\":$it,\"pull_request\":{}}" }

// Combine issues and pull requests into one JSON array
val combinedJsons =
"[$issueJsons${if (pullRequestNumbers.isNotEmpty()) ", $pullRequestJsons" else ""}]"

val mockWebServer = MockWebServer()
mockWebServer.enqueue(MockResponse().setBody("[$issueJsons]"))
mockWebServer.enqueue(MockResponse().setBody("[]")) // No more issues.
mockWebServer.enqueue(MockResponse().setBody(combinedJsons))
mockWebServer.enqueue(MockResponse().setBody("[]"))
GitHubClient.remoteApiUrl = mockWebServer.url("/").toString()
}

Expand Down
8 changes: 4 additions & 4 deletions wiki/Accessibility-A11y-Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ There are various manual and automated tests to check if app is accessible by al

**[Accessibility Scanner](https://support.google.com/accessibility/android/answer/6376570?hl=en)** : Using Accessibility Scanner we can take screenshots of each and every screen in the Oppia-app manually and the Accessibility Scanner app will give the output for the individual screenshot mentioning all the errors.

[Here](https://youtu.be/LF5AgGI5H3A) is a video tutorial on how to set up and use the Accessibility Scanner.
[Here](https://youtu.be/zCIlMlbFf7I?si=Xn1L5iCJ-TJ4DRVq) is a video tutorial on how to set up and use the Accessibility Scanner.

**Screen Reader**: Screen readers like **Talkback** can be used to test the app manually. Talkback app is used by blind people to navigate to different items in the screen and get audio based output. This app will not give any error like Accessibility Scanner.

Expand Down Expand Up @@ -80,7 +80,7 @@ TalkBack is the Google **screen reader** included on Android devices. TalkBack g
5. Read all the instructions written on the screen as using Talkback requires specific steps.
6. Turn on **Use Service** -> **Allow**

[Here](https://youtu.be/xpIM9xlowjs) is a video tutorial on "How to use Talkback and what does its output mean?".
[Here](https://youtu.be/JBRV1dauxyI?si=VzrxFJSpU9r3pdqq) is a video tutorial on "How to use Talkback and what does its output mean?".

### Useful Resources
* [Android A11Y Overview](https://support.google.com/accessibility/android/answer/6006564)
Expand All @@ -89,9 +89,9 @@ TalkBack is the Google **screen reader** included on Android devices. TalkBack g
* [Display speech output as Text: Talkback](https://developer.android.com/guide/topics/ui/accessibility/testing#optional_talkback_developer_settings)

### Developer Videos
* [How to use Accessibility Scanner? - Tutorial](https://youtu.be/LF5AgGI5H3A)
* [How to use Accessibility Scanner? - Tutorial](https://youtu.be/zCIlMlbFf7I?si=Xn1L5iCJ-TJ4DRVq)
* [Presentation Slides](https://docs.google.com/presentation/d/1PM_gs3TV2LVKFv6WuF9CUQHWbK7koepAxypzxeZTFzE/edit?usp=sharing)
* [How to use Talkback and what does its output mean? - Tutorial](https://youtu.be/xpIM9xlowjs)
* [How to use Talkback and what does its output mean? - Tutorial](https://youtu.be/JBRV1dauxyI?si=VzrxFJSpU9r3pdqq)
* [Presentation Slides](https://docs.google.com/presentation/d/17SeKJLKT-rUNa_Yupe97bMFSsjTNzp83jX-lZPKEtnQ/edit?usp=sharing)

## Using AccessibilityTestRule in Espresso Tests
Expand Down
2 changes: 1 addition & 1 deletion wiki/Interpreting-CI-Results.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Example in the below check the second job has some error or failure
Navigate to logs or search the keyword ‘error’ to find the error message to understand what might have caused the failure in the checks.

### Developer Video - Understanding CI check failures
Learn how to interpret and troubleshoot oppia-android CI check failures in this insightful [developer video](https://youtu.be/I2bRf6fvgJ0?si=35sAagbUFSk6bOBA).
Learn how to interpret and troubleshoot oppia-android CI check failures in this insightful [developer video](https://youtu.be/HLzHQULZbJE?si=RLY9_8Yzv5cjYM7q).
2 changes: 1 addition & 1 deletion wiki/Static-Analysis-Checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,4 @@ To fix failing tests from GitHub CI individually, follow the steps below.
Note: Before running the script command in your local terminal, make sure you have Bazel installed. To learn how to set up Bazel for Oppia Android, follow these [instructions](https://github.com/oppia/oppia-android/wiki/Oppia-Bazel-Setup-Instructions). Also make sure you have oppia-android-tools installed since static checks rely on these tools to be able to perform some of the checks. To install oppia-android-tools, run `bash scripts/setup.sh` in the oppia-android directory.

### Developer Video - Understanding CI check failures
Learn how to interpret and troubleshoot oppia-android CI check failures in this insightful [developer video](https://youtu.be/I2bRf6fvgJ0?si=35sAagbUFSk6bOBA).
Learn how to interpret and troubleshoot oppia-android CI check failures in this insightful [developer video](https://youtu.be/HLzHQULZbJE?si=RLY9_8Yzv5cjYM7q).

0 comments on commit f3f4c6d

Please sign in to comment.