fix(nc-gui): view action menu test cases

This commit is contained in:
Ramesh Mane
2024-12-26 08:01:47 +01:00
parent b2dcf30632
commit 17a5528111
4 changed files with 19 additions and 10 deletions

View File

@@ -92,18 +92,24 @@ export class ToolbarViewMenuPage extends BasePage {
await this.get().locator(`.ant-dropdown-menu-title-content:has-text("${menu}")`).first().click();
if (subMenu) {
// for CSV download, pass locator instead of clicking it here
if (subMenu === 'Download CSV') {
if (subMenu === 'CSV') {
await this.verifyDownloadAsCSV({
downloadLocator: this.rootPage.locator(`.ant-dropdown-menu-title-content:has-text("${subMenu}")`).last(),
downloadLocator: this.rootPage
.locator(`.ant-dropdown-menu-item.ant-dropdown-menu-item-only-child:has-text("${subMenu}")`)
.last(),
expectedDataFile: verificationInfo?.verificationFile ?? './fixtures/expectedBaseDownloadData.txt',
});
} else if (subMenu === 'Download Excel') {
} else if (subMenu === 'Excel') {
await this.verifyDownloadAsXLSX({
downloadLocator: this.rootPage.locator(`.ant-dropdown-menu-title-content:has-text("${subMenu}")`).last(),
downloadLocator: this.rootPage
.locator(`.ant-dropdown-menu-item.ant-dropdown-menu-item-only-child:has-text("${subMenu}")`)
.last(),
expectedDataFile: verificationInfo?.verificationFile ?? './fixtures/expectedBaseDownloadData.txt',
});
} else {
await this.rootPage.locator(`.ant-dropdown-menu-title-content:has-text("${subMenu}")`).last().click();
const loacator = this.rootPage.getByTestId(`nc-view-action-lock-subaction-${subMenu}`).last();
await loacator.click();
if (['Collaborative', 'Locked'].includes(subMenu)) {
await this.rootPage.locator(`.nc-lock-view-modal-wrapper`).waitFor({ state: 'visible' });
@@ -112,12 +118,12 @@ export class ToolbarViewMenuPage extends BasePage {
}
switch (subMenu) {
case 'Download CSV':
case 'CSV':
await this.verifyToast({
message: 'Successfully exported all table data',
});
break;
case 'Download Excel':
case 'Excel':
await this.verifyToast({
message: 'Successfully exported all table data',
});

View File

@@ -52,7 +52,7 @@ test.describe('Grid view locked', () => {
await dashboard.grid.toolbar.viewsMenu.click({
menu: 'Download',
subMenu: 'Download CSV',
subMenu: 'CSV',
verificationInfo: {
verificationFile: isPg(context) ? './fixtures/expectedBaseDownloadDataPg.txt' : null,
},
@@ -72,7 +72,7 @@ test.describe('Grid view locked', () => {
await dashboard.grid.toolbar.viewsMenu.click({
menu: 'Download',
subMenu: 'Download Excel',
subMenu: 'Excel',
verificationInfo: {
verificationFile: isPg(context) ? './fixtures/expectedBaseDownloadDataPg.txt' : null,
},