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

Functional Tests - Fix describe message for generate invoice by date/status #16679

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -33,8 +33,8 @@ const init = async function () {
};
};

// Filter And Quick Edit invoices
describe('Filter And Quick Edit invoices', async () => {
// Generate PDF file by date
describe('Generate PDF file by date', async () => {
// before and after functions
before(async function () {
browser = await helper.createBrowser();
Expand All @@ -51,62 +51,59 @@ describe('Filter And Quick Edit invoices', async () => {
// Login into BO
loginCommon.loginBO();

// 1 : Generate PDF file by date
describe('Generate PDF file by date', async () => {
describe('Create invoice', async () => {
const tests = [
{args: {orderRow: 1, status: Statuses.shipped.status}},
{args: {orderRow: 2, status: Statuses.paymentAccepted.status}},
];
tests.forEach((orderToEdit) => {
it('should go to the orders page', async function () {
await this.pageObjects.boBasePage.goToSubMenu(
this.pageObjects.boBasePage.ordersParentLink,
this.pageObjects.boBasePage.ordersLink,
);
const pageTitle = await this.pageObjects.ordersPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.ordersPage.pageTitle);
});

it(`should go to the order page number '${orderToEdit.args.orderRow}'`, async function () {
await this.pageObjects.ordersPage.goToOrder(orderToEdit.args.orderRow);
const pageTitle = await this.pageObjects.viewOrderPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.viewOrderPage.pageTitle);
});

it(`should change the order status to '${orderToEdit.args.status}' and check it`, async function () {
const result = await this.pageObjects.viewOrderPage.modifyOrderStatus(orderToEdit.args.status);
await expect(result).to.be.true;
});
});
});

describe('Generate PDF file by date', async () => {
it('should go to invoices page', async function () {
describe('Create invoice', async () => {
const tests = [
{args: {orderRow: 1, status: Statuses.shipped.status}},
{args: {orderRow: 2, status: Statuses.paymentAccepted.status}},
];
tests.forEach((orderToEdit) => {
it('should go to the orders page', async function () {
await this.pageObjects.boBasePage.goToSubMenu(
this.pageObjects.boBasePage.ordersParentLink,
this.pageObjects.boBasePage.invoicesLink,
this.pageObjects.boBasePage.ordersLink,
);
const pageTitle = await this.pageObjects.invoicesPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.invoicesPage.pageTitle);
const pageTitle = await this.pageObjects.ordersPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.ordersPage.pageTitle);
});

it('should generate PDF file by date and check the file existence', async function () {
await this.pageObjects.invoicesPage.generatePDFByDate();
const exist = await files.checkFileExistence(
global.BO.DOWNLOAD_PATH,
Invoices.moreThanAnInvoice.fileName,
);
await expect(exist).to.be.true;
it(`should go to the order page number '${orderToEdit.args.orderRow}'`, async function () {
await this.pageObjects.ordersPage.goToOrder(orderToEdit.args.orderRow);
const pageTitle = await this.pageObjects.viewOrderPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.viewOrderPage.pageTitle);
});

it('should check the error message when there is no invoice in the entered date', async function () {
await this.pageObjects.invoicesPage.generatePDFByDate(dateFrom, dateTo);
const textMessage = await this.pageObjects.invoicesPage.getTextContent(
this.pageObjects.invoicesPage.alertTextBlock,
);
await expect(textMessage).to.equal(this.pageObjects.invoicesPage.errorMessageWhenGenerateFileByDate);
it(`should change the order status to '${orderToEdit.args.status}' and check it`, async function () {
const result = await this.pageObjects.viewOrderPage.modifyOrderStatus(orderToEdit.args.status);
await expect(result).to.be.true;
});
});
});

describe('Generate invoice by date', async () => {
it('should go to invoices page', async function () {
await this.pageObjects.boBasePage.goToSubMenu(
this.pageObjects.boBasePage.ordersParentLink,
this.pageObjects.boBasePage.invoicesLink,
);
const pageTitle = await this.pageObjects.invoicesPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.invoicesPage.pageTitle);
});

it('should generate PDF file by date and check the file existence', async function () {
await this.pageObjects.invoicesPage.generatePDFByDate();
const exist = await files.checkFileExistence(
global.BO.DOWNLOAD_PATH,
Invoices.moreThanAnInvoice.fileName,
);
await expect(exist).to.be.true;
});

it('should check the error message when there is no invoice in the entered date', async function () {
await this.pageObjects.invoicesPage.generatePDFByDate(dateFrom, dateTo);
const textMessage = await this.pageObjects.invoicesPage.getTextContent(
this.pageObjects.invoicesPage.alertTextBlock,
);
await expect(textMessage).to.equal(this.pageObjects.invoicesPage.errorMessageWhenGenerateFileByDate);
});
});
});
Expand Up @@ -30,8 +30,8 @@ const init = async function () {
};
};

// Filter And Quick Edit invoices
describe('Filter And Quick Edit invoices', async () => {
// 1 : Generate PDF file by status
describe('Generate PDF file by status', async () => {
// before and after functions
before(async function () {
browser = await helper.createBrowser();
Expand All @@ -48,74 +48,71 @@ describe('Filter And Quick Edit invoices', async () => {
// Login into BO
loginCommon.loginBO();

// 1 : Generate PDF file by status
describe('Generate PDF file by date', async () => {
describe('Create invoice', async () => {
const tests = [
{args: {orderRow: 1, status: Statuses.shipped.status}},
{args: {orderRow: 2, status: Statuses.paymentAccepted.status}},
];
tests.forEach((orderToEdit) => {
it('should go to the orders page', async function () {
await this.pageObjects.boBasePage.goToSubMenu(
this.pageObjects.boBasePage.ordersParentLink,
this.pageObjects.boBasePage.ordersLink,
);
const pageTitle = await this.pageObjects.ordersPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.ordersPage.pageTitle);
});

it(`should go to the order page number '${orderToEdit.args.orderRow}'`, async function () {
await this.pageObjects.ordersPage.goToOrder(orderToEdit.args.orderRow);
const pageTitle = await this.pageObjects.viewOrderPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.viewOrderPage.pageTitle);
});

it(`should change the order status to '${orderToEdit.args.status}' and check it`, async function () {
const result = await this.pageObjects.viewOrderPage.modifyOrderStatus(orderToEdit.args.status);
await expect(result).to.be.true;
});
});
});

describe('Generate PDF file by status', async () => {
it('should go to invoices page', async function () {
describe('Create invoice', async () => {
const tests = [
{args: {orderRow: 1, status: Statuses.shipped.status}},
{args: {orderRow: 2, status: Statuses.paymentAccepted.status}},
];
tests.forEach((orderToEdit) => {
it('should go to the orders page', async function () {
await this.pageObjects.boBasePage.goToSubMenu(
this.pageObjects.boBasePage.ordersParentLink,
this.pageObjects.boBasePage.invoicesLink,
this.pageObjects.boBasePage.ordersLink,
);
await this.pageObjects.boBasePage.closeSfToolBar();
const pageTitle = await this.pageObjects.invoicesPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.invoicesPage.pageTitle);
const pageTitle = await this.pageObjects.ordersPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.ordersPage.pageTitle);
});

it('should check the error message when we don\'t select a status', async function () {
await this.pageObjects.invoicesPage.generatePDFByStatus();
const textMessage = await this.pageObjects.invoicesPage.getTextContent(
this.pageObjects.invoicesPage.alertTextBlock,
);
await expect(textMessage).to.equal(this.pageObjects.invoicesPage.errorMessageWhenNotSelectStatus);
it(`should go to the order page number '${orderToEdit.args.orderRow}'`, async function () {
await this.pageObjects.ordersPage.goToOrder(orderToEdit.args.orderRow);
const pageTitle = await this.pageObjects.viewOrderPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.viewOrderPage.pageTitle);
});

it('should check the error message when there is no invoice in the status selected', async function () {
await this.pageObjects.invoicesPage.chooseStatus(OrderStatuses.canceled.id);
await this.pageObjects.invoicesPage.generatePDFByStatus();
const textMessage = await this.pageObjects.invoicesPage.getTextContent(
this.pageObjects.invoicesPage.alertTextBlock,
);
await expect(textMessage).to.equal(this.pageObjects.invoicesPage.errorMessageWhenGenerateFileByStatus);
it(`should change the order status to '${orderToEdit.args.status}' and check it`, async function () {
const result = await this.pageObjects.viewOrderPage.modifyOrderStatus(orderToEdit.args.status);
await expect(result).to.be.true;
});
});
});

it('should choose the statuses, generate the invoice and check the file existence', async function () {
await this.pageObjects.invoicesPage.chooseStatus(OrderStatuses.paymentAccepted.id);
await this.pageObjects.invoicesPage.chooseStatus(OrderStatuses.shipped.id);
await this.pageObjects.invoicesPage.generatePDFByStatus();
const exist = await files.checkFileExistence(
global.BO.DOWNLOAD_PATH,
Invoices.moreThanAnInvoice.fileName,
);
await expect(exist).to.be.true;
});
describe('Generate invoice by status', async () => {
it('should go to invoices page', async function () {
await this.pageObjects.boBasePage.goToSubMenu(
this.pageObjects.boBasePage.ordersParentLink,
this.pageObjects.boBasePage.invoicesLink,
);
await this.pageObjects.boBasePage.closeSfToolBar();
const pageTitle = await this.pageObjects.invoicesPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.invoicesPage.pageTitle);
});

it('should check the error message when we don\'t select a status', async function () {
await this.pageObjects.invoicesPage.generatePDFByStatus();
const textMessage = await this.pageObjects.invoicesPage.getTextContent(
this.pageObjects.invoicesPage.alertTextBlock,
);
await expect(textMessage).to.equal(this.pageObjects.invoicesPage.errorMessageWhenNotSelectStatus);
});

it('should check the error message when there is no invoice in the status selected', async function () {
await this.pageObjects.invoicesPage.chooseStatus(OrderStatuses.canceled.id);
await this.pageObjects.invoicesPage.generatePDFByStatus();
const textMessage = await this.pageObjects.invoicesPage.getTextContent(
this.pageObjects.invoicesPage.alertTextBlock,
);
await expect(textMessage).to.equal(this.pageObjects.invoicesPage.errorMessageWhenGenerateFileByStatus);
});

it('should choose the statuses, generate the invoice and check the file existence', async function () {
await this.pageObjects.invoicesPage.chooseStatus(OrderStatuses.paymentAccepted.id);
await this.pageObjects.invoicesPage.chooseStatus(OrderStatuses.shipped.id);
await this.pageObjects.invoicesPage.generatePDFByStatus();
const exist = await files.checkFileExistence(
global.BO.DOWNLOAD_PATH,
Invoices.moreThanAnInvoice.fileName,
);
await expect(exist).to.be.true;
});
});
});