Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Merge branch 'prerelease' into release
Browse files Browse the repository at this point in the history
# Conflicts:
#	buildSrc/src/main/kotlin/ProtonMail.kt
  • Loading branch information
Zorica Stojchevska committed Mar 16, 2021
2 parents 81843df + 9078db0 commit 6dceedf
Show file tree
Hide file tree
Showing 258 changed files with 7,830 additions and 4,351 deletions.
5 changes: 3 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ unit tests release:
--device model=Pixel2,version=28
--test-targets "class ch.protonmail.android.uitests.tests.suites.SmokeSuite"
--use-orchestrator
--num-flaky-test-attempts=2
--num-flaky-test-attempts=1
--timeout 30m

firebase tests:
Expand Down Expand Up @@ -258,14 +258,15 @@ firebase feature tests:
- echo $SERVICE_ACCOUNT_MAIL > /tmp/service-account.json
- gcloud auth activate-service-account --key-file /tmp/service-account.json
- export CLOUDSDK_CORE_DISABLE_PROMPTS=1
- gcloud --quiet firebase test android run
- gcloud beta --quiet firebase test android run
--app app/build/outputs/apk/beta/debug/ProtonMail-Android-${VERSION_NAME}-beta-debug.apk
--test app/build/outputs/apk/androidTest/beta/debug/ProtonMail-Android-${VERSION_NAME}-beta-debug-androidTest.apk
--device model=$MODEL,version=$API_LEVEL
--test-targets "class ch.protonmail.android.uitests.tests.$TEST_CLASS"
--use-orchestrator
--num-flaky-test-attempts=1
--timeout 45m
--client-details testType=$TEST_TYPE,testSuite=$TEST_CLASS,commitBranch=$CI_COMMIT_BRANCH,gitlabJobUrl=$CI_JOB_URL

include:
- project: 'translations/generator'
Expand Down
2 changes: 1 addition & 1 deletion .idea/codeStyles/Project.xml

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

Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ import ch.protonmail.android.api.models.room.contacts.ContactEmail
import ch.protonmail.android.api.models.room.contacts.ContactEmailContactLabelJoin
import ch.protonmail.android.api.models.room.contacts.ContactLabel
import ch.protonmail.android.api.models.room.contacts.ContactsDatabaseFactory
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.runBlockingTest
import org.junit.Assert
import org.junit.Rule
import java.util.Arrays
import kotlin.test.Test
import java.util.*

/**
* Created by Dino Kadrikj on 13.08.2018.
Expand All @@ -51,7 +53,7 @@ class ContactGroupsDatabaseTest {
database.saveContactGroupLabel(label2)
database.saveContactGroupLabel(label3)

val needed = database.findContactGroupById("b")
val needed = database.findContactGroupByIdBlocking("b")
Assert.assertEquals(label2, needed)
}

Expand All @@ -62,7 +64,7 @@ class ContactGroupsDatabaseTest {
database.saveContactGroupLabel(label1)
database.updateFullContactGroup(label2)

val needed = database.findContactGroupById("a")
val needed = database.findContactGroupByIdBlocking("a")
Assert.assertEquals(needed?.name, "ab")
}

Expand All @@ -74,8 +76,8 @@ class ContactGroupsDatabaseTest {
database.saveAllContactGroups(label1, label2)
database.updateFullContactGroup(label3)

val neededUpdated = database.findContactGroupById("a")
val neededNotUpdated = database.findContactGroupById("b")
val neededUpdated = database.findContactGroupByIdBlocking("a")
val neededNotUpdated = database.findContactGroupByIdBlocking("b")
Assert.assertEquals(neededUpdated?.name, "ab")
Assert.assertEquals(neededNotUpdated?.name, "bb")
}
Expand All @@ -87,7 +89,7 @@ class ContactGroupsDatabaseTest {
database.saveContactGroupLabel(label1)
database.updatePartially(label2)

val needed = database.findContactGroupById("a")
val needed = database.findContactGroupByIdBlocking("a")
Assert.assertEquals(needed?.color, "aaa")
Assert.assertEquals(needed?.name, "ab")
Assert.assertEquals(needed?.order, 1)
Expand All @@ -113,7 +115,7 @@ class ContactGroupsDatabaseTest {
database.saveContactGroupLabel(label2)
database.saveContactGroupLabel(label3)

val actual = database.findContactGroupById("a")
val actual = database.findContactGroupByIdBlocking("a")
Assert.assertEquals(label3, actual)
}

Expand All @@ -125,7 +127,7 @@ class ContactGroupsDatabaseTest {
database.saveAllContactGroups(label1, label2, label3)
val sizeAfterInsert = database.findContactGroupsLiveData().testValue?.size
Assert.assertEquals(sizeAfterInsert, 3)
database.clearContactGroupsLabelsTable()
database.clearContactGroupsLabelsTableBlocking()
val sizeAfterClearing = database.findContactGroupsLiveData().testValue?.size
Assert.assertEquals(sizeAfterClearing, 0)
}
Expand Down Expand Up @@ -165,7 +167,7 @@ class ContactGroupsDatabaseTest {
val email5 = ContactEmail("e5", "[email protected]", "e", labelIds = listOf("lb"))
val email6 = ContactEmail("e6", "[email protected]", "f", labelIds = listOf("ld"))

database.saveAllContactsEmails(email1, email2, email3, email4, email5, email6)
database.saveAllContactsEmailsBlocking(email1, email2, email3, email4, email5, email6)
database.saveAllContactGroups(label1, label2, label3, label4)

val contactEmailContactLabel1 = ContactEmailContactLabelJoin("e1", "la")
Expand All @@ -178,13 +180,13 @@ class ContactGroupsDatabaseTest {
val contactEmailContactLabel8 = ContactEmailContactLabelJoin("e5", "lb")
val contactEmailContactLabel9 = ContactEmailContactLabelJoin("e6", "ld")

database.saveContactEmailContactLabel(contactEmailContactLabel1, contactEmailContactLabel2, contactEmailContactLabel3,
contactEmailContactLabel4, contactEmailContactLabel5, contactEmailContactLabel6, contactEmailContactLabel7,
contactEmailContactLabel8, contactEmailContactLabel9)
val laCount = database.countContactEmailsByLabelId("la")
val lbCount = database.countContactEmailsByLabelId("lb")
val lcCount = database.countContactEmailsByLabelId("lc")
val ldCount = database.countContactEmailsByLabelId("ld")
database.saveContactEmailContactLabelBlocking(contactEmailContactLabel1, contactEmailContactLabel2, contactEmailContactLabel3,
contactEmailContactLabel4, contactEmailContactLabel5, contactEmailContactLabel6, contactEmailContactLabel7,
contactEmailContactLabel8, contactEmailContactLabel9)
val laCount = database.countContactEmailsByLabelIdBlocking("la")
val lbCount = database.countContactEmailsByLabelIdBlocking("lb")
val lcCount = database.countContactEmailsByLabelIdBlocking("lc")
val ldCount = database.countContactEmailsByLabelIdBlocking("ld")
Assert.assertEquals(3, laCount)
Assert.assertEquals(2, lbCount)
Assert.assertEquals(3, lcCount)
Expand All @@ -201,7 +203,7 @@ class ContactGroupsDatabaseTest {
val email4 = ContactEmail("e4", "[email protected]", labelIds = listOf("lb"), name = "ce3")
val email5 = ContactEmail("e5", "[email protected]", labelIds = listOf("lb", "la"), name = "ce4")

database.saveAllContactsEmails(email1, email2, email4, email5)
database.saveAllContactsEmailsBlocking(email1, email2, email4, email5)
database.saveAllContactGroups(label1, label2)

val contactEmailContactLabel1 = ContactEmailContactLabelJoin("e1", "la")
Expand All @@ -211,8 +213,8 @@ class ContactGroupsDatabaseTest {
val contactEmailContactLabel7 = ContactEmailContactLabelJoin("e5", "lb")
val contactEmailContactLabel8 = ContactEmailContactLabelJoin("e5", "la")

database.saveContactEmailContactLabel(contactEmailContactLabel1, contactEmailContactLabel2,
contactEmailContactLabel3, contactEmailContactLabel4, contactEmailContactLabel7, contactEmailContactLabel8)
database.saveContactEmailContactLabelBlocking(contactEmailContactLabel1, contactEmailContactLabel2,
contactEmailContactLabel3, contactEmailContactLabel4, contactEmailContactLabel7, contactEmailContactLabel8)
val laReturnedEmails = database.findAllContactsEmailsByContactGroupAsync("la").testValue
val lbReturnedEmails = database.findAllContactsEmailsByContactGroupAsync("lb").testValue
val lcReturnedEmails = database.findAllContactsEmailsByContactGroupAsync("lc").testValue
Expand All @@ -233,7 +235,7 @@ class ContactGroupsDatabaseTest {
val email4 = ContactEmail("e3", "[email protected]", labelIds = listOf("lb"), name = "ce3")
val email5 = ContactEmail("e4", "[email protected]", labelIds = listOf("lb", "la"), name = "ce4")

database.saveAllContactsEmails(email1, email2, email4, email5)
database.saveAllContactsEmailsBlocking(email1, email2, email4, email5)
database.saveAllContactGroups(label1, label2)

val contactEmailContactLabel1 = ContactEmailContactLabelJoin("e1", "la")
Expand All @@ -243,18 +245,20 @@ class ContactGroupsDatabaseTest {
val contactEmailContactLabel7 = ContactEmailContactLabelJoin("e4", "lb")
val contactEmailContactLabel8 = ContactEmailContactLabelJoin("e4", "la")

database.saveContactEmailContactLabel(contactEmailContactLabel1, contactEmailContactLabel2,
contactEmailContactLabel3, contactEmailContactLabel4, contactEmailContactLabel7, contactEmailContactLabel8)
var result = database.filterContactsEmailsByContactGroup("la", "%2%")

Assert.assertNotNull(result)
Assert.assertEquals(1, result.size)
Assert.assertEquals(listOf(email2), result)

result = database.filterContactsEmailsByContactGroup("lb", "%3%")
Assert.assertNotNull(result)
Assert.assertEquals(2, result.size)
Assert.assertEquals(listOf(email4, email5), result)
database.saveContactEmailContactLabelBlocking(contactEmailContactLabel1, contactEmailContactLabel2,
contactEmailContactLabel3, contactEmailContactLabel4, contactEmailContactLabel7, contactEmailContactLabel8)
runBlockingTest {
val result = database.filterContactsEmailsByContactGroup("la", "%2%").first()

Assert.assertNotNull(result)
Assert.assertEquals(1, result.size)
Assert.assertEquals(listOf(email2), result)

val result2 = database.filterContactsEmailsByContactGroup("lb", "%3%").first()
Assert.assertNotNull(result2)
Assert.assertEquals(2, result2.size)
Assert.assertEquals(listOf(email4, email5), result2)
}
}

@Test
Expand All @@ -267,7 +271,7 @@ class ContactGroupsDatabaseTest {
val email4 = ContactEmail("e4", "[email protected]", labelIds = listOf("lb"), name = "ce3")
val email5 = ContactEmail("e5", "[email protected]", labelIds = listOf("lb", "la"), name = "ce4")

database.saveAllContactsEmails(email1, email2, email4, email5)
database.saveAllContactsEmailsBlocking(email1, email2, email4, email5)
database.saveAllContactGroups(label1, label2)

val contactEmailContactLabel1 = ContactEmailContactLabelJoin("e1", "la")
Expand All @@ -277,7 +281,7 @@ class ContactGroupsDatabaseTest {
val contactEmailContactLabel7 = ContactEmailContactLabelJoin("e5", "lb")
val contactEmailContactLabel8 = ContactEmailContactLabelJoin("e5", "la")

database.saveContactEmailContactLabel(contactEmailContactLabel1, contactEmailContactLabel2,
database.saveContactEmailContactLabelBlocking(contactEmailContactLabel1, contactEmailContactLabel2,
contactEmailContactLabel3, contactEmailContactLabel4, contactEmailContactLabel7, contactEmailContactLabel8)
val laReturnedEmails = database.findAllContactGroupsByContactEmailAsync("e1").testValue

Expand Down
Loading

0 comments on commit 6dceedf

Please sign in to comment.