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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functional tests - Fix 'FO:classic:01-03 get GDPR data in PDF' #35364

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
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Post condition:
describe('FO - Account : Get GDPR data in PDF', async () => {
let browserContext: BrowserContext;
let page: Page;
let filePath: string|null;
let filePath: string | null;
let registrationDate: string;
let lastVisitDate: string;
let secondLastVisitDate: string;
Expand Down Expand Up @@ -245,7 +245,8 @@ describe('FO - Account : Get GDPR data in PDF', async () => {

const isVisible = await files.isTextInPDF(
filePath,
`${today},,${customerData.firstName} ${customerData.lastName},,`,
`${today} ${customerData.firstName} ${customerData.lastName} `,
true,
);
expect(isVisible, 'The date and the customer name are not correct!').to.eq(true);
});
Expand All @@ -255,72 +256,72 @@ describe('FO - Account : Get GDPR data in PDF', async () => {

const age = await basicHelper.age(customerData.birthDate);

const isVisible = await files.isTextInPDF(filePath, 'General info,,Gender, ,'
+ `${customerData.socialTitle},Name, ,${customerData.firstName} ${customerData.lastName},`
+ `Birth date, ,${customerData.birthDate.toISOString().slice(0, 10)},Age, ,${age},Email,`
+ `${customerData.email},Language, ,English (English),Creation account date, ,`
+ `${registrationDate},Last visit, ,${lastVisitDate},Siret,Ape,Company,Website`);
const isVisible = await files.isTextInPDF(filePath, 'General info Gender '
+ `${customerData.socialTitle} Name ${customerData.firstName} ${customerData.lastName} `
+ `Birth date ${customerData.birthDate.toISOString().slice(0, 10)} Age ${age} Email `
+ `${customerData.email} Language English (English) Creation account date `
+ `${registrationDate} Last visit ${lastVisitDate} Siret Ape Company Website`, true);
expect(isVisible, 'General info is not correct!').to.eq(true);
});

it('should check that Addresses table is empty', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkThatAddressesTableIsEmpty', baseContext);

const isVisible = await files.isTextInPDF(filePath, ',No addresses,,');
const isVisible = await files.isTextInPDF(filePath, 'No addresses ', true);
expect(isVisible, 'Addresses table is not empty!').to.eq(true);
});

it('should check that Orders table is empty', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkThatOrdersTableIsEmpty', baseContext);

const isVisible = await files.isTextInPDF(filePath, 'Orders,,Reference, ,Payment, ,Order state, ,'
+ 'Total paid, ,Date,,No orders,,');
const isVisible = await files.isTextInPDF(filePath, 'Orders Reference Payment Order state '
+ 'Total paid Date No orders', true);
expect(isVisible, 'Orders table is not empty!').to.eq(true);
});

it('should check that Carts table is empty', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkThatCartsTableIsEmpty1', baseContext);

const isVisible = await files.isTextInPDF(filePath, ',Carts,,Id, ,Total products, ,Date,,No carts,,');
const isVisible = await files.isTextInPDF(filePath, 'Carts Id Total products Date No carts', true);
expect(isVisible, 'Carts table is not empty!').to.eq(true);
});

it('should check that Messages table is empty', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkThatMessagesTableIsEmpty', baseContext);

const isVisible = await files.isTextInPDF(filePath, 'Messages,,IP, ,Message, ,Date,,No messages,,');
const isVisible = await files.isTextInPDF(filePath, 'Messages IP Message Date No messages', true);
expect(isVisible, 'Messages table is not empty!').to.eq(true);
});

it('should check Last connections table', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkLastConnectionsTable1', baseContext);

const isVisible = await files.isTextInPDF(filePath, 'Last connections,,Origin request, ,Page viewed, ,'
+ `Time on the page, ,IP address, ,Date,,1 / 2 ${today},,${customerData.firstName} `
+ `${customerData.lastName},,0, ,${ipAddress}, ,${lastVisitDate}`);
const isVisible = await files.isTextInPDF(filePath, 'Last connections Origin request Page viewed '
+ `Time on the page IP address Date 1 / 2 ${today} ${customerData.firstName} `
+ `${customerData.lastName} 0 ${ipAddress} ${lastVisitDate}`, true);
expect(isVisible, 'The data in Last connections table is not correct!').to.eq(true);
});

it('should check that Newsletter subscription table is empty', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkNewsletterSubscriptionTable', baseContext);

const isVisible = await files.isTextInPDF(filePath, 'Module : Newsletter subscription,,0,,Newsletter '
+ 'subscription: no email to export, this customer has not registered.,,');
const isVisible = await files.isTextInPDF(filePath, 'Module : Newsletter subscription 0 Newsletter '
+ 'subscription: no email to export this customer has not registered.', true);
expect(isVisible, 'Newsletter subscription table is not empty!').to.eq(true);
});

it('should check that Module product comments is empty', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkModuleProductComments', baseContext);

const isVisible = await files.isTextInPDF(filePath, 'Module : Product Comments,,');
const isVisible = await files.isTextInPDF(filePath, 'Module : Product Comments ', true);
expect(isVisible, 'Products comments is not empty!').to.eq(true);
});

it('should check that mail alerts table is empty', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkModuleMailAlerts', baseContext);

const isVisible = await files.isTextInPDF(filePath, ',Module : Mail alerts,,0,,Mail alert: Unable to export '
+ 'customer using email.');
const isVisible = await files.isTextInPDF(filePath, 'Module : Mail alerts 0 Mail alert: Unable to export '
+ 'customer using email.', true);
expect(isVisible, 'Mail alert table is not empty!').to.eq(true);
});
});
Expand Down Expand Up @@ -436,9 +437,9 @@ describe('FO - Account : Get GDPR data in PDF', async () => {
shoppingCartDate = `${shoppingCartDate.substring(6, 10)}-${shoppingCartDate.substring(0, 2)}-`
+ `${shoppingCartDate.substring(3, 5)} ${shoppingCartDate.substring(11, 19)}`;

const isVisible = await files.isTextInPDF(filePath, `Carts,,Id, ,Total products, ,Date,,#${shoppingCartID}`
+ `, ,1, ,${shoppingCartDate},,Product(s) in the cart :,,Reference, ,Name, ,Quantity,,`
+ `${Products.demo_1.reference}, ,${Products.demo_1.name}, ,2`);
const isVisible = await files.isTextInPDF(filePath, `Carts Id Total products Date #${shoppingCartID}`
+ ` 1 ${shoppingCartDate} Product(s) in the cart : Reference Name Quantity `
+ `${Products.demo_1.reference} ${Products.demo_1.name} 2`, true);
expect(isVisible, 'Data in Carts table is not correct!').to.eq(true);
});
});
Expand Down Expand Up @@ -578,10 +579,10 @@ describe('FO - Account : Get GDPR data in PDF', async () => {
it('should check Addresses table', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkAddressesTable1', baseContext);

const isVisible = await files.isTextInPDF(filePath, 'Addresses,,Alias, ,Company, ,Name, ,Address, ,'
+ `Phone(s), ,Country, ,Date,,${addressData.alias}, ,${addressData.company}, ,${addressData.firstName} `
+ `${addressData.lastName}, ,${addressData.address},${addressData.postalCode} ${addressData.city},`
+ `${addressData.phone}, ,${addressData.country}`);
const isVisible = await files.isTextInPDF(filePath, 'Addresses Alias Company Name Address '
+ `Phone(s) Country Date ${addressData.alias} ${addressData.company} ${addressData.firstName} `
+ `${addressData.lastName} ${addressData.address.replace(',', '')} ${addressData.postalCode} ${addressData.city} `
+ `${addressData.phone} ${addressData.country}`, true);
expect(isVisible, 'Data in Addresses table is not correct!').to.eq(true);
});

Expand All @@ -590,17 +591,17 @@ describe('FO - Account : Get GDPR data in PDF', async () => {

const orderCreateDate = `${orderDate.substring(6, 10)}-${orderDate.substring(0, 2)}-`
+ `${orderDate.substring(3, 5)} ${orderDate.substring(11, 19)}`;
const isVisible = await files.isTextInPDF(filePath, 'Orders,,Reference, ,Payment, ,Order state, ,Total paid,'
+ ` ,Date,,${orderReference}, ,Bank transfer, ,Awaiting bank wire,payment,${totalPaid} EUR, ,`
+ `${orderCreateDate},,Product(s) in the order :,,Reference, ,Name, ,Quantity,,${Products.demo_1.reference}`
+ `, ,${Products.demo_1.name},(Size: S - Color: White),2`);
const isVisible = await files.isTextInPDF(filePath, 'Orders Reference Payment Order state Total paid '
+ `Date ${orderReference} Bank transfer Awaiting bank wire payment ${totalPaid} EUR `
+ `${orderCreateDate} Product(s) in the order : Reference Name Quantity ${Products.demo_1.reference}`
+ ` ${Products.demo_1.name} (Size: S - Color: White) 2`, true);
expect(isVisible, 'Data in Orders table is not correct!').to.eq(true);
});

it('should check that Carts table is empty', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkCartsTable1', baseContext);

const isVisible = await files.isTextInPDF(filePath, ',Carts,,Id, ,Total products, ,Date,,No carts');
const isVisible = await files.isTextInPDF(filePath, 'Carts Id Total products Date No carts', true);
expect(isVisible, 'Carts table is not empty!').to.eq(true);
});
});
Expand Down Expand Up @@ -706,10 +707,10 @@ describe('FO - Account : Get GDPR data in PDF', async () => {
it('should check Addresses table', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkAddressesTable2', baseContext);

const isVisible = await files.isTextInPDF(filePath, 'Addresses,,Alias, ,Company, ,Name, ,Address, ,'
+ `Phone(s), ,Country, ,Date,,My Address, ,${addressData.company}, ,${addressData.firstName} `
+ `${addressData.lastName}, ,${addressData.address},${addressData.postalCode} ${addressData.city},`
+ `${addressData.phone}, ,${addressData.country}`);
const isVisible = await files.isTextInPDF(filePath, 'Addresses Alias Company Name Address '
+ `Phone(s) Country Date My Address ${addressData.company} ${addressData.firstName} `
+ `${addressData.lastName} ${addressData.address.replace(',', '')} ${addressData.postalCode} ${addressData.city} `
+ `${addressData.phone} ${addressData.country}`, true);
expect(isVisible, 'Data in Addresses table is not correct!').to.eq(true);
});

Expand All @@ -718,17 +719,17 @@ describe('FO - Account : Get GDPR data in PDF', async () => {

const orderCreateDate = `${orderDate.substring(6, 10)}-${orderDate.substring(0, 2)}-`
+ `${orderDate.substring(3, 5)} ${orderDate.substring(11, 19)}`;
const isVisible = await files.isTextInPDF(filePath, 'Orders,,Reference, ,Payment, ,Order state, ,Total paid,'
+ ` ,Date,,${orderReference}, ,Bank transfer, ,Awaiting bank wire,payment,${totalPaid} EUR, ,`
+ `${orderCreateDate},,Product(s) in the order :,,Reference, ,Name, ,Quantity,,${Products.demo_1.reference}`
+ `, ,${Products.demo_1.name},(Size: S - Color: White),2`);
const isVisible = await files.isTextInPDF(filePath, 'Orders Reference Payment Order state Total paid'
+ ` Date ${orderReference} Bank transfer Awaiting bank wire payment ${totalPaid} EUR `
+ `${orderCreateDate} Product(s) in the order : Reference Name Quantity ${Products.demo_1.reference}`
+ ` ${Products.demo_1.name} (Size: S - Color: White) 2`, true);
expect(isVisible, 'Data in Orders table is not correct!').to.eq(true);
});

it('should check that Carts table is empty', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkCartsTable2', baseContext);

const isVisible = await files.isTextInPDF(filePath, ',Carts,,Id, ,Total products, ,Date,,No carts');
const isVisible = await files.isTextInPDF(filePath, 'Carts Id Total products Date No carts', true);
expect(isVisible, 'Carts table is not empty!').to.eq(true);
});

Expand All @@ -737,9 +738,9 @@ describe('FO - Account : Get GDPR data in PDF', async () => {

const dateString = `${messageDate.substring(6, 10)}-${messageDate.substring(0, 2)}-`
+ `${messageDate.substring(3, 5)} ${messageDate.substring(11, 19)}`;
const isVisible = await files.isTextInPDF(filePath, `Messages,,IP, ,Message, ,Date,,1 / 2 ${today},,`
+ `${contactUsData.firstName} ${contactUsData.lastName},,${ipAddress}, ,${contactUsData.message}, ,${
dateString}`);
const isVisible = await files.isTextInPDF(filePath, `Messages IP Message Date 1 / 2 ${today} `
+ `${contactUsData.firstName} ${contactUsData.lastName} ${ipAddress} ${contactUsData.message} ${
dateString}`, true);
expect(isVisible, 'Data in Messages table is not correct!').to.eq(true);
});
});
Expand Down Expand Up @@ -871,10 +872,10 @@ describe('FO - Account : Get GDPR data in PDF', async () => {
it('should check Addresses table', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkAddressesTable3', baseContext);

const isVisible = await files.isTextInPDF(filePath, 'Addresses,,Alias, ,Company, ,Name, ,Address, ,'
+ `Phone(s), ,Country, ,Date,,My Address, ,${addressData.company}, ,${addressData.firstName} `
+ `${addressData.lastName}, ,${addressData.address},${addressData.postalCode} ${addressData.city},`
+ `${addressData.phone}, ,${addressData.country}`);
const isVisible = await files.isTextInPDF(filePath, 'Addresses Alias Company Name Address '
+ `Phone(s) Country Date My Address ${addressData.company} ${addressData.firstName} `
+ `${addressData.lastName} ${addressData.address.replace(',', '')} ${addressData.postalCode} ${addressData.city}`
+ ` ${addressData.phone} ${addressData.country}`, true);
expect(isVisible, 'Data in Addresses table is not correct!').to.eq(true);
});

Expand All @@ -883,17 +884,17 @@ describe('FO - Account : Get GDPR data in PDF', async () => {

const orderCreateDate = `${orderDate.substring(6, 10)}-${orderDate.substring(0, 2)}-`
+ `${orderDate.substring(3, 5)} ${orderDate.substring(11, 19)}`;
const isVisible = await files.isTextInPDF(filePath, 'Orders,,Reference, ,Payment, ,Order state, ,Total paid,'
+ ` ,Date,,${orderReference}, ,Bank transfer, ,Awaiting bank wire,payment,${totalPaid} EUR, ,`
+ `${orderCreateDate},,Product(s) in the order :,,Reference, ,Name, ,Quantity,,${Products.demo_1.reference}`
+ `, ,${Products.demo_1.name},(Size: S - Color: White),2`);
const isVisible = await files.isTextInPDF(filePath, 'Orders Reference Payment Order state Total paid'
+ ` Date ${orderReference} Bank transfer Awaiting bank wire payment ${totalPaid} EUR `
+ `${orderCreateDate} Product(s) in the order : Reference Name Quantity ${Products.demo_1.reference}`
+ ` ${Products.demo_1.name} (Size: S - Color: White) 2`, true);
expect(isVisible, 'Data in Orders table is not correct!').to.eq(true);
});

it('should check that Carts table is empty', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkCartsTable3', baseContext);

const isVisible = await files.isTextInPDF(filePath, ',Carts,,Id, ,Total products, ,Date,,No carts');
const isVisible = await files.isTextInPDF(filePath, 'Carts Id Total products Date No carts', true);
expect(isVisible, 'Carts table is not empty!').to.eq(true);
});

Expand All @@ -902,17 +903,17 @@ describe('FO - Account : Get GDPR data in PDF', async () => {

const dateString = `${messageDate.substring(6, 10)}-${messageDate.substring(0, 2)}-`
+ `${messageDate.substring(3, 5)} ${messageDate.substring(11, 19)}`;
const isVisible = await files.isTextInPDF(filePath, `Messages,,IP, ,Message, ,Date,,1 / 2 ${today},,`
+ `${contactUsData.firstName} ${contactUsData.lastName},,${ipAddress}, ,${contactUsData.message}, ,${
dateString}`);
const isVisible = await files.isTextInPDF(filePath, `Messages IP Message Date 1 / 2 ${today} `
+ `${contactUsData.firstName} ${contactUsData.lastName} ${ipAddress} ${contactUsData.message} ${
dateString}`, true);
expect(isVisible, 'Data in Messages table is not correct!').to.eq(true);
});

it('should check Last connections table', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkLastConnectionsTable2', baseContext);

const isVisible = await files.isTextInPDF(filePath, 'Last connectionsOrigin request Page viewed '
+ `Time on the page IP address Date${connectionOrigin.split(',').join('')}0 ${ipAddress} ${secondLastVisitDate}0 `
const isVisible = await files.isTextInPDF(filePath, 'Last connections Origin request Page viewed '
+ `Time on the page IP address Date ${connectionOrigin.split(',').join('')} 0 ${ipAddress} ${secondLastVisitDate} 0 `
+ `${ipAddress} ${lastVisitDate}`, true);
expect(isVisible, 'The data in Last connections table is not correct!').to.eq(true);
});
Expand Down