From 47aaede8c77616f8417171cb9ef8efa85840a5e8 Mon Sep 17 00:00:00 2001 From: Hideki Ikemoto Date: Fri, 7 Jan 2022 16:26:08 +0900 Subject: [PATCH] test: remove broken integration-test --- .circleci/config.yml | 7 - package.json | 3 - scripts/ci.sh | 1 - test/selenium/chrome.ts | 20 --- test/selenium/driver.ts | 120 ------------------ test/selenium/firefox.ts | 29 ----- test/selenium/libs/block_anchor.ts | 31 ----- test/selenium/libs/block_dialog.ts | 34 ----- test/selenium/libs/compact_menu.ts | 26 ---- test/selenium/libs/interface.ts | 21 --- test/selenium/libs/option_page.ts | 106 ---------------- test/selenium/run_all.ts | 108 ---------------- test/selenium/test_google_images_tab.ts | 58 --------- test/selenium/test_google_news_tab_top.ts | 79 ------------ .../selenium/test_google_search_inner_card.ts | 79 ------------ test/selenium/test_google_search_result.ts | 79 ------------ test/selenium/test_google_search_top_news.ts | 79 ------------ test/selenium/test_google_search_tweet.ts | 79 ------------ 18 files changed, 959 deletions(-) delete mode 100644 test/selenium/chrome.ts delete mode 100644 test/selenium/driver.ts delete mode 100644 test/selenium/firefox.ts delete mode 100644 test/selenium/libs/block_anchor.ts delete mode 100644 test/selenium/libs/block_dialog.ts delete mode 100644 test/selenium/libs/compact_menu.ts delete mode 100644 test/selenium/libs/interface.ts delete mode 100644 test/selenium/libs/option_page.ts delete mode 100644 test/selenium/run_all.ts delete mode 100644 test/selenium/test_google_images_tab.ts delete mode 100644 test/selenium/test_google_news_tab_top.ts delete mode 100644 test/selenium/test_google_search_inner_card.ts delete mode 100644 test/selenium/test_google_search_result.ts delete mode 100644 test/selenium/test_google_search_top_news.ts delete mode 100644 test/selenium/test_google_search_tweet.ts diff --git a/.circleci/config.yml b/.circleci/config.yml index 1b1fad4f..ac74c10a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,15 +31,8 @@ jobs: tar xvfj firefox.tar.bz2 - run: command: make ci - - run: - name: "Archive screenshots" - command: cd tmp/screenshots; tar cvfj screenshots.tar.bz2 * - when: always - store_test_results: path: reports - - store_artifacts: - path: tmp/screenshots - destination: screenshots - persist_to_workspace: root: tmp/workspace paths: diff --git a/package.json b/package.json index 9ee5f195..55f720a7 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,6 @@ "@types/html-webpack-plugin": "^3.2.5", "@types/jest": "^27.0.2", "@types/node": "^12.11.2", - "@types/selenium-webdriver": "^4.0.5", "@types/stack-trace": "^0.0.29", "@types/webpack": "^5.28.0", "@typescript-eslint/eslint-plugin": "^4.22.0", @@ -25,7 +24,6 @@ "html-webpack-plugin": "^5.3.2", "jest": "^27.2.5", "prettier": "^2.2.1", - "selenium-webdriver": "^4.0.0-alpha.8", "ts-jest": "^27.0.5", "ts-loader": "^9.2.2", "ts-node": "^9.1.1", @@ -38,7 +36,6 @@ "archive": "ts-node ./scripts/archive.ts", "build": "webpack", "fix": "yarn eslint --fix --ext .ts apps scripts test *.ts jest.config.js", - "integration-test": "yarn archive && node --stack_trace_limit=50 --async-stack-traces -r ts-node/register test/selenium/run_all.ts", "lint": "prettier --write .; yarn eslint --ext .ts apps scripts test *.ts jest.config.js", "lint-for-ci": "prettier --check .; yarn eslint --format junit --output-file ./reports/eslint/eslint.xml --ext .ts apps scripts test *.ts jest.config.js", "manifest": "ts-node ./scripts/make_manifest.ts", diff --git a/scripts/ci.sh b/scripts/ci.sh index 963f0302..f749557a 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -19,4 +19,3 @@ yarn test yarn build yarn archive -yarn integration-test diff --git a/test/selenium/chrome.ts b/test/selenium/chrome.ts deleted file mode 100644 index 4aded5f1..00000000 --- a/test/selenium/chrome.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Builder, Capabilities } from "selenium-webdriver"; -import { Options } from "selenium-webdriver/chrome"; -import { readFileSync } from "fs"; -import { DriverType, TestWebDriver } from "./driver"; -import { TestCase } from "./libs/interface"; - -export default function (testCase: TestCase): TestWebDriver { - const extension = readFileSync("tmp/workspace/gossip-site-blocker.crx", "base64"); - const options = new Options().addExtensions(extension).windowSize({ width: 1280, height: 800 }); - - const capabilities = Capabilities.chrome(); - capabilities.set("chromeOptions", { - args: [ - "--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36", - ], - }); - - const driver = new Builder().withCapabilities(capabilities).setChromeOptions(options).build(); - return new TestWebDriver(driver, DriverType.Chrome, testCase); -} diff --git a/test/selenium/driver.ts b/test/selenium/driver.ts deleted file mode 100644 index 7b3238f6..00000000 --- a/test/selenium/driver.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { By, until, WebDriver, WebElement } from "selenium-webdriver"; -import { existsSync, mkdirSync, writeFileSync } from "fs"; -import { DriverType, TestCase, TestDriverInterface } from "./libs/interface"; -import TestOptionPage from "./libs/option_page"; -import TestBlockDialog from "./libs/block_dialog"; -import TestBlockAnchor from "./libs/block_anchor"; -import TestCompactMenu from "./libs/compact_menu"; - -export { DriverType } from "./libs/interface"; - -export class TestWebDriver implements TestDriverInterface { - private readonly _driver: WebDriver; - - private readonly _driverType: DriverType; - - private readonly _testCase: TestCase; - - private _counter: number; - - constructor(driver: WebDriver, driverType: DriverType, testCase: TestCase) { - this._driver = driver; - this._driverType = driverType; - this._testCase = testCase; - this._counter = 1; - } - - async close(): Promise { - return this._driver.close(); - } - - async get(url: string): Promise { - await this._driver.get(url); - return this.pause(500); - } - - getDriverType(): DriverType { - return this._driverType; - } - - async googleSearch(keywords: string[]): Promise { - const query = keywords.join("+"); - await this._driver.get(`https://www.google.com/search?q=${query}`); - return this.pause(2000); - } - - async googleNewsSearch(keywords: string[]): Promise { - const query = keywords.join("+"); - await this._driver.get(`https://www.google.com/search?q=${query}&tbm=nws`); - return this.pause(1000); - } - - async googleImageSearch(keywords: string[]): Promise { - const query = keywords.join("+"); - await this._driver.get(`https://www.google.com/search?q=${query}&tbm=isch`); - return this.pause(1000); - } - - async querySelector(css: string): Promise { - return this._driver.findElement(By.css(css)); - } - - async querySelectorAll(css: string): Promise { - return this._driver.findElements(By.css(css)); - } - - async findDialog(): Promise { - const dialog = new TestBlockDialog(this._driver); - await dialog.init(); - - return dialog; - } - - async pause(milliSeconds: number): Promise { - await this._driver.sleep(milliSeconds); - } - - async click(element: WebElement): Promise { - // cannot use Actions API for