Browse Source

work on map view tests - WIP

pull/4749/head
Daniel Spaude 2 years ago
parent
commit
8cfc195e6e
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 19
      tests/playwright/pages/Dashboard/ExpandedForm/index.ts
  2. 7
      tests/playwright/pages/Dashboard/Map/index.ts
  3. 10
      tests/playwright/pages/Dashboard/index.ts
  4. 2
      tests/playwright/tests/columnAttachments.spec.ts
  5. 2
      tests/playwright/tests/columnFormula.spec.ts
  6. 1
      tests/playwright/tests/columnGeoData.spec.ts
  7. 2
      tests/playwright/tests/columnMenuOperations.spec.ts
  8. 2
      tests/playwright/tests/filters.spec.ts
  9. 2
      tests/playwright/tests/keyboardShortcuts.spec.ts
  10. 2
      tests/playwright/tests/language.spec.ts
  11. 2
      tests/playwright/tests/metaSync.spec.ts
  12. 303
      tests/playwright/tests/viewMap.spec.ts

19
tests/playwright/pages/Dashboard/ExpandedForm/index.ts

@ -69,29 +69,10 @@ export class ExpandedFormPage extends BasePage {
break;
case 'geodata': {
const [lat, long] = value.split(',');
// async open({ index, columnHeader }: { index: number; columnHeader: string }) {
// await this.cell.get({ index, columnHeader }).locator(`[data-testid="nc-geo-data-set-location-button"]`).click();
// }
// async enterLatLong({ lat, long }: { lat: string; long: string }) {
// await this.rootPage.locator(`[data-testid="nc-geo-data-latitude"]`).fill(lat);
// await this.rootPage.locator(`[data-testid="nc-geo-data-longitude"]`).fill(long);
// }
// async clickSave() {
// await this.rootPage.locator(`[data-testid="nc-geo-data-save"]`).click();
// }
// async close() {
// await this.rootPage.keyboard.press('Escape');
// }
await this.rootPage.locator(`[data-testid="nc-geo-data-set-location-button"]`).click();
await this.rootPage.locator(`[data-testid="nc-geo-data-latitude"]`).fill(lat);
await this.rootPage.locator(`[data-testid="nc-geo-data-longitude"]`).fill(long);
await this.rootPage.locator(`[data-testid="nc-geo-data-save"]`).click();
// await field.locator('input').fill(value);
break;
}
case 'belongsTo':

7
tests/playwright/pages/Dashboard/Map/index.ts

@ -19,9 +19,7 @@ export class MapPage extends BasePage {
async marker(lat: string, long: string) {
const latLongStr = `${lat}, ${long}`;
// await this.rootPage.pause();
const marker = await this.get().locator(`.leaflet-marker-pane img[alt="${latLongStr}"]`);
// await this.rootPage.pause();
return marker;
}
@ -46,11 +44,6 @@ export class MapPage extends BasePage {
}
}
// async openExpandedRow({ index }: { index: number }) {
// await this.card(index).click();
// await (await this.rootPage.locator('.ant-drawer-body').elementHandle())?.waitForElementState('stable');
// }
// todo: Wait for render to complete
async waitLoading() {
await this.rootPage.waitForTimeout(1000);

10
tests/playwright/pages/Dashboard/index.ts

@ -71,16 +71,6 @@ export class DashboardPage extends BasePage {
await this.tabBar.textContent().then(text => expect(text).toContain(title));
}
// async activateGeoDataEasterEgg() {
// const element = await this.rootPage.$('.nc-active-btn');
// const { x, y } = await element.boundingBox();
// // Click the element 5 times in a row
// for (let i = 0; i < 5; i++) {
// await this.rootPage.mouse.click(x + 50, y);
// }
// }
async closeTab({ title }: { title: string }) {
const tab = this.tabBar.locator(`.ant-tabs-tab:has-text("${title}")`);
await tab.locator('button.ant-tabs-tab-remove').click();

2
tests/playwright/tests/columnAttachments.spec.ts

@ -5,8 +5,6 @@ import setup from '../setup';
import { AccountPage } from '../pages/Account';
import { AccountLicensePage } from '../pages/Account/License';
// was green when run individually via .only
// on bbed1f864945fa61e3d92e3e2c8dfa783060b302
test.describe('Attachment column', () => {
let dashboard: DashboardPage;
let accountLicensePage: AccountLicensePage, accountPage: AccountPage, context: any;

2
tests/playwright/tests/columnFormula.spec.ts

@ -124,8 +124,6 @@ const formulaDataByDbType = (context: NcContext) => [
},
];
// was green when run individually via .only
// on bbed1f864945fa61e3d92e3e2c8dfa783060b302
test.describe('Virtual Columns', () => {
let dashboard: DashboardPage;
let context: any;

1
tests/playwright/tests/columnGeoData.spec.ts

@ -28,7 +28,6 @@ test.describe('Geo Data column', () => {
});
await grid.column.verify({ title: 'GeoData1', isVisible: true });
// await dashboard.rootPage.pause();
await grid.cell.geoData.open({
index: 0,

2
tests/playwright/tests/columnMenuOperations.spec.ts

@ -38,8 +38,6 @@ const columns = [
},
];
// was green when run individually via .only
// on 368aada3309bbb3de2af23bd06363f098db15a31
test.describe('Column menu operations', () => {
let dashboard: DashboardPage;
let context: any;

2
tests/playwright/tests/filters.spec.ts

@ -78,8 +78,6 @@ async function verifyFilter(param: {
// Number based filters
//
// was green when run individually via .only
// on aebc2b442ac952519b00062839169eb9a82ac3b9
test.describe('Filter Tests: Numerical', () => {
async function numBasedFilterTest(dataType, eqString, isLikeString) {
await dashboard.closeTab({ title: 'Team & Auth' });

2
tests/playwright/tests/keyboardShortcuts.spec.ts

@ -3,8 +3,6 @@ import { DashboardPage } from '../pages/Dashboard';
import { GridPage } from '../pages/Dashboard/Grid';
import setup from '../setup';
// was green when run individually via .only
// on c066219aa958677b8eb02c5394889410b5d11298
test.describe('Verify shortcuts', () => {
let dashboard: DashboardPage, grid: GridPage;
let context: any;

2
tests/playwright/tests/language.spec.ts

@ -41,8 +41,6 @@ const langMenu = [
'zh-Hant.json',
];
// was green when run individually via .only
// on c1caef73e3e8740d9d510a5b9ba143053b6eec5f
test.describe('Common', () => {
let context: any;
let dashboard: DashboardPage;

2
tests/playwright/tests/metaSync.spec.ts

@ -4,8 +4,6 @@ import { SettingsPage, SettingTab } from '../pages/Dashboard/Settings';
import setup, { NcContext } from '../setup';
import { isMysql, isPg, isSqlite, mysqlExec, pgExec, sqliteExec } from '../setup/db';
// was green when run individually via .only
// on 6b743b11dbb9f9f2f33790f6c4182a65c430e2fa
test.describe('Meta sync', () => {
let dashboard: DashboardPage;
let settings: SettingsPage;

303
tests/playwright/tests/viewMap.spec.ts

@ -52,31 +52,6 @@ test.describe.only('Map View', () => {
});
});
// if (isSqlite(context)) {
// await dashboard.treeView.deleteTable({ title: 'FilmList' });
// }
// if (isPg(context)) {
// // Since these view depend on the Ratings column of the Film table
// await dashboard.treeView.deleteTable({ title: 'NicerButSlowerFilmList' });
// await dashboard.treeView.deleteTable({ title: 'FilmList' });
// }
// if (isSqlite(context) || isPg(context)) {
// await dashboard.grid.column.openEdit({ title: 'Rating' });
// await dashboard.grid.column.selectType({ type: 'SingleSelect' });
// let count = 0;
// for (const rating of filmRatings) {
// await dashboard.grid.column.selectOption.addOption({
// index: count,
// option: rating,
// skipColumnModal: true,
// });
// count = count + 1;
// }
// await dashboard.grid.column.save();
// }
test('shows the marker and opens the expanded form view when clicking on it', async () => {
await dashboard.viewSidebar.createMapView({
title: 'Map 1',
@ -114,282 +89,4 @@ test.describe.only('Map View', () => {
await dashboard.expandedForm.clickDeleteRow();
await dashboard.map.verifyMarkerCount(1);
});
// await dashboard.viewSidebar.verifyView({
// title: 'Film Kanban',
// index: 1,
// });
// // configure stack-by field
// await toolbar.clickStackByField();
// await toolbar.stackBy.click({ title: 'Rating' });
// // click again to close menu
// await toolbar.clickStackByField();
// const kanban = dashboard.kanban;
// await kanban.verifyStackCount({ count: 6 });
// await kanban.verifyStackOrder({
// order: ['Uncategorized', 'G', 'PG', 'PG-13', 'R', 'NC-17'],
// });
// await kanban.verifyStackFooter({
// count: [0, 178, 194, 223, 195, 210],
// });
// await kanban.verifyCardCount({
// count: [0, 25, 25, 25, 25, 25],
// });
// // hide fields
// await toolbar.fields.hideAll();
// await toolbar.fields.toggle({ title: 'Title' });
// await kanban.verifyCardCount({
// count: [0, 25, 25, 25, 25, 25],
// });
// // verify card order
// const order = [
// ['ACE GOLDFINGER', 'AFFAIR PREJUDICE', 'AFRICAN EGG'],
// ['ACADEMY DINOSAUR', 'AGENT TRUMAN', 'ALASKA PHANTOM'],
// ['AIRPLANE SIERRA', 'ALABAMA DEVIL', 'ALTER VICTORY'],
// ['AIRPORT POLLOCK', 'ALONE TRIP', 'AMELIE HELLFIGHTERS'],
// ['ADAPTATION HOLES', 'ALADDIN CALENDAR', 'ALICE FANTASIA'],
// ];
// for (let i = 1; i <= order.length; i++)
// await kanban.verifyCardOrder({
// stackIndex: i,
// order: order[i - 1],
// });
// // // verify inter stack drag-drop
// // await kanban.dragDropCard({
// // from: "ACE GOLDFINGER",
// // to: "ACADEMY DINOSAUR",
// // });
// // verify drag drop stack
// await kanban.dragDropStack({
// from: 1, // G
// to: 2, // PG
// });
// await kanban.verifyStackOrder({
// order: ['Uncategorized', 'PG', 'G', 'PG-13', 'R', 'NC-17'],
// });
// // verify drag drop stack
// await kanban.dragDropStack({
// from: 2, // G
// to: 1, // PG
// });
// await kanban.verifyStackOrder({
// order: ['Uncategorized', 'G', 'PG', 'PG-13', 'R', 'NC-17'],
// });
// // verify sort
// await toolbar.sort.add({
// columnTitle: 'Title',
// isAscending: false,
// isLocallySaved: false,
// });
// // verify card order
// const order2 = [
// ['YOUNG LANGUAGE', 'WEST LION'],
// ['WORST BANGER', 'WORDS HUNTER'],
// ];
// for (let i = 1; i <= order2.length; i++)
// await kanban.verifyCardOrder({
// stackIndex: i,
// order: order2[i - 1],
// });
// await toolbar.sort.reset();
// // verify card order
// const order3 = [
// ['ACE GOLDFINGER', 'AFFAIR PREJUDICE', 'AFRICAN EGG'],
// ['ACADEMY DINOSAUR', 'AGENT TRUMAN', 'ALASKA PHANTOM'],
// ];
// for (let i = 1; i <= order3.length; i++)
// await kanban.verifyCardOrder({
// stackIndex: i,
// order: order3[i - 1],
// });
// // verify filter
// await toolbar.clickFilter({
// networkValidation: true,
// });
// await toolbar.filter.add({
// columnTitle: 'Title',
// opType: 'is like',
// value: 'BA',
// isLocallySaved: false,
// });
// await toolbar.clickFilter();
// // verify card order
// const order4 = [
// ['BAKED CLEOPATRA', 'BALLROOM MOCKINGBIRD'],
// ['ARIZONA BANG', 'EGYPT TENENBAUMS'],
// ];
// for (let i = 1; i <= order4.length; i++)
// await kanban.verifyCardOrder({
// stackIndex: i,
// order: order4[i - 1],
// });
// await toolbar.filter.reset();
// const order5 = [
// ['ACE GOLDFINGER', 'AFFAIR PREJUDICE', 'AFRICAN EGG'],
// ['ACADEMY DINOSAUR', 'AGENT TRUMAN', 'ALASKA PHANTOM'],
// ];
// for (let i = 1; i <= order5.length; i++)
// await kanban.verifyCardOrder({
// stackIndex: i,
// order: order5[i - 1],
// });
// await dashboard.rootPage.waitForTimeout(1000);
// });
// test('Kanban view operations', async () => {
// test.slow();
// await dashboard.viewSidebar.createKanbanView({
// title: 'Film Kanban',
// });
// await dashboard.viewSidebar.verifyView({
// title: 'Film Kanban',
// index: 1,
// });
// await toolbar.sort.add({
// columnTitle: 'Title',
// isAscending: false,
// isLocallySaved: false,
// });
// await toolbar.clickFilter();
// await toolbar.filter.add({
// columnTitle: 'Title',
// opType: 'is like',
// value: 'BA',
// isLocallySaved: false,
// });
// await toolbar.clickFilter();
// await toolbar.fields.hideAll();
// await toolbar.fields.toggle({ title: 'Title' });
// await dashboard.viewSidebar.copyView({ title: 'Film Kanban' });
// await dashboard.viewSidebar.verifyView({
// title: 'Kanban-1',
// index: 2,
// });
// const kanban = dashboard.kanban;
// await kanban.verifyStackCount({ count: 6 });
// await kanban.verifyStackOrder({
// order: ['Uncategorized', 'G', 'PG', 'PG-13', 'R', 'NC-17'],
// });
// await kanban.verifyStackFooter({
// count: [0, 4, 5, 8, 6, 6],
// });
// await kanban.verifyCardCount({
// count: [0, 4, 5, 8, 6, 6],
// });
// // verify card order
// const order2 = [
// ['BAREFOOT MANCHURIAN', 'BARBARELLA STREETCAR'],
// ['WORST BANGER', 'PRESIDENT BANG'],
// ];
// for (let i = 1; i <= order2.length; i++)
// await kanban.verifyCardOrder({
// stackIndex: i,
// order: order2[i - 1],
// });
// await dashboard.viewSidebar.changeViewIcon({
// title: 'Kanban-1',
// icon: 'american-football',
// });
// await dashboard.viewSidebar.deleteView({ title: 'Kanban-1' });
// ///////////////////////////////////////////////
// await dashboard.viewSidebar.openView({ title: 'Film Kanban' });
// // add new stack
// await kanban.addNewStack({ title: 'Test' });
// await dashboard.rootPage.waitForTimeout(1000);
// await kanban.verifyStackCount({ count: 7 });
// await kanban.verifyStackOrder({
// order: ['Uncategorized', 'G', 'PG', 'PG-13', 'R', 'NC-17', 'Test'],
// });
// // collapse stack
// await kanban.verifyCollapseStackCount({ count: 0 });
// await kanban.collapseStack({ index: 0 });
// await kanban.verifyCollapseStackCount({ count: 1 });
// await kanban.expandStack({ index: 0 });
// await kanban.verifyCollapseStackCount({ count: 0 });
// // add record to stack & verify
// await toolbar.fields.hideAll();
// await toolbar.fields.toggleShowSystemFields();
// await toolbar.fields.toggle({ title: 'LanguageId' });
// await toolbar.fields.toggle({ title: 'Title' });
// await toolbar.sort.reset();
// await toolbar.filter.reset();
// await kanban.addCard({ stackIndex: 6 });
// await dashboard.expandedForm.fillField({
// columnTitle: 'Title',
// value: 'New record',
// });
// await dashboard.expandedForm.fillField({
// columnTitle: 'LanguageId',
// value: '1',
// });
// // todo: Check why kanban doesnt reload the rows data
// await dashboard.expandedForm.save({ waitForRowsData: false });
// await kanban.verifyStackCount({ count: 7 });
// await kanban.verifyStackOrder({
// order: ['Uncategorized', 'G', 'PG', 'PG-13', 'R', 'NC-17', 'Test'],
// });
// await kanban.verifyCardCount({
// count: [0, 25, 25, 25, 25, 25, 1],
// });
// // delete stack
// await kanban.deleteStack({ index: 6 });
// await dashboard.rootPage.waitForTimeout(1000);
// await kanban.verifyStackCount({ count: 6 });
// await kanban.verifyStackOrder({
// order: ['Uncategorized', 'G', 'PG', 'PG-13', 'R', 'NC-17'],
// });
// await kanban.verifyCardCount({
// count: [1, 25, 25, 25, 25, 25],
// });
// });
// test('Kanban shared view operations', async ({ page }) => {
// test.slow();
// await dashboard.viewSidebar.createKanbanView({
// title: 'Film Kanban',
// });
// await dashboard.viewSidebar.verifyView({
// title: 'Film Kanban',
// index: 1,
// });
// // Share view
// await toolbar.fields.toggle({ title: 'Rating' });
// await toolbar.clickShareView();
// const sharedLink = await toolbar.shareView.getShareLink();
// await toolbar.shareView.close();
// // sign-out
// await dashboard.signOut();
// // Open shared view & verify stack count
// await page.goto(sharedLink);
// const kanban = dashboard.kanban;
// await kanban.verifyStackCount({ count: 6 });
// });
});

Loading…
Cancel
Save