Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(testkit): add eslint, small fixes and add tslib #2572

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/testkit/BaseElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import { test, Page, Locator } from "@playwright/test";
export class BaseElement {
page : Page;
locator : Locator;
elementReportName: String
elementReportName: string
/**
* Create a BaseElement.
* @param {Object} page - The Playwright page object.
* @param {Object} locator - The locator for the element.
* @param {string} elementReportName - The name for reporting purposes.
*/
constructor(page: Page, locator: Locator, elementReportName: String) {
constructor(page: Page, locator: Locator, elementReportName: string) {
this.page = page;
this.locator = locator;
this.elementReportName = elementReportName;
Expand All @@ -31,7 +31,7 @@ export class BaseElement {
* Wait for the list elements to stabilize (i.e., the count of items remains constant for a specified duration).
* @returns {Promise<void>}
*/
async waitForElementsGroup(locator: Locator, elementReportName: String): Promise<void> {
async waitForElementsGroup(locator: Locator, elementReportName: string): Promise<void> {
await test.step(`Wait for ${elementReportName} items to stabilize`, async () => {
let previousCount = 0;
let stableCountTime = 0;
Expand Down Expand Up @@ -75,6 +75,7 @@ export class BaseElement {
await this.locator.scrollIntoViewIfNeeded();
});
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async getAttributeValue(attributeName: string, options: any = { timeout: 10000, pollInterval: 500 }) : Promise <string | null> {
let attributeValue = null;

Expand Down
2 changes: 1 addition & 1 deletion packages/testkit/__TESTS__/checkbox.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test.describe("menuButton Class with Storybook", () => {
checkbox = new Checkbox(page, checkboxLocator, "Test checkbox button");
});

test("set checkbox", async ({page}) => {
test("set checkbox", async () => {
if (await checkbox.isChecked()){
await checkbox.setChecked(false);
expect(await checkbox.isChecked()).toBe(false);
Expand Down
2 changes: 1 addition & 1 deletion packages/testkit/__TESTS__/textArea.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test.describe("textArea Class with Storybook", () => {
textArea = new TextArea(page, textAreaLocator, "Test text field");
});

test("set text in textarea", async ({page}) => {
test("set text in textarea", async () => {
await textArea.setText("Test Text");
expect(textArea.textAreaInput.locator).toHaveValue("Test Text");
});
Expand Down
2 changes: 1 addition & 1 deletion packages/testkit/__TESTS__/textfield.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test.describe("textArea Class with Storybook", () => {
textField = new TextField(page, textfieldLocator, "Test text field");
});

test("set text in text field", async ({page}) => {
test("set text in text field", async () => {
await textField.setText("Test Text");
await textField.exitEditMode();
expect(textField.locator).toHaveValue("Test Text");
Expand Down
2 changes: 2 additions & 0 deletions packages/testkit/buttons/MenuButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class MenuButton extends Button {
override locator: Locator;
override elementReportName: string;
button: Button;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
menu: any;

/**
Expand All @@ -18,6 +19,7 @@ export class MenuButton extends Button {
* @param {string} elementReportName - The name for reporting purposes.
* @param {any} menuType - The type of menu associated with the button.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(page: Page, locator: Locator, elementReportName: string, menuType: any) {
super(page, locator, elementReportName);
this.page = page;
Expand Down
6 changes: 6 additions & 0 deletions packages/testkit/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// eslint.config.js
export default [
{
ignores: ["node_modules/", "dist/", "*.config.js", "*.spec.js"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this? It should already ignore node_modules and dist
For the others I think it'd be useful

}
];
7 changes: 6 additions & 1 deletion packages/testkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"url": "https://github.com/mondaycom/vibe/issues"
},
"devDependencies": {
"@playwright/test": "1.45.3"
"@eslint/js": "^9.13.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just use eslint

"@playwright/test": "1.45.3",
"eslint": "^9.13.0",
"globals": "^15.11.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is it for? I don't think you need it

"tslib": "^2.8.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need typescript as well? Or maybe just typescript

"typescript-eslint": "^8.12.2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need it either, it's included in eslint

}
}
Loading
Loading