Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: run Cypress test against pre-compiled HTML #1141

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,14 @@
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<argLine>-Dspring.profiles.active=test,maven-test</argLine>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@
import org.junit.jupiter.api.DynamicContainer;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.TestFactory;
import org.owasp.wrongsecrets.asciidoc.AsciiDocGenerator;
import org.owasp.wrongsecrets.asciidoc.PreCompiledGenerator;
import org.owasp.wrongsecrets.asciidoc.TemplateGenerator;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
import org.testcontainers.Testcontainers;

/**
Expand All @@ -35,8 +42,8 @@
"KEEPASSPATH=src/test/resources/alibabacreds.kdbx",
"keepasspath=src/test/resources/alibabacreds.kdbx"
})
@ActiveProfiles("test")
@Slf4j
@Import(CypressIntegrationTest.Configuration.class)
public class CypressIntegrationTest {
@LocalServerPort private int port;

Expand Down Expand Up @@ -80,4 +87,19 @@ private void createContainerFromSuite(
}
dynamicContainers.add(DynamicContainer.dynamicContainer(suite.getTitle(), dynamicTests));
}

@TestConfiguration
static class Configuration {

@Bean
@Primary
public TemplateGenerator generators(Environment environment) {
if (environment.matchesProfiles("maven-test")) {
log.info("Using pre-compiled generator for tests");
return new PreCompiledGenerator();
}
log.info("Using AsciiDoc generator for tests");
return new AsciiDocGenerator();
}
}
}
Loading