AddProgressiveWebAppAudits Method

Applies to TestComplete 15.64, last modified on May 16, 2024

Description

The WebAudits.For(…).AddProgressiveWebAppAudits method adds the Progressive web app audit to the web audits checkpoint and sets the threshold value for it.

Declaration

WebAuditsCheckpointObj.AddProgressiveWebAppAudits(ThresholdScore)

WebAuditsCheckpointObj An expression, variable or parameter that specifies a reference to a WebAuditsCheckpoint object
ThresholdScore [in]    Optional    Integer Default value: 90   
Result A WebAuditsCheckpoint object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

ThresholdScore

The threshold value against which the actual audit score will be compared.

Result Value

A WebAuditsCheckpoint object with the specified audit and the threshold value set for the audit.

Example

The following example shows how to add the Progressive Web App audit to a checkpoint and run the audit:

JavaScript, JScript

function VerifyWebPage(){
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 var obj = WebAudits.For(url);
 obj.AddProgressiveWebAppAudits(60).Check();
}

Python

def VerifyWebPage():
  url = "http://services.smartbear.com/samples/TestComplete14/smartstore"
  obj = WebAudits.For(url)
  obj.AddProgressiveWebAppAudits(60).Check()

VBScript

Sub VerifyWebPage
 url = "http://services.smartbear.com/samples/TestComplete15/smartstore"
 Set obj = WebAudits.For(url)
 obj.AddProgressiveWebAppAudits(60).Check()
End Sub

DelphiScript

procedure VerifyWebPage();
var url, obj;
begin
 url :='http://services.smartbear.com/samples/TestComplete15/smartstore';
 obj := WebAudits.For(url);
 obj.AddProgressiveWebAppAudits(60).Check();
end;

C++Script, C#Script

function VerifyWebPage(){
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 var obj = WebAudits["For"](url);
 obj["AddProgressiveWebAppAudits"](60)["Check"]();
}

The following example shows how to add the Progressive Web App audit to a checkpoint and run the audit:

JavaScript, JScript

function VerifyWebPage(){
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 var obj = WebAudits.For(url);
 var auditsResult = obj.AddProgressiveWebAppAudits().Query();
 if (auditsResult.ProgressiveWebAppScore < 30){
   Log.Error("Progressive Web App audit failed!");
   return;
 }

 if (auditsResult.ProgressiveWebAppScore < 70){
   Log.Warning("Progressive Web App audit passed with a warning!");
   return;
 }

 Log.Message("Progressive Web App audit passed!");
}

Python

def VerifyWebPage():
 url = "http://services.smartbear.com/samples/TestComplete14/smartstore"
 obj = WebAudits.For(url)
 auditsResult = obj.AddProgressiveWebAppAudits().Query()
 if (auditsResult.ProgressiveWebAppScore < 30):
   Log.Error("Progressive web app audit failed!")
   return
 
 if (auditsResult.ProgressiveWebAppScore < 70):
   Log.Warning("Progressive web app audit passed with a warning!")
   return
 
 Log.Message("Progressive web app audit failed!")

VBScript

Sub VerifyWebPage
 url = "http://services.smartbear.com/samples/TestComplete15/smartstore"
 Set obj = WebAudits.For(url)
 Set auditsResult = obj.AddProgressiveWebAppAudits().Query()
 If (auditsResult.ProgressiveWebAppScore < 30) Then
   Log.Error("Progressive Web App audit failed!")
   return
 End If

 If (auditsResult.ProgressiveWebAppScore < 70) Then
   Log.Warning("Progressive Web App audit passed with a warning!")
   return
 End If
 Log.Message("Progressive Web App audit passed!")
End Sub

DelphiScript

procedure VerifyWebPage();
var url, obj, auditsResult;
begin
 url := 'http://services.smartbear.com/samples/TestComplete15/smartstore';
 obj := WebAudits.For(url);
 auditsResult := obj.AddProgressiveWebAppAudits().Query();
 if (auditsResult.ProgressiveWebAppScore < 30) then
    begin
      Log.Error('Progressive Web App audit failed!');
      exit;
    end;


  if (auditsResult.ProgressiveWebAppScore < 70) then
    begin
      Log.Warning('Progressive Web App audit passed with a warning!');
      exit;
    end;
   
  Log.Message('Progressive Web App audit passed!');
end;

C++Script, C#Script

function VerifyWebPage(){
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 var obj = WebAudits["For"](url);
 var auditsResult = obj["AddProgressiveWebAppAudits"]()["Query"]();
 if (auditsResult["ProgressiveWebAppScore"] < 30){
   Log["Error"]("Progressive Web App audit failed!");
   return;
 }

 if (auditsResult["ProgressiveWebAppScore"] < 70){
   Log["Warning"]("Progressive Web App audit passed with a warning!");
   return;
 }

 Log["Message"]("Progressive Web App audit passed!");
}

See Also

OCRObject Object
Web Audits Checkpoints

Highlight search results