Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add embed and expand share e2e

Ed Plato854615ab7cff
diff --git a/e2e/features/share/embed-test.js b/e2e/features/share/embed-test.js
new file mode 100644
index 000000000..1ab6766b8
--- /dev/null
+++ b/e2e/features/share/embed-test.js
@@ -0,0 +1,91 @@
+const reuseables = require('../../reuseables/skip-tour.js');
+const localSelectors = require('../../reuseables/selectors.js');
+
+const TIME_LIMIT = 10000;
+
+const {
+ addLayers,
+ compareButton,
+ dataDownloadTabButton,
+ embedLinkButton,
+ eventsSidebarTabButton,
+ infoToolbarButton,
+ locationSearchToolbarButton,
+ measureBtn,
+ projToolbarButton,
+ shareEmbedInput,
+ shareToolbar,
+ shareToolbarButton,
+ snapshotToolbarButton,
+} = localSelectors;
+
+const embedShareNav = '.embed-share-nav';
+
+// embed input value with default page 2020-01-01
+const iframeValue = (c) => `<iframe src="${c.globals.url}?t=2020-01-01-T00%3A00%3A00Z&em=true" role="application" sandbox="allow-modals allow-scripts allow-same-origin allow-forms allow-popups" width="100%" height="100%" allow="fullscreen; autoplay;" loading="lazy"></iframe>`;
+
+module.exports = {
+ before(c) {
+ reuseables.loadAndSkipTour(c, TIME_LIMIT);
+ },
+ 'Embed share tab dialog displays embed input': (c) => {
+ const queryString = '?t=2020-01-01';
+ c.url(c.globals.url + queryString);
+ c.waitForElementVisible(shareToolbarButton, TIME_LIMIT);
+ c.click(shareToolbarButton);
+ c.waitForElementVisible(shareToolbar, TIME_LIMIT);
+ c.click(`${embedShareNav} a`);
+ c.waitForElementVisible(shareEmbedInput, TIME_LIMIT);
+ c.assert.attributeContains(shareEmbedInput, 'value', iframeValue(c));
+ },
+ 'Embed share nav link tab disabled if data tab selected': (c) => {
+ const queryString = '?sh=VIIRS_NOAA20_CorrectedReflectance_TrueColor,C1604567932-LANCEMODIS&t=2020-01-01';
+ c.url(c.globals.url + queryString);
+ c.waitForElementVisible(shareToolbarButton, TIME_LIMIT);
+ c.click(shareToolbarButton);
+ c.waitForElementVisible(shareToolbar, TIME_LIMIT);
+ },
+ 'Embed share nav link tab disabled if tour active': (c) => {
+ const queryString = '?tr=swath_gaps';
+ c.url(c.globals.url + queryString);
+ c.waitForElementVisible(shareToolbarButton, TIME_LIMIT);
+ c.click(shareToolbarButton);
+ c.waitForElementVisible(shareToolbar, TIME_LIMIT);
+ c.assert.cssClassPresent(`${embedShareNav} a`, 'disabled');
+ },
+ 'Embed mode is active with query string parameter': (c) => {
+ const queryString = '?t=2020-01-01&em=true';
+ c.url(c.globals.url + queryString);
+ c.waitForElementVisible('.embed-overlay-bg', TIME_LIMIT);
+ c.waitForElementVisible('.embed-overlay-btn', TIME_LIMIT);
+ c.click('.embed-overlay-bg');
+ c.expect.element(embedLinkButton).to.be.visible;
+ },
+ 'Embed mode styling is correct': (c) => {
+ // visible
+ c.expect.element('.timeline-header-mobile').to.be.visible;
+ c.expect.element('.mobile-date-change-arrows-btn').to.be.visible;
+ // not present
+ c.expect.element(eventsSidebarTabButton).to.not.be.present;
+ c.expect.element(locationSearchToolbarButton).to.not.be.present;
+ // not visible
+ c.expect.element(dataDownloadTabButton).to.not.be.visible;
+ c.expect.element(infoToolbarButton).to.not.be.visible;
+ c.expect.element(measureBtn).to.not.be.visible;
+ c.expect.element(projToolbarButton).to.not.be.visible;
+ c.expect.element(shareToolbarButton).to.not.be.visible;
+ c.expect.element(snapshotToolbarButton).to.not.be.visible;
+ c.expect.element(addLayers).to.not.be.visible;
+ c.expect.element(compareButton).to.not.be.visible;
+ },
+ 'Clicking embed link button opens up new tab': (c) => {
+ c.click(embedLinkButton);
+ c.pause(1000);
+ c.windowHandles((tabs) => {
+ c.assert.equal(tabs.value.length, 2);
+ });
+ },
+ after(c) {
+ c.end();
+ },
+};
diff --git a/e2e/features/share/share-test.js b/e2e/features/share/share-test.js
new file mode 100644
index 000000000..76bb94287
--- /dev/null
+++ b/e2e/features/share/share-test.js
@@ -0,0 +1,69 @@
+const reuseables = require('../../reuseables/skip-tour.js');
+const localSelectors = require('../../reuseables/selectors.js');
+
+const TIME_LIMIT = 10000;
+
+const {
+ shareToolbar,
+ shareToolbarButton,
+ shareLinkInput,
+} = localSelectors;
+
+const linkShareNav = '.link-share-nav';
+const embedShareNav = '.embed-share-nav';
+const socialShareNav = '.social-share-nav';
+
+module.exports = {
+ before(c) {
+ reuseables.loadAndSkipTour(c, TIME_LIMIT);
+ },
+ 'Clicking the share link button opens the share dialog': (c) => {
+ c.waitForElementVisible(shareToolbarButton, TIME_LIMIT);
+ c.click(shareToolbarButton);
+ c.waitForElementVisible(shareToolbar, TIME_LIMIT);
+ c.expect.element(shareToolbar).to.be.present;
+ },
+ 'Share tabs link, embed, and social are visible and enabled': (c) => {
+ c.expect.element(linkShareNav).to.be.present;
+ c.expect.element(embedShareNav).to.be.present;
+ c.expect.element(socialShareNav).to.be.present;
+ c.assert.cssClassPresent(`${linkShareNav} a`, 'active');
+ },
+ 'Share link clipboard with existing time query string param in the page url will have the same serialized time': (c) => {
+ const queryString = '?t=2018-12-31';
+ c.url(c.globals.url + queryString);
+ c.waitForElementVisible(shareToolbarButton, TIME_LIMIT);
+ c.click(shareToolbarButton);
+ c.assert.urlContains('t=');
+ c.assert.attributeContains(shareLinkInput, 'value', `${c.globals.url}?t=2018-12-31-T00%3A00%3A00Z`);
+ },
+ 'Share link clipboard with no time query string param in the page url will have the same serialized time (partial YYYY-MM-DD)': (c) => {
+ reuseables.loadAndSkipTour(c, TIME_LIMIT);
+ c.waitForElementVisible(shareToolbarButton, TIME_LIMIT);
+ c.click(shareToolbarButton);
+ let date = new Date();
+ if (date.getUTCHours() < 3) {
+ date = new Date(date.getTime() - 86400000);
+ }
+ const year = date.getUTCFullYear();
+ const month = date.getUTCMonth() + 1;
+ const day = date.getUTCDate();
+ const monthText = month < 10 ? `0${month}` : month;
+ const dayText = day < 10 ? `0${day}` : day;
+ c.assert.not.urlContains('t=');
+ c.assert.attributeContains(shareLinkInput, 'value', `t=${year}-${monthText}-${dayText}`);
+ },
+ 'Clicking the social tab displays social share buttons': (c) => {
+ c.click(shareToolbarButton);
+ c.waitForElementVisible(shareToolbar, TIME_LIMIT);
+ c.click(`${socialShareNav} a`);
+ c.waitForElementVisible('#social-share', TIME_LIMIT);
+ c.expect.element('#fb-share').to.be.present;
+ c.expect.element('#tw-share').to.be.present;
+ c.expect.element('#rd-share').to.be.present;
+ c.expect.element('#email-share').to.be.present;
+ },
+ after(c) {
+ c.end();
+ },
+};
diff --git a/e2e/features/social/share-test.js b/e2e/features/social/share-test.js
deleted file mode 100644
index e44991597..000000000
--- a/e2e/features/social/share-test.js
+++ /dev/null
@@ -1,49 +0,0 @@
-const reuseables = require('../../reuseables/skip-tour.js');
-const localSelectors = require('../../reuseables/selectors.js');
-
-const TIME_LIMIT = 10000;
-
-const {
- shareToolbar,
- shareToolbarButton,
- shareLinkInput,
-} = localSelectors;
-
-module.exports = {
- before(client) {
- reuseables.loadAndSkipTour(client, TIME_LIMIT);
- },
- 'Clicking the share link button opens the share dialog': (client) => {
- client.waitForElementVisible(shareToolbarButton, TIME_LIMIT);
- client.click(shareToolbarButton);
- client.waitForElementVisible(shareToolbar, TIME_LIMIT);
- client.expect.element(shareToolbar).to.be.present;
- },
- 'Share link clipboard with existing time query string param in the page url will have the same serialized time': (client) => {
- const queryString = '?t=2018-12-31';
- client.url(client.globals.url + queryString);
- client.waitForElementVisible(shareToolbarButton, TIME_LIMIT);
- client.click(shareToolbarButton);
- client.assert.urlContains('t=');
- client.assert.attributeContains(shareLinkInput, 'value', `${client.globals.url}?t=2018-12-31-T00%3A00%3A00Z`);
- },
- 'Share link clipboard with no time query string param in the page url will have the same serialized time (partial YYYY-MM-DD)': (client) => {
- reuseables.loadAndSkipTour(client, TIME_LIMIT);
- client.waitForElementVisible(shareToolbarButton, TIME_LIMIT);
- client.click(shareToolbarButton);
- let date = new Date();
- if (date.getUTCHours() < 3) {
- date = new Date(date.getTime() - 86400000);
- }
- const year = date.getUTCFullYear();
- const month = date.getUTCMonth() + 1;
- const day = date.getUTCDate();
- const monthText = month < 10 ? `0${month}` : month;
- const dayText = day < 10 ? `0${day}` : day;
- client.assert.not.urlContains('t=');
- client.assert.attributeContains(shareLinkInput, 'value', `t=${year}-${monthText}-${dayText}`);
- },
- after(client) {
- client.end();
- },
-};
diff --git a/e2e/reuseables/selectors.js b/e2e/reuseables/selectors.js
index 9698926f3..3ab2b5531 100644
--- a/e2e/reuseables/selectors.js
+++ b/e2e/reuseables/selectors.js
@@ -161,8 +161,10 @@ module.exports = {
infoToolbarButton: '#wv-info-button',
// share
- shareToolbar: '#toolbar_share_link',
+ shareToolbar: '#toolbar_share',
shareLinkInput: '#permalink-content-link',
+ shareEmbedInput: '#permalink-content-embed',
+ embedLinkButton: '#wv-embed-link-button',
// Location Search
locationSearchComponent: '.location-search-component',
diff --git a/web/css/embed.css b/web/css/embed.css
index 1788536a4..95d901e86 100644
--- a/web/css/embed.css
+++ b/web/css/embed.css
@@ -31,7 +31,7 @@
}
}
-#wv-embed-button {
+#wv-embed-link-button {
position: absolute;
z-index: 102;
top: 10px;
diff --git a/web/js/containers/embed.js b/web/js/containers/embed.js
index c650db052..551bec04b 100644
--- a/web/js/containers/embed.js
+++ b/web/js/containers/embed.js
@@ -32,7 +32,7 @@ class Embed extends React.Component {
renderEmbedLinkBtn() {
const { isMobile } = this.props;
- const buttonId = 'wv-embed-button';
+ const buttonId = 'wv-embed-link-button';
const labelText = 'Open new tab with content in Worldview';
return (
<Button
diff --git a/web/js/containers/share.js b/web/js/containers/share.js
index af4b9b1f5..f4886caa8 100644
--- a/web/js/containers/share.js
+++ b/web/js/containers/share.js
@@ -167,7 +167,7 @@ class ShareLinkContainer extends Component {
{SOCIAL_SHARE_TABS.map((type) => {
const navTitle = lodashStartCase(type);
const navDisabledMessage = `${navTitle} is not available when the current application features are in use.`;
- const navTitleClass = `${navTitle}-nav`;
+ const navTitleClass = `${type}-share-nav`;
return (
<NavItem key={type} className={navTitleClass}>
<NavLink
diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js
index 4c04b62ca..85c74803f 100644
--- a/web/js/containers/toolbar.js
+++ b/web/js/containers/toolbar.js
@@ -51,7 +51,7 @@ const CUSTOM_MODAL_PROPS = {
bodyComponent: Projection,
wrapClassName: 'toolbar_modal_outer toolbar_modal_outer',
},
- TOOLBAR_SHARE_LINK: {
+ TOOLBAR_SHARE: {
headerText: 'Share',
type: 'toolbar',
backdrop: false,
@@ -184,8 +184,8 @@ class toolbarContainer extends Component {
className="wv-toolbar-button"
aria-label={labelText}
onClick={() => openModal(
- 'TOOLBAR_SHARE_LINK',
- CUSTOM_MODAL_PROPS.TOOLBAR_SHARE_LINK,
+ 'TOOLBAR_SHARE',
+ CUSTOM_MODAL_PROPS.TOOLBAR_SHARE,
)}
>
{this.renderTooltip(buttonId, labelText)}