-
Notifications
You must be signed in to change notification settings - Fork 40
Adding a new page
Using author pages on Touch UI is basing on YAML configuration file named pages.yml
in wchich we are defining pages we want to use. The file should be put under main/resources
folder in your project. The single configuration entry for a page consists of three elements:
- key - human-readable key for obtaining concrete page in test class
- path - path to the page (without edit.html prefix)
- parsys - path to parsys obtained form
data-path
attribute from it's DOM element (can be truncated up to/jcr:content
)
Let's take a look at the example:
Text - Update&Read:
path: /content/geometrixx/en/toolbar/search.html
parsys: /par
The original data-path attribute of parsys is /content/geometrixx/en/toolbar/search/jcr:content/par
but the part up to jcr:content
is redundant. If you want to read more about providing data-path attributes please refer to Component descriptions tutorial.
To get instance of a page provided in configuration we need to use AuthorPageFactory
instance which can be injected in your test class
@Inject
private AuthorPageFactory authorPageFactory;
Instance of this class can provide you a page using path. To get path of desired page from your configuration file you should use Pages
class which can be injected in the same way as the factory above
@Inject
private Pages pages;
Now - all you need to do is to use that objects in a proper way:
import com.cognifide.qa.bb.aem.AemLogin;
import com.cognifide.qa.bb.aem.touch.data.pages.Pages;
import com.cognifide.qa.bb.aem.touch.pageobjects.pages.AuthorPage;
import com.cognifide.qa.bb.aem.touch.pageobjects.pages.AuthorPageFactory;
import com.cognifide.qa.bb.junit.TestRunner;
import com.cognifide.bdd.demo.GuiceModule;
//...
@RunWith(TestRunner.class)
@Modules(GuiceModule.class)
public class AemRichtextTest {
@Inject
private AemLogin aemLogin;
@Inject
private Pages pages;
@Inject
private AuthorPageFactory authorPageFactory;
private AuthorPage page;
//..
@Before
public void before() {
aemLogin.authorLogin();
page = authorPageFactory.create(pages.getPath("Text - Update&Read"));
page.open();
}
//..
}
The Pages#getPath
method is used to get page path from configuration key - in this case Text - Update&Read
which we have defined in the very first section of this tutorial. The AuthorPageFactory#create
method creates an AuthorPage
instance which can be used for adding, deleting and configuring components in the parsys provided in the YAML configuration as well as getting content of the desired component. For details please take a look at the javadoc and further parts of AEM Touch UI tutorial.
- Configuring Bobcat
- Selenium enhancements
- Cucumber enhancements
- Traffic analyzer
- Email support
- Reporting
- Cloud integration
- Mobile integration
- Executing tests on different environments
- Working with multiple threads
- Tips and tricks
- Authoring tutorial - Classic
- AEM Classic Authoring Advanced usage
- Siteadmin
- Sidekick
- Aem Component
- Working with author pages
- Working with Publish pages
- Advanced component interactions
- Working with Context Menu
- Using Aem Content Tree
- Aem Content Finder
- Storing component configurations
- Working with packages
- Jcr Support
- Authoring tutorial - Touch UI
- Adding and editing a component
- Sites management tutorial