File

e2e/src/utils/pagination.po.ts

Description

E2E Pagination Object.

Example

Index

Methods

Methods

get
get()

Get the pagination bloc

Returns : any
getButtonByPage
getButtonByPage(page: number)

Get the page button

Parameters :
Name Type Optional Description
page number
Returns : any
getCurrentText
getCurrentText()

Get the text of the current page

Returns : any
getNext
getNext()

Get the next button

Returns : any
getPrevious
getPrevious()

Get the previous button

Returns : any
import { by, element } from 'protractor';

/**
 * E2E Pagination Object.
 *
 * @author Damien Vitrac
 */
export class Pagination {

  /**
   * Get the pagination bloc
   * @returns {ElementFinder}
   */
  get() {
    return element(by.css('#pagination'));
  }

  /**
   * Get the page button
   * @param {number} page
   * @returns {ElementFinder}
   */
  getButtonByPage(page: number) {
    const lis = element.all(by.css('#pagination ul li'));
    return lis.get(page).$('a');
  }

  /**
   * Get the previous button
   * @returns {ElementFinder}
   */
  getPrevious() {
    return element(by.css('#pagination .pagination-previous a'));
  }

  /**
   * Get the next button
   * @returns {ElementFinder}
   */
  getNext() {
    return element(by.css('#pagination .pagination-next a'));
  }

  /**
   * Get the text of the current page
   */
  getCurrentText() {
    return element(by.css('#pagination .current')).getText();
  }

}

results matching ""

    No results matching ""