Skip to content

Commit

Permalink
fix: remove waits
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh committed Jan 26, 2024
1 parent f0d9097 commit 35cd104
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 53 deletions.
1 change: 0 additions & 1 deletion cypress/e2e/item/create/createShortcut.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const createShortcutInList = ({
id: string;
toItemPath?: string;
}) => {
// cy.wait(TABLE_ITEM_RENDER_TIME);
const menuSelector = `#${buildItemMenuButtonId(id)}`;
cy.get(menuSelector).click();
createShortcut({ id, toItemPath });
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/item/delete/gridRecycleItem.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { SAMPLE_ITEMS } from '../../../fixtures/items';

const recycleItem = (id: string) => {
const menuSelector = `#${buildItemMenuButtonId(id)}`;
// cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(menuSelector).click();
cy.get(`#${buildItemMenu(id)} .${ITEM_MENU_RECYCLE_BUTTON_CLASS}`).click();
};
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/item/delete/listDeleteItem.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { RECYCLED_ITEM_DATA, SAMPLE_ITEMS } from '../../../fixtures/items';

const deleteItem = (id: string) => {
// cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(
`${buildItemsTableRowIdAttribute(id)} .${ITEM_DELETE_BUTTON_CLASS}`,
).click();
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/item/delete/listDeleteItems.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { RECYCLED_ITEM_DATA, SAMPLE_ITEMS } from '../../../fixtures/items';
const deleteItems = (itemIds: string[]) => {
// check selected ids
itemIds.forEach((id) => {
// cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(`${buildItemsTableRowIdAttribute(id)} .ag-checkbox-input`).click();
});

Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/item/delete/listRecycleItem.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import {
} from '../../../../src/config/selectors';
import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { SAMPLE_ITEMS } from '../../../fixtures/items';
import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';

const recycleItem = (id: string) => {
const menuSelector = `#${buildItemMenuButtonId(id)}`;
cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(menuSelector).click();
cy.get(`#${buildItemMenu(id)} .${ITEM_MENU_RECYCLE_BUTTON_CLASS}`).click();
};
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/item/delete/listRecycleItems.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import {
} from '../../../../src/config/selectors';
import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { SAMPLE_ITEMS } from '../../../fixtures/items';
import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';

const recycleItems = (itemIds: string[]) => {
// check selected ids
itemIds.forEach((id) => {
cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(`${buildItemsTableRowIdAttribute(id)} .ag-checkbox-input`).click();
});

Expand Down
8 changes: 1 addition & 7 deletions cypress/e2e/item/edit/editFolder.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import {
} from '../../../../src/config/selectors';
import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { EDITED_FIELDS, SAMPLE_ITEMS } from '../../../fixtures/items';
import {
EDIT_ITEM_PAUSE,
TABLE_ITEM_RENDER_TIME,
} from '../../../support/constants';
import { EDIT_ITEM_PAUSE } from '../../../support/constants';
import { editItem } from '../../../support/editUtils';

describe('Edit Folder', () => {
Expand All @@ -35,9 +32,6 @@ describe('Edit Folder', () => {
cy.setUpApi(SAMPLE_ITEMS);
cy.visit(HOME_PATH);

// wait for the render
cy.wait(TABLE_ITEM_RENDER_TIME);

// click edit button
const itemId = SAMPLE_ITEMS.items[0].id;
cy.get(`#${buildEditButtonId(itemId)}`).click();
Expand Down
5 changes: 1 addition & 4 deletions cypress/e2e/item/favorite/favoriteItem.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ import {
} from '../../../../src/config/selectors';
import { SAMPLE_FAVORITE, SAMPLE_ITEMS } from '../../../fixtures/items';
import { CURRENT_USER } from '../../../fixtures/members';
import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';

const toggleFavoriteButton = (itemId: string) => {
cy.wait(TABLE_ITEM_RENDER_TIME);
const menuSelector = `#${buildItemMenuButtonId(itemId)}`;
cy.get(menuSelector).click();
cy.get(`#${buildItemMenuButtonId(itemId)}`).click();
cy.get(`#${buildItemMenu(itemId)} .${FAVORITE_ITEM_BUTTON_CLASS}`).click();
};

Expand Down
20 changes: 8 additions & 12 deletions cypress/e2e/item/home/home.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { BUILDER } from '../../../../src/langs/constants';
import { SAMPLE_ITEMS, generateOwnItems } from '../../../fixtures/items';
import { CURRENT_USER } from '../../../fixtures/members';
import {
NAVIGATION_LOAD_PAUSE,
TABLE_ITEM_RENDER_TIME,
} from '../../../support/constants';
import { NAVIGATION_LOAD_PAUSE } from '../../../support/constants';
import { ItemForTest } from '../../../support/types';

const translateBuilder = (key: string) =>
Expand Down Expand Up @@ -82,6 +79,7 @@ describe('Home', () => {
cy.wait('@getAccessibleItems')
.its('request.url')
.should('contain', 'page=1');
cy.get(`#${buildItemCard(sampleItems[0].id)}`).should('be.visible');
cy.wait('@getAccessibleItems')
.its('request.url')
.should('contain', searchText);
Expand Down Expand Up @@ -150,14 +148,12 @@ describe('Home', () => {
cy.goToItemInGrid(childId);

// should get children
cy.wait('@getChildren', { timeout: TABLE_ITEM_RENDER_TIME }).then(
({ response: { body } }) => {
// check item is created and displayed
for (const item of body) {
cy.get(`#${buildItemCard(item.id)}`).should('exist');
}
},
);
cy.wait('@getChildren').then(({ response: { body } }) => {
// check item is created and displayed
for (const item of body) {
cy.get(`#${buildItemCard(item.id)}`).should('exist');
}
});

// root title
cy.get(`#${NAVIGATION_ROOT_ID}`).contains(
Expand Down
5 changes: 1 addition & 4 deletions cypress/e2e/item/move/listMoveItem.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ import {
} from '../../../../src/config/selectors';
import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { SAMPLE_ITEMS } from '../../../fixtures/items';
import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';

const openMoveModal = ({ id: movedItemId }: { id: string }) => {
const menuSelector = `#${buildItemMenuButtonId(movedItemId)}`;
cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(menuSelector).click();
cy.get(`#${buildItemMenuButtonId(movedItemId)}`).click();
cy.get(
`#${buildItemMenu(movedItemId)} .${ITEM_MENU_MOVE_BUTTON_CLASS}`,
).click();
Expand Down
3 changes: 0 additions & 3 deletions cypress/e2e/item/move/listMoveMultiple.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
} from '../../../../src/config/selectors';
import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { SAMPLE_ITEMS } from '../../../fixtures/items';
import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';

const moveItems = ({
itemIds,
Expand All @@ -16,11 +15,9 @@ const moveItems = ({
}) => {
// check selected ids
itemIds.forEach((id) => {
cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(`${buildItemsTableRowIdAttribute(id)} input`).click();
});

cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(`#${ITEMS_TABLE_MOVE_SELECTED_ITEMS_ID}`).click();
cy.handleTreeMenu(toItemPath);
};
Expand Down
5 changes: 1 addition & 4 deletions cypress/e2e/item/pin/pinItem.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ import {
} from '../../../../src/config/selectors';
import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { ITEMS_SETTINGS, PINNED_ITEM } from '../../../fixtures/items';
import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';

const togglePinButton = (itemId: string) => {
cy.wait(TABLE_ITEM_RENDER_TIME);
const menuSelector = `#${buildItemMenuButtonId(itemId)}`;
cy.get(menuSelector).click();
cy.get(`#${buildItemMenuButtonId(itemId)}`).click();
cy.get(`#${buildItemMenu(itemId)} .${PIN_ITEM_BUTTON_CLASS}`).click();
};

Expand Down
7 changes: 1 addition & 6 deletions cypress/support/commands/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import {
buildItemLink,
buildItemsTableRowIdAttribute,
} from '../../../src/config/selectors';
import {
NAVIGATE_PAUSE,
TABLE_ITEM_RENDER_TIME,
WAIT_FOR_ITEM_TABLE_ROW_TIME,
} from '../constants';
import { NAVIGATE_PAUSE, WAIT_FOR_ITEM_TABLE_ROW_TIME } from '../constants';

Cypress.Commands.add('goToItemInGrid', (id) => {
cy.wait(NAVIGATE_PAUSE);
Expand All @@ -30,5 +26,4 @@ Cypress.Commands.add('goToHome', () => {
Cypress.Commands.add('goToItemWithNavigation', (id) => {
cy.wait(NAVIGATE_PAUSE);
cy.get(`[href="${buildItemPath(id)}"]`).click();
cy.wait(TABLE_ITEM_RENDER_TIME);
});
1 change: 0 additions & 1 deletion cypress/support/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const REDIRECTION_TIME = 500;
export const CAPTION_EDIT_PAUSE = 2000;

export const ROW_HEIGHT = 48;
export const TABLE_ITEM_RENDER_TIME = 7000;
export const TABLE_MEMBERSHIP_RENDER_TIME = 3000;
export const FIXTURES_THUMBNAILS_FOLDER = './thumbnails';
export const CHATBOX_LOADING_TIME = 5000;
Expand Down
5 changes: 1 addition & 4 deletions cypress/support/editUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
buildEditButtonId,
} from '../../src/config/selectors';
import { ITEM_LAYOUT_MODES } from '../../src/enums';
import { CAPTION_EDIT_PAUSE, TABLE_ITEM_RENDER_TIME } from './constants';
import { CAPTION_EDIT_PAUSE } from './constants';

// eslint-disable-next-line import/prefer-default-export
// bug: use string for type to fit usage
Expand All @@ -21,9 +21,6 @@ export const editItem = (
},
mode = DEFAULT_ITEM_LAYOUT_MODE,
): void => {
if (DEFAULT_ITEM_LAYOUT_MODE === ITEM_LAYOUT_MODES.LIST) {
cy.wait(TABLE_ITEM_RENDER_TIME);
}
const { id, type } = payload;
switch (mode) {
case ITEM_LAYOUT_MODES.GRID: {
Expand Down

0 comments on commit 35cd104

Please sign in to comment.