Commit 30738b62 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into 319-dev-input-focus-lost-on-search

parents bab9f124 a849f70e
Pipeline #1736 failed with stage
# Gauge - metadata dir
.gauge
# Gauge - log files dir
logs
# Gauge - reports dir
reports
# Gauge - JavaScript node dependencies
node_modules
.DS_Store
/bower_components/ /bower_components/
/node_modules/ /node_modules/
/.cache/ /.cache/
...@@ -32,3 +45,4 @@ bundle.js ...@@ -32,3 +45,4 @@ bundle.js
/.lesshst /.lesshst
/dist/js/**/*.map /dist/js/**/*.map
/dist/styles/**/*.map /dist/styles/**/*.map
{
"Language": "js",
"Plugins": [
"html-report"
]
}
\ No newline at end of file
{
"name": "js",
"description": "Gauge template for Javascript and Taiko",
"postInstallCmd": "npm install",
"postInstallMsg": "Run specifications with \"npm test\" in project root.",
"version": "1.0.5"
}
...@@ -17,13 +17,14 @@ ...@@ -17,13 +17,14 @@
"clean": "rm -Rf output node_modules", "clean": "rm -Rf output node_modules",
"clean-js": "rm -Rf node_modules", "clean-js": "rm -Rf node_modules",
"clean-ps": "rm -Rf output", "clean-ps": "rm -Rf output",
"test": "pulp test",
"server": "serve dist", "server": "serve dist",
"prod": "yarn prod:compile && yarn prod:dce && yarn prod:bundle && yarn prod:pack", "prod": "yarn prod:compile && yarn prod:dce && yarn prod:bundle && yarn prod:pack",
"prod:compile": "pulp build -- -g corefn", "prod:compile": "pulp build -- -g corefn",
"prod:dce": "zephyr -f Main.main", "prod:dce": "zephyr -f Main.main",
"prod:bundle": "pulp browserify --skip-compile -o dce-output -t app.js", "prod:bundle": "pulp browserify --skip-compile -o dce-output -t app.js",
"prod:pack": "parcel build index.html -d prod --public-url . --no-source-maps" "prod:pack": "parcel build index.html -d prod --public-url . --no-source-maps",
"test-pulp": "pulp test",
"test": "gauge run specs/"
}, },
"dependencies": { "dependencies": {
"@popperjs/core": "^2.9.2", "@popperjs/core": "^2.9.2",
...@@ -47,12 +48,14 @@ ...@@ -47,12 +48,14 @@
"sigma": "git://github.com/poorscript/sigma.js#garg" "sigma": "git://github.com/poorscript/sigma.js#garg"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.9", "@babel/core": "^7.15.0",
"@babel/preset-react": "^7.12.7", "@babel/preset-react": "^7.12.7",
"@getgauge/cli": "^1.4.0",
"parcel": "^2.0.0-beta.2", "parcel": "^2.0.0-beta.2",
"react-testing-library": "^8.0.1", "react-testing-library": "^8.0.1",
"sass": "^1.35.2", "sass": "^1.35.2",
"serve": "^12.0.0", "serve": "^12.0.0",
"taiko": "latest",
"vscode-languageserver": "^7.0.0", "vscode-languageserver": "^7.0.0",
"xhr2": "^0.2.1" "xhr2": "^0.2.1"
}, },
......
# Logged in user specification
Tags: login
* Open gargantext
* User must be logged in as "user1" with password "1resu"
* Expand tree
## Successful list view
* Open the list view
...@@ -65,11 +65,6 @@ readJSON affResp = ...@@ -65,11 +65,6 @@ readJSON affResp =
Left err -> Left $ ReadJSONError err Left err -> Left $ ReadJSONError err
Right r -> Right r Right r -> Right r
-- readJSONOrFail affResp = do
-- case readJSON affResp of
-- Left err -> throwError $ error $ "decodeJson affResp.body: " <> show err
-- Right b -> pure b
-- TODO too much duplicate code in `postWwwUrlencoded` -- TODO too much duplicate code in `postWwwUrlencoded`
send :: forall body res. JSON.WriteForeign body => JSON.ReadForeign res => send :: forall body res. JSON.WriteForeign body => JSON.ReadForeign res =>
Method -> Maybe Token -> String -> Maybe body -> Aff (Either RESTError res) Method -> Maybe Token -> String -> Maybe body -> Aff (Either RESTError res)
......
module Gargantext.Utils.CacheAPI where module Gargantext.Utils.CacheAPI where
import Gargantext.Prelude hiding (add)
import Control.Monad.Except (runExcept) import Control.Monad.Except (runExcept)
import Control.Promise (Promise, toAffE) import Control.Promise (Promise, toAffE)
import Data.Either (Either(..)) import Data.Either (Either(..))
...@@ -10,25 +12,12 @@ import Effect.Aff (Aff, throwError) ...@@ -10,25 +12,12 @@ import Effect.Aff (Aff, throwError)
import Effect.Exception (error) import Effect.Exception (error)
import Foreign as F import Foreign as F
import Foreign.Object as O import Foreign.Object as O
import Gargantext.Ends (class ToUrl, toUrl)
import Gargantext.Sessions (Session(..))
import Milkis as M import Milkis as M
import Simple.JSON as JSON import Simple.JSON as JSON
import Type.Row (class Union) import Type.Row (class Union)
import Gargantext.Prelude hiding (add)
import Gargantext.Ends (class ToUrl, toUrl)
import Gargantext.Sessions (Session(..))
get :: forall a p. JSON.ReadForeign a => ToUrl Session p => Cache -> Session -> p -> Aff a
get cache session p = do
let req = makeGetRequest session p
res <- cached cache req
j <- M.text res
case JSON.readJSON j of
Left err -> throwError $ error $ "decodeJson affResp.body: " <> show err
Right b -> pure b
foreign import data Cache :: Type foreign import data Cache :: Type
foreign import data Request :: Type foreign import data Request :: Type
...@@ -119,7 +108,7 @@ pureJson req = do ...@@ -119,7 +108,7 @@ pureJson req = do
Right b -> pure b Right b -> pure b
foreign import _makeRequest :: forall options trash. foreign import _makeRequest :: forall options.
M.URL -> { method :: M.Method, headers :: M.Headers | options } -> Request M.URL -> { method :: M.Method, headers :: M.Headers | options } -> Request
foreign import _openCache :: String -> Effect (Promise Cache) foreign import _openCache :: String -> Effect (Promise Cache)
foreign import _delete :: String -> Effect (Promise Unit) foreign import _delete :: String -> Effect (Promise Unit)
......
const {Builder, By, Key, until} = require('selenium-webdriver');
(async function login() {
let driver = await new Builder().forBrowser('firefox').build();
try {
await driver.get('http://localhost:8008');
await driver.findElement(By.css('#page-wrapper .btn-primary')).click();
await driver.findElement(By.css('#loginModal input[name=username]')).sendKeys('user1');
await driver.findElement(By.css('#loginModal input[name=password]')).sendKeys('1resu');
await driver.findElement(By.css('#loginModal input[type=checkbox]')).click();
await driver.findElement(By.css('#loginModal #login-button')).click();
}
finally {
driver.quit();
}
})();
const { openBrowser, goto, write, click, closeBrowser, $, into } = require('taiko');
(async () => {
try {
await openBrowser();
await goto("http://localhost:8008");
await click($('#page-wrapper .btn-primary'));
await write('user1', into($('#loginModal input[name=username]')));
await write('1resu', into($('#loginModal input[name=password]')));
await click($('#loginModal input[type=checkbox]'));
await click($('#loginModal #login-button'));
} catch (error) {
console.error(error);
} finally {
closeBrowser();
}
})();
/* globals gauge*/
"use strict";
const path = require('path');
const {
openBrowser,
write,
closeBrowser,
goto,
press,
screenshot,
above,
click,
checkBox,
listItem,
toLeftOf,
link,
text,
into,
textBox,
evaluate,
$
} = require('taiko');
const assert = require("assert");
const headless = process.env.headless_chrome.toLowerCase() === 'true';
beforeSuite(async () => {
await openBrowser({
headless: headless
})
});
afterSuite(async () => {
await closeBrowser();
});
// Return a screenshot file name
gauge.customScreenshotWriter = async function () {
const screenshotFilePath = path.join(process.env['gauge_screenshots_dir'],
`screenshot-${process.hrtime.bigint()}.png`);
await screenshot({
path: screenshotFilePath
});
return path.basename(screenshotFilePath);
};
step('Open gargantext', async () => {
goto('http://localhost:8008');
});
step("User must be logged in as <user> with password <password>", async (user, password) => {
await click($('.forest-layout button.btn-primary'));
await click($('.modal-body table tr:first-child td:nth-child(2) a'));
await write(user, into($('#loginModal input[name=username]')));
await write(password, into($('#loginModal input[name=password]')));
await click($('#loginModal input[type=checkbox]'));
await click($('#loginModal #login-button'));
});
step("Expand tree", async () => {
var exists;
var $element = '.forest-layout .leaf .chevron-icon .fa-chevron-right';
while(1) {
exists = await $($element).exists();
if(exists) {
await click($($element));
} else {
break;
}
}
});
step('Open the list view', async () => {
await click($('.forest-layout .fa-list'));
});
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment