我在寻求帮助,我已经绝望了。
我用Gherkin制作了一个简单的测试脚本并生成了步骤。我想将Applitools集成到这个过程中,即使用eyes.Check()方法。但是无论我多么努力,每次初始化眼睛对象时,都会出现以下错误:Method not found: "Applitools.BatchInfo Applitools.IEyesBase.get_Batch()。
applitools.com 上的示例不适合我,因为相同的Ruby实现对我不起作用,而且C#示例不涉及使用 Gherkin。
我的场景:
@Default.Target.Environment:Edu
Feature: LoginScenario
@INWK.LP.C0002
Scenario: L001_Login
When I open Web Site
And I login as user my_email@edu.hse.ru with pass 12345678
Then I close browser
我的步骤:
using System.Drawing;
using Applitools;
using Applitools.Selenium;
using Lms.Helpers;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using TechTalk.SpecFlow;
using NUnit.Framework;
using Configuration = Applitools.Selenium.Configuration;
namespace Lms.Steps
{
[TestFixture]
[Binding]
public class LoginInLmsSteps
{
private IWebDriver driver;
private LoginHelper loginHelper;
private Eyes eyes;
private EyesRunner runner;
private string Url => "https://lms.hse.ru/";
[Before]
[SetUp]
public void BeforeEach()
{
Configuration config = new Configuration();
config.SetApiKey("my_key");
config.SetBatch(new BatchInfo("LMS Batch"));
config.AddBrowser(800, 600, BrowserType.CHROME);
runner = new ClassicRunner();
eyes = new Eyes(runner);
eyes.SetConfiguration(config);
}
[When(@"I open Web Site")]
public void WhenIOpenWebSite()
{
driver = new ChromeDriver();
driver.Url = Url;
}
[When(@"I login as user (.*) with pass (.*)")]
public void WhenILoginAsUserWithPass(string username, string password)
{
eyes.Open(driver, "LMS", "Login test", new Size(800, 600));
eyes.CheckWindow("Login Page");
loginHelper.Login(username, password);
eyes.CloseAsync();
}
[Then(@"I close browser")]
public void ThenICloseBrowser()
{
driver.Quit();
driver = null;
}
[TearDown]
public void AfterEach()
{
// If the test was aborted before eyes.close was called, ends the test as aborted.
eyes.AbortIfNotClosed();
//Wait and collect all test results
TestResultsSummary allTestResults = runner.GetAllTestResults();
}
}
}
也就是说,我已经在设置阶段发现了错误
如果有任何帮助,我将不胜感激!