Commit a69331d3 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch '21-dev-automated-tests' of...

Merge branch '21-dev-automated-tests' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev
parents 39a3fdef 087054b1
# 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"
}
{ {
"name": "Gargantext", "name": "gauge-taiko-template",
"version": "0.0.2.9.6.1", "description": "Starter template for writing JavaScript tests for Gauge",
"scripts": { "scripts": {
"generate-purs-packages-nix": "./nix/generate-purs-packages.nix", "test": "gauge run specs/"
"generate-psc-packages-nix": "./nix/generate-packages-json.bash", },
"css": "sass src/sass/sass.sass:dist/styles/sass.css && yarn css-themes", "dependencies": {
"css-themes": "yarn css-default-theme && yarn css-dark-theme && yarn css-darkster-theme && yarn css-greyson-theme && yarn css-herbie-theme && yarn css-monotony-theme", "taiko": "latest"
"css-default-theme": "sass src/sass/bootstrap/default.sass:dist/styles/bootstrap-default.css", },
"css-dark-theme": "cp node_modules/bootstrap-dark/src/bootstrap-dark.css dist/styles/bootstrap-dark.css", "devDependencies": {
"css-darkster-theme": "sass src/sass/bootstrap/darkster.scss:dist/styles/bootstrap-darkster.css", "@babel/core": "^7.15.0",
"css-greyson-theme": "sass src/sass/bootstrap/greyson.scss:dist/styles/bootstrap-greyson.css", "@getgauge/cli": "^1.4.0"
"css-herbie-theme": "sass src/sass/bootstrap/herbie.scss:dist/styles/bootstrap-herbie.css", }
"css-monotony-theme": "sass src/sass/bootstrap/monotony.scss:dist/styles/bootstrap-monotony.css",
"docs": "pulp docs -- --format html",
"repl": "pulp repl",
"clean": "rm -Rf output node_modules",
"clean-js": "rm -Rf node_modules",
"clean-ps": "rm -Rf output",
"test": "pulp test",
"server": "serve dist",
"prod": "yarn prod:compile && yarn prod:dce && yarn prod:bundle && yarn prod:pack",
"prod:compile": "pulp build -- -g corefn",
"prod:dce": "zephyr -f Main.main",
"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"
},
"dependencies": {
"@popperjs/core": "^2.9.2",
"aes-js": "^3.1.1",
"base-x": "^3.0.2",
"bootstrap": "^4.6.0",
"bootstrap-dark": "^1.0.3",
"create-react-class": "^15.6.3",
"echarts": "^5.1.2",
"echarts-for-react": "^3.0.1",
"highlightjs": "^9.16.2",
"immer": "^9.0.5",
"prop-types": "^15.6.2",
"pullstate": "^1.20.6",
"react": "^17.0.2",
"react-awesome-popover": "^6.1.1",
"react-bootstrap": "^1.5.2",
"react-dom": "^17.0.2",
"react-tooltip": "^4.2.8",
"secp256k1": "^4.0.2",
"sigma": "git://github.com/poorscript/sigma.js#garg"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/preset-react": "^7.12.7",
"parcel": "^2.0.0-beta.2",
"react-testing-library": "^8.0.1",
"sass": "^1.35.2",
"serve": "^12.0.0",
"vscode-languageserver": "^7.0.0",
"xhr2": "^0.2.1"
},
"optionalDependencies": {
"purescript-language-server": "^0.15.2"
}
} }
# 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
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