portal and stress test

Merge request reports

Loading
+2
Changes for src/test/resources/hypo/afterScenario.js: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -53,6 +53,8 @@ function() {
        karate.call('classpath:hypo/deleteAll.feature@deleteServiceOrderAfter', { auth_token: token, orderId: sOrderK8sId });
        }
        if (networkControllerId) {


        karate.call('classpath:hypo/deleteAll.feature@deleteFabricNetwork', { token: token, networkControllerId: networkControllerId });
        }
        karate.call('classpath:hypo/deleteAll.feature@deletePeeringAfter',      { auth_token: token, orgId: cleanupId });
+33
Changes for src/test/resources/hypo/orchestratorMasterNightly.feature: 33 added lines, 0 removed lines.
Original line number Diff line number Diff line
@nightly-workflow
Feature: Master Orchestrator - Run all tests sequentially - Nightly Tests

  Scenario: Execute all orchestrators one by one 
    
    * karate.log('========================================')
    * karate.log('STARTING MASTER-NIGHTLY ORCHESTRATOR') 
    * karate.log('========================================')
    
     # Test 1
    * karate.log('#################### 1) Running Portal Orchestrator... ####################')
    * call read('classpath:hypo/orchestratorPortal.feature')
    * karate.log('------ Tests for the Portal PASSED ------')
    
    # Test 2
    * karate.log('#################### 2) Running Private Orchestrator... ####################')
    * call read('classpath:hypo/orchestratorPrivate.feature')
    * karate.log('------ Tests with a private cluster PASSED ------')
    
    # Test 3
    * karate.log('#################### 3) Running Public Orchestrator... ####################')
    * call read('classpath:hypo/orchestratorPublic.feature')
    * karate.log('------ Tests with a public PASSED ------')
    
    # Test 4
    * karate.log('#################### 4) Running OCM Orchestrator... ####################')
    * call read('classpath:hypo/orchestratorOCM.feature')
    * karate.log('------ Tests with a OCM PASSED ------')
    

    * karate.log('========================================')
    * karate.log('------ ALL TESTS PASSED ------')
    * karate.log('========================================')
 No newline at end of file
+29
Changes for src/test/resources/hypo/orchestratorMasterNightlyNoPortal.feature: 29 added lines, 0 removed lines.
Original line number Diff line number Diff line
@nightly-workflow-no-portal
Feature: Master Orchestrator - Run all tests sequentially - Nightly Tests

  Scenario: Execute all orchestrators one by one 
    
    * karate.log('========================================')
    * karate.log('STARTING MASTER-NIGHTLY ORCHESTRATOR') 
    * karate.log('========================================')
    

    # Test 1
    * karate.log('#################### 1) Running Private Orchestrator... ####################')
    * call read('classpath:hypo/orchestratorPrivate.feature')
    * karate.log('------ Tests with a private cluster PASSED ------')
    
    # Test 2
    * karate.log('#################### 2) Running Public Orchestrator... ####################')
    * call read('classpath:hypo/orchestratorPublic.feature')
    * karate.log('------ Tests with a public PASSED ------')
    
    # Test 3
    * karate.log('#################### 3) Running OCM Orchestrator... ####################')
    * call read('classpath:hypo/orchestratorOCM.feature')
    * karate.log('------ Tests with a OCM PASSED ------')
    

    * karate.log('========================================')
    * karate.log('------ ALL TESTS PASSED ------')
    * karate.log('========================================')
 No newline at end of file
+226
Changes for src/test/resources/hypo/orchestratorPortal.feature: 226 added lines, 0 removed lines.
Original line number Diff line number Diff line
@portal-login-test
Feature: Portal Login via Keycloak - Complete Flow

  Scenario: Navigate to Portal, Click Keycloak Login, Enter Credentials, Access Portal

    * def portalUsername = keycloakUsername
    * def portalPassword = keycloakPassword

    * def loginPortal = 
      """
      function() {

          // Helper function to find and click by text
          var clickByText = function(text) {
                  karate.log('Looking for: ' + text);
                  var allDivs = driver.findElements(By.tagName('div'));
                  for (var i = 0; i < allDivs.size(); i++) {
                      var divText = allDivs.get(i).getText().trim();
                      if (divText.equals(text)) {
                          var element = allDivs.get(i);
                          var jsExecutor = driver;
                          jsExecutor.executeScript('arguments[0].scrollIntoView({block: "center"});', element);
                          java.lang.Thread.sleep(500);
                          element.click();
                          java.lang.Thread.sleep(3000);
                          karate.log('Clicked: ' + text);
                          return driver.getCurrentUrl();
                      }
                  }
                  karate.fail(text + ' not found');
              }  


          var ChromeDriver = Java.type('org.openqa.selenium.chrome.ChromeDriver');
          var ChromeOptions = Java.type('org.openqa.selenium.chrome.ChromeOptions');
          var By = Java.type('org.openqa.selenium.By');
          var WebDriverWait = Java.type('org.openqa.selenium.support.ui.WebDriverWait');
          var ExpectedConditions = Java.type('org.openqa.selenium.support.ui.ExpectedConditions');
          var Duration = Java.type('java.time.Duration');
          
          var options = new ChromeOptions();
          
          // Detect OS and set binary path
          var osName = java.lang.System.getProperty('os.name').toLowerCase();
          if (osName.contains('linux')) {
              options.setBinary('/usr/bin/chromium');
              karate.log('Using Linux Chromium');
          } else if (osName.contains('windows')) {
              options.setBinary('C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe');
              karate.log('Using Windows Chrome');
          } else {
              karate.log('Auto-detecting Chrome (no explicit path)');
          }
          
          options.addArguments('--start-maximized');
          options.addArguments('--no-sandbox');
          options.addArguments('--disable-dev-shm-usage');
          
          var driver = new ChromeDriver(options);
          karate.log('### ChromeDriver started ###');

          var wait = new WebDriverWait(driver, Duration.ofSeconds(20));
          
          try {
              var portalUrl = karate.get('portalUrl');
              var portalUsername = karate.get('portalUsername');
              var portalPassword = karate.get('portalPassword');
              
              karate.log('1) Navigating to: ' + portalUrl);
              driver.get(portalUrl);
              java.lang.Thread.sleep(3000);
              
              var clearBrowserData = function() {
                  driver.manage().deleteAllCookies();
                  try {
                      var jsExecutor = driver;
                      jsExecutor.executeScript('window.localStorage.clear();');
                      jsExecutor.executeScript('window.sessionStorage.clear();');
                      karate.log('✓ Cookies and storage cleared');
                  } catch (e) {
                      karate.log('⚠ Could not clear storage');
                  }
              }
              
              clearBrowserData();
              karate.log('2) Current window handles: ' + driver.getWindowHandles().size());
              var originalWindow = driver.getWindowHandle();
              
              karate.log('3) Clicking Keycloak Login button...');
              driver.findElement(By.xpath("//button[contains(text(), 'Keycloak Login')]")).click();
              
              java.lang.Thread.sleep(5000);
              
              var windowHandles = driver.getWindowHandles();
              karate.log('Window handles after click: ' + windowHandles.size());
              
              if (windowHandles.size() > 1) {
                  karate.log('4) New window detected! Switching...');
                  var iterator = windowHandles.iterator();
                  while (iterator.hasNext()) {
                      var handle = iterator.next();
                      if (!handle.equals(originalWindow)) {
                          driver.switchTo().window(handle);
                          break;
                      }
                  }
              }
              
              java.lang.Thread.sleep(3000);
              karate.log('5) Current URL: ' + driver.getCurrentUrl());
              
              karate.log('6) Waiting for username input...');
              wait.until(ExpectedConditions.presenceOfElementLocated(By.name('username')));
              
              karate.log('7) Entering credentials...');
              driver.findElement(By.name('username')).sendKeys(portalUsername);
              java.lang.Thread.sleep(500);
              
              karate.log('8) Entering password...');
              driver.findElement(By.name('password')).sendKeys(portalPassword);
              java.lang.Thread.sleep(500);
              
              karate.log('9) Clicking login...');
              driver.findElement(By.id('kc-login')).click();
              
              java.lang.Thread.sleep(5000);
              
              if (driver.getWindowHandles().size() > 1) {
                  driver.switchTo().window(originalWindow);
                  java.lang.Thread.sleep(2000);
              }
              
              var currentUrl = driver.getCurrentUrl();
              karate.log('10) URL after login: ' + currentUrl);
              
              // Check if signup page
              if (currentUrl.contains('/signup')) {
                  karate.log('11) SIGNUP PAGE - filling form...');
                  
                  wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[contains(@placeholder, 'name') or contains(@placeholder, 'Name')]")));
                  
                  var fullNameInput = driver.findElement(By.xpath("//input[contains(@placeholder, 'name') or contains(@placeholder, 'Name') or contains(@name, 'name')]"));
                  fullNameInput.clear();
                  fullNameInput.sendKeys(portalUsername);
                  java.lang.Thread.sleep(500);
                  
                  var createBtn = driver.findElement(By.xpath("//button[contains(text(), 'Create')]"));
                  createBtn.click();
                  karate.log('12) Submitted signup form');
                  
                  java.lang.Thread.sleep(5000);
              } else {
                  karate.log('11) Already at portal - skipping signup');
                  karate.log('12) Moved to Clicks');
              }
              
              
              // Click MARKETPLACE
              karate.log('13) Clicking MARKETPLACE...');
              var marketplaceUrl = clickByText('MARKETPLACE');
              karate.log('14) URL: ' + marketplaceUrl);
              java.lang.Thread.sleep(2000);
              // Click MY SERVICES
              karate.log('15) Clicking MY SERVICES...');
              var servicesUrl = clickByText('MY SERVICES');
              karate.log('16) URL: ' + servicesUrl);
              java.lang.Thread.sleep(2000);
              // Click MY REGISTRIES
              karate.log('17) Clicking MY REGISTRIES...');
              var servicesUrl = clickByText('MY REGISTRIES');
              karate.log('18) URL: ' + servicesUrl);
              java.lang.Thread.sleep(2000); 
              

              // Click PLATFORM
              karate.log('19) Clicking PLATFROM...');
              var servicesUrl = clickByText('PLATFORM');
              karate.log('20) URL: ' + servicesUrl);
              java.lang.Thread.sleep(2000);

               // Click MANAGE
              karate.log('21) Clicking MANAGE...');
              var servicesUrl = clickByText('MANAGE');
              karate.log('22) URL: ' + servicesUrl);

              // Click each tab in the modal
              karate.log('23) Clicking Networks tab...');
              clickByText('Networks');
              
              karate.log('24a) Clicking Domains tab (Identities)...');
              clickByText('Domains');
              karate.log('24a) Clicking Domains tab. (Connections)..');
              clickByText('Connections');
              
              karate.log('25) Clicking OSS tab...');
              clickByText('OSS');
              
              karate.log('26) Clicking Clusters tab...');
              clickByText('Clusters');
              
             // Close modal by clicking CLOSE
              karate.log('24) Closing modal...');
              driver.findElement(By.xpath("//*[contains(text(), 'CLOSE')]")).click();
              karate.log('24a)Modal closed');
               
              karate.log('### MANAGE WINDOW TEST PASSED ###');

              karate.log('### ALL BUTTONS CLICKED SUCCESSFULLY ###');
              
              var finalUrl = driver.getCurrentUrl();
              karate.log('25) Final URL: ' + finalUrl);
              karate.log('### PORTAL TEST PASSED ###');
              
              return { success: true, url: finalUrl };
          } catch (e) {
              karate.log('✗ Error: ' + e.message);
              karate.fail('Portal flow failed: ' + e.message);
          } finally {
              driver.quit();
          }
      }
      """
    
    * def result = loginPortal()
    * match result.success == true
    * karate.log('---- PORTAL TEST PASSED ----')
 No newline at end of file
−145

File deleted.

Loading
Loading