我们的应用程序中有数百个 JavaScript 文件,目前以未压缩的方式提供。为了提高客户端性能,我们的解决方案之一是缩小 JavaScript 文件。我已经创建了一个自动化解决方案来在构建中执行此操作,但是,当部署这些新文件时,确定是否将其重新发送给客户端的文件时间戳将会更改。这意味着,在未来的每个版本中,所有 javascript 文件都将具有新的时间戳。我们的客户将再次重新下载所有缩小的 JavaScript 文件,从而破坏缩小的性能方面。
这是其他人遇到过的问题吗?你的解决方案是什么?您的项目中是否使用了单独的非缩小和缩小的 javascript 文件,并且不在构建中执行缩小?
我们考虑了其他解决方案(例如仅在源代码控制存储库中查找实际更改的文件),但这是我想了解其他人正在做什么的一个问题。
我在从 devoloper 工具的控制台日志中已存在的站点获取数据时遇到问题。我是 Puppeteer 的新手,所以我试图获取所有这些控制台日志结果,但它们都有字符串类型。你们能帮我找到一种方法来获取真实的对象或者一种解析它并使用它的方法吗,谢谢
我在想在 cypress 中遵循哪种最佳实践。
场景:我可以单击加载新页面的链接,也可以使用 cy.visit() 直接转到该页面。我可以知道推荐/最佳实践是什么吗?cy.visit() 大大减少了运行测试的时间。
我们正在尝试在 Azure Pipeline 中自动化 Teams Tab 应用程序,但我们想知道这是否可能。我们已经为应用程序创建了 zip 文件,该文件可以通过 App Studio 上传并且可以正常工作。但是我们不希望客户通过 App Studio 这样做,相反,我们希望在他们的管道上自动化这个过程。为此,我们创建了以下 powershell:
# Generate zip file for deployment
$compress = @{
Path = "color.png", "outline.png", "manifest.json"
CompressionLevel = "Fastest"
DestinationPath = "app.zip"
}
Compress-Archive @compress -Update
Run Code Online (Sandbox Code Playgroud)
然后我们检查是否MicrosoftTeams安装了模块,否则我们安装它:
# Checks whether MicrosoftTeams module is available
if (Get-Module -ListAvailable -Name "MicrosoftTeams") {
Write-Verbose "MicrosoftTeams module already installed."
}
else {
Write-Verbose "Installing module MicrosoftTeams - https://docs.microsoft.com/en-us/powershell/module/teams/?view=teams-ps."
Install-Module MicrosoftTeams
}
Write-Verbose "Importing module MicrosoftTeams."
Import-Module MicrosoftTeams
Run Code Online (Sandbox Code Playgroud)
我们与 …
我刚刚在处理一个项目时遇到了 pythons PIL 库,所以对此非常陌生。
我的简单程序从目录导入一张图像,使用 PIL 应用所需的操作,然后将其保存到另一个文件夹中。
我的问题 - 我可以批量导入包含多个图像的目录并在 PIL 中对该目录中的所有图像运行所需的操作吗?
我有一种奇怪的感觉,我在这里做错了什么。
这是我的 PowerShell 脚本,当然是从这里窃取和改编的:
param(
$instance = "localhost"
)
if (!(Get-Module -ListAvailable -Name "SQLPS")) {
Write-Host -BackgroundColor Red -ForegroundColor White "Module Invoke-Sqlcmd is not loaded"
exit
}
#Function to execute queries (depending on if the user will be using specific credentials or not)
function Execute-Query([string]$query,[string]$database,[string]$instance,[int]$trusted,[string]$username,[string]$password){
if($trusted -eq 1){
try{
Invoke-Sqlcmd -Query $query -Database $database -ServerInstance $instance -ErrorAction Stop -ConnectionTimeout 5 -QueryTimeout 0
}
catch{
Write-Host -BackgroundColor Red -ForegroundColor White $_
exit
}
}
else{
try{
Invoke-Sqlcmd -Query $query …Run Code Online (Sandbox Code Playgroud) Selenium4 中是否删除了 driver.getContextHandles() 或 driver.context() ,因为这些方法将用于 Appium 驱动程序?我正在使用 Selenium 4.1.1 和 JavaClient-8.0.0-beta2。
在混合应用程序中运行测试时遇到查找元素的问题。场景 单击图标后,Web 视图将在应用程序中打开。元素未找到异常即将到来,而元素在 Chrome 中是唯一找到/标识的。
任何建议都将有助于进一步进行。
automation android-webview selenium-webdriver hybrid-mobile-app appium
我在 Cypress 测试中使用了 softAssertions。我能够使用softAssert()方法来验证元素中的文本,但我试图弄清楚如何使用softAssert()方法来断言元素可见。在 cypress 中,我使用.should('be.visible')很简单,但我似乎无法使其与softAssert()方法一起使用。我试图断言的元素是输入字段、表格和按钮。我在下面举了一个简单的例子。
我就是这样做的:
const jsonAssertion = require("soft-assert")
Cypress.Commands.add('softAssert', (actual, expected, message) => {
jsonAssertion.softAssert(actual, expected, message)
if (jsonAssertion.jsonDiffArray.length) {
jsonAssertion.jsonDiffArray.forEach(diff => {
const log = Cypress.log({
name: 'Soft assertion error',
displayName: 'softAssert',
message: diff.error.message
})
})
}
});
Cypress.Commands.add('softContains', (actual, expected, message) => {
jsonAssertion.softContains(actual, expected, message)
if (jsonAssertion.jsonDiffArray.length) {
jsonAssertion.jsonDiffArray.forEach(diff => {
const log = Cypress.log({
name: 'Soft assertion error',
displayName: 'softContains',
message: diff.error.message
})
})
} …Run Code Online (Sandbox Code Playgroud) 我是 C# 编程新手。
我正在尝试自动化一些 API 测试并使用 RestSharp 库在 POST 请求中传递有效负载。该有效负载看起来像这样
public class Payload
{
public string firstPayload = @"{
" + "\n" +
@" ""channel"": ""XYZ"",
" + "\n" +
@" ""Email"": ""abc@abc.com""
" + "\n" +
@"}";
}
Run Code Online (Sandbox Code Playgroud)
我在测试项目中将此负载称为有效负载。该请求在 Postman (JSON) 中看起来像这样
{
"channel": "XYZ",
"Email": "abc@abc.com"
}
Run Code Online (Sandbox Code Playgroud)
但由于我不能一遍又一遍地使用同一电子邮件,现在我想在电子邮件中添加 YYYYMMDDTHHMMSS 格式的 (DateTime.Now) ,以便每次运行测试时,它都是唯一的电子邮件。该电子邮件应类似于“abc20220825124587@abc.com”
但我不确定如何在逐字字符串firstPayload C# 代码中添加当前日期时间
我试图在某些应用程序中通过 google 自动登录,但收到此错误消息:(未捕获的异常)错误:超过 ResizeObserver 循环限制错误以下错误源自您的应用程序代码,而不是来自 Cypress。
超出 ResizeObserver 循环限制
当赛普拉斯检测到源自您的应用程序的未捕获错误时,它将自动使当前测试失败。
此行为是可配置的,您可以选择通过侦听 uncaught:exception 事件来关闭此行为。
这是我的代码:
describe('empty spec', () => {
it('login multi domain ', () => {
cy.visit('/login');
cy.get('form > .flex').click({force:true});
cy.origin(`https://accounts.google.com`, ()=>{
cy.get("#identifierId").type("user");
cy.get(".VfPpkd-LgbsSe-OWXEXe-k8QpJ").click({force:true});
cy.get(`#password`).type("pass");
cy.get(".VfPpkd-LgbsSe-OWXEXe-k8QpJ").click({force:true});
})
})
})
Run Code Online (Sandbox Code Playgroud)
提前致谢
automation ×10
cypress ×3
javascript ×3
powershell ×2
appium ×1
c# ×1
dom ×1
minify ×1
node.js ×1
puppeteer ×1
python ×1
restsharp ×1
scripting ×1
sql-server ×1
t-sql ×1
web-scraping ×1