|
| 1 | +# File Content |
| 2 | + |
| 3 | +:include-file: doc-artifacts/snippets/fsFileContent/createFile.groovy { |
| 4 | + title: "write content to a file", |
| 5 | + includeRegexp: ["fs\\.writeText"] |
| 6 | +} |
| 7 | + |
| 8 | +:include-file: doc-artifacts/snippets/fsFileContent/readFile.groovy { |
| 9 | + title: "validate file content", |
| 10 | + startLine: "assert-file", |
| 11 | + endLine: "assert-file", |
| 12 | + excludeStartEnd: true |
| 13 | +} |
| 14 | + |
| 15 | +`fs.textContent` declares file content, but doesn't access it right away. |
| 16 | +Webtau reads file content when validation happens. Here is an example of waiting on file content: |
| 17 | + |
| 18 | +:include-file: doc-artifacts/snippets/fsFileContent/readFile.groovy { |
| 19 | + title: "wait for file content", |
| 20 | + startLine: "wait-for-id", |
| 21 | + endLine: "wait-for-id", |
| 22 | + excludeStartEnd: true |
| 23 | +} |
| 24 | + |
| 25 | +Use `.data` to access actual file content for further processing |
| 26 | + |
| 27 | +:include-file: doc-artifacts/snippets/fsFileContent/readFile.groovy { |
| 28 | + title: "access file content", |
| 29 | + startLine: "actual-file-content", |
| 30 | + endLine: "actual-file-content", |
| 31 | + excludeStartEnd: true |
| 32 | +} |
| 33 | + |
| 34 | +Use `extractByRegexp` to extract content from a file by regular expression |
| 35 | + |
| 36 | +:include-file: doc-artifacts/snippets/fsFileContent/readFile.groovy { |
| 37 | + title: "extract file content", |
| 38 | + startLine: "extract-id", |
| 39 | + endLine: "extract-id", |
| 40 | + excludeStartEnd: true, |
| 41 | + excludeRegexp: "statusCode" |
| 42 | +} |
| 43 | + |
| 44 | +# Copy |
| 45 | + |
| 46 | +:include-file: doc-artifacts/snippets/fsCopy/copyFileToDir.groovy { |
| 47 | + title: "copy single file to a directory", |
| 48 | + includeRegexp: ["fs\\.copy", "createDir"] |
| 49 | +} |
| 50 | + |
| 51 | +:include-file: doc-artifacts/snippets/fsCopy/copyFileToTempDir.groovy { |
| 52 | + title: "copy single file to a temp directory", |
| 53 | + includeRegexp: ["fs\\.copy", "tempDir"] |
| 54 | +} |
| 55 | + |
| 56 | +:include-file: doc-artifacts/snippets/fsCopy/copyFileToFile.groovy { |
| 57 | + title: "copy single file to a file", |
| 58 | + includeRegexp: ["fs\\.copy"] |
| 59 | +} |
| 60 | + |
| 61 | +# Unzip |
| 62 | + |
| 63 | +:include-file: doc-artifacts/snippets/fsArchive/unzip.groovy { |
| 64 | + title: "unzip a file" |
| 65 | +} |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
0 commit comments