我想通过编写的UI测试来实现CI / CD,以便每晚自动运行Nightwatch.js测试。我尝试将文件复制到jenkins中的工作区并运行它们。我尝试将TFS用作版本控制系统,以查看是否可以使其以这种方式运行。我一直遇到的问题(请参见附件)是,当我在本地运行时,chrome浏览器会打开并运行测试。但是,在Jenkins中,它说找不到元素。我已经研究了如何无头运行chrome,但是当我在nightwatch.json配置文件中添加--headless标记时,仍然遇到相同的错误。底线是,如何使Nightwatch.js测试按夜间计划运行? (最好是詹金斯)
尝试从tfs源代码管理运行测试 尝试从复制到jenkins工作区的本地测试中运行测试。 尝试运行无头测试(在本地有效,Jenkins无效)https://developers.google.com/web/updates/2017/04/headless-chrome
这是我的nightwatch.json文件。
Scanner input = new Scanner(System.in);
Random rand = new Random();
System.out.print("Input size of array: ");
int arraySize = input.nextInt();
int arr[] = new int[arraySize * 2]; //User size * 2
for (int i = 0; i < arr.length; i++) {
arr[i] = rand.nextInt(100);//Random elements for array size
}
System.out.println("Array before sort: " + Arrays.toString(arr));//
Arrays.sort(arr);
System.out.println("Array after sort: " + Arrays.toString(arr));
System.out.print("Input first n elements that you want to move in second array ");
int nElementsForSecondArray = input.nextInt();
//First n elements that user input and creating new array2
int arr2[] = new int[arraySize * 2];
for (int i = 0; i < nElementsForSecondArray; i++) {
arr2[i] = arr[i];
}
System.out.println("Second array: " + Arrays.toString(arr2));//Print array2 with n elements from first array
System.out.print("Input first n elements that you want to move in third array ");
int nElementsForThirdArray = input.nextInt();
//First n elements that user input and craeting new array3
int arr3[] = new int[arraySize * 2];
for (int i = 0; i < nElementsForThirdArray; i++) {
arr3[i] = arr[i];
}
System.out.println("Third array: " + Arrays.toString(arr3));//Print array3 with n elements from first array
}
}
答案 0 :(得分:0)
.windowMaximize()似乎导致我的测试在Jenkins中挂起并失败。