getgauge/gauge-ts

Add Table parameter support

BugDiver opened this issue · 2 comments

Add support for typed Table as a parameter to steps.

Currently, it's available as any type

Example:

import { Step } from "gauge-ts";

export default class StepImplementation {
    @Step("Almost all words have vowels <wordsTable>")
    public async verifyVowelsCountInMultipleWords(wordsTable: any) {
        for (const row of wordsTable.rows) {
            equal(await this.countVowels(row.cells[0]), parseInt(row.cells[1]));
        }
    }
}

Describe the solution you'd like

import { Step, Table } from "gauge-ts";

export default class StepImplementation {
    @Step("Almost all words have vowels <wordsTable>")
    public async verifyVowelsCountInMultipleWords(table: Table) {
        for (let row of table.getTableRows()) {
            let word:string = row.getCell("Word");
            let expectedCount = parseInt(row.getCell("Vowel Count"));
            let actualCount = countVowels(word);
            equal(expectedCount, actualCount);
        }
    }
}

Probably fixing this one could fix also #119 🤔

Done via 49f1273