Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Commit

Permalink
Added people entry deletion test
Browse files Browse the repository at this point in the history
  • Loading branch information
Marketionist committed Jul 31, 2015
1 parent 61697ef commit 5bff2d8
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ var peoplePage = {
peopleEntryLink: element(by.css('.aldryn-people-article > h2 > a')),
personTitle: element(by.css('.aldryn-people-detail h2 > div')),

// deleting people entry
deleteButton: element(by.css('.deletelink-box a')),
sidebarConfirmationButton: element(by.css('#content [type="submit"]')),

cmsLogin: function (credentials) {
// object can contain username and password, if not set it will
// fallback to 'admin'
Expand Down
70 changes: 70 additions & 0 deletions aldryn_people/tests/frontend/integration/specs/spec.people.crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,74 @@ describe('Aldryn People tests: ', function () {
});
});

it('deletes people entry', function () {
// wait for modal iframe to appear
browser.wait(function () {
return browser.isElementPresent(peoplePage.sideMenuIframe);
}, peoplePage.iframeWaitTime);

// switch to sidebar menu iframe
browser.switchTo()
.frame(browser.findElement(By.css('.cms_sideframe-frame iframe')));

// wait for edit people entry link to appear
browser.wait(function () {
return browser.isElementPresent(peoplePage.editPersonLinks.first());
}, peoplePage.mainElementsWaitTime);

// validate edit people entry links texts to delete proper people entry
peoplePage.editPersonLinks.first().getText().then(function (text) {
// wait till horizontal scrollbar will disappear and
// editPersonLinks will become clickable
browser.sleep(1500);

if (text === personName) {
return peoplePage.editPersonLinks.first().click();
} else {
return peoplePage.editPersonLinks.get(1).getText()
.then(function (text) {
if (text === personName) {
return peoplePage.editPersonLinks.get(1).click();
} else {
return peoplePage.editPersonLinks.get(2).getText()
.then(function (text) {
if (text === personName) {
return peoplePage.editPersonLinks.get(2).click();
}
});
}
});
}
}).then(function () {
// wait for delete button to appear
browser.wait(function () {
return browser.isElementPresent(peoplePage.deleteButton);
}, peoplePage.mainElementsWaitTime);

browser.actions().mouseMove(peoplePage.saveAndContinueButton)
.perform();
return peoplePage.deleteButton.click();
}).then(function () {
// wait for confirmation button to appear
browser.wait(function () {
return browser.isElementPresent(peoplePage.sidebarConfirmationButton);
}, peoplePage.mainElementsWaitTime);

peoplePage.sidebarConfirmationButton.click();

browser.wait(function () {
return browser.isElementPresent(peoplePage.successNotification);
}, peoplePage.mainElementsWaitTime);

// validate success notification
expect(peoplePage.successNotification.isDisplayed()).toBeTruthy();

// switch to default page content
browser.switchTo().defaultContent();

// refresh the page to see changes
browser.refresh();
});
});

});

0 comments on commit 5bff2d8

Please sign in to comment.