Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(picking): refactor picking component names #759

Merged
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/fulfillment-e2e/src/integration/customer-note.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CustomerNoteModalFragment } from '../support/page_fragments/customer-note-modal.fragment';
import { PickingListsFragment } from '../support/page_fragments/picking-lists.fragment';
import { ListsFragment } from '../support/page_fragments/lists.fragment';

const pickingListsFragment = new PickingListsFragment();
const listsFragment = new ListsFragment();
const customerNoteFragment = new CustomerNoteModalFragment();

describe('Customer note suite', () => {
Expand All @@ -12,7 +12,7 @@ describe('Customer note suite', () => {

it('should show and hide the customer note modal', () => {
// open
pickingListsFragment.getCustomerNoteButtons().click();
listsFragment.getCustomerNoteButtons().click();
customerNoteFragment.getModal().should('be.visible');

// close
Expand Down
40 changes: 40 additions & 0 deletions apps/fulfillment-e2e/src/integration/fully-picking-a-list.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { PickerFragment } from '../support/page_fragments/picker.fragment';
import { ProductFragment } from '../support/page_fragments/product.fragment';
import { PickerPage } from '../support/page_objects/picker.page';

describe('Fully pick a picking list', () => {
const pickingListId = '37cb241e-f18a-5768-985c-a2d7aff4875e';

const pickerPage = new PickerPage(pickingListId);

const pickerFragment = new PickerFragment();
const productFragment = new ProductFragment();

beforeEach(() => {
cy.clearIndexedDB();
cy.login();
pickerPage.visit();
pickerPage.productFragment.getProducts().should('be.visible');

pickerFragment.getProducts().each((product) => {
cy.wrap(product).within(() => {
productFragment.pickAllProductItems();
productFragment.getSubmitButton().click();
});
});
});

it('must have all products on picked tab after done all of them', () => {
pickerFragment.getProducts().then((products) => {
pickerFragment
.getTabCounter(pickerPage.getPickedTab())
.should('contain.text', products.length);
});

pickerFragment.getPickingCompleteImage().should('be.visible');
pickerFragment.getFinishPickingButton().should('be.visible');

pickerFragment.getFinishPickingButton().eq(0).click();
cy.location('pathname').should('be.eq', `/`);
});
});

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { PickerHeaderFragment } from '../support/page_fragments/picker-header.fragment';
import { PickerPage } from '../support/page_objects/picker.page';

const pickingListId = 'd5bf20f1-7f36-568d-85b5-e4502acbcc82';

const pickerPage = new PickerPage(pickingListId);
const pickerHeaderFragment = new PickerHeaderFragment();

describe('picking header with no customer note', () => {
beforeEach(() => {
cy.clearIndexedDB();
cy.login();
pickerPage.visit();
});

it('should not display customer note icon', () => {
pickerHeaderFragment.getCustomerNoteIcon().should('not.exist');
});
});
51 changes: 51 additions & 0 deletions apps/fulfillment-e2e/src/integration/lists-search.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { ListsHeaderFragment } from '../support/page_fragments/lists-header.fragment';
import { ListsFragment } from '../support/page_fragments/lists.fragment';
import { UserProfileFragment } from '../support/page_fragments/user-profile-modal.fragment';

const listsFragment = new ListsFragment();
const headerFragment = new ListsHeaderFragment();
const userProfileFragment = new UserProfileFragment();

describe('Picking Lists Search', () => {
beforeEach(() => {
cy.clearIndexedDB();
cy.login();

headerFragment.getSearch().click();
});

it('should show correct picking items after search', () => {
listsFragment.getWrapper().should('be.visible');
headerFragment
.getSearchInput()
.should('be.visible')
.should('have.attr', 'placeholder');

listsFragment.getNoItemsFallbackHeading().should('be.visible');
listsFragment.getStartSearchingFallbackImage().should('be.visible');

headerFragment.getSearchInput().type('D', { force: true });
listsFragment.getNoItemsFallbackHeading().should('be.visible');
listsFragment.getStartSearchingFallbackImage().should('be.visible');

headerFragment.getSearchInput().type('E', { force: true });
listsFragment.getPickingListsItems().should('have.length.at.least', 1);

headerFragment.getSearchClearButton().click();
listsFragment.getNoItemsFallbackHeading().should('be.visible');
listsFragment.getStartSearchingFallbackImage().should('be.visible');

headerFragment.getSearchInput().type('something', { force: true });
listsFragment.getNoItemsFallbackHeading().should('be.visible');
listsFragment.getNoPickingResultsFallbackImage().should('be.visible');

headerFragment.getSearchBackButton().click();
listsFragment.getNoItemsFallback().should('not.exist');
headerFragment.getTitle().should('be.visible');
listsFragment.getPickingListsItems().should('have.length.at.least', 1);

headerFragment.getUserIcon().should('be.visible').click();

userProfileFragment.getWrapper().should('be.visible');
});
});
22 changes: 22 additions & 0 deletions apps/fulfillment-e2e/src/integration/lists.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ListsHeaderFragment } from '../support/page_fragments/lists-header.fragment';
import { ListsFragment } from '../support/page_fragments/lists.fragment';

const listsFragment = new ListsFragment();
const headerFragment = new ListsHeaderFragment();

describe('Picking Lists', () => {
beforeEach(() => {
cy.clearIndexedDB();
cy.login();
});

it('should display picking lists', () => {
headerFragment.getSearchIcon().should('be.visible');
headerFragment.getUserIcon().should('be.visible');
headerFragment.getHeadline().should('contain.text', 'Pick lists');
listsFragment.getSortButton().should('be.visible');

listsFragment.getWrapper().should('be.visible');
listsFragment.getPickingListsItems().should('be.visible');
});
});
137 changes: 137 additions & 0 deletions apps/fulfillment-e2e/src/integration/partialy-picking-list.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import { CustomerNoteModalFragment } from '../support/page_fragments/customer-note-modal.fragment';
import { ListsFragment } from '../support/page_fragments/lists.fragment';
import { PickerHeaderFragment } from '../support/page_fragments/picker-header.fragment';
import { PickerFragment } from '../support/page_fragments/picker.fragment';
import { ProductFragment } from '../support/page_fragments/product.fragment';
import { UserProfileFragment } from '../support/page_fragments/user-profile-modal.fragment';
import { PickerPage } from '../support/page_objects/picker.page';

const pickingListId = '37cb241e-f18a-5768-985c-a2d7aff4875e';

const pickerPage = new PickerPage(pickingListId);

const listsFragment = new ListsFragment();
const productFragment = new ProductFragment();
const pickerFragment = new PickerFragment();
const pickerHeaderFragment = new PickerHeaderFragment();
const customerNoteModalFragment = new CustomerNoteModalFragment();
const userProfileFragment = new UserProfileFragment();

describe('Partial picking a picklist', () => {
beforeEach(() => {
cy.clearIndexedDB();
cy.login();
pickerPage.visit();
pickerPage.productFragment.getProducts().should('be.visible');
});

it('should check partial picking', () => {
// See picking lists id
pickerHeaderFragment
.getPickingListsTitle()
.should('be.visible')
.and('contain', 'DE--19');

// See customer note
pickerHeaderFragment.getCustomerNoteIcon().should('be.visible').click();
customerNoteModalFragment.getModal().should('be.visible');
customerNoteModalFragment.getCloseButton().click();

// See user profile modal
pickerHeaderFragment.getUserIcon().should('be.visible').click();
userProfileFragment.getWrapper().should('be.visible');
userProfileFragment.getCloseButton().should('be.visible').click();
userProfileFragment.getWrapper().should('not.be.visible');

// Setting initial number of products in each tab
pickerPage
.getNotPickedProductsNumber()
.as('initialNotPickedProductsNumber');
pickerPage.getPickedProductsNumber().as('initialPickedProductsNumber');
pickerPage.getNotFoundProductsNumber().as('initialNotFoundProductsNumber');

// Check fallbacks on "Picked" and "Not Found" tabs
pickerPage.insideTabContent(pickerPage.getPickedTab(), () => {
pickerFragment.getNoItemsTitle().should('be.visible');
pickerFragment.getNoItemsImage().should('be.visible');
});

pickerPage.insideTabContent(pickerPage.getNotFoundTab(), () => {
pickerFragment.getNoItemsTitle().should('be.visible');
pickerFragment.getNoItemsImage().should('be.visible');
});

// For the first item, select only part of the quantity.
pickerPage.insideTabContent(pickerPage.getNotPickedTab(), () => {
pickerPage.pickProduct(productFragment.getProducts().eq(0), 1);
});

// Verify that the Partial Picking Modal is opened.
pickerFragment.getPartialPickingDialog().should('be.visible');

// Confirm partial picking
pickerFragment.getPartialPickingConfirmButton().click();

// Dialog should be closed
pickerFragment.getPartialPickingDialog().should('not.be.visible');

// Verify that the picking item is moved to the "Picked" tab with the entered quantity, and the "Not found" tab with the not entered quantity.
// Not Picked tab list should have x-1 products
cy.get('@initialNotPickedProductsNumber').then((initCount) => {
pickerPage
.getNotPickedProductsNumber()
.should('be.eq', Number(initCount) - 1);
});

// Picked tab list should have x+1 products
cy.get('@initialPickedProductsNumber').then((initCount) => {
pickerPage
.getPickedProductsNumber()
.should('be.eq', Number(initCount) + 1);
});

// Not Found tab list should have x+1 products
cy.get('@initialNotFoundProductsNumber').then((initCount) => {
pickerPage
.getNotFoundProductsNumber()
.should('be.eq', Number(initCount) + 1);
});

// Pick the rest of the products
pickerPage.insideTabContent(pickerPage.getNotPickedTab(), () => {
productFragment.getProducts().each((product) => {
cy.wrap(product).within(() => {
productFragment.pickAllProductItems();
productFragment.getSubmitButton().click();
});
});

// Verify that the congratulation text and illustration are shown
pickerFragment.getPickingCompleteImage().should('be.visible');
pickerFragment.getPickingCompleteTitle().should('be.visible');
pickerFragment.getPickingCompleteText().should('be.visible');
});

// Verify that the “Finish picking” button appears
const tabs = [
pickerPage.getNotPickedTab(),
pickerPage.getPickedTab(),
pickerPage.getNotFoundTab(),
];

tabs.forEach((tab) => {
pickerPage.insideTabContent(tab, () => {
pickerFragment.getFinishPickingButton().should('be.visible');
});
});

// Tap the “Finish picking” button
pickerPage.insideTabContent(pickerPage.getNotPickedTab(), () => {
pickerFragment.getFinishPickingButton().click();
});

// Verify that the Picking lists page is shown
cy.location('pathname').should('be.eq', `/`);
listsFragment.getWrapper().should('be.visible');
});
});
Loading
Loading