/*
 * Copyright (C) 2013 salesforce.com, inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.auraframework.test.page;

import java.net.MalformedURLException;
import java.net.URISyntaxException;

import org.auraframework.system.AuraContext.Mode;

/**
 * this is an example for testing UI with PageObject pattern.
 * for more info about the PageObject 'idea': https://code.google.com/p/selenium/wiki/PageObjects
 */
public class SampleUIWithPageObjectTest extends PageObjectTestCase<SampleAuraPageObject> {

	public SampleUIWithPageObjectTest(String name) throws MalformedURLException, URISyntaxException {
		super(new SampleAuraPageObject(name, true, "uiExamples:buttonExample"));
	}
	
	/**
	 * get the default mode 
	 * @return
	 */
	private static Mode getDefaultMode() {
		return Mode.SELENIUM;
	}
	
	/**
	 * get the mode without fast click, for IPAD and Android browsers
	 * @return
	 */
	@SuppressWarnings("unused")
	private Mode getModeWithoutFastClick() {
		return Mode.CADENCE;
	}
	
	public void testButtunUIWithPageObject() throws Exception {
		//TODO browserType&mode etc should belong to [test]Context, not Page Object.
		page().passWebdriverInfo(getBrowserType(), this.currentDriver, getDefaultMode(), timeoutInSecs, true);
		//PageObject is in charge of load itself, clicking , typing , etc
		page().open();
        page().clickOnButton();
        String outputText = page().getOutputText();

        //Test case is in charge of assertion.
        //we didn't input anything into inputText, so it's undefined.
        assertEquals("get different text!","Hi, undefined",outputText);
    }
	
	//need at least one test per class or it complains
	public void testDummyPageObject() {
		return;
	}

}

@@ -1330,196 +1330,8 @@
 %7D%0A%09%0A
-%09/**%0A%09 * get the mode without fast click, for IPAD and Android browsers%0A%09 * @return%0A%09 */%0A%09@SuppressWarnings(%22unused%22)%0A%09private Mode getModeWithoutFastClick() %7B%0A%09%09return Mode.CADENCE;%0A%09%7D%0A%09%0A
 %09pub

test cleanup