UNPKG

@sap_oss/wdio-qmate-service

Version:

[![REUSE status](https://api.reuse.software/badge/github.com/SAP/wdio-qmate-service)](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[![Node.js CI](https://github.com/SAP/wdio-qmate-service/actions/workflows/node.js.yml/badge.svg)](http

40 lines (31 loc) 1.4 kB
const path = require("path"); describe("file - getTextData - Retrieve the content from .txt file", function () { let value; it("Preperation & Execution", async function () { const pathToFile = path.resolve(__dirname, "./testFiles/test.txt"); value = await util.file.getTextData(pathToFile); }); it("Verification", async () => { common.assertion.expectEqual(typeof value === "string", true); }); }); describe("file - getTextData - Assert if search string is included in file", function () { let value; it("Preperation & Execution", async function () { const pathToFile = path.resolve(__dirname, "./testFiles/test3.txt"); value = await util.file.getTextData(pathToFile); }); it("Verification", async () => { common.assertion.expectEqual(value.includes("FICA payment formats PF_BE"), true); common.assertion.expectEqual(value.includes("C000000000100000"), true); }); }); describe("file - getTextData - checkFileEnding - Assert correct file ending", function () { let pathToFile = null; it("Preperation", async function () { pathToFile = path.resolve(__dirname, "./testFiles/test1.xml"); }); it("Execution & Verification", async () => { await expect(util.file.getTextData(pathToFile)).rejects.toThrowError("Function 'getTextData' failed with: Wrong file format 'xml' was passed to function. Expected file format: txt."); }); });