Ver Fonte

Fix UI test runner

Danilo Bargen há 6 anos atrás
pai
commit
f60d6b7659
2 ficheiros alterados com 7 adições e 3 exclusões
  1. 1 1
      package.json
  2. 6 2
      tests/ui/run.ts

+ 1 - 1
package.json

@@ -16,7 +16,7 @@
     "testserver": "npx webpack-dev-server --config webpack.tests.js",
     "test": "echo -e 'NOTE: Use either \"npm run test:unit\" or \"npm run test:ui\"\n' && exit 1",
     "test:unit": "npm run build:unittests && karma start --single-run --log-level=debug --colors",
-    "test:ui": "npm run build:uitests && bash tests/ui/run.sh",
+    "test:ui": "bash tests/ui/run.sh",
     "lint": "npm run lint:ts && npm run lint:sass",
     "lint:ts": "tslint -c tslint.json --project tsconfig.json --exclude \"**/src/config.ts\"",
     "lint:sass": "sass-lint -c .sass-lint.yml -v -q",

+ 6 - 2
tests/ui/run.ts

@@ -22,7 +22,7 @@ const filterQuery = process.argv[3];
 type Testfunc = (driver: WebDriver) => void;
 
 // Shared selectors
-const composeArea = By.css('div.compose');
+const composeArea = By.id('composeDiv');
 const emojiKeyboard = By.css('.emoji-keyboard');
 const emojiTrigger = By.css('.emoji-trigger');
 
@@ -30,7 +30,7 @@ const emojiTrigger = By.css('.emoji-trigger');
  * Helper function to extract text.
  */
 async function extractText(driver: WebDriver): Promise<string> {
-    const script = `return window.composeArea.getText();`;
+    const script = `return window.composeArea.get_text();`;
     return driver.executeScript<string>(script);
 }
 
@@ -209,6 +209,7 @@ const TESTS: Array<[string, Testfunc]> = [
 const TEST_URL = 'http://localhost:7777/tests/ui/compose_area.html';
 (async function() {
     const driver: WebDriver = await new Builder().forBrowser(browser).build();
+    driver.manage().setTimeouts({implicit: 1000, pageLoad: 30000, script: 30000});
     let i = 0;
     let success = 0;
     let failed = 0;
@@ -218,6 +219,9 @@ const TEST_URL = 'http://localhost:7777/tests/ui/compose_area.html';
         console.info(`Filter query: "${filterQuery}"\n`);
     }
     try {
+        // Initial pageload to ensure bundles are generated
+        await driver.get(TEST_URL);
+
         for (const [name, testfunc] of TESTS) {
             try {
                 if (filterQuery === undefined || name.toLowerCase().indexOf(filterQuery.toLowerCase()) !== -1) {