001/* 002 Licensed to the Apache Software Foundation (ASF) under one 003 or more contributor license agreements. See the NOTICE file 004 distributed with this work for additional information 005 regarding copyright ownership. The ASF licenses this file 006 to you under the Apache License, Version 2.0 (the 007 "License"); you may not use this file except in compliance 008 with the License. You may obtain a copy of the License at 009 010 http://www.apache.org/licenses/LICENSE-2.0 011 012 Unless required by applicable law or agreed to in writing, 013 software distributed under the License is distributed on an 014 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 KIND, either express or implied. See the License for the 016 specific language governing permissions and limitations 017 under the License. 018 */ 019package org.apache.wiki.pages.haddock; 020 021import org.openqa.selenium.By; 022 023import com.codeborne.selenide.Condition; 024import com.codeborne.selenide.Selenide; 025import com.codeborne.selenide.SelenideElement; 026 027public class ReadWikiPage implements HaddockPage { 028 029 public String authenticatedText() { 030 return Selenide.$( By.className( "wikipage" ) ).text().trim(); 031 } 032 033 public LoginPage clickOnLogin() { 034 Selenide.$( By.className( "icon-signin" ) ).click(); 035 return new LoginPage(); 036 } 037 038 public ReadWikiPage clickOnShowReaderView() { 039 Selenide.$( By.linkText( "Show Reader View" ) ).click(); 040 return new ReadWikiPage(); 041 } 042 043 public ReadWikiPage hoverLoginArea() { 044 Selenide.$( By.className( "icon-user" ) ).hover(); 045 return this; 046 } 047 048 public ReadWikiPage hoverMoreArea() { 049 Selenide.$( By.id( "more" ) ).hover(); 050 return this; 051 } 052 053 public ReadWikiPage logout() { 054 Selenide.$( By.linkText( "Log out" ) ).click(); 055 Selenide.$( By.className( "btn-success" ) ).waitUntil( Condition.visible, 1_000L ).click(); 056 return this; 057 } 058 059 public ReadWikiPage navigateTo( String wikiPageName ) { 060 Selenide.$( By.linkText( wikiPageName ) ).click(); 061 return new ReadWikiPage(); 062 } 063 064 public SelenideElement sidebar() { 065 return Selenide.$( By.className( "sidebar" ) ); 066 } 067 068}