Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add social share e2e tests

Ed Plato36c4b9b1f413
diff --git a/e2e/features/social/share-test.js b/e2e/features/social/share-test.js
new file mode 100644
index 000000000..73d2e381b
--- /dev/null
+++ b/e2e/features/social/share-test.js
@@ -0,0 +1,44 @@
+const reuseables = require('../../reuseables/skip-tour.js');
+const localSelectors = require('../../reuseables/selectors.js');
+
+const TIME_LIMIT = 10000;
+
+const {
+ socialToolbar,
+ socialCopyLinkButton,
+ socialLinkInput,
+} = localSelectors;
+
+module.exports = {
+ before(client) {
+ reuseables.loadAndSkipTour(client, TIME_LIMIT);
+ },
+ 'Clicking the social link button opens the social share dialog': (client) => {
+ client.waitForElementVisible(socialCopyLinkButton, TIME_LIMIT);
+ client.click(socialCopyLinkButton);
+ client.pause(1000);
+ client.expect.element(socialToolbar).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(socialCopyLinkButton, TIME_LIMIT);
+ client.click(socialCopyLinkButton);
+ client.assert.urlContains('t=');
+ client.assert.attributeContains(socialLinkInput, '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(socialCopyLinkButton, TIME_LIMIT);
+ client.click(socialCopyLinkButton);
+ const date = new Date();
+ const year = date.getUTCFullYear();
+ const month = date.getUTCMonth() + 1;
+ const day = date.getUTCDate();
+ client.assert.not.urlContains('t=');
+ client.assert.attributeContains(socialLinkInput, 'value', `t=${year}-${month < 10 ? `0${month}` : month}-${day}`);
+ },
+ after(client) {
+ client.end();
+ },
+};
diff --git a/e2e/reuseables/selectors.js b/e2e/reuseables/selectors.js
index d069e4669..e4eab27f7 100644
--- a/e2e/reuseables/selectors.js
+++ b/e2e/reuseables/selectors.js
@@ -56,4 +56,9 @@ module.exports = {
// ui
uiInfoButton: '#wv-info-button',
+
+ // social
+ socialToolbar: '#toolbar_share_link',
+ socialCopyLinkButton: '#wv-link-button',
+ socialLinkInput: '#permalink_content',
};