Skip to content

Commit

Permalink
CR Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc45 committed May 8, 2024
1 parent a9cd10b commit 850eb0c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
Binary file modified qit
Binary file not shown.
12 changes: 10 additions & 2 deletions src/src/Commands/CustomTests/RunE2ECommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in
$test_mode = E2ETestManager::$test_modes['headless'];
}

$wait = $input->getOption( 'up_only' ) || $test_mode === 'codegen';
$wait = $input->getOption( 'up_only' ) || $test_mode === E2ETestManager::$test_modes['codegen'];
$woo_extension = $input->getArgument( 'woo_extension' );
$test = $input->getArgument( 'test' );
$shard = $input->getOption( 'shard' );
Expand Down Expand Up @@ -267,7 +267,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in
if ( $exit_status_code === Command::SUCCESS ) {
return Command::SUCCESS;
} else {
if ( ! $wait ) {
if ( $test_mode === E2ETestManager::$test_modes['headless'] ) {
$this->output->writeln( sprintf( '<error>Tests failed. Exit status code: %s</error>', $exit_status_code ) );
}

Expand All @@ -276,6 +276,14 @@ protected function execute( InputInterface $input, OutputInterface $output ): in
}

public static function shutdown_test_run(): void {
static $did_shutdown = false;

if ( $did_shutdown ) {
return;
} else {
$did_shutdown = true;
}

echo "\nShutting down environment...\n";
// Env not up or could not parse the "up" JSON.
if ( empty( $GLOBALS['env_to_shutdown'] ) || ! $GLOBALS['env_to_shutdown'] instanceof EnvInfo ) {
Expand Down
4 changes: 3 additions & 1 deletion src/src/Commands/Environment/ListEnvironmentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ protected function execute( InputInterface $input, OutputInterface $output ): in
$v = $elapsed;
}
if ( is_array( $v ) ) {
$v = implode( ', ', $v );
// "implode" only works on flat arrays, otherwise we need "print_r".
$is_flat = count( array_filter( $v, 'is_array' ) ) === 0;
$v = $is_flat ? implode( ', ', $v ) : print_r( $v, true );
}
// Check if "field" option is set, and only add if matches.
if ( $input->getOption( 'field' ) && $input->getOption( 'field' ) !== $k ) {
Expand Down
2 changes: 1 addition & 1 deletion src/src/LocalTests/E2E/E2ETestManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function run_tests( E2EEnvInfo $env_info, string $test_mode, bool $bootst
if ( $bootstrap_only ) {
if ( $test_mode === 'codegen' ) {
$io = new SymfonyStyle( App::make( InputInterface::class ), $this->output );
$io->success( "Open the site URL above on Playwright Codegen and start generating tests.\nLearn More: https://qit.woo.com/docs/codegen" );
$io->success( "Open the site URL above on Playwright Codegen and start generating tests.\nLearn More: https://qit.woo.com/docs/custom-tests/generating-tests#codegen" );

$this->playwright_codegen->open_codegen( $env_info );

Expand Down
6 changes: 5 additions & 1 deletion src/src/Zipper.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,16 @@ public function validate_zip( string $zip_file ): void {

$zip_process = new Process( $args );

$zip_process->mustRun( function ( $type, $out ) {
$zip_process->run( function ( $type, $out ) {
if ( $this->output->isVeryVerbose() ) {
$this->output->write( 'Docker ZIP Validation: ' . $out );
}
} );

if ( ! $zip_process->isSuccessful() ) {
throw new \RuntimeException( sprintf( 'The zip file "%s" appears to be invalid. For details, re-run the command with the --verbose flag.' ) );
}

if ( $this->output->isVeryVerbose() ) {
$this->output->writeln( sprintf( 'Docker ZIP validation of %s successful (%f seconds).', basename( $zip_file ), microtime( true ) - $start ) );
}
Expand Down

0 comments on commit 850eb0c

Please sign in to comment.