Skip to content

Commit

Permalink
test: remove await form expect
Browse files Browse the repository at this point in the history
  • Loading branch information
boubkerbribri committed Sep 21, 2023
1 parent 99b65f6 commit aa94c6f
Show file tree
Hide file tree
Showing 512 changed files with 6,793 additions and 6,781 deletions.
44 changes: 22 additions & 22 deletions tests/UI/campaigns/cldr/03_deleteCurrency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('CLDR : Delete a currency', async () => {
await localizationPage.closeSfToolBar(page);

const pageTitle = await localizationPage.getPageTitle(page);
await expect(pageTitle).to.contains(localizationPage.pageTitle);
expect(pageTitle).to.contains(localizationPage.pageTitle);
});

it('should go to Currencies Tab', async function () {
Expand All @@ -67,14 +67,14 @@ describe('CLDR : Delete a currency', async () => {
await localizationPage.goToSubTabCurrencies(page);

const pageTitle = await currenciesPage.getPageTitle(page);
await expect(pageTitle).to.contains(currenciesPage.pageTitle);
expect(pageTitle).to.contains(currenciesPage.pageTitle);
});

it('should reset all filters', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'resetFilter', baseContext);

numberOfCurrencies = await currenciesPage.resetAndGetNumberOfLines(page);
await expect(numberOfCurrencies).to.be.above(0);
expect(numberOfCurrencies).to.be.above(0);
});

currencies.forEach((currency: CurrencyData, index : number) => {
Expand All @@ -84,19 +84,19 @@ describe('CLDR : Delete a currency', async () => {
await currenciesPage.goToAddNewCurrencyPage(page);

const pageTitle = await addCurrencyPage.getPageTitle(page);
await expect(pageTitle).to.contains(addCurrencyPage.pageTitle);
expect(pageTitle).to.contains(addCurrencyPage.pageTitle);
});

it(`should create the currency ${currency.isoCode}`, async function () {
await testContext.addContextItem(this, 'testIdentifier', `createOfficialCurrency${currency.isoCode}`, baseContext);

// Create and check successful message
const textResult = await addCurrencyPage.addOfficialCurrency(page, currency);
await expect(textResult).to.contains(currenciesPage.successfulCreationMessage);
expect(textResult).to.contains(currenciesPage.successfulCreationMessage);

// Check number of currencies after creation
const numberOfCurrenciesAfterCreation = await currenciesPage.getNumberOfElementInGrid(page);
await expect(numberOfCurrenciesAfterCreation).to.be.equal(numberOfCurrencies + index + 1);
expect(numberOfCurrenciesAfterCreation).to.be.equal(numberOfCurrencies + index + 1);
});
});

Expand All @@ -106,14 +106,14 @@ describe('CLDR : Delete a currency', async () => {
await localizationPage.goToSubTabLocalizations(page);

const pageTitle = await localizationPage.getPageTitle(page);
await expect(pageTitle).to.contains(localizationPage.pageTitle);
expect(pageTitle).to.contains(localizationPage.pageTitle);
});

it(`should choose '${Currencies.usd.isoCode}' as default currency`, async function () {
await testContext.addContextItem(this, 'testIdentifier', 'setUSDAsDefaultCurrency', baseContext);

const textResult = await localizationPage.setDefaultCurrency(page, `${Currencies.usd.name} (${Currencies.usd.isoCode})`);
await expect(textResult).to.contains(localizationPage.successfulSettingsUpdateMessage);
expect(textResult).to.contains(localizationPage.successfulSettingsUpdateMessage);
});

it('should go to Currencies Tab', async function () {
Expand All @@ -122,7 +122,7 @@ describe('CLDR : Delete a currency', async () => {
await localizationPage.goToSubTabCurrencies(page);

const pageTitle = await currenciesPage.getPageTitle(page);
await expect(pageTitle).to.contains(currenciesPage.pageTitle);
expect(pageTitle).to.contains(currenciesPage.pageTitle);
});

it(`should filter by iso code of currency '${Currencies.usd.isoCode}'`, async function () {
Expand All @@ -133,18 +133,18 @@ describe('CLDR : Delete a currency', async () => {

// Check number of currencies
const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page);
await expect(numberOfCurrenciesAfterFilter).to.be.equal(1);
expect(numberOfCurrenciesAfterFilter).to.be.equal(1);

// Check currency
const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code');
await expect(textColumn).to.contains(Currencies.usd.isoCode);
expect(textColumn).to.contains(Currencies.usd.isoCode);
});

it('should delete currency', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'deleteCurrencyUSDWithError', baseContext);

const result = await currenciesPage.deleteCurrency(page, 1);
await expect(result).to.be.equal(currenciesPage.cannotDeleteDefaultCurrencyMessage);
expect(result).to.be.equal(currenciesPage.cannotDeleteDefaultCurrencyMessage);
});

it('should go to Localization Tab', async function () {
Expand All @@ -153,14 +153,14 @@ describe('CLDR : Delete a currency', async () => {
await localizationPage.goToSubTabLocalizations(page);

const pageTitle = await localizationPage.getPageTitle(page);
await expect(pageTitle).to.contains(localizationPage.pageTitle);
expect(pageTitle).to.contains(localizationPage.pageTitle);
});

it(`should choose '${Currencies.euro.isoCode}' as default currency`, async function () {
await testContext.addContextItem(this, 'testIdentifier', 'setEURAsDefaultCurrency', baseContext);

const textResult = await localizationPage.setDefaultCurrency(page, `${Currencies.euro.name} (${Currencies.euro.isoCode})`);
await expect(textResult).to.contains(localizationPage.successfulSettingsUpdateMessage);
expect(textResult).to.contains(localizationPage.successfulSettingsUpdateMessage);
});

it('should go to Currencies Tab', async function () {
Expand All @@ -169,7 +169,7 @@ describe('CLDR : Delete a currency', async () => {
await localizationPage.goToSubTabCurrencies(page);

const pageTitle = await currenciesPage.getPageTitle(page);
await expect(pageTitle).to.contains(currenciesPage.pageTitle);
expect(pageTitle).to.contains(currenciesPage.pageTitle);
});

it(`should filter by iso code of currency '${Currencies.usd.isoCode}'`, async function () {
Expand All @@ -180,28 +180,28 @@ describe('CLDR : Delete a currency', async () => {

// Check number of currencies
const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page);
await expect(numberOfCurrenciesAfterFilter).to.be.equal(1);
expect(numberOfCurrenciesAfterFilter).to.be.equal(1);

// Check currency
const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code');
await expect(textColumn).to.contains(Currencies.usd.isoCode);
expect(textColumn).to.contains(Currencies.usd.isoCode);
});

it('should delete currency', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'deleteCurrencyUSD', baseContext);

const result = await currenciesPage.deleteCurrency(page, 1);
await expect(result).to.be.equal(currenciesPage.successfulDeleteMessage);
expect(result).to.be.equal(currenciesPage.successfulDeleteMessage);
});

it(`should select rows except '${Currencies.euro.isoCode}'`, async function () {
await testContext.addContextItem(this, 'testIdentifier', 'resetAndSelectRowsExceptEUR', baseContext);

const numberOfCurrenciesAfterDelete = await currenciesPage.resetAndGetNumberOfLines(page);
await expect(numberOfCurrenciesAfterDelete).to.be.eq(numberOfCurrencies + currencies.length - 1);
expect(numberOfCurrenciesAfterDelete).to.be.eq(numberOfCurrencies + currencies.length - 1);

const isBulkActionsEnabledBeforeSelect = await currenciesPage.isBulkActionsEnabled(page);
await expect(isBulkActionsEnabledBeforeSelect).to.be.false;
expect(isBulkActionsEnabledBeforeSelect).to.eq(false);

for (let numRow = 1; numRow <= numberOfCurrenciesAfterDelete; numRow++) {
const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, numRow, 'iso_code');
Expand All @@ -212,7 +212,7 @@ describe('CLDR : Delete a currency', async () => {
}

const isBulkActionsEnabledAfterSelect = await currenciesPage.isBulkActionsEnabled(page);
await expect(isBulkActionsEnabledAfterSelect).to.be.true;
expect(isBulkActionsEnabledAfterSelect).to.eq(true);
});

it('should bulk delete currencies', async function () {
Expand All @@ -222,6 +222,6 @@ describe('CLDR : Delete a currency', async () => {
expect(result).to.be.eq(currenciesPage.successfulMultiDeleteMessage);

const numberOfCurrenciesAfterBulkDeete = await currenciesPage.getNumberOfElementInGrid(page);
await expect(numberOfCurrenciesAfterBulkDeete).to.be.equal(numberOfCurrencies);
expect(numberOfCurrenciesAfterBulkDeete).to.be.equal(numberOfCurrencies);
});
});
40 changes: 20 additions & 20 deletions tests/UI/campaigns/cldr/04_searchCurrencyByISOCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('CLDR : Search a currency by ISO code', async () => {
await localizationPage.closeSfToolBar(page);

const pageTitle = await localizationPage.getPageTitle(page);
await expect(pageTitle).to.contains(localizationPage.pageTitle);
expect(pageTitle).to.contains(localizationPage.pageTitle);
});

it('should go to Currencies Tab', async function () {
Expand All @@ -69,14 +69,14 @@ describe('CLDR : Search a currency by ISO code', async () => {
await localizationPage.goToSubTabCurrencies(page);

const pageTitle = await currenciesPage.getPageTitle(page);
await expect(pageTitle).to.contains(currenciesPage.pageTitle);
expect(pageTitle).to.contains(currenciesPage.pageTitle);
});

it('should reset all filters', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'resetFilter', baseContext);

numberOfCurrencies = await currenciesPage.resetAndGetNumberOfLines(page);
await expect(numberOfCurrencies).to.be.above(0);
expect(numberOfCurrencies).to.be.above(0);
});

installedCurrencies.forEach((currency: CurrencyData, index: number) => {
Expand All @@ -86,19 +86,19 @@ describe('CLDR : Search a currency by ISO code', async () => {
await currenciesPage.goToAddNewCurrencyPage(page);

const pageTitle = await addCurrencyPage.getPageTitle(page);
await expect(pageTitle).to.contains(addCurrencyPage.pageTitle);
expect(pageTitle).to.contains(addCurrencyPage.pageTitle);
});

it(`should create the currency ${currency.isoCode}`, async function () {
await testContext.addContextItem(this, 'testIdentifier', `createOfficialCurrency${currency.isoCode}`, baseContext);

// Create and check successful message
const textResult = await addCurrencyPage.addOfficialCurrency(page, currency);
await expect(textResult).to.contains(currenciesPage.successfulCreationMessage);
expect(textResult).to.contains(currenciesPage.successfulCreationMessage);

// Check number of currencies after creation
const numberOfCurrenciesAfterCreation = await currenciesPage.getNumberOfElementInGrid(page);
await expect(numberOfCurrenciesAfterCreation).to.be.equal(numberOfCurrencies + index + 1);
expect(numberOfCurrenciesAfterCreation).to.be.equal(numberOfCurrencies + index + 1);
});
});

Expand All @@ -110,11 +110,11 @@ describe('CLDR : Search a currency by ISO code', async () => {

// Check number of currencies
const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page);
await expect(numberOfCurrenciesAfterFilter).to.be.equal(1);
expect(numberOfCurrenciesAfterFilter).to.be.equal(1);

// Check currency
const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code');
await expect(textColumn).to.contains(Currencies.euro.isoCode);
expect(textColumn).to.contains(Currencies.euro.isoCode);
});

it('should filter by iso code "US"', async function () {
Expand All @@ -125,11 +125,11 @@ describe('CLDR : Search a currency by ISO code', async () => {

// Check number of currencies
const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page);
await expect(numberOfCurrenciesAfterFilter).to.be.equal(1);
expect(numberOfCurrenciesAfterFilter).to.be.equal(1);

// Check currency
const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code');
await expect(textColumn).to.contains(Currencies.usd.isoCode);
expect(textColumn).to.contains(Currencies.usd.isoCode);
});

it('should filter by iso code "PY"', async function () {
Expand All @@ -141,14 +141,14 @@ describe('CLDR : Search a currency by ISO code', async () => {

// Check number of currencies
const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page);
await expect(numberOfCurrenciesAfterFilter).to.be.equal(2);
expect(numberOfCurrenciesAfterFilter).to.be.equal(2);

// Check currencies
const textColumnRow1 = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code');
await expect(textColumnRow1).to.contains(Currencies.jpy.isoCode);
expect(textColumnRow1).to.contains(Currencies.jpy.isoCode);

const textColumnRow2 = await currenciesPage.getTextColumnFromTableCurrency(page, 2, 'iso_code');
await expect(textColumnRow2).to.contains(Currencies.pyg.isoCode);
expect(textColumnRow2).to.contains(Currencies.pyg.isoCode);
});

it('should filter by iso code "P"', async function () {
Expand All @@ -160,17 +160,17 @@ describe('CLDR : Search a currency by ISO code', async () => {

// Check number of currencies
const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page);
await expect(numberOfCurrenciesAfterFilter).to.be.equal(3);
expect(numberOfCurrenciesAfterFilter).to.be.equal(3);

// Check currencies
const textColumnRow1 = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code');
await expect(textColumnRow1).to.contains(Currencies.gbp.isoCode);
expect(textColumnRow1).to.contains(Currencies.gbp.isoCode);

const textColumnRow2 = await currenciesPage.getTextColumnFromTableCurrency(page, 2, 'iso_code');
await expect(textColumnRow2).to.contains(Currencies.jpy.isoCode);
expect(textColumnRow2).to.contains(Currencies.jpy.isoCode);

const textColumnRow3 = await currenciesPage.getTextColumnFromTableCurrency(page, 3, 'iso_code');
await expect(textColumnRow3).to.contains(Currencies.pyg.isoCode);
expect(textColumnRow3).to.contains(Currencies.pyg.isoCode);
});

it('should filter by iso code "ABC"', async function () {
Expand All @@ -181,18 +181,18 @@ describe('CLDR : Search a currency by ISO code', async () => {

// Check number of currencies
const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page);
await expect(numberOfCurrenciesAfterFilter).to.be.equal(0);
expect(numberOfCurrenciesAfterFilter).to.be.equal(0);

// Check currencies
const textColumn = await currenciesPage.getTextForEmptyTable(page);
await expect(textColumn).to.equal('warning No records found');
expect(textColumn).to.equal('warning No records found');
});

it('should reset all filters', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'resetFilterFinal', baseContext);

const numberOfCurrenciesAfterReset = await currenciesPage.resetAndGetNumberOfLines(page);
await expect(numberOfCurrenciesAfterReset).to.be.eq(numberOfCurrencies + installedCurrencies.length);
expect(numberOfCurrenciesAfterReset).to.be.eq(numberOfCurrencies + installedCurrencies.length);
});

// Post-condition - Delete currencies
Expand Down

0 comments on commit aa94c6f

Please sign in to comment.