Package jp.vmi.selenium.selenese.log

Examples of jp.vmi.selenium.selenese.log.CookieFilter


            "[INFO] - Cookie: [del] key2 (domain=localhost, path=/)"))));
    }

    @Test
    public void cookieFilter() {
        runner.setCookieFilter(new CookieFilter(FilterType.SKIP, "key2"));
        execute("cookie");
        assertThat(result, is(instanceOf(Warning.class)));
        List<String> actual = getSystemOut(new Filter() {
            private boolean fetch = false;

            @Override
            public String filter(String line) {
                if (!fetch && line.contains("deleteAllVisibleCookies")) {
                    fetch = true;
                } else if (fetch && line.contains("- Cookie:")) {
                    return line
                        .replaceFirst("^\\[[^\\]]+\\]\\s+", "") // suppress timestamp.
                        .replaceFirst("domain=\\*", "domain=localhost"); // fixup safari driver's bug.
                }
                return null;
            }
        });
        assertThat(actual, is(equalTo(Arrays.asList(
            "[INFO] - Cookie: [add] key1=[value1] (domain=localhost, path=/, expire=*)",
            "[INFO] - Cookie: [add] key3=[value3] (domain=localhost, path=/, expire=*)",
            "[ERROR] - Cookie: key1=[value1] (domain=localhost, path=/, expire=*)",
            "[ERROR] - Cookie: key3=[value3] (domain=localhost, path=/, expire=*)",
            "[INFO] - Cookie: [del] key3 (domain=localhost, path=/)"))));

        testSuites.clear();
        runner.setCookieFilter(new CookieFilter(FilterType.PASS, "key1"));
        execute("cookie2");
        assertThat(result, is(instanceOf(Success.class)));
        List<String> actual2 = getSystemOut(new Filter() {

            @Override
View Full Code Here


                    break;
                default:
                    throw new IllegalArgumentException("invalid cookie filter format: " + cookieFilter);
                }
                String pattern = cookieFilter.substring(1);
                runner.setCookieFilter(new CookieFilter(filterType, pattern));
            }
            runner.setJUnitResultDir(cli.getOptionValue("xml-result"));
            runner.setHtmlResultDir(cli.getOptionValue("html-result"));
            int timeout = NumberUtils.toInt(cli.getOptionValue("timeout", DEFAULT_TIMEOUT_MILLISEC));
            if (timeout <= 0)
View Full Code Here

    private static final Logger log = LoggerFactory.getLogger(CommandLogInterceptor.class);

    private void logResult(LogRecorder clr, String indent, String cmdStr, Result result, Context context) {
        PageInformation prevInfo = context.getLatestPageInformation();
        PageInformation info = new PageInformation(context);
        CookieFilter cookieFilter = context.getCookieFilter();
        String prefix = indent + "- Cookie: ";
        if (result.isFailed()) {
            String resStr = info.getFirstMessage(prevInfo, indent, cmdStr, "=>", result.toString());
            log.error(resStr);
            clr.error(resStr);
View Full Code Here

TOP

Related Classes of jp.vmi.selenium.selenese.log.CookieFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.