    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.its.environment;
    020
    021
    022import com.codeborne.selenide.Configuration;
    023
    024/**
    025 * Tests' environment values that can be overwritten through System properties.
    026 */
    027public class Env {
    028
    029    /** Base url on which the functional tests are run. Default value is {@code https://jspwiki-wiki.apache.org}. */
    030    public static final String TESTS_BASE_URL = System.getProperty( "it-jspwiki.base.url", "https://jspwiki-wiki.apache.org" );
    031
    032    /** Selenide tests download's folder. Default value is {@code ./target/downloads}. */
    033    public static final String TESTS_CONFIG_DOWNLOADS_FOLDER = System.getProperty( "it-jspwiki.config.download-folder", "./target/downloads" );
    034
    035    /** Should the browser start on headless mode? Only for Firefox / Chrome. Default value is {@code false}. */
    036    public static final boolean TESTS_CONFIG_HEADLESS = Boolean.parseBoolean( System.getProperty( "it-jspwiki.config.headless", "false" ) );
    037
    038    /** Selenide tests reports' folder. Default value is {@code ./target/selenide}. */
    039    public static final String TESTS_CONFIG_REPORTS_FOLDER = System.getProperty( "it-jspwiki.config.reports", "./target/selenide" );
    040
    041    /** Amount of time, in milliseconds, to wait for the search index tasks to complete. Default value is {@code 1200}. */
    042    public static final long TESTS_CONFIG_SEARCH_INDEX_WAIT = Long.parseLong( System.getProperty( "it-jspwiki.config.search-index-wait", "1200" ) );
    043
    044    /** Which size should start the browser with?. Default value is {@code 1366x768}. */
    045    public static final String TESTS_CONFIG_BROWSER_SIZE = System.getProperty( "it-jspwiki.config.browser-size", "1366x768" );
    046
    047    /** Folder where the WebDriver will be downloaded. Default value is {@code ./target/wdm}. */
    048    public static final String TESTS_CONFIG_WDM_TARGET_PATH = System.getProperty( "it-jspwiki.config.wdm.target-path", "./target/wdm" );
    049
    050    /** Janne's username. Default value is {@code janne}. */
    051    public static final String LOGIN_JANNE_USERNAME = System.getProperty( "it-jspwiki.login.janne.username", "janne" );
    052
    053    /** Janne's password. Default value is {@code myP@5sw0rd}. */
    054    public static final String LOGIN_JANNE_PASSWORD = System.getProperty( "it-jspwiki.login.janne.password", "myP@5sw0rd" );
    055
    056    public static void setUp() {
    057        Configuration.headless = Env.TESTS_CONFIG_HEADLESS;
    058        Configuration.fastSetValue = true; // default value seems to not send `[` or `{` characters to input controls. weird.
    059        Configuration.reportsFolder = Env.TESTS_CONFIG_REPORTS_FOLDER;
    060        Configuration.browserSize = Env.TESTS_CONFIG_BROWSER_SIZE;
    061        Configuration.downloadsFolder = Env.TESTS_CONFIG_DOWNLOADS_FOLDER;
    062        System.setProperty( "wdm.targetPath", Env.TESTS_CONFIG_WDM_TARGET_PATH );
    063    }
    064
    065}