Depends what you need to achieve. Protractor would be better to work with Angular JS - but Serenity is more for automated acceptance criteria using BDD. Therefore, I want my (ATDD) tests to be ideally free from the development framework of choice. Imagine you start developing using Vaadin framework and you write your ATDD tests using Vaadin TestBench and then you switch on using Angular JS. You need to heavily refactor your tests.
You can write unit and integration tests using Protractor (or other frameworks tied up to Angular) and use Serenity for end to end/acceptance/smoke tests.
From what I know, there is no strong integration of Serenity with Angular JS, other than the one mentioned
here
Below is an example of mine to setup a value in an Angular JS dropdown using click on arrow and find desired value.
public void setValueInSimpleDropDown (String value) {
WebElementFacade myDropdown = getDropdown(0);
clickDropdownArrow(myDropdown);
setValueInDropdown(value, myDropdown);
}
private WebElementFacade getDropdown (int index) {
return findAll(By.cssSelector(".select2")).get(index);
}
private void clickDropdownArrow (WebElementFacade dropdown) {
By arrow = By.cssSelector(".select2-arrow");
dropdown.find(arrow).then().click();
}
private void setValueInDropdown (String value, WebElementFacade dropdown) {
ByJQuerySelector desiredValue = new ByJQuerySelector(".dropdown-item:contains('" + value + "')");
find(desiredValue).waitUntilVisible().then().click();
}
You can write similar methods for setting a value using search and put them in a separate library.
Theo