vita-playwright 1.2.10 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -79,7 +79,7 @@ const postResponse = await ApiHelper.post(url, header, payload);
|
|
|
79
79
|
* @description: Post call with endpoint, headers and data.
|
|
80
80
|
* @param {string} apiEndPoint - API end point.
|
|
81
81
|
* @param {string} headers - headers contains authentication keys, application type etc..
|
|
82
|
-
* @param {
|
|
82
|
+
* @param {string} payload - payload data
|
|
83
83
|
* @returns {Promise<reponse>} - returns Promise of reponse
|
|
84
84
|
*/
|
|
85
85
|
import { ApiHelper } from "vita-playwright";
|
|
@@ -481,7 +481,7 @@ static async auditLightHouse(pageurl: string, deviceType, filename, customThresh
|
|
|
481
481
|
pwa: 70,
|
|
482
482
|
}, format = { html: true })
|
|
483
483
|
|
|
484
|
-
"Usage with new browser context:"
|
|
484
|
+
//"Usage with new browser context:"
|
|
485
485
|
test("light house testing "+vurl, async ({ page }) => {
|
|
486
486
|
const browser = await playwright['chromium'].launch({
|
|
487
487
|
args: ['--start-maximized', '--remote-debugging-port=9222'],
|
|
@@ -493,11 +493,11 @@ static async auditLightHouse(pageurl: string, deviceType, filename, customThresh
|
|
|
493
493
|
await LightHouseUtility.auditLightHouse(url, "desktop", url.split('/').join('_')+'.html');
|
|
494
494
|
});
|
|
495
495
|
|
|
496
|
-
"Usage with default playwright page:"
|
|
497
|
-
Please set port in playwright.config.ts
|
|
496
|
+
//"Usage with default playwright page:"
|
|
497
|
+
//Please set port in playwright.config.ts
|
|
498
498
|
args: ['--start-maximized','--remote-debugging-port=9222']
|
|
499
499
|
|
|
500
|
-
calling auditLightHouse from test
|
|
500
|
+
//calling auditLightHouse from test
|
|
501
501
|
test("light house testing " + url, async ({ page }) => {
|
|
502
502
|
page.goto(url);
|
|
503
503
|
await LightHouseUtility.auditLightHouse(url, "desktop", url.split('/').join('_')+'.html');
|
|
@@ -514,7 +514,7 @@ calling auditLightHouse from test
|
|
|
514
514
|
*/
|
|
515
515
|
static async createLightHouseReport(filePath: string, sheetname: string)
|
|
516
516
|
|
|
517
|
-
Usage:
|
|
517
|
+
//Usage:
|
|
518
518
|
await LightHouseUtility.createLightHouseReport(process.cwd() + '/lighthouse/pages', process.cwd() + '/lighthouse/index.html', applicationName);
|
|
519
519
|
```
|
|
520
520
|
|
|
@@ -614,4 +614,4 @@ TODO: need to add Data Comparisions Utilities
|
|
|
614
614
|
// will be added in next versions
|
|
615
615
|
```
|
|
616
616
|
## Missing Features
|
|
617
|
-
There are many features of playwright and other node modules needs to be added.
|
|
617
|
+
There are many features of playwright and other node modules needs to be added.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare class AzureStorageMethods {
|
|
2
2
|
static getblobs(storageAccount: any, containerName: any, storageAccountKey: any, apiMethodName: string, blobFilterName?: string): Promise<any[]>;
|
|
3
|
+
static createBlobByUploadingData(storageAccount: string, sasToken: string, containerName: string, filepath: string, fileNameWithExtension: string): Promise<void>;
|
|
3
4
|
}
|
|
@@ -14,6 +14,7 @@ var DOMParser = require('xmldom').DOMParser;
|
|
|
14
14
|
const xmlToJson_1 = require("./xmlToJson");
|
|
15
15
|
var CryptoJS = require('crypto-js');
|
|
16
16
|
const api_axios_1 = require("./api_axios");
|
|
17
|
+
const storage_blob_1 = require("@azure/storage-blob");
|
|
17
18
|
class AzureStorageMethods {
|
|
18
19
|
static getblobs(storageAccount, containerName, storageAccountKey, apiMethodName, blobFilterName = "") {
|
|
19
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -47,9 +48,11 @@ class AzureStorageMethods {
|
|
|
47
48
|
var config = {
|
|
48
49
|
method: apiMethod,
|
|
49
50
|
url: `https://${storageAccount}.blob.core.windows.net/${containerName}?restype=container&comp=list&prefix=${blobFilterName}`,
|
|
50
|
-
headers: {
|
|
51
|
+
headers: {
|
|
52
|
+
"Authorization": `SharedKey ${storageAccount}:${signatureEncoded}`,
|
|
51
53
|
"x-ms-date": header_date,
|
|
52
|
-
"x-ms-version": "2018-03-28"
|
|
54
|
+
"x-ms-version": "2018-03-28"
|
|
55
|
+
},
|
|
53
56
|
};
|
|
54
57
|
var response = yield api_axios_1.TokenGenerators.request(config);
|
|
55
58
|
var apiData = response.data;
|
|
@@ -59,7 +62,8 @@ class AzureStorageMethods {
|
|
|
59
62
|
var newBlobs = [];
|
|
60
63
|
if (blobs.length) {
|
|
61
64
|
for (var i = 0; i < blobs.length; i++) {
|
|
62
|
-
var blob = {
|
|
65
|
+
var blob = {
|
|
66
|
+
"fileName": (blobs[i].Name['#text']).replace(blobFilterName, ""),
|
|
63
67
|
"modifiedTime": (Date.parse(blobs[i].Properties['Last-Modified']['#text'])),
|
|
64
68
|
"status": Math.floor(Date.now() - (Date.parse(blobs[i].Properties['Last-Modified']['#text'])) / 1000) > 30 ? 1 : 0,
|
|
65
69
|
};
|
|
@@ -67,7 +71,8 @@ class AzureStorageMethods {
|
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
else if (blobs.fileName) {
|
|
70
|
-
var blob = {
|
|
74
|
+
var blob = {
|
|
75
|
+
"fileName": (blobs.Name['#text']).replace(blobFilterName, ""),
|
|
71
76
|
"modifiedTime": (Date.parse(blobs.Properties['Last-Modified']['#text'])),
|
|
72
77
|
"status": Math.floor(Date.now() - (Date.parse(blobs.Properties['Last-Modified']['#text'])) / 1000) > 30 ? 1 : 0,
|
|
73
78
|
};
|
|
@@ -78,6 +83,15 @@ class AzureStorageMethods {
|
|
|
78
83
|
return newBlobs;
|
|
79
84
|
});
|
|
80
85
|
}
|
|
86
|
+
static createBlobByUploadingData(storageAccount, sasToken, containerName, filepath, fileNameWithExtension) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const blobServiceClient = new storage_blob_1.BlobServiceClient("https://" + storageAccount + ".blob.core.windows.net/" + "?" + sasToken);
|
|
89
|
+
const containerClient = blobServiceClient.getContainerClient(containerName);
|
|
90
|
+
const blockBlobClient = containerClient.getBlockBlobClient(fileNameWithExtension);
|
|
91
|
+
const uploadBlobResponse = yield blockBlobClient.uploadFile(filepath);
|
|
92
|
+
console.log(`Block blob ${fileNameWithExtension} uploaded successfully`);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
81
95
|
}
|
|
82
96
|
exports.AzureStorageMethods = AzureStorageMethods;
|
|
83
97
|
//# sourceMappingURL=azure_storage_methods.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"azure_storage_methods.js","sourceRoot":"","sources":["../../../src/utils/azure_storage_methods.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC;AAC5C,2CAAwC;AACxC,IAAI,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACpC,2CAA6C;AAC7C,MAAa,mBAAmB;IAC5B,MAAM,CAAO,QAAQ,CAAC,cAAmB,
|
|
1
|
+
{"version":3,"file":"azure_storage_methods.js","sourceRoot":"","sources":["../../../src/utils/azure_storage_methods.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC;AAC5C,2CAAwC;AACxC,IAAI,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACpC,2CAA6C;AAC7C,sDAAwD;AACxD,MAAa,mBAAmB;IAC5B,MAAM,CAAO,QAAQ,CAAC,cAAmB,EAAE,aAAkB,EAAE,iBAAsB,EAAE,aAAqB,EAAE,cAAc,GAAG,EAAE;;YAC7H,IAAI,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YAC3C,IAAI,SAAS,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC;YAE5C,IAAI,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,cAAc,0BAA0B,aAAa,uCAAuC,cAAc,EAAE,CAAC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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YAC3F,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YAE3G,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;IAED,MAAM,CAAO,yBAAyB,CAAC,cAAsB,EAAE,QAAgB,EAAE,aAAqB,EAAE,QAAgB,EAAE,qBAA6B;;YAEnJ,MAAM,iBAAiB,GAAG,IAAI,gCAAiB,CAC3C,UAAU,GAAG,cAAc,GAAG,yBAAyB,GAAG,GAAG,GAAG,QAAQ,CAC3E,CAAC;YACF,MAAM,eAAe,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;YAE5E,MAAM,eAAe,GAAG,eAAe,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;YAElF,MAAM,kBAAkB,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAEtE,OAAO,CAAC,GAAG,CAAC,cAAc,qBAAqB,wBAAwB,CAAC,CAAC;QAC7E,CAAC;KAAA;CAIJ;AAhGD,kDAgGC"}
|
package/package.json
CHANGED
|
@@ -2,13 +2,14 @@ var DOMParser = require('xmldom').DOMParser;
|
|
|
2
2
|
import { XmlToJson } from './xmlToJson';
|
|
3
3
|
var CryptoJS = require('crypto-js');
|
|
4
4
|
import { TokenGenerators } from './api_axios'
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { BlobServiceClient } from "@azure/storage-blob";
|
|
6
|
+
export class AzureStorageMethods {
|
|
7
|
+
static async getblobs(storageAccount: any, containerName: any, storageAccountKey: any, apiMethodName: string, blobFilterName = "") {
|
|
7
8
|
var header_date = new Date().toUTCString();
|
|
8
9
|
var apiMethod = apiMethodName.toUpperCase();
|
|
9
|
-
|
|
10
|
+
|
|
10
11
|
var url = new URL(`https://${storageAccount}.blob.core.windows.net/${containerName}?restype=container&comp=list&prefix=${blobFilterName}`);
|
|
11
|
-
const signatureParts = [apiMethod,"","","","","","","","","","",""]
|
|
12
|
+
const signatureParts = [apiMethod, "", "", "", "", "", "", "", "", "", "", ""]
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
const canonicalHeaderParts = [];
|
|
@@ -22,7 +23,7 @@ export class AzureStorageMethods{
|
|
|
22
23
|
// Construct CanonicalizedResource
|
|
23
24
|
const canonicalResourceParts = [`/${storageAccount}${url.pathname}`];
|
|
24
25
|
const canonicalQueryNames: string[] = [];
|
|
25
|
-
url.searchParams.forEach(function(value, key) {
|
|
26
|
+
url.searchParams.forEach(function (value, key) {
|
|
26
27
|
canonicalQueryNames.push(key.toLowerCase());
|
|
27
28
|
});
|
|
28
29
|
canonicalQueryNames.sort();
|
|
@@ -42,44 +43,60 @@ export class AzureStorageMethods{
|
|
|
42
43
|
const signatureBytes = CryptoJS.HmacSHA256(signatureRaw, CryptoJS.enc.Base64.parse(storageAccountKey));
|
|
43
44
|
const signatureEncoded = signatureBytes.toString(CryptoJS.enc.Base64);
|
|
44
45
|
|
|
45
|
-
var config = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var
|
|
46
|
+
var config = {
|
|
47
|
+
method: apiMethod,
|
|
48
|
+
url: `https://${storageAccount}.blob.core.windows.net/${containerName}?restype=container&comp=list&prefix=${blobFilterName}`,
|
|
49
|
+
headers: {
|
|
50
|
+
"Authorization": `SharedKey ${storageAccount}:${signatureEncoded}`,
|
|
51
|
+
"x-ms-date": header_date,
|
|
52
|
+
"x-ms-version": "2018-03-28"
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var response = await TokenGenerators.request(config);
|
|
57
|
+
var apiData = response.data
|
|
58
|
+
var XmlNode = new DOMParser().parseFromString(apiData, 'text/xml');
|
|
56
59
|
var jsonObj = await XmlToJson.xmlToJson(XmlNode);
|
|
57
60
|
var blobs = jsonObj.EnumerationResults.Blobs.Blob;
|
|
58
61
|
var newBlobs = [];
|
|
59
62
|
if (blobs.length) {
|
|
60
|
-
for (var i = 0; i < blobs.length; i++){
|
|
61
|
-
var blob = {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
for (var i = 0; i < blobs.length; i++) {
|
|
64
|
+
var blob = {
|
|
65
|
+
"fileName": (blobs[i].Name['#text']).replace(blobFilterName, ""),
|
|
66
|
+
"modifiedTime": (Date.parse(blobs[i].Properties['Last-Modified']['#text'])),
|
|
67
|
+
"status": Math.floor(Date.now() - (Date.parse(blobs[i].Properties['Last-Modified']['#text'])) / 1000) > 30 ? 1 : 0,
|
|
68
|
+
}
|
|
65
69
|
newBlobs.push(blob)
|
|
66
70
|
}
|
|
67
|
-
} else if(blobs.fileName){
|
|
68
|
-
var blob = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
} else if (blobs.fileName) {
|
|
72
|
+
var blob = {
|
|
73
|
+
"fileName": (blobs.Name['#text']).replace(blobFilterName, ""),
|
|
74
|
+
"modifiedTime": (Date.parse(blobs.Properties['Last-Modified']['#text'])),
|
|
75
|
+
"status": Math.floor(Date.now() - (Date.parse(blobs.Properties['Last-Modified']['#text'])) / 1000) > 30 ? 1 : 0,
|
|
76
|
+
}
|
|
72
77
|
newBlobs.push(blob)
|
|
73
78
|
}
|
|
74
|
-
|
|
75
|
-
newBlobs.sort((a,b)=> a.fileName > b.fileName ? 1 : ((b.fileName > a.fileName) ? -1 : 0
|
|
79
|
+
|
|
80
|
+
newBlobs.sort((a, b) => a.fileName > b.fileName ? 1 : ((b.fileName > a.fileName) ? -1 : 0))
|
|
76
81
|
newBlobs.sort((a, b) => a.modifiedTime < b.modifiedTime ? 1 : ((b.modifiedTime < a.modifiedTime) ? -1 : 0))
|
|
77
|
-
|
|
82
|
+
|
|
78
83
|
return newBlobs;
|
|
79
84
|
}
|
|
80
85
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
static async createBlobByUploadingData(storageAccount: string, sasToken: string, containerName: string, filepath: string, fileNameWithExtension: string) {
|
|
87
|
+
|
|
88
|
+
const blobServiceClient = new BlobServiceClient(
|
|
89
|
+
"https://" + storageAccount + ".blob.core.windows.net/" + "?" + sasToken
|
|
90
|
+
);
|
|
91
|
+
const containerClient = blobServiceClient.getContainerClient(containerName);
|
|
92
|
+
|
|
93
|
+
const blockBlobClient = containerClient.getBlockBlobClient(fileNameWithExtension);
|
|
94
|
+
|
|
95
|
+
const uploadBlobResponse = await blockBlobClient.uploadFile(filepath);
|
|
96
|
+
|
|
97
|
+
console.log(`Block blob ${fileNameWithExtension} uploaded successfully`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
85
102
|
}
|