Create poll UX (#1571)

* Add poll attachment button

* Add poll creation feature flag

* Setup navigation to CreatePollScreen

* Add create/cancel actions

* Add create poll screen ui skeleton

* Add bindings in CreatePollScreen

* Add logics in CreatePollScreen

* Cleanup code

* Fix option deletion crash

* Fix conflicts

* Add create poll logic

* Add localisations

* Fix test build errors

* Fix crash

* Add UTs

* Add accessibility IDs

* Add ui tests

* Add 240 char limit

* Fix addOption hide behavior

* Add maxNumberOfOptions

* Cleanup code

* Move delete workaround in the view model

* Use compound delete icon
This commit is contained in:
Alfonso Grillo
2023-08-30 11:23:30 +02:00
committed by GitHub
parent e08d7b491e
commit a2623dd254
41 changed files with 846 additions and 3 deletions
@@ -0,0 +1,66 @@
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
class CreatePollScreenUITests: XCTestCase {
func testEmptyScreen() async throws {
let app = Application.launch(.createPoll)
try await app.assertScreenshot(.createPoll)
}
func testFilledPoll() async throws {
let app = Application.launch(.createPoll)
let questionTextField = app.textFields[A11yIdentifiers.createPollScreen.question]
questionTextField.tap()
questionTextField.typeText("Do you like polls?")
let option1TextField = app.textFields[A11yIdentifiers.createPollScreen.optionID(0)]
option1TextField.tap()
option1TextField.typeText("Yes")
let option2TextField = app.textFields[A11yIdentifiers.createPollScreen.optionID(1)]
option2TextField.tap()
option2TextField.typeText("No")
let createButton = app.buttons[A11yIdentifiers.createPollScreen.create]
XCTAssertTrue(createButton.isEnabled)
try await app.assertScreenshot(.createPoll, step: 1)
}
func testMaxOptions() async throws {
let app = Application.launch(.createPoll)
let createButton = app.buttons[A11yIdentifiers.createPollScreen.create]
let addOption = app.buttons[A11yIdentifiers.createPollScreen.addOption]
for _ in 1...18 {
if !addOption.exists {
app.swipeUp()
}
addOption.tap()
}
app.swipeUp()
XCTAssertFalse(addOption.exists)
XCTAssertFalse(createButton.isEnabled)
try await app.assertScreenshot(.createPoll, step: 2)
}
}
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:29a2bba04064c1ed0e839bf7fe29d51bf2c6488b0e4e0992deecff1c30aeb092
size 157226
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f63af9f1e715da12f55d7e91279c47219b42b27125e44f915c47227321a12bdb
size 185844
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:467a21fa9a0d2a535887851f4ba65b91f106f38a1663eec31dd5b33ad4316fef
size 89795
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a934baa838db31b290f69fff6037d6764789615a25f34c94b8273abde4b8c83a
size 170170
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f425a4f8ff36e11084da41350cc5ccae122be06cac59d1e9b03adab4f1c50d15
size 308853
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d07086d5750c676a1f935366289bf803ed50cd2d83e962227edb50e4be432cf7
size 103803
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e8de87274b05142ffd494ef3e539e222241461521d9c12da6c60fe2bb8a894de
size 161620
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5952c0897de9cce140b877dda5413f2ee2a611d5bdfe7747b24289c3280534ef
size 223668
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9bb7f282056f9db7bc3edd8c9be0493d9252b407800ee6214da367b60eef5867
size 97972
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:75784ba1bcc96f0db74fa476073241c7e27dc809b35516a4a7fe35ee127b5748
size 183973
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a71198a895a22048cb9ace7b98bb9bb6f8ea531e01502e07a6a6c4db87738873
size 351270
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ac225c17efd828512b67ee40d4de6ea63b6173bac280156945d8a77622a12556
size 125867