Skip to content

Commit

Permalink
cypress - adding explicit parameter types
Browse files Browse the repository at this point in the history
  • Loading branch information
piwysocki authored and adrianmroz-allegro committed Mar 6, 2023
1 parent c4a56a5 commit cd80fb1
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/bar-chart.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ context("Bar Chart", () => {
legend().find(".legend-header").should("have.text", "Channel");
});

function assertLegendRowsInOrder(...values) {
function assertLegendRowsInOrder(...values: string[]) {
values.forEach((label, idx) => {
legendValue(idx + 1).should("contain", label);
});
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/boolean-filter-menu.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ context("Boolean Filter Menu", () => {
// tslint:enable:max-line-length
};

function assertSelection(isTrueOptionSelected, isFalseOptionSelected) {
function selectionToPredicate(isSelected) {
function assertSelection(isTrueOptionSelected: boolean, isFalseOptionSelected: boolean) {
function selectionToPredicate(isSelected: boolean) {
return isSelected ? "have.class" : "not.have.class";
}

Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/csv-data-source.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ context("CSV Data Source", () => {
const splitValue = (idx: number) => leftGutter().get(`.split-value:nth-child(${idx})`);
const measureValue = (idx: number) => body().get(`.measure-row:nth-child(${idx}) .measure-label`);

function assertDates(...dates) {
function assertDates(...dates: string[]) {
dates.forEach((date, idx) => {
splitValue(idx + 1).should("contain", date);
});
}

function assertValues(...values) {
function assertValues(...values: string[]) {
values.forEach((value, idx) => {
measureValue(idx + 1).should("contain", value);
});
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/fixed-time-filter-menu.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ context("Fixed Time Filter Menu", () => {
fixedTimeFilter: "http://localhost:9090/#wiki/4/N4IgbglgzgrghgGwgLzgFwgewHYgFwhqZqJQgA0hEAtgKbI634gCiaAxgPQCqAKgMIUQAMwgI0tAE5k8AbVBoAngAcmBDHSGTaw5hqaV9AJTjYA5rRnyQUEpLTMATAAYAjAFYAtM4Ccn1468zs54bqHOAHTBzgBaQrTYACZObl6+/gDMQSFhwVHBcQC+ALollFDKSGhWxeVSEJb41trCUgnsaiBwiYm0yZTCmJLU6PgKKp29wnAw4kJgiDCdIIWGE8x0cLDaK7UgyhDY2H0AIjQJUFjYViDsABamxwhC2HB0FXAdQtBGmABGxBAewORz6AGUhg4CN1ev0QAhaBYkvhsLMEJQ7hAzHckNioaiEAhCkA=="
};

function assertInputValues(startDate, startTime, endDate, endTime) {
function assertInputValues(startDate: string, startTime: string, endDate: string, endTime: string) {
startDateInput().should("have.value", startDate);
startTimeInput().should("have.value", startTime);
endDateInput().should("have.value", endDate);
endTimeInput().should("have.value", endTime);
}

function assertCalendarValues(date, startDay, endDay) {
function assertCalendarValues(date: string, startDay: number, endDay: number) {
calendarHeader().should("contain", date);
calendarDay(startDay).should("have.class", "selected");
calendarDay(endDay).should("have.class", "selected");
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/legend.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ context("Line Chart Legend", () => {
// tslint:enable:max-line-length
};

function assertLegendRowsInOrder(...values) {
function assertLegendRowsInOrder(...values: string[]) {
const rows = legendValues();
rows.should("have.length", values.length);

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/line-chart.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ context("Line Chart", () => {
});

describe("Highlight", () => {
const assertHighlighterPosition = (expectedLeft, expectedWidth) =>
const assertHighlighterPosition = (expectedLeft: number, expectedWidth: number) =>
highlighterFrame().should($frame => {
const frame = $frame.get(0);
expect(frame.offsetLeft).to.eq(expectedLeft);
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/split-tile.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ context("Split Tile", () => {
// tslint:enable:max-line-length
};

const shouldHaveSplits = (...splits) => {
const shouldHaveSplits = (...splits: string[]) => {
splitItems().should("have.length", splits.length);
splitItemsRow().within(() => {
splits.forEach((split, idx) => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/string-split-menu.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ context("String Split Menu", () => {
channelSplit: "http://localhost:9090/#wiki/4/N4IgbglgzgrghgGwgLzgFwgewHYgFwhpwBGCApiADSEQC2ZyOFBAomgMYD0AqgCoDCVEADMICNGQBOUfAG1QaAJ4AHZjXpDJZYfnUVqGegAUpWACYy88kGZiT0WXASMBGACJCoE5fgC0LgxU1BHQyLxAAXwBdaOooZSQ0S2slVV0vSQhsAHMhMzoybChHXXYACzhsbDIET0xJNHxQLR0CODMzMjMhVLUoUzC8iC12DBxdTqh2QvycoVVMzG6CSOokWghGvABWAAZYkH7Mwatm7SlC6d12zu7qYXradCbCIIntOBhxITBEGDVVq80gR6HBYFpIlFqMostUzG4CkVHMkQOVKtVatRsHB6PE4FdqNAAEqYYiYRpQkAwqpdADK9S2IBuXSE5GyM3w2C+CGoZQg2TKSAFWy5CAQESAA=="
};

function assertSplitSettings(orderBy, descending, limit) {
function assertSplitSettings(orderBy: string, descending: boolean, limit: number) {
sortBySelection().should("contain", orderBy);
sortDirection().should("have.class", descending ? "descending" : "ascending");
limitSelection().should("contain", limit);
Expand Down
10 changes: 5 additions & 5 deletions cypress/e2e/table.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ context("Table", () => {
const highlightModal = () => cy.get(".highlight-modal");
const acceptHighlight = () => highlightModal().find(".accept");
const dropHighlight = () => highlightModal().find(".drop");
const findSplitValue = label => table().find(`.split-value:contains("${label}")`);
const nthRow = n => table().find(`.measure-row:nth-child(${n})`);
const findSplitValue = (label: string) => table().find(`.split-value:contains("${label}")`);
const nthRow = (n: number) => table().find(`.measure-row:nth-child(${n})`);

describe("Highlight", () => {
const urls = {
Expand All @@ -37,7 +37,7 @@ context("Table", () => {
clickSplitValue("Main");
});

function clickSplitValue(label) {
function clickSplitValue(label: string) {
return findSplitValue(label)
.then($splitValue => {
const { top: scrollerOffset } = $splitValue.closest(".scroller").offset();
Expand All @@ -48,7 +48,7 @@ context("Table", () => {
});
}

function assertSplitValueRowHighlight(label) {
function assertSplitValueRowHighlight(label: string) {
const splitValue = findSplitValue(label);
splitValue
.should("have.class", "highlight")
Expand All @@ -63,7 +63,7 @@ context("Table", () => {
table().find(".split-value.selected").should("not.exist");
}

function assertFilterTileValues(values) {
function assertFilterTileValues(values: string[]) {
values.forEach((value, idx) => {
filterTile(idx + 1).should("contain", value);
});
Expand Down

0 comments on commit cd80fb1

Please sign in to comment.