Skip to content

Commit

Permalink
pr comment modification
Browse files Browse the repository at this point in the history
  • Loading branch information
Khadreal committed Feb 12, 2024
1 parent 425ed8d commit fa4d865
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/support/steps/wpml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,23 @@ Given('wpml has more than one languages', async function (this:ICustomWorld) {
await this.utils.visitPage('wp-admin/admin.php?page=sitepress-multilingual-cms%2Fmenu%2Flanguages.php');
const languages = await this.page.locator('.enabled-languages li').all()

if(languages.length >= 5) {
if(languages.length >= 3) {
return
}

const checkBoxesLength = await this.page.locator('.available-languages li input[type=checkbox]').all()

await this.page.locator( '#icl_add_remove_button' ).click();
let count = 0;
const checkboxes = this.page.locator('.available-languages li input[type=checkbox]')

for (let i = 0; i < checkBoxesLength.length; ++i) {
const randomNumber = Math.floor(Math.random() * checkBoxesLength.length)

if((await this.page.locator(checkboxes[randomNumber]).isChecked() ) ) {
continue;
}

if(count > 3) {
break;
}

checkboxes[randomNumber].check()
await this.page.locator('.available-languages li input[type=checkbox]').nth(randomNumber).check()
count++;
}

Expand Down Expand Up @@ -120,7 +115,6 @@ When('switch to another language', async function () {

await scrollPage;
});
this.page.pause();

// Remove the event listeners to prevent duplicate messages.
this.page.off('console', consoleHandler);
Expand Down

0 comments on commit fa4d865

Please sign in to comment.