Last active
April 18, 2018 13:53
-
-
Save gpsarkar/e764317af27e9a4e50ae51546fec01f7 to your computer and use it in GitHub Desktop.
testcafe snippet for asserting a text contains in pptx file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Selector } from 'testcafe'; | |
var textract = require('textract'); | |
fixture `File read and assert` | |
.page(about:blank); | |
test('test file content', async t => { | |
const fullFilePath = 'c:\\temp\\test.pptx'; | |
const stringToSearch = 'ABCDXYZ1234'; | |
var containsText = await new Promise(resolve => { | |
textract.fromFileWithPath(fullFilePath, function( error, text ) { | |
if(text.includes(stringToSearch)) { | |
resolve(true); | |
} else { | |
resolve(false); | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment