niedziela, 13 stycznia 2019

[QUICK TIP] How to handle with error "Application was unable to start correctly (0xc000007b) while starting IntelliJ

Nice morning. First coffee. Starting Intellij. Oops.
 "Application was unable to start correctly (0xc000007b). (...)".
Hmm. Yesterday there was windows update with some protection issues. Hmm.
Quick google search. Many advices, mainly for interrupting games starting. Hmm.

Before you launch system recovery, try to add exception in "Exploit Protecion" function in windows defender for idea64.exe or idea.exe with turned off protection option/options. Run once again IntelliJ.
In my issue it helped.
System recovery also helped. Shortly. Until the next windows update.

Go to:

Windows Defender Security Center → App & browser control → Exploit protection settings → Program settings → Add program to customise → Add by program name -> type program name (idea64.exe)  → Override system settings →  Turn off setting/ settings → Apply

środa, 12 grudnia 2018

[QUICK TIP] Cucumber-java: how to configure reports for running tests locally in IDE (IntelliJ)

Sometimes, you need to run tests locally in your IDE. Having two kinds of reports (temporary and saved in file) is possible by configuring both console and "file" reports plugins.
One type of report is temporary console output. 
It needs "org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter" plugin ("Cucumber for java") to work fine. Its configuration is set in "Cucumber java" configuration runner after scenario or feature was run, in "Program arguments" row:

 --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter.

You can find it as follow:

Run → Edit Configurations → Cucumber java → name of test → Program arguments

Second type of report is "file" report.
It needs additionally configuration, when tests are running with context menu, not running directly runner class.
Its configuration you set in "Cucumber java" configuration runner after scenario or feature was run (or in cucumber runner template), in "Program arguments" row together with "CucumberJvm3SMFormatter" plugin. Simply type:

"--plugin pretty --plugin html:target/html"

All configuration in "Program arguments" row looks like below:

" --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter --plugin pretty --plugin html:target/html"

Report is created in "target" directory as html report with "pretty" (default for Cucumber) formatter plugin. You also get formatted test output in console.

poniedziałek, 10 grudnia 2018

[QUICK TIP] IntelliJ: how to import gradle project when no gradle installed

If you have to import gradle project to IntelliJ and no gradle is installed in system, you can visit gradle home page to get library or allow IntelliJ does the work with installing gradle.
Before importing your target project, you can create temporary gradle project with IntelliJ: simply run IntelliJ, choose "Create new project" and select "Gradle" as type of project.

After temporary gradle project was created, you can import to IntelliJ your target gradle project (temporary one is not needed any more, so delete it).

wtorek, 4 grudnia 2018

[QUICK TIP] Visual Studio: how to resolve lack of references

Lack of reference usually happens, when you import project into IDE or when you switch to branch with some changes.
In Visual Studio you can use NuGet to get necessary libraries/packages.
One way is using general NuGet manager:

Tools → NuGet Package Manager → Manage NuGet Packages for Solution

Another way is using NuGet for particular project in your solution:

[Solution Explorer] → expand solution → expand project → References → context menu → Manage NuGet Packages

Missing references you can browse by name and install in chosen project.
After reference was installed, refresh project tree and build solution/project.


wtorek, 3 lipca 2018

Cucumber-java and enums

For reusing steps with different values as variables you might simply use enum class. you might of course use switch statement, but where is creativness here?

Feature file

Feature file looks as below:

Feature: As a user i want to visit cucumber page
  Scenario: Visit cucumber as first page and wp as second page
    Given I go to "cucumber" page
      Then I should be on "https://cucumber.io/" page
      When I go to "WP" page
      Then I should be on "https://www.wp.pl/" page

Enum class

Your enum class looks as below:

public enum UrlEnum{

    CUCUMBER("https://cucumber.io/"),
    WP("http://wp.pl"),
    ONET("http://onet.pl");

    public final String urlName;

    UrlEnum(String urlName) {
        this.urlName = urlName;
    }

    public static String getTranslatedEnum(String url) {
        UrlEnum nameToTranslate = UrlEnum.valueOf(url.toUpperCase());
        return nameToTranslate.toString();
    }

    @Override    public String toString() {
        return urlName;
    }
}

Enum class UrlEnum keeps url's strings and with method "getTranslatedEnum(urlName)" you might get value of enum's name- which is passed in "String url" from feature step.

Step in steps class

Step in steps class looks as below:

 @Given("I go to {string} page")
 public void iGoToPage(String urlName){
     urlToGo = UrlEnum.getTranslatedEnum(urlName);
     navigationPageObjects.getPage(urlToGo);
}

In project there might be many enum classes, which keep different categories.

Template

Whole template for "Cucumber-java-enums" you find on github: 
https://github.com/bazylMN/cucumber-java-enum.

Instruction

There is an instruction attached to project, how to work with template, so here I do not write about setting up template. Read README.md file.

Project works as template for cucumber-java framework. It is initial configuration for running tests with Cucumber-java with simple test. All you need is customise it, adding scenarios, steps, page objects and enums.

środa, 21 marca 2012

Testowanie strony pod przeglądarkami

Testowanie, oczywiście, pod różnymi przeglądarkami.
Nie ma problemu, jeśli chcemy podejrzeć wygląd strony pod różnymi wersjami np. Firefox'a. Po prostu pobieramy starsze wersje i instalujemy na komputerze. Problem pojawia się z Internet Explorerem i starszymi jego wersjami. Można kombinować z wirtualnymi maszynami, czemu nie?
Trochę prościej i bez zbędnego wysiłku można pobrać programik IETester, pracujący jak przeglądarka i zawierający właśnie starsze wersje IE (do pobrania tutaj).
Lub zainstalować Expression Studio4 Ultimate, który zawiera min. Expression Web4 (i o niego właśnie chodzi). Mamy tu możliwość przetestowania strony min. pod starszymi wersjami IE. Dodatkowo możemy odszukać "błąd" w kodzie CSS i miejsce, w którym się pojawił, powodując odmienną interpretację w wyświetlaniu strony przez przeglądarki. Bardzo prosto odszukać i od razu skorygować kod CSS (filmik do obejrzenia) Dla mnie bomba- w jednym miejscu wszystko można zrobić: napisać kod, wstawić elementy i przetestować wygląd strony pod różnymi przeglądarkami. 

czwartek, 15 marca 2012

Przekierowanie na stronę/ blokada podglądu plików na serwerze

Blokada podglądu plików, znajdujących się na serwerze: w katalogu głównym (lub w takim, w którym znajdują się np. pliki przechowujące dane o użytkownikach, itp.) umieszczamy plik index.php z poniższym kodem:
<?php header("Location: http://www.nazwa-strony.pl"); ?>
Przy próbie dostania się do katalogu, jesteśmy przekierowani pod wskazany w index.php adres.

środa, 14 marca 2012

Wyśrodkowanie układu w IE6

Mając przykładowo taki szkielet strony w html'u:

<body>
 <div id="wrapper">
          treść
 </div>
</body>

stylami CSS wyśrodkowujemy układ w IE6 jak poniżej:

body {text-align: center;}/*reguła wyśrodkowująca układ w IE6*/
#wrapper {width: 90%; /*dla układu płynnego (fluid) szerokość w procentach*/
          margin: 0 auto; /*wyśrodkowuje układ w oknie przeglądarki*/
          text-align:left; /*resetuje regułę środkującą w IE6*/
}

Kod wg Charles'a Wyke- Smith'a.

poniedziałek, 12 marca 2012

Copyright w stopce

Link  w stopce, otwierający się w osobnym oknie (target="_blank"), ze znakiem specjalnym praw autorskich (&copy; czyli w efekcie na stronie wyświetla się ©):

<a href="http://link-do-strony.pl/" target="_blank">Copyright &copy; 2012 nazwa-strony</a>

poniedziałek, 5 marca 2012

Style dla IE w WordPress'ie

Czasami jest potrzeba skorzystania z osobnych styli dla przeglądarki IE w WordPress'ie. Wystarczy umieścić poniższy kod w header.php.

<!--[if IE]>
    <link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/ie.css" media="screen" type="text/css" />
    <![endif]-->