OBA Website automated using playwright
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

30 lines
1.1 KiB

exports.ContentPage=
class ContentPage {
constructor(page) {
this.page = page;
this.contentButton="//span[normalize-space()='Content']";
this.contentToEdit="//select[@id='select_content_to_edit']";
this.contentPageValidate="//h1[normalize-space()='Content Editor']";
this.contentText="//div[@class='CodeMirror-scroll']";
this.contentSave="//button[normalize-space()='Save']";
}
async clickContentButton(){
await this.page.locator(this.contentButton).click();
}
async ContentToSave(contentToEditOption){
await this.page.locator(this.contentButton).click();
await this.page.locator(this.contentToEdit).selectOption({label:contentToEditOption});
await this.page.waitForSelector('.CodeMirror');
await this.page.evaluate(() => {
const codeMirrorElement = document.querySelector('.CodeMirror');
codeMirrorElement.CodeMirror.setValue('Everything goes good');
});
await this.page.locator(this.contentSave).click();
}
}