-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: e2e refactors [TESTENG-2] (#9549)
- Loading branch information
1 parent
8f21555
commit 63d69a1
Showing
85 changed files
with
596 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
webui/react/src/e2e/models/ant/DatePicker.ts → ...t/src/e2e/models/common/ant/DatePicker.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { BaseComponent } from 'e2e/models/common/base/BaseComponent'; | ||
import { BaseOverlay, OverlayArgs } from 'e2e/models/common/base/BaseOverlay'; | ||
|
||
/** | ||
* Represents the Dropdown component from antd/es/dropdown/index.js | ||
* Until the dropdown component supports test ids, this model will match any open dropdown. | ||
*/ | ||
export class Dropdown extends BaseOverlay { | ||
constructor(args: OverlayArgs) { | ||
super({ | ||
...args, | ||
selector: '.ant-dropdown ul.ant-dropdown-menu:visible', | ||
}); | ||
} | ||
|
||
/** | ||
* Returns a MenuItem with the specified id | ||
* @param {string} id - the id of the menu item | ||
*/ | ||
menuItem(id: string): MenuItem { | ||
return new MenuItem({ | ||
parent: this, | ||
selector: `li.ant-dropdown-menu-item[data-menu-id$="${id}"]`, | ||
}); | ||
} | ||
|
||
/** | ||
* Selects a MenuItem with the specified id | ||
* @param {string} id - id of the item to select | ||
*/ | ||
async selectMenuOption(id: string): Promise<void> { | ||
await this.open(); | ||
await this.menuItem(id).pwLocator.click(); | ||
await this.pwLocator.waitFor({ state: 'hidden' }); | ||
} | ||
|
||
/** | ||
* Closes the dropdown. | ||
*/ | ||
async close(): Promise<void> { | ||
await this.pwLocator.press('Escape', { timeout: 500 }); | ||
} | ||
} | ||
|
||
/** | ||
* Represents a menu item from the Dropdown component | ||
*/ | ||
class MenuItem extends BaseComponent { | ||
override readonly _parent: Dropdown; | ||
constructor({ parent, selector }: { parent: Dropdown; selector: string }) { | ||
super({ parent, selector }); | ||
this._parent = parent; | ||
} | ||
|
||
/** | ||
* Selects the menu item | ||
* @param {object} clickArgs - arguments to pass to the click method | ||
*/ | ||
async select(clickArgs: object = {}): Promise<void> { | ||
await this._parent.open(); | ||
await this.pwLocator.click(clickArgs); | ||
await this._parent.pwLocator.waitFor({ state: 'hidden' }); | ||
} | ||
} |
21 changes: 18 additions & 3 deletions
21
webui/react/src/e2e/models/ant/Modal.ts → .../react/src/e2e/models/common/ant/Modal.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../react/src/e2e/models/ant/Notification.ts → ...src/e2e/models/common/ant/Notification.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { BaseOverlay, OverlayArgs } from 'e2e/models/common/base/BaseOverlay'; | ||
|
||
/** | ||
* Represents the Popver component from antd/es/popover/index.js | ||
*/ | ||
export class Popover extends BaseOverlay { | ||
constructor(args: OverlayArgs) { | ||
super({ | ||
...args, | ||
selector: '.ant-popover .ant-popover-content .ant-popover-inner-content:visible', | ||
}); | ||
} | ||
|
||
/** | ||
* Closes the popover. | ||
*/ | ||
async close(): Promise<void> { | ||
// [ET-284] Popover click handle doesn't work unless we wait | ||
await this.root._page.waitForTimeout(500); | ||
// Popover has no close button and doesn't respect Escape key | ||
await this.root.nav.sidebar.header.pwLocator.click(); | ||
await this.pwLocator.waitFor({ state: 'hidden' }); | ||
} | ||
} |
Oops, something went wrong.