|
| 1 | +# Validation |
| 2 | + |
| 3 | +:include-file: doc-artifacts/snippets/fsFileContent/readFile.groovy { |
| 4 | + title: "validate file content", |
| 5 | + surroundedBy: "assert-file" |
| 6 | +} |
| 7 | + |
| 8 | +# Content Extraction |
| 9 | + |
| 10 | +Use `.data` to access actual file content for further processing |
| 11 | + |
| 12 | +:include-file: doc-artifacts/snippets/fsFileContent/readFile.groovy { |
| 13 | + title: "access file content", |
| 14 | + surroundedBy: "actual-file-content" |
| 15 | +} |
| 16 | + |
| 17 | +Use `extractByRegexp` to extract content from a file by regular expression |
| 18 | + |
| 19 | +:include-file: doc-artifacts/snippets/fsFileContent/readFile.groovy { |
| 20 | + title: "extract file content", |
| 21 | + surroundedBy: "extract-id", |
| 22 | + excludeRegexp: "statusCode" |
| 23 | +} |
| 24 | + |
| 25 | +# Write To File |
| 26 | + |
| 27 | +:include-file: doc-artifacts/snippets/fsFileContent/createFile.groovy { |
| 28 | + title: "write content to a file", |
| 29 | + includeRegexp: ["fs\\.writeText"] |
| 30 | +} |
| 31 | + |
| 32 | +# Replace File Content |
| 33 | + |
| 34 | +Use `replaceText` to replace text in place |
| 35 | + |
| 36 | +:include-file: doc-artifacts/snippets/fsFileContent/replaceFile.groovy { |
| 37 | + title: "replace file content", |
| 38 | + surroundedBy: "replace-text" |
| 39 | +} |
| 40 | + |
| 41 | +```columns |
| 42 | +left: :include-file: doc-artifacts/fs-content-to-replace.txt {title: "file to replace"} |
| 43 | +right: :include-file: doc-artifacts/fs-content-after-replace-text.txt {title: "result of replace"} |
| 44 | +``` |
| 45 | + |
| 46 | +# Wait For Content |
| 47 | + |
| 48 | +`fs.textContent` declares file content, but doesn't access it right away. |
| 49 | +WebTau reads file content when validation happens. Here is an example of waiting on file content: |
| 50 | + |
| 51 | +:include-file: doc-artifacts/snippets/fsFileContent/readFile.groovy { |
| 52 | + title: "wait for a specific file content", |
| 53 | + surroundedBy: "wait-for-id" |
| 54 | +} |
| 55 | + |
| 56 | +Use `takeSnapshot` and `waitTo change` to wait for any file change: |
| 57 | + |
| 58 | +:include-file: doc-artifacts/snippets/fsFileContent/waitForChange.groovy { |
| 59 | + title: "wait for any content change", |
| 60 | + surroundedBy: ["file-take-snapshot", "file-wait-to-change"], |
| 61 | + surroundedBySeparator: "..." |
| 62 | +} |
| 63 | + |
0 commit comments