Commit 988289d1b9
Verified · cmc
Layout: unified · split
gitbayUITests/LiveSmokeUITests.swift +18 −11
| @@ -1916,7 +1916,7 @@ extension LiveSmokeUITests { | ||
| 1916 | 1916 | } |
| 1917 | 1917 | |
| 1918 | 1918 | /// A comment's preview renders its markup before anything is sent: |
| 1919 | /// the bold markers are gone and the words remain. Nothing is posted. | |
| 1919 | /// the bold markers are gone and the word remains. Nothing is posted. | |
| 1920 | 1920 | func testMarkupPreviewFlow() throws { |
| 1921 | 1921 | openRepo(Self.fixtureRepo) |
| 1922 | 1922 | app.staticTexts["Issues"].firstMatch.tap() |
| @@ -1927,23 +1927,29 @@ extension LiveSmokeUITests { | ||
| 1927 | 1927 | let field = app.descendants(matching: .any) |
| 1928 | 1928 | .matching(identifier: "issue-comment-field").firstMatch |
| 1929 | 1929 | XCTAssertTrue(scrollTo(field, swipes: 10), "no comment field on the issue") |
| 1930 | field.tap() | |
| 1931 | let draft = "**ui-smoke preview**" | |
| 1932 | field.typeText(draft) | |
| 1930 | let draft = "**Bold preview**" | |
| 1931 | focusAndType(field, draft) | |
| 1933 | 1932 | |
| 1934 | 1933 | let preview = app.descendants(matching: .any) |
| 1935 | 1934 | .matching(identifier: "issue-comment-preview").firstMatch |
| 1936 | 1935 | XCTAssertTrue(scrollTo(preview), "no preview row for a non-empty comment") |
| 1936 | // The keyboard can cover the row right after typing. | |
| 1937 | for _ in 0..<3 where !preview.isHittable { app.swipeUp() } | |
| 1937 | 1938 | preview.tap() |
| 1938 | XCTAssertTrue(app.staticTexts | |
| 1939 | .containing(NSPredicate(format: "label CONTAINS 'ui-smoke preview'")).firstMatch | |
| 1940 | .waitForExistence(timeout: 5), "preview did not render the draft") | |
| 1939 | let rendered = app.staticTexts | |
| 1940 | .containing(NSPredicate(format: "label CONTAINS 'Bold preview'")).firstMatch | |
| 1941 | if !rendered.waitForExistence(timeout: 3) { | |
| 1942 | // The row's identifier can land on the cell rather than the toggle. | |
| 1943 | app.buttons["Preview"].firstMatch.tap() | |
| 1944 | } | |
| 1945 | XCTAssertTrue(rendered.waitForExistence(timeout: 5), "preview did not render the draft") | |
| 1941 | 1946 | XCTAssertFalse(app.staticTexts |
| 1942 | .containing(NSPredicate(format: "label CONTAINS '**ui-smoke'")).firstMatch.exists, | |
| 1947 | .containing(NSPredicate(format: "label CONTAINS '**Bold'")).firstMatch.exists, | |
| 1943 | 1948 | "preview shows the raw markup") |
| 1944 | 1949 | |
| 1945 | 1950 | // Kept on success too: this is how the preview's look is checked |
| 1946 | 1951 | // in light and dark without signing a simulator in by hand. |
| 1952 | for _ in 0..<3 where !rendered.isHittable { app.swipeUp() } | |
| 1947 | 1953 | let shot = XCTAttachment(screenshot: app.screenshot()) |
| 1948 | 1954 | shot.name = "markup preview" |
| 1949 | 1955 | shot.lifetime = .keepAlways |
| @@ -1951,8 +1957,9 @@ extension LiveSmokeUITests { | ||
| 1951 | 1957 | |
| 1952 | 1958 | // Leave the fixture as found: clear the draft, send nothing. |
| 1953 | 1959 | XCTAssertTrue(scrollTo(field), "comment field scrolled away") |
| 1954 | field.tap() | |
| 1955 | field.typeText(String(repeating: XCUIKeyboardKey.delete.rawValue, count: draft.count)) | |
| 1956 | XCTAssertFalse(preview.exists, "preview row outlived an empty comment") | |
| 1960 | field.coordinate(withNormalizedOffset: CGVector(dx: 0.98, dy: 0.9)).tap() | |
| 1961 | let typed = (field.value as? String)?.count ?? draft.count | |
| 1962 | field.typeText(String(repeating: XCUIKeyboardKey.delete.rawValue, count: typed)) | |
| 1963 | XCTAssertTrue(preview.waitForNonExistence(timeout: 5), "preview row outlived an empty comment") | |
| 1957 | 1964 | } |
| 1958 | 1965 | } |