mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-06 21:24:23 +08:00
adds integration tests for about sciNote modal
This commit is contained in:
parent
a769cb8563
commit
e5a01f7a57
10 changed files with 106 additions and 35 deletions
|
@ -1,4 +1,5 @@
|
||||||
import React from "react";
|
// @flow
|
||||||
|
import React, { Component } from "react";
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
import { NavDropdown, MenuItem } from "react-bootstrap";
|
import { NavDropdown, MenuItem } from "react-bootstrap";
|
||||||
import {
|
import {
|
||||||
|
@ -8,35 +9,68 @@ import {
|
||||||
PREMIUM_LINK,
|
PREMIUM_LINK,
|
||||||
CONTACT_US_LINK
|
CONTACT_US_LINK
|
||||||
} from "../../../config/routes";
|
} from "../../../config/routes";
|
||||||
|
import { getSciNoteInfo } from "../../../services/api/configurations_api";
|
||||||
|
|
||||||
const InfoDropdown = () =>
|
type State = {
|
||||||
<NavDropdown
|
modalOpen: boolean,
|
||||||
noCaret
|
scinoteVersion: string,
|
||||||
title={
|
addons: Array<string>
|
||||||
<span>
|
};
|
||||||
<span className="glyphicon glyphicon-info-sign" />
|
|
||||||
<span className="visible-xs-inline visible-sm-inline">
|
class InfoDropdown extends Component<*, State> {
|
||||||
<FormattedMessage id="navbar.info_label" />
|
constructor(props: any) {
|
||||||
</span>
|
super(props);
|
||||||
</span>
|
this.state = { modalOpen: false, scinoteVersion: "", addons: [] };
|
||||||
}
|
(this: any).showAboutUsModal = this.showAboutUsModal.bind(this);
|
||||||
id="nav-info-dropdown"
|
}
|
||||||
>
|
|
||||||
<MenuItem href={CUSTOMER_SUPPORT_LINK} target="_blank">
|
showAboutUsModal(): void {
|
||||||
<FormattedMessage id="info_dropdown.customer_support" />
|
getSciNoteInfo().then(response => {
|
||||||
</MenuItem>
|
const { scinoteVersion, addons } = response;
|
||||||
<MenuItem href={TUTORIALS_LINK} target="_blank">
|
(this: any).setState({
|
||||||
<FormattedMessage id="info_dropdown.tutorials" />
|
scinoteVersion,
|
||||||
</MenuItem>
|
addons,
|
||||||
<MenuItem href={RELEASE_NOTES_LINK} target="_blank">
|
modalOpen: true
|
||||||
<FormattedMessage id="info_dropdown.release_notes" />
|
});
|
||||||
</MenuItem>
|
});
|
||||||
<MenuItem href={PREMIUM_LINK} target="_blank">
|
}
|
||||||
<FormattedMessage id="info_dropdown.premium" />
|
|
||||||
</MenuItem>
|
render() {
|
||||||
<MenuItem href={CONTACT_US_LINK} target="_blank">
|
return (
|
||||||
<FormattedMessage id="info_dropdown.contact_us" />
|
<NavDropdown
|
||||||
</MenuItem>
|
noCaret
|
||||||
</NavDropdown>;
|
title={
|
||||||
|
<span>
|
||||||
|
<span className="glyphicon glyphicon-info-sign" />
|
||||||
|
<span className="visible-xs-inline visible-sm-inline">
|
||||||
|
<FormattedMessage id="navbar.info_label" />
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
id="nav-info-dropdown"
|
||||||
|
>
|
||||||
|
<MenuItem href={CUSTOMER_SUPPORT_LINK} target="_blank">
|
||||||
|
<FormattedMessage id="info_dropdown.customer_support" />
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem href={TUTORIALS_LINK} target="_blank">
|
||||||
|
<FormattedMessage id="info_dropdown.tutorials" />
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem href={RELEASE_NOTES_LINK} target="_blank">
|
||||||
|
<FormattedMessage id="info_dropdown.release_notes" />
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem href={PREMIUM_LINK} target="_blank">
|
||||||
|
<FormattedMessage id="info_dropdown.premium" />
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem href={CONTACT_US_LINK} target="_blank">
|
||||||
|
<FormattedMessage id="info_dropdown.contact_us" />
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem divider />
|
||||||
|
<MenuItem>
|
||||||
|
<FormattedMessage id="info_dropdown.about_scinote" />
|
||||||
|
</MenuItem>
|
||||||
|
</NavDropdown>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default InfoDropdown;
|
export default InfoDropdown;
|
||||||
|
|
|
@ -204,7 +204,8 @@ export default {
|
||||||
tutorials: "Tutorials",
|
tutorials: "Tutorials",
|
||||||
release_notes: "Release notes",
|
release_notes: "Release notes",
|
||||||
premium: "Premium",
|
premium: "Premium",
|
||||||
contact_us: "Contact us"
|
contact_us: "Contact us",
|
||||||
|
about_scinote: "About sciNote"
|
||||||
},
|
},
|
||||||
user_account_dropdown: {
|
user_account_dropdown: {
|
||||||
greeting: "Hi, {name}",
|
greeting: "Hi, {name}",
|
||||||
|
|
6
app/javascript/src/services/api/configurations_api.js
Normal file
6
app/javascript/src/services/api/configurations_api.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
// @flow
|
||||||
|
import axiosInstance from "./config";
|
||||||
|
import { ABOUT_SCINOTE_PATH } from "./endpoints";
|
||||||
|
|
||||||
|
export const getSciNoteInfo = (): Promise<*> =>
|
||||||
|
axiosInstance.get(ABOUT_SCINOTE_PATH).then(({ data }) => data);
|
|
@ -42,3 +42,6 @@ export const INVITE_USERS_PATH = "/client_api/users/invite_users";
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
export const SETTINGS_TEAMS = "/settings/teams";
|
export const SETTINGS_TEAMS = "/settings/teams";
|
||||||
|
|
||||||
|
// scinote configurations
|
||||||
|
export const ABOUT_SCINOTE_PATH = "/client_api/about_scinote";
|
||||||
|
|
|
@ -18,7 +18,7 @@ Rails.application.routes.draw do
|
||||||
get '/settings/*all', to: 'client_api/settings#index'
|
get '/settings/*all', to: 'client_api/settings#index'
|
||||||
|
|
||||||
namespace :client_api, defaults: { format: 'json' } do
|
namespace :client_api, defaults: { format: 'json' } do
|
||||||
%i(activities teams notifications users).each do |path|
|
%i(activities teams notifications users confirmations).each do |path|
|
||||||
draw path
|
draw path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
2
config/routes/confirmations.rb
Normal file
2
config/routes/confirmations.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# scinote configurations routes
|
||||||
|
get '/about_scinote', to: 'configurations_controller#about_scinote'
|
21
features/navigation/addons_versions_modal.feature
Normal file
21
features/navigation/addons_versions_modal.feature
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
Feature: Addon versions
|
||||||
|
As a sciNote User
|
||||||
|
I want know what addon are activated
|
||||||
|
So that I know what features are enabled
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the "BioSistemika Process" team exists
|
||||||
|
Given the following users are registered
|
||||||
|
| email | password | password_confirmation | full_name | initials |
|
||||||
|
| admin@myorg.com | mypassword1234 | mypassword1234 | Karli Novak | KN |
|
||||||
|
And "admin@myorg.com" is in "BioSistemika Process" team as a "admin"
|
||||||
|
And is signed in with "admin@myorg.com", "mypassword1234"
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Open the sciNote addons modal
|
||||||
|
Given I'm on the profile page
|
||||||
|
And I click "#nav-info-dropdown" icon
|
||||||
|
And I click "About sciNote" link within ".dropdown.open"
|
||||||
|
Then I should see "About sciNote"
|
||||||
|
And I should see "sciNote core version"
|
||||||
|
And I should see "Addon versions"
|
|
@ -15,7 +15,7 @@ Background:
|
||||||
Scenario: Successful navigate to profile page
|
Scenario: Successful navigate to profile page
|
||||||
Given I'm on the home page of "BioSistemika Process" team
|
Given I'm on the home page of "BioSistemika Process" team
|
||||||
And I click on Avatar
|
And I click on Avatar
|
||||||
And I click "Settings" link within "user-account-dropdown"
|
And I click "Settings" link within "#user-account-dropdown"
|
||||||
Then I should see "My Profile"
|
Then I should see "My Profile"
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
|
|
|
@ -15,7 +15,7 @@ Given(/^I click "(.+)" link$/) do |link|
|
||||||
end
|
end
|
||||||
|
|
||||||
Given(/^I click "(.+)" link within "(.+)"$/) do |link, element|
|
Given(/^I click "(.+)" link within "(.+)"$/) do |link, element|
|
||||||
within("##{element}") do
|
within(element) do
|
||||||
click_link link
|
click_link link
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -92,3 +92,7 @@ Then(/^I should see "([^"]*)" in "([^"]*)" input field$/) do |text, container_id
|
||||||
container = page.find_by_id(container_id)
|
container = page.find_by_id(container_id)
|
||||||
expect(container).to have_xpath("//input[@value='#{text}']")
|
expect(container).to have_xpath("//input[@value='#{text}']")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Given("I click {string} icon") do |id|
|
||||||
|
find(:css, id).click
|
||||||
|
end
|
||||||
|
|
|
@ -4865,7 +4865,7 @@ prop-types-extra@^1.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
warning "^3.0.0"
|
warning "^3.0.0"
|
||||||
|
|
||||||
prop-types@^15.5.10:
|
prop-types@^15.5.10, prop-types@^15.5.6:
|
||||||
version "15.6.0"
|
version "15.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.0.tgz#ceaf083022fc46b4a35f69e13ef75aed0d639856"
|
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.0.tgz#ceaf083022fc46b4a35f69e13ef75aed0d639856"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
Loading…
Add table
Reference in a new issue