-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: update test, test card and list layouts
- Loading branch information
Showing
42 changed files
with
1,215 additions
and
426 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"baseUrl": "http://web.graasp.org:3111" | ||
"baseUrl": "http://web.graasp.org:3111", | ||
"video": false | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,103 @@ | ||
import { MODES, ROOT_ID } from '../../../../src/config/constants'; | ||
import { buildItemPath, HOME_PATH } from '../../../../src/config/paths'; | ||
import { | ||
buildItemCard, | ||
buildItemMenu, | ||
ITEM_MENU_BUTTON_CLASS, | ||
ITEM_MENU_COPY_BUTTON_CLASS, | ||
} from '../../../../src/config/selectors'; | ||
import { SIMPLE_ITEMS } from '../../../fixtures/items'; | ||
|
||
const copyItem = (id, toItemId) => { | ||
const menuSelector = `#${buildItemCard(id)} .${ITEM_MENU_BUTTON_CLASS}`; | ||
cy.get(menuSelector).click(); | ||
cy.get(`#${buildItemMenu(id)} .${ITEM_MENU_COPY_BUTTON_CLASS}`).click(); | ||
cy.fillTreeModal(toItemId); | ||
}; | ||
|
||
describe('Copy Item in Grid', () => { | ||
it('copy item on Home', () => { | ||
cy.setUpApi({ items: SIMPLE_ITEMS }); | ||
cy.visit(HOME_PATH); | ||
cy.switchMode(MODES.GRID); | ||
|
||
// copy | ||
const { id: copyItemId } = SIMPLE_ITEMS[0]; | ||
const { id: toItem } = SIMPLE_ITEMS[1]; | ||
copyItem(copyItemId, toItem); | ||
|
||
cy.wait('@copyItem').then(({ response: { body } }) => { | ||
cy.get(`#${buildItemCard(copyItemId)}`).should('exist'); | ||
|
||
// check in new parent | ||
cy.goToItemInGrid(toItem); | ||
cy.get(`#${buildItemCard(body.id)}`).should('exist'); | ||
}); | ||
}); | ||
|
||
it('copy item in item', () => { | ||
cy.setUpApi({ items: SIMPLE_ITEMS }); | ||
const { id } = SIMPLE_ITEMS[0]; | ||
|
||
// go to children item | ||
cy.visit(buildItemPath(id)); | ||
cy.switchMode(MODES.GRID); | ||
|
||
// move | ||
const { id: copyItemId } = SIMPLE_ITEMS[2]; | ||
const { id: toItem } = SIMPLE_ITEMS[3]; | ||
copyItem(copyItemId, toItem); | ||
|
||
cy.wait('@copyItem').then(({ response: { body } }) => { | ||
cy.get(`#${buildItemCard(copyItemId)}`).should('exist'); | ||
|
||
// check in new parent | ||
cy.goToItemInGrid(toItem); | ||
cy.get(`#${buildItemCard(body.id)}`).should('exist'); | ||
}); | ||
}); | ||
|
||
it('copy item to Home', () => { | ||
cy.setUpApi({ items: SIMPLE_ITEMS }); | ||
const { id } = SIMPLE_ITEMS[0]; | ||
|
||
// go to children item | ||
cy.visit(buildItemPath(id)); | ||
cy.switchMode(MODES.GRID); | ||
|
||
// move | ||
const { id: copyItemId } = SIMPLE_ITEMS[2]; | ||
const toItem = ROOT_ID; | ||
copyItem(copyItemId, toItem); | ||
|
||
cy.wait('@copyItem').then(({ response: { body } }) => { | ||
cy.get(`#${buildItemCard(copyItemId)}`).should('exist'); | ||
|
||
// check in new parent | ||
cy.goToHome(); | ||
cy.get(`#${buildItemCard(body.id)}`).should('exist'); | ||
}); | ||
}); | ||
|
||
describe('Errors handling', () => { | ||
it('error while moving item does not create in interface', () => { | ||
cy.setUpApi({ items: SIMPLE_ITEMS, copyItemError: true }); | ||
const { id } = SIMPLE_ITEMS[0]; | ||
|
||
// go to children item | ||
cy.visit(buildItemPath(id)); | ||
cy.switchMode(MODES.GRID); | ||
|
||
// move | ||
const { id: copyItemId } = SIMPLE_ITEMS[2]; | ||
const { id: toItem } = SIMPLE_ITEMS[0]; | ||
copyItem(copyItemId, toItem); | ||
|
||
cy.wait('@copyItem').then(({ response: { body } }) => { | ||
// check item is still existing in parent | ||
cy.get(`#${buildItemCard(copyItemId)}`).should('exist'); | ||
cy.get(`#${buildItemCard(body.id)}`).should('not.exist'); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.