From 828836a67daf66d65f2e71816d440859bef40106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20CG?= Date: Tue, 26 Nov 2024 18:23:34 +0100 Subject: [PATCH] chore: fix lint errors on tests --- eslint.config.mjs | 10 ---------- tests/e2e/cucumber/common-steps.spec.ts | 3 ++- tests/e2e/cucumber/facets.spec.ts | 5 +++-- tests/e2e/support/index.ts | 4 ++++ 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 77e99365..793f3d85 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -22,14 +22,4 @@ export default empathyco( 'ts/no-unsafe-member-access': 'off', }, }, - { - files: ['tests/**/*.{ts,tsx,vue}'], - rules: { - // Enable the following rules progressively when the project is ready to enforce them - 'ts/no-unsafe-call': 'off', - 'ts/no-unsafe-argument': 'off', - 'ts/no-unsafe-member-access': 'off', - 'ts/no-unsafe-return': 'off', - }, - }, ) diff --git a/tests/e2e/cucumber/common-steps.spec.ts b/tests/e2e/cucumber/common-steps.spec.ts index e78358a6..ee1bc3b8 100644 --- a/tests/e2e/cucumber/common-steps.spec.ts +++ b/tests/e2e/cucumber/common-steps.spec.ts @@ -1,3 +1,4 @@ +import type { XAPI } from '@empathyco/x-components' import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor' import ViewportPreset = Cypress.ViewportPreset @@ -8,7 +9,7 @@ Given('start page with {string} size view', (view: ViewportPreset) => { Then('search bar is clicked', () => { cy.getByDataTest('x').should('exist') - cy.window().then(window => window.InterfaceX.search()) + cy.window().then(window => (window.InterfaceX as XAPI).search()) }) // Search diff --git a/tests/e2e/cucumber/facets.spec.ts b/tests/e2e/cucumber/facets.spec.ts index 4af3295b..8f8a82a5 100644 --- a/tests/e2e/cucumber/facets.spec.ts +++ b/tests/e2e/cucumber/facets.spec.ts @@ -1,3 +1,4 @@ +import type { TestContext } from '../support' import { Then, When } from '@badeball/cypress-cucumber-preprocessor' import '../cucumber/global-definitions' @@ -31,7 +32,7 @@ When('filter {int} from facet {string} is clicked', (filterNumber: number, facet Then( 'filter {int} from facet {string} is selected is {boolean}', - function (this: any, filterNumber: number, facetName: string, isSelected: boolean) { + function (this: TestContext, filterNumber: number, facetName: string, isSelected: boolean) { cy.getByDataTest(facetName) .contains(this[`clickedFilter${filterNumber}`].trim()) .should(`${isSelected ? '' : 'not.'}to.have.class`, 'x-selected') @@ -67,7 +68,7 @@ When( Then( 'selection status of child filter {int} from parent filter {int} in facet {string} is {boolean}', function ( - this: any, + this: TestContext, childFilterIndex: number, hierarchicalFilterIndex: number, facetName: string, diff --git a/tests/e2e/support/index.ts b/tests/e2e/support/index.ts index f82b04a5..a2f1feb6 100644 --- a/tests/e2e/support/index.ts +++ b/tests/e2e/support/index.ts @@ -16,6 +16,10 @@ import Withinable = Cypress.Withinable */ Cypress.on('uncaught:exception', err => !err.message.includes('ResizeObserver loop limit exceeded')) +export interface TestContext { + [key: string]: string +} + export interface CustomCommands { /** * Searches a query by typing it in the search input and pressing enter.