小编Raf*_* C.的帖子

箭头函数语法(=>)'仅在ES6中可用(使用'esversion:6')

目前我正在使用量角器/ grunt运行我的测试但是我收到以下错误消息:

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
Run Code Online (Sandbox Code Playgroud)

我认为我的.jshintrc文件没有被读取,因为我添加了这个条件.

.jshintrc

{ 
  "esversion": 6 
}
Run Code Online (Sandbox Code Playgroud)

Gruntfile.js

jshint : {
  all: ["tests/API/**/*.js"],
  options: {
    undef: true,
    mocha: true,
    node: true,
    jshintrc: true,
    esversion: 6,
    globals: {
      require: true,
      module: true,
      console: true,
      esversion: 6,
      }
  },
  ui: ["tests/UI/**/*.js"],
  options: {
    undef: true,
    mocha: true,
    node: true,
    jshintrc: true,
    esversion: 6,
    globals: {
      require: true,
      module: true,
      console: true,
      esversion: 6,
      jshintrc: true,
    }
  } …
Run Code Online (Sandbox Code Playgroud)

javascript jshint gruntjs ecmascript-6 grunt-contrib-jshint

15
推荐指数
4
解决办法
2万
查看次数

Pytest - 没有测试

我正在使用pytest和selenium.当我尝试运行我的测试脚本时:

import pytest
from selenium import webdriver
from pages import *
from locators import *
from selenium.webdriver.common.by import By
import time

class RegisterNewInstructor:
    def setup_class(cls):
        cls.driver = webdriver.Firefox()
        cls.driver.get("http://mytest.com")

    def test_01_clickBecomeTopButtom(self):
        page = HomePage(self.driver)
        page.click_become_top_button()
        self.assertTrue(page.check_instructor_form_page_loaded())


    def teardown_class(cls):
        cls.driver.close()
Run Code Online (Sandbox Code Playgroud)

显示的消息是:没有测试在0.84秒内运行

有人可以帮助我进行这个简单的测试吗?

python automated-tests pytest

9
推荐指数
2
解决办法
8015
查看次数

如何使用 XCTest 从 iOS 13 删除/重置应用程序?

最近我开始使用 XCTest 测试 iOS 应用程序,但我发现了一些困难,主要困难是删除或重置每个测试类中的应用程序内容。

我目前正在使用 XCode 11 并尝试从 iOS 13 中为每个测试类删除/重置应用程序,我已经尝试过:

  • 通过跳板删除应用程序
  • 转至应用程序设置删除应用程序

这一步在我的测试中非常重要,因为在每个测试中我都需要创建一个配置文件并登录,所以在下一个测试中我需要从头开始安装应用程序

xcode xctest xcuitest ios13 xcode11

7
推荐指数
2
解决办法
6176
查看次数

将诱惑报告结果发送到 aws s3

目前我正在使用 Ruby、Appium 和 Allure 来生成我的报告 (allure-rspec)。我的测试在持续集成 (BuddyBuild) 上运行,我在 aws s3 上有一个存储桶。使用所有必要的文件生成报告结构后,我可以看到报告只是在本地生成了一个服务器,但我想将 html 文件发送到我在 s3 中的存储桶。用我的测试结果生成报告后,我已经尝试将所有诱惑文件发送到我的存储桶中,但不幸的是,报告仅在使用allure openallure serve命令后生成。如何将结果发送到我的存储桶以与我的团队共享结果?

ruby rspec amazon-s3 allure

5
推荐指数
1
解决办法
2038
查看次数

范围为“class”的 Pytest 装置不适用于“setup_class”方法

我目前正在用来pytest_addoption运行 API 测试,因此测试应该针对用户在命令行上使用的环境运行。在我的测试文件中,我尝试UsersSupport仅实例化该类一次,并传递env参数。我的代码:

测试.py

import pytest

# Environments
QA1 = 'https://qa1.company.com'
LOCALHOST = 'https://localhost'


def pytest_addoption(parser):
    parser.addoption(
        '--env',
        action='store',
        default='qa1'
    )


@pytest.fixture(scope='class')
def env(request):
    cmd_option = request.config.getoption('env')
    if cmd_option == 'qa1':
        chosen_env = QA1
    elif cmd_option == 'localhost':
        chosen_env = LOCALHOST
    else:
        raise UnboundLocalError('"--env" command line must use "qa1", "localhost"')
    return chosen_env
Run Code Online (Sandbox Code Playgroud)

用户支持.py

import requests


class UsersSupport:

    def __init__(self, env):
        self.env = env
        self.users_endpoint = '/api/v1/users'

    def create_user(self, payload):
        response = requests.post(
            url=f'{self.env}{self.users_endpoint}',
            json=payload, …
Run Code Online (Sandbox Code Playgroud)

python pytest python-3.x

5
推荐指数
1
解决办法
2395
查看次数

Selenium-send_keys()发送不完整的字符串

我的问题:我有一种填充字段的方法,但是问题是硒没有将完整的字符串发送到该字段,因此我的断言在验证时失败。

我的代码:

var webdriver = require('selenium-webdriver');
var casual = require('casual');
var expect = require('chai').expect;
var By = webdriver.By;

exports.addPropuesta = function (driver) {

var first_name = casual.first_name;

driver.findElement(By.xpath("//a[contains(text(),'Añadir Propuesta Test')]")).click();

name_field = driver.findElement(By.name('nombre'));
name_field.sendKeys(first_name);

driver.findElement(By.css("Input[type='submit']")).click();

driver.findElement(By.css('.table')).getText().then(function(table_content){

    expect(table_content).to.include(first_name);

    });
};
Run Code Online (Sandbox Code Playgroud)

javascript selenium node.js selenium-webdriver

4
推荐指数
1
解决办法
3101
查看次数

尝试执行 selenium 后出现错误“服务器提前终止,状态为 1”

实际上使用 selenium 2.53.2、nodeJS v5.12.0 和 chromedriver 2.24.1 我试图在本地执行测试但收到错误Server terminated early with status 1

在此输入图像描述

有人能帮我解决这个问题吗?

selenium node.js selenium-chromedriver selenium-webdriver

3
推荐指数
1
解决办法
1万
查看次数

通过包而不是可执行文件安装 chromedriver

目前我正在使用 python 开发一个 selenium webdriver 项目。我的测试仅在 Chrome 中运行(当项目中存在可执行文件时)。是否有更新的替代方案可以通过包安装 chromedriver?

我的问题是我的代码在github中,所以如果我的同事想在本地测试,对我有用的可执行chromedriver文件可能对他不起作用。怎么解决呢?

python selenium pip selenium-chromedriver selenium-webdriver

3
推荐指数
1
解决办法
3万
查看次数

量角器 - 更改css属性以与元素交互

目前在页面上我测试我有一个select是与display: none在CSS中,所以我不能与此元素进行交互.我搜查了但是我找不到任何可以帮助我的东西.

HTML

<select name="preview_district" placeholder="Departamento" data-native-select="true" data-toggle-placeholder="true">
<option value="*" disabled="" selected="" hidden="">(Selecciona)</option>
<option value="91">AMAZONAS</option>
<option value="5">ANTIOQUIA</option>
</select>
Run Code Online (Sandbox Code Playgroud)

CSS

select[data-native-select="true"] {
    display: none;
}
Run Code Online (Sandbox Code Playgroud)

javascript protractor

2
推荐指数
1
解决办法
2288
查看次数

从同一类中的另一个方法调用变量

我的场景

我只有一个带有两种方法的类。在第一种方法中,我将值存储在变量中。在第二种方法中,我尝试调用这些变量

class UpdateTallysheet(Page):

    def confirme_status_capture_exp_value(self):

        self.select_dropdown_value(EventsLocators.STATUS, "8")
        value_1 = self.find_element(EventsLocators.EXAM_EXP_VALUE).get_attribute("value")
        value_2 = self.find_element(EventsLocators.PANO_EXP_VALUE).get_attribute("value")
        value_3 = self.find_element(EventsLocators.TREATMENT_EXP_VALUE).get_attribute("value")

        self.find_element(EventsLocators.SAVE_BUTTON).click()
        WebDriverWait(self.driver, AUTOCOMPLETE_TIMEOUT).until(
            EC.text_to_be_present_in_element((By.CLASS_NAME, "success"), 'Event updated successfully'))
        self.find_element(EventsLocators.TALLYSHEET_LINK).click()

    def fill_date(self):

        self.select_current_date(EventsLocators.DATE_RECEIVED, EventsLocators.CURRENT_DATE)
        self.select_current_date(EventsLocators.DATE_COMPLETED, EventsLocators.CURRENT_DATE)
        print self.value_1
Run Code Online (Sandbox Code Playgroud)

我的错误

AttributeError: 'UpdateTallysheet' 对象没有属性 'value_1'

如何value_1在另一种方法中使用该变量?

python oop python-2.7

1
推荐指数
1
解决办法
3720
查看次数