Search in sources :

Example 1 with PendingWebTestContext

use of com.google.idea.blaze.base.run.producers.PendingWebTestContext in project intellij by bazelbuild.

the class JavascriptTestContextProviderTest method testMultipleBrowsers.

@Test
public void testMultipleBrowsers() throws Throwable {
    PsiFile jsTestFile = configure(ImmutableList.of("chrome-linux", "firefox-linux"), "function testFoo() {}");
    ConfigurationContext context = createContextFromPsi(jsTestFile);
    ConfigurationFromContext configurationFromContext = getConfigurationFromContext(context);
    BlazeCommandRunConfiguration configuration = getBlazeRunConfiguration(configurationFromContext);
    assertThat(configuration.getPendingContext()).isNotNull();
    assertThat(configuration.getPendingContext()).isInstanceOf(PendingWebTestContext.class);
    PendingWebTestContext testContext = (PendingWebTestContext) configuration.getPendingContext();
    testContext.updateContextAndRerun(configuration, TargetInfo.builder(Label.create("//foo/bar:foo_test_firefox-linux"), "js_web_test").build(), () -> {
    });
    assertThat(configuration.getTargetKind()).isEqualTo(Kind.fromRuleName("js_web_test"));
    assertThat(configuration.getTargets()).containsExactly(TargetExpression.fromStringSafe("//foo/bar:foo_test_firefox-linux"));
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) PendingWebTestContext(com.google.idea.blaze.base.run.producers.PendingWebTestContext) ConfigurationFromContext(com.intellij.execution.actions.ConfigurationFromContext) PsiFile(com.intellij.psi.PsiFile) BlazeCommandRunConfiguration(com.google.idea.blaze.base.run.BlazeCommandRunConfiguration) Test(org.junit.Test)

Example 2 with PendingWebTestContext

use of com.google.idea.blaze.base.run.producers.PendingWebTestContext in project intellij by bazelbuild.

the class OldJavascriptTestContextProviderTest method testMultipleBrowsers.

@Test
public void testMultipleBrowsers() throws Throwable {
    PsiFile jsTestFile = configure(ImmutableList.of("chrome-linux", "firefox-linux"), "function testFoo() {}");
    ConfigurationContext context = createContextFromPsi(jsTestFile);
    ConfigurationFromContext configurationFromContext = getConfigurationFromContext(context);
    BlazeCommandRunConfiguration configuration = getBlazeRunConfiguration(configurationFromContext);
    assertThat(configuration.getPendingContext()).isNotNull();
    assertThat(configuration.getPendingContext()).isInstanceOf(PendingWebTestContext.class);
    PendingWebTestContext testContext = (PendingWebTestContext) configuration.getPendingContext();
    testContext.updateContextAndRerun(configuration, TargetInfo.builder(Label.create("//foo/bar:foo_test_firefox-linux"), "web_test").build(), () -> {
    });
    assertThat(configuration.getTargetKind()).isEqualTo(RuleTypes.WEB_TEST.getKind());
    assertThat(configuration.getTargets()).containsExactly(TargetExpression.fromStringSafe("//foo/bar:foo_test_firefox-linux"));
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) PendingWebTestContext(com.google.idea.blaze.base.run.producers.PendingWebTestContext) ConfigurationFromContext(com.intellij.execution.actions.ConfigurationFromContext) PsiFile(com.intellij.psi.PsiFile) BlazeCommandRunConfiguration(com.google.idea.blaze.base.run.BlazeCommandRunConfiguration) Test(org.junit.Test)

Aggregations

BlazeCommandRunConfiguration (com.google.idea.blaze.base.run.BlazeCommandRunConfiguration)2 PendingWebTestContext (com.google.idea.blaze.base.run.producers.PendingWebTestContext)2 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)2 ConfigurationFromContext (com.intellij.execution.actions.ConfigurationFromContext)2 PsiFile (com.intellij.psi.PsiFile)2 Test (org.junit.Test)2