-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Functional Tests : BO - Stocks - Movements - Filter by category, move…
…ment type, employee and period
- Loading branch information
Showing
14 changed files
with
1,129 additions
and
7,739 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
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
639 changes: 639 additions & 0 deletions
639
tests/UI/campaigns/functional/BO/03_catalog/08_stocks/01_movements/01_filterMovements.ts
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
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,53 @@ | ||
// Import utils | ||
import testContext from '@utils/testContext'; | ||
|
||
import {expect} from 'chai'; | ||
import {createConnection} from 'mysql2/promise'; | ||
import type {Connection} from 'mysql2/promise'; | ||
|
||
let dbConnection: Connection; | ||
|
||
/** | ||
* Function to clean all Stock Movements | ||
* @param baseContext {string} String to identify the test | ||
*/ | ||
function cleanTableStockMovements(baseContext: string = 'commonTests-cleanTableStockMovements'): void { | ||
const dbPrefix: string = global.INSTALL.DB_PREFIX; | ||
|
||
describe(`Clean table ${dbPrefix}stock_mvt`, async () => { | ||
// before and after functions | ||
before(async () => { | ||
if (!global.GENERATE_FAILED_STEPS) { | ||
dbConnection = await createConnection({ | ||
user: global.INSTALL.DB_USER, | ||
password: global.INSTALL.DB_PASSWD, | ||
host: `my_prestashop_${global.INSTALL.DB_SERVER}_1`, | ||
port: 3306, | ||
database: global.INSTALL.DB_NAME, | ||
connectionLimit: 5, | ||
debug: true, | ||
}); | ||
} | ||
}); | ||
|
||
after(async () => { | ||
if (dbConnection) { | ||
await dbConnection.end(); | ||
} | ||
}); | ||
|
||
it(`should remove all lines in ${dbPrefix}stock_mvt`, async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'truncateTable', baseContext); | ||
|
||
await dbConnection.execute(`TRUNCATE TABLE ${dbPrefix}stock_mvt`); | ||
|
||
const [rows] = await dbConnection.query({ | ||
sql: `SELECT * FROM ${dbPrefix}stock_mvt`, | ||
rowsAsArray: true, | ||
}); | ||
expect(rows).to.be.length(0); | ||
}); | ||
}); | ||
} | ||
|
||
export default cleanTableStockMovements; |
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
Oops, something went wrong.