BES-66 | formatting tests
This commit is contained in:
parent
e31dd0d04d
commit
8dadec66b2
@ -117,7 +117,7 @@ class Base {
|
||||
console.log(`${elementName} is not displayed. Exception: ${e}`);
|
||||
return false;
|
||||
}
|
||||
}, 10000, `Expected ${selector} to be displayed after 10s`);
|
||||
}, 5000, `Expected ${selector} to be displayed after 5s`);
|
||||
}
|
||||
|
||||
waitForNthElementDisplayed(selectorList, position, elementName) {
|
||||
|
@ -8,6 +8,8 @@ class AddNote {
|
||||
this.noteTopic = '#topic';
|
||||
this.noteField = '#tinymce';
|
||||
this.frameNote = '#content_ifr';
|
||||
this.boxFormatting = '.tox-dialog';
|
||||
this.boxHeader = '.tox-dialog__header';
|
||||
this.toolbarButton = '.tox-tbtn';
|
||||
this.addNoteButton = '.mt-1';
|
||||
}
|
||||
@ -40,12 +42,22 @@ class AddNote {
|
||||
}
|
||||
|
||||
clickFormattingButton(id) {
|
||||
base.clickNth(this.toolbarButton, id, 'Button for Bold');
|
||||
base.clickNth(this.toolbarButton, id, 'Button for formatting');
|
||||
return this;
|
||||
}
|
||||
|
||||
isFormattingButtonEnabled(id) {
|
||||
return JSON.parse($$(this.toolbarButton)[id].getAttribute('aria-pressed'));
|
||||
}
|
||||
|
||||
isBoxDisplayed() {
|
||||
base.waitForDisplayed(this.boxFormatting);
|
||||
return base.isDisplayed(this.boxFormatting);
|
||||
}
|
||||
|
||||
getBoxHeaderText() {
|
||||
base.waitForDisplayed(this.boxHeader);
|
||||
return base.getAttribute(this.boxHeader, 'textContent', 'Header in box');
|
||||
}
|
||||
}
|
||||
module.exports = AddNote;
|
@ -39,38 +39,104 @@ describe('Formatting buttons', () => {
|
||||
const addnote = navigate.toAddNotePage('user');
|
||||
|
||||
addStep('Check if bold button is enabled');
|
||||
const date = `${common.noteName}`
|
||||
const date = `${common.noteName}`;
|
||||
addnote.clickFormattingButton(3);
|
||||
expect(addnote.isFormattingButtonEnabled(3), 'Bold button is enabled').to.be.true;
|
||||
})
|
||||
|
||||
it('bold styling is disabled', () => {
|
||||
addStep('Redirect to Create Note Page as logged user');
|
||||
const addnote = navigate.toAddNotePage('user');
|
||||
|
||||
addStep('Check if bold button is disabled');
|
||||
const date = `${common.noteName}`
|
||||
addnote.clickFormattingButton(3).clickFormattingButton(3);
|
||||
expect(addnote.isFormattingButtonEnabled(3), 'Bold button is disabled').to.be.false;
|
||||
})
|
||||
|
||||
it('italic styling is enabled', () => {
|
||||
addStep('Redirect to Create Note Page as logged user');
|
||||
const addnote = navigate.toAddNotePage('user');
|
||||
|
||||
addStep('Check if Italic button is enabled');
|
||||
const date = `${common.noteName}`
|
||||
const date = `${common.noteName}`;
|
||||
addnote.clickFormattingButton(4);
|
||||
expect(addnote.isFormattingButtonEnabled(4), 'Italic button is enabled').to.be.true;
|
||||
})
|
||||
|
||||
it('italic styling is disabled', () => {
|
||||
it('right align styling is enabled', () => {
|
||||
addStep('Redirect to Create Note Page as logged user');
|
||||
const addnote = navigate.toAddNotePage('user');
|
||||
|
||||
addStep('Check if Italic button is disabled');
|
||||
const date = `${common.noteName}`
|
||||
addnote.clickFormattingButton(4).clickFormattingButton(4);
|
||||
expect(addnote.isFormattingButtonEnabled(4), 'Italic button is disabled').to.be.false;
|
||||
addStep('Check if right align button is enabled');
|
||||
const date = `${common.noteName}`;
|
||||
addnote.clickFormattingButton(5);
|
||||
expect(addnote.isFormattingButtonEnabled(5), 'Right align button is enabled').to.be.true;
|
||||
})
|
||||
|
||||
it('center align styling is enabled', () => {
|
||||
addStep('Redirect to Create Note Page as logged user');
|
||||
const addnote = navigate.toAddNotePage('user');
|
||||
|
||||
addStep('Check if center align button is enabled');
|
||||
const date = `${common.noteName}`;
|
||||
addnote.clickFormattingButton(6);
|
||||
expect(addnote.isFormattingButtonEnabled(6), 'Center align button is enabled').to.be.true;
|
||||
})
|
||||
|
||||
it('left align styling is enabled', () => {
|
||||
addStep('Redirect to Create Note Page as logged user');
|
||||
const addnote = navigate.toAddNotePage('user');
|
||||
|
||||
addStep('Check if left align button is enabled');
|
||||
const date = `${common.noteName}`;
|
||||
addnote.clickFormattingButton(7);
|
||||
expect(addnote.isFormattingButtonEnabled(7), 'Left align button is enabled').to.be.true;
|
||||
})
|
||||
|
||||
it('Insert/edit link is enabled', () => {
|
||||
addStep('Redirect to Create Note Page as logged user');
|
||||
const addnote = navigate.toAddNotePage('user');
|
||||
|
||||
addStep('Check if insert/edit link option is enabled');
|
||||
const date = `${common.noteName}`;
|
||||
addnote.clickFormattingButton(8);
|
||||
expect(addnote.isFormattingButtonEnabled(8), 'Edit link button is disabled').to.be.false;
|
||||
|
||||
addStep('Check if box is displayed for editing link');
|
||||
expect(addnote.isBoxDisplayed(), 'Box to edit link is displayed').to.be.true;
|
||||
expect(addnote.getBoxHeaderText(), 'Header of box are about editing link').to.be.equal('Insert/Edit Link');
|
||||
})
|
||||
|
||||
it('Insert/edit image is enabled', () => {
|
||||
addStep('Redirect to Create Note Page as logged user');
|
||||
const addnote = navigate.toAddNotePage('user');
|
||||
|
||||
addStep('Check if insert/edit image option is enabled');
|
||||
const date = `${common.noteName}`;
|
||||
addnote.clickFormattingButton(9);
|
||||
expect(addnote.isFormattingButtonEnabled(9), 'Edit image button is disabled').to.be.false;
|
||||
|
||||
addStep('Check if box is displayed for editing image');
|
||||
expect(addnote.isBoxDisplayed(), 'Box to edit image is displayed').to.be.true;
|
||||
expect(addnote.getBoxHeaderText(), 'Header of box are about editing image').to.be.equal('Insert/Edit Image');
|
||||
})
|
||||
|
||||
it('Insert/edit media is enabled', () => {
|
||||
addStep('Redirect to Create Note Page as logged user');
|
||||
const addnote = navigate.toAddNotePage('user');
|
||||
|
||||
addStep('Check if insert/edit media option is enabled');
|
||||
const date = `${common.noteName}`;
|
||||
addnote.clickFormattingButton(10);
|
||||
expect(addnote.isFormattingButtonEnabled(10), 'Edit media button is disabled').to.be.false;
|
||||
|
||||
addStep('Check if box is displayed for editing media');
|
||||
expect(addnote.isBoxDisplayed(), 'Box to edit media is displayed').to.be.true;
|
||||
expect(addnote.getBoxHeaderText(), 'Header of box are about editing media').to.be.equal('Insert/Edit Media');
|
||||
})
|
||||
|
||||
it('Insert/edit code sample is enabled', () => {
|
||||
addStep('Redirect to Create Note Page as logged user');
|
||||
const addnote = navigate.toAddNotePage('user');
|
||||
|
||||
addStep('Check if insert/edit code sample option is enabled');
|
||||
const date = `${common.noteName}`;
|
||||
addnote.clickFormattingButton(11);
|
||||
expect(addnote.isFormattingButtonEnabled(11), 'Edit code sample button is disabled').to.be.false;
|
||||
|
||||
addStep('Check if box is displayed for editing code sample');
|
||||
expect(addnote.isBoxDisplayed(), 'Box to edit code sample is displayed').to.be.true;
|
||||
expect(addnote.getBoxHeaderText(), 'Header of box are about editing code sample').to.be.equal('Insert/Edit Code Sample');
|
||||
})
|
||||
});
|
||||
|
@ -47,36 +47,4 @@ describe('Note page in BestNotes', () => {
|
||||
expect(topic.isNoteDisplayed(), 'Note field should be displayed').to.be.true;
|
||||
expect(topic.getTextNote(), 'Text note should contained Va Banque in text').to.contain('Va Banque');
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
//commented till adding notes will be implemented
|
||||
|
||||
/* describe('User Notes in BestNotes', () => {
|
||||
it('Edit and Delete Button should be displayed in user notes', () => {
|
||||
addStep('Redirect to Topic Page as anon');
|
||||
const topic = navigate.toTopicPage();
|
||||
topic.clickSubjectButton();
|
||||
|
||||
addStep('Check if Topic Page is displayed and URL matches');
|
||||
expect(browser.getUrl(), 'Topic Page URL is displayed as expected').to.equal(common.bestNotesLink + 'topics_by_subject_id/1');
|
||||
|
||||
addStep('Click topic Programowanie obiektowe');
|
||||
expect(topic.getTextFromListButton(), 'Title of topic shoukd be equal Programowanie obiektowe').to.equal('Programowanie obiektowe');
|
||||
topic.clickTopicButton();
|
||||
|
||||
addStep('Click note Lorem ipsum');
|
||||
expect(topic.getTextFromYourNotesListButton(), 'Title of note shoukd be equal Lorem ipsum').to.equal('Lorem ipsum');
|
||||
topic.clickYourNoteButton();
|
||||
|
||||
addStep('Check if Note has a correct URL, title and contains text');
|
||||
expect(browser.getUrl(), 'Note URL is displayed as expected').to.equal(common.bestNotesLink + 'note/1');
|
||||
expect(topic.getTitleNote(), 'Title note should be displayed about Lorem ipsum').to.equal(`${common.titleNote}Lorem ipsum`);
|
||||
expect(topic.getTextNote(), 'Text note should contained Lorem ipsum text').to.contain('Lorem ipsum');
|
||||
|
||||
addStep('Check if Note has a edit and delete button');
|
||||
expect(topic.isEditButtonDisplayed(), 'Edit button should be displayed').to.equal(true);
|
||||
expect(topic.isDeleteButtonDisplayed(), 'Delete button should be displayed').to.equal(true);
|
||||
})
|
||||
});
|
||||
*/
|
||||
});
|
Loading…
Reference in New Issue
Block a user