Skip to content

Hydroshare Tests

Runs various smoke tests for the hydroshare.org

HydroshareSpamSuite

Bases: BaseTestSuite

Python unittest setup for health checks

Source code in hydroshare/hydroshare.py
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
class HydroshareSpamSuite(BaseTestSuite):
    """Python unittest setup for health checks"""

    vision_client = None

    def setUp(self):
        super(HydroshareSpamSuite, self).setUp()
        self.driver.get(BASE_URL)
        self.vision_client = vision.ImageAnnotatorClient()

    def send_record(self, data):
        if self.records == "aws":
            kinesis_record(
                SPAM_DATA_STREAM_CONFIG,
                SPAM_DATA_STREAM_NAME,
                "spam-user",
                data,
            )
        if self.records == "gcp":
            future = self.publisher.publish(
                self.publisher.topic_path("cuahsiqa", "spam-users"),
                json.dumps(data, ensure_ascii=False).encode("utf8"),
            )
            future.result()

    def test_C_000001(self):
        """
        Tries to identify potential spam resources (e.g., advertisements) on the
        SiteMap page.
        To do this, it collects all links to resources from the SiteMap page,
        and tests if a link text matches specific patterns (e.g., contains
        specific keywords, or parts of words, or simply general patterns, such
        as phone numbers).
        The test will simply print all suspicious resources to stdout, there are
        no assertions in it.
        """

        def check_links_against_patterns(links, patterns):
            resources = []
            # Compile a single regular expression that will match any individual
            # pattern from a given list of patterns, case-insensitive.
            # ( '|' is a special character in regular expressions. An expression
            # 'A|B' will match either 'A' or 'B' ).
            full_pattern = re.compile("|".join(patterns), re.IGNORECASE)
            for link in links:
                match = re.search(full_pattern, link.text)
                # Link text matches one of the patterns.
                if match is not None:
                    link_url = link.get_attribute("href")
                    match_text = match.group()
                    resources.append([link.text, match_text, link_url])

            return resources

        def print_formatted_result(detected_resources, classification):
            print(f"Found {len(detected_resources)} {classification} resources:\n")
            detected_resources = [
                f'"{item[0]}" (has word(s) "{item[1]}" '
                f"in text). Resource URL: {item[2]}"
                for item in detected_resources
            ]
            print("  * " + "\n  * ".join(detected_resources) + "\n\n")

        Home.to_sitemap(self.driver)
        links = SiteMap.get_resource_list(self.driver)
        print(
            f"\nThere are {len(links)} resources at HydroShare " f'"Site Map" page.\n'
        )

        spam_patterns = [
            "amazing",
            "business",
            "cheap[est]?",
            "credit[s]?",
            "customer[s]?",
            r"\bdeal[s]?\b",
            "phone number",
            "price",
            "4free",
            # US phone number format (1-[3 digits]-[3 digits]-[4 digits]
            # r'' is a 'raw' string (backslash symbol is treated as a literal
            # backslash).
            r"\d-[\d]{3}-[\d]{3}-[\d]{4}",
            "airline[s]?",
            "baggage",
            "booking",
            "flight[s]?",
            r"\breservation\b",
            "vacation[al]?",
            "ticket[s]?",
            r"\baccount\b",
            "antivirus",
            "cleaner",
            "cookies",
            "[e]?mail",
            "laptop",
            "password",
            "sign up",
            "sign in",
            "wi[-]?fi",
            # r'' is a 'raw' string (backslash symbol is treated as a literal
            # backslash).
            # '\b' stands for 'word boundary'.
            r"\bgoogle\b",
            "android",
            r"\bchrome\b",
            r"\bapple\b",
            "icloud",
            r"\bios\b",
            "iphone",
            r"\bmac\b",
            "macbook",
            "macos",
            "facebook",
            "microsoft",
            "internet explorer",
            "adult",
            "escort",
            "porn",
            "xxx",
        ]
        spam_resources = check_links_against_patterns(links, spam_patterns)
        print_formatted_result(spam_resources, classification="potential spam")

        # Not related to spam, but these are potentially useless resources.
        verifyme_patterns = [
            "hello",
            "hello world",
            "my first",
            "test resource",
            "untitled",
            r"\b123\b",
        ]
        # verifyme_resources = check_links_against_patterns(links, verifyme_patterns)
        # print_formatted_result(verifyme_resources, classification="potentially useless")

    def test_C_000002(self):
        """
        Tries to identify potential spam users, via user ID sweep.
        The test will simply print all suspicious resources to stdout, there are
        no assertions in it.
        """

        patterns = [
            "amazing",
            "business",
            "cheap[est]?",
            "credit[s]?",
            "customer[s]?",
            "deal[s]?",
            "phone number",
            "price",
            "4free",
            "airline[s]?",
            "baggage",
            "booking",
            "flight[s]?",
            r"\breservation\b",
            "vacation[al]?",
            "ticket[s]?",
            # r"\baccount\b",
            "antivirus",
            "cleaner",
            "cookies",
            # r"\b[e]?mail\b",
            "laptop",
            "password",
            "mail7d.com",
            "inbox-me.top",
            "smart-email.me",
            "best service",
            "SEO services",
            "sign up",
            "sign in",
            "wi[-]?fi",
            # r'' is a 'raw' string (backslash symbol is treated as a literal
            # backslash).
            # '\b' stands for 'word boundary'.
            # r"\bgoogle\b",
            "android",
            r"\bchrome\b",
            r"\bapple\b",
            " icloud ",
            r"\bios\b",
            "iphone",
            r" mac ",
            "macbook",
            "macos",
            # "facebook",
            "microsoft",
            "internet explorer",
            "adult",
            "escort",
            "porn",
            "xxx",
        ]
        profile_picture_flags = [
            "Lingerie top",
            "Brassiere",
            "Lingerie",
            "Undergarment",
            "Gun barrel",
            "Gun",
            "Food",
            "Trigger",
            "Drugs",
            "Drug",
            "Prescription",
            "Pills",
            "Pill bottle",
            "Pill",
        ]
        full_pattern = re.compile("|".join(patterns), re.IGNORECASE)

        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)

        for i in range(1708, 7746):
            TestSystem.to_url(self.driver, BASE_URL + "/user/{}/".format(i))
            if "User profile" in TestSystem.title(self.driver):
                data = Profile.get_data(self.driver)
                match = re.search(
                    full_pattern, json.dumps(Profile.get_data(self.driver))
                )
                profile_picture_match = False
                if data["profile_picture"] not in [None, ""]:
                    response = self.vision_client.label_detection(
                        image={
                            "source": {"image_uri": BASE_URL + data["profile_picture"]}
                        }
                    )
                    print(
                        i, [label.description for label in response.label_annotations]
                    )
                    if any(
                        [
                            label.description in profile_picture_flags
                            for label in response.label_annotations
                        ]
                    ):
                        profile_picture_match = True
                # Link text matches one of the patterns.
                if match is not None or profile_picture_match:
                    data["id"] = i
                    data["matches"] = str(match)
                    if data["profile_picture"] not in [None, ""]:
                        data["profile_picture_labels"] = ",".join(
                            [label.description for label in response.label_annotations]
                        )
                    else:
                        data["profile_picture_labels"] = ""
                    self.send_record(data)

test_C_000001()

Tries to identify potential spam resources (e.g., advertisements) on the SiteMap page. To do this, it collects all links to resources from the SiteMap page, and tests if a link text matches specific patterns (e.g., contains specific keywords, or parts of words, or simply general patterns, such as phone numbers). The test will simply print all suspicious resources to stdout, there are no assertions in it.

Source code in hydroshare/hydroshare.py
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
def test_C_000001(self):
    """
    Tries to identify potential spam resources (e.g., advertisements) on the
    SiteMap page.
    To do this, it collects all links to resources from the SiteMap page,
    and tests if a link text matches specific patterns (e.g., contains
    specific keywords, or parts of words, or simply general patterns, such
    as phone numbers).
    The test will simply print all suspicious resources to stdout, there are
    no assertions in it.
    """

    def check_links_against_patterns(links, patterns):
        resources = []
        # Compile a single regular expression that will match any individual
        # pattern from a given list of patterns, case-insensitive.
        # ( '|' is a special character in regular expressions. An expression
        # 'A|B' will match either 'A' or 'B' ).
        full_pattern = re.compile("|".join(patterns), re.IGNORECASE)
        for link in links:
            match = re.search(full_pattern, link.text)
            # Link text matches one of the patterns.
            if match is not None:
                link_url = link.get_attribute("href")
                match_text = match.group()
                resources.append([link.text, match_text, link_url])

        return resources

    def print_formatted_result(detected_resources, classification):
        print(f"Found {len(detected_resources)} {classification} resources:\n")
        detected_resources = [
            f'"{item[0]}" (has word(s) "{item[1]}" '
            f"in text). Resource URL: {item[2]}"
            for item in detected_resources
        ]
        print("  * " + "\n  * ".join(detected_resources) + "\n\n")

    Home.to_sitemap(self.driver)
    links = SiteMap.get_resource_list(self.driver)
    print(
        f"\nThere are {len(links)} resources at HydroShare " f'"Site Map" page.\n'
    )

    spam_patterns = [
        "amazing",
        "business",
        "cheap[est]?",
        "credit[s]?",
        "customer[s]?",
        r"\bdeal[s]?\b",
        "phone number",
        "price",
        "4free",
        # US phone number format (1-[3 digits]-[3 digits]-[4 digits]
        # r'' is a 'raw' string (backslash symbol is treated as a literal
        # backslash).
        r"\d-[\d]{3}-[\d]{3}-[\d]{4}",
        "airline[s]?",
        "baggage",
        "booking",
        "flight[s]?",
        r"\breservation\b",
        "vacation[al]?",
        "ticket[s]?",
        r"\baccount\b",
        "antivirus",
        "cleaner",
        "cookies",
        "[e]?mail",
        "laptop",
        "password",
        "sign up",
        "sign in",
        "wi[-]?fi",
        # r'' is a 'raw' string (backslash symbol is treated as a literal
        # backslash).
        # '\b' stands for 'word boundary'.
        r"\bgoogle\b",
        "android",
        r"\bchrome\b",
        r"\bapple\b",
        "icloud",
        r"\bios\b",
        "iphone",
        r"\bmac\b",
        "macbook",
        "macos",
        "facebook",
        "microsoft",
        "internet explorer",
        "adult",
        "escort",
        "porn",
        "xxx",
    ]
    spam_resources = check_links_against_patterns(links, spam_patterns)
    print_formatted_result(spam_resources, classification="potential spam")

    # Not related to spam, but these are potentially useless resources.
    verifyme_patterns = [
        "hello",
        "hello world",
        "my first",
        "test resource",
        "untitled",
        r"\b123\b",
    ]

test_C_000002()

Tries to identify potential spam users, via user ID sweep. The test will simply print all suspicious resources to stdout, there are no assertions in it.

Source code in hydroshare/hydroshare.py
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
def test_C_000002(self):
    """
    Tries to identify potential spam users, via user ID sweep.
    The test will simply print all suspicious resources to stdout, there are
    no assertions in it.
    """

    patterns = [
        "amazing",
        "business",
        "cheap[est]?",
        "credit[s]?",
        "customer[s]?",
        "deal[s]?",
        "phone number",
        "price",
        "4free",
        "airline[s]?",
        "baggage",
        "booking",
        "flight[s]?",
        r"\breservation\b",
        "vacation[al]?",
        "ticket[s]?",
        # r"\baccount\b",
        "antivirus",
        "cleaner",
        "cookies",
        # r"\b[e]?mail\b",
        "laptop",
        "password",
        "mail7d.com",
        "inbox-me.top",
        "smart-email.me",
        "best service",
        "SEO services",
        "sign up",
        "sign in",
        "wi[-]?fi",
        # r'' is a 'raw' string (backslash symbol is treated as a literal
        # backslash).
        # '\b' stands for 'word boundary'.
        # r"\bgoogle\b",
        "android",
        r"\bchrome\b",
        r"\bapple\b",
        " icloud ",
        r"\bios\b",
        "iphone",
        r" mac ",
        "macbook",
        "macos",
        # "facebook",
        "microsoft",
        "internet explorer",
        "adult",
        "escort",
        "porn",
        "xxx",
    ]
    profile_picture_flags = [
        "Lingerie top",
        "Brassiere",
        "Lingerie",
        "Undergarment",
        "Gun barrel",
        "Gun",
        "Food",
        "Trigger",
        "Drugs",
        "Drug",
        "Prescription",
        "Pills",
        "Pill bottle",
        "Pill",
    ]
    full_pattern = re.compile("|".join(patterns), re.IGNORECASE)

    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)

    for i in range(1708, 7746):
        TestSystem.to_url(self.driver, BASE_URL + "/user/{}/".format(i))
        if "User profile" in TestSystem.title(self.driver):
            data = Profile.get_data(self.driver)
            match = re.search(
                full_pattern, json.dumps(Profile.get_data(self.driver))
            )
            profile_picture_match = False
            if data["profile_picture"] not in [None, ""]:
                response = self.vision_client.label_detection(
                    image={
                        "source": {"image_uri": BASE_URL + data["profile_picture"]}
                    }
                )
                print(
                    i, [label.description for label in response.label_annotations]
                )
                if any(
                    [
                        label.description in profile_picture_flags
                        for label in response.label_annotations
                    ]
                ):
                    profile_picture_match = True
            # Link text matches one of the patterns.
            if match is not None or profile_picture_match:
                data["id"] = i
                data["matches"] = str(match)
                if data["profile_picture"] not in [None, ""]:
                    data["profile_picture_labels"] = ",".join(
                        [label.description for label in response.label_annotations]
                    )
                else:
                    data["profile_picture_labels"] = ""
                self.send_record(data)

HydroshareTestSuite

Bases: BaseTestSuite

Python unittest setup for functional tests

Source code in hydroshare/hydroshare.py
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
class HydroshareTestSuite(BaseTestSuite):
    """Python unittest setup for functional tests"""

    def setUp(self):
        super(HydroshareTestSuite, self).setUp()
        self.driver.get(BASE_URL)

    def test_B_000001(self):
        """
        When creating a resource, ensure all resource types have a "Cancel"
        button available, so that they are not forced to finish creating a resource
        if they don't actually want one or if they made a mistake
        """
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        resource_types = [
            "CompositeResource",
            "CollectionResource",
            "ToolResource",
        ]
        for resource_type in resource_types:
            Home.create_resource(self.driver, resource_type)
            NewResource.configure(self.driver, "TEST TITLE")
            NewResource.cancel(self.driver)

    def test_B_000003(self):
        """
        Confirms the Beaver Divide Air Temperature example resource landing page is
        online via navigation and title check, then downloads the BagIt
        archive to make sure it downloads successfully
        """
        LandingPage.to_discover(self.driver)
        Discover.add_filters(
            self.driver,
            author="Castronova, Anthony",
            resource_type="Composite",
            availability=["discoverable", "public"],
        )
        Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
        Resource.download_bagit(self.driver)
        self.assertTrue(Downloads.check_successful_download_new_tab(self.driver))

    def test_B_000005(self):
        """
        Confirms user passwords can be changed, and then changed back
        to the original value, using the Profile interface
        """
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_profile(self.driver)
        Profile.to_editor(self.driver)
        Profile.reset_password(self.driver, PASSWORD, PASSWORD + "test")
        Profile.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD + "test")
        Home.to_profile(self.driver)
        Profile.to_editor(self.driver)
        Profile.reset_password(self.driver, PASSWORD + "test", PASSWORD)
        Profile.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)

    def test_B_000006(self):
        """
        Confirms the sorting behavior on the Discover page (both sort
        direction and sort field) functions correctly, as evaluated by a few
        of the first rows being ordered correctly
        """
        LandingPage.to_discover(self.driver)
        Discover.add_filters(
            self.driver,
            availability=["published"],
        )  # remove once long delay issue is fixed
        orderings = [
            {
                "name": "First Author",
                "column": 3,
            },
            {
                "name": "Date Created",
                "column": 4,
            },
            {
                "name": "Last Modified",
                "column": 5,
            },
        ]
        for ordering in orderings:
            Discover.set_sort(self.driver, ordering["column"])
            TestSystem.wait()  # remove once long delay issue is fixed
            self.assertTrue(
                Discover.check_sorting_multi(self.driver, ordering["name"], "Ascending")
            )
            Discover.set_sort(self.driver, ordering["column"])
            TestSystem.wait()  # remove once long delay issue is fixed
            self.assertTrue(
                Discover.check_sorting_multi(
                    self.driver, ordering["name"], "Descending"
                )
            )

    def test_B_000007(self):
        """
        Confirms all apps have an associated resource page which is
        correctly linked and correctly listed within the app info on the
        apps page
        """
        TestSystem.to_url(self.driver, BASE_URL + "/apps/")
        apps_count = Apps.get_count(self.driver)
        for i in range(1, apps_count + 1):  # xpath start at 1
            app_name = Apps.get_title(self.driver, i)
            Apps.show_info(self.driver, i)
            Apps.to_resource(self.driver, i)
            resource_title = Resource.get_title(self.driver)
            self.assertIn(app_name, resource_title)
            TestSystem.back(self.driver)

    def test_B_000008(self):
        """
        Checks all HydroShare Help links lead to valid pages
        and that the topic title words come up in the associated help page
        """
        LandingPage.to_help(self.driver)
        core_count = Help.get_core_count(self.driver)
        core_topics = [
            Help.get_core_topic(self.driver, i + 1) for i in range(0, core_count)
        ][
            :-3
        ]  # Last three topics include mailto: contact emails
        for ind, core_topic in enumerate(core_topics, 1):  # xpath ind start at 1
            Help.open_core(self.driver, ind)
            words_string = re.sub("[^A-Za-z]", " ", core_topic)
            matches = [
                word in HelpArticle.get_title(self.driver)
                for word in words_string.split(" ")
            ]
            self.assertTrue(True in matches)
            HelpArticle.to_help_breadcrumb(self.driver)

    def test_B_000009(self):
        """
        Confirms the basic get methods within hydroshare api do not return
        errors.  These basic get methods are accessible from the Swagger UI and
        use just a resource id required parameter
        """
        resource_id = "54ae2ade31f646d097d78ef0695bb36c"
        endpoints = [
            {"id": "operations-resource-resource_read", "resource_param_ind": 1},
            {
                "id": "operations-resource-resource_file_list_list",
                "resource_param_ind": 3,
            },
            {
                "id": "operations-resource-resource_files_list",
                "resource_param_ind": 3,
            },
            {"id": "operations-resource-resource_map_list", "resource_param_ind": 1},
            {
                "id": "operations-resource-resource_scimeta_list",
                "resource_param_ind": 1,
            },
            {
                "id": "operations-resource-resource_scimeta_elements_read",
                "resource_param_ind": 1,
            },
            {
                "id": "operations-resource-resource_sysmeta_list",
                "resource_param_ind": 1,
            },
        ]

        TestSystem.to_url(self.driver, "{}/hsapi/".format(BASE_URL))
        for endpoint in endpoints:
            API.toggle_endpoint(self.driver, endpoint["id"])
            API.try_endpoint(self.driver)
            API.set_parameter(self.driver, endpoint["resource_param_ind"], resource_id)
            API.execute_request(self.driver)
            response_code = API.get_response_code(self.driver)
            self.assertEqual(response_code, "200")
            API.toggle_endpoint(self.driver, endpoint["id"])

    def test_B_000010(self):
        """
        Confirms the basic get methods within hydroshare api, which require
        no parameters, can be ran through the Swagger UI
        """
        endpoints = [
            "operations-resource-resource_content_types_list",
            "operations-resource-resource_types_list",
            "operations-user-user_list",
            "operations-userInfo-userInfo_list",
        ]
        TestSystem.to_url(self.driver, "{}/hsapi/".format(BASE_URL))
        for endpoint in endpoints:
            API.toggle_endpoint(self.driver, endpoint)
            API.try_endpoint(self.driver)
            API.execute_request(self.driver)
            response_code = API.get_response_code(self.driver)
            self.assertEqual(response_code, "200")
            API.toggle_endpoint(self.driver, endpoint)

    def test_B_000011(self):
        """
        Check Hydroshare About policy pages to confirm link titles, content titles, and page titles all align
        """
        LandingPage.to_about(self.driver)
        About.toggle_tree(self.driver)
        About.toggle_tree(self.driver)
        About.expand_tree_top(self.driver, "Policies")
        policies = [
            "HydroShare Publication Agreement",
            "Quota",
            "Statement of Privacy",
            "Terms of Use",
        ]
        for policy in policies:
            About.open_policy(self.driver, policy)
            article_title = About.get_title(self.driver)
            webpage_title = TestSystem.title(self.driver)
            self.assertIn(policy, article_title)
            self.assertIn(policy, webpage_title)

    def test_B_000012(self):
        """
        Confirm footer links redirect to valid pages and are available
        at the bottom of a sample of pages
        """
        LandingPage.to_terms(self.driver)
        terms_title = HelpArticle.get_title(self.driver)
        self.assertIn("terms of use", terms_title.lower())
        HelpArticle.to_privacy(self.driver)
        privacy_title = HelpArticle.get_title(self.driver)
        self.assertIn("statement of privacy", privacy_title.lower())
        HelpArticle.to_sitemap(self.driver)
        self.assertNotIn("Page not found", TestSystem.title(self.driver))

    def test_B_000013(self):
        """
        Confirms clean removal, then readdition, of user organizations using
        the user profile interface
        """
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_profile(self.driver)
        Profile.to_editor(self.driver)
        Profile.delete_organization(self.driver, 2)
        Profile.delete_organization(self.driver, 1)
        Profile.add_organization(self.driver, "Freie Universität Berlin")
        Profile.add_organization(self.driver, "Agricultural University of Warsaw")
        Profile.save_changes(self.driver)
        page_tip = Profile.page_tip.get_text(self.driver)
        self.assertEqual(
            "Your profile has been successfully updated.",
            page_tip,
        )

    def test_B_000014(self):
        """
        Confirms ability to create HydroShare groups through the standard
        GUI workflow
        """
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_collaborate(self.driver)
        Collaborate.to_groups(self.driver)
        group_name = "QA Test Group {}".format(random.randint(1, 1000000))
        Groups.create_group(
            self.driver,
            name=group_name,
            purpose="1230!@#$%^&*()-=_+<{[QA TEST]}>.,/",
            about="Über Die Gruppe",
            privacy="private",
        )
        new_group_name = Group.check_title(self.driver)
        self.assertEqual(group_name, new_group_name)

    def test_B_000015(self):
        """
        Confirms the resource landing page "Open With" works, in the case of JupyterHub
        """
        LandingPage.to_discover(self.driver)
        Discover.add_filters(self.driver, owner="Castronova, Anthony")
        Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
        Resource.open_with_jupyterhub(self.driver)
        webpage_title = TestSystem.title(self.driver)
        self.assertNotIn("Page not found", webpage_title)

    def test_B_000016(self):
        """
        Create a basic resource without any files and confirm that the resulting
        resource landing page is OK
        """
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Test Resource")
        NewResource.create(self.driver)
        Resource.view(self.driver)
        resource_title = Resource.get_title(self.driver)
        self.assertEqual("Test Resource", resource_title)

    def test_B_000017(self):
        """
        Confirm resource type filters can be applied in My Resources
        """
        options = [
            "Collection",
            "Composite Resource",
            "Generic",
            "Geographic Feature",
            "Geographic Raster",
            "HIS Referenced",
            "Model Instance",
            "Model Program",
            "MODFLOW",
            "Multidimensional",
            "Script Resource",
            "Swat Model Instance",
            "Time Series",
            "Web App",
        ]
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_my_resources(self.driver)
        MyResources.search_resource_type(self.driver)
        for option in options:
            MyResources.search_type(self.driver, option)
            page_title = TestSystem.title(self.driver)
            self.assertIn("My Resources", page_title)

    def test_B_000018(self):
        """
        Use My Resources search bar filters and non-ASCII characters, in
        order to verify filter usability for non-English resources
        """
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_my_resources(self.driver)
        MyResources.search_resource_type(self.driver)

        self.assertNotIn("[type:", MyResources.read_searchbar(self.driver))
        MyResources.search_type(self.driver, "Web App")
        self.assertIn("[type:", MyResources.read_searchbar(self.driver))
        self.assertNotIn("[author:", MyResources.read_searchbar(self.driver))
        MyResources.search_author(self.driver, "Über")
        self.assertIn("[author:Über", MyResources.read_searchbar(self.driver))
        self.assertNotIn("[subject:", MyResources.read_searchbar(self.driver))
        MyResources.search_subject(self.driver, "Über")
        self.assertIn("[subject:Über", MyResources.read_searchbar(self.driver))

        self.assertIn("[type:", MyResources.read_searchbar(self.driver))
        self.assertIn("[author:Über", MyResources.read_searchbar(self.driver))
        self.assertIn("[subject:Über", MyResources.read_searchbar(self.driver))

        MyResources.clear_search(self.driver)

        self.assertNotIn("[type:", MyResources.read_searchbar(self.driver))
        self.assertNotIn("[author:", MyResources.read_searchbar(self.driver))
        self.assertNotIn("[subject:", MyResources.read_searchbar(self.driver))

        MyResources.search_resource_type(self.driver)
        MyResources.search_type(self.driver, "Web App")
        MyResources.search_author(self.driver, "Über")
        MyResources.search_subject(self.driver, "Über")
        MyResources.clear_author_search(self.driver)
        self.assertNotIn("[author:", MyResources.read_searchbar(self.driver))
        MyResources.clear_subject_search(self.driver)
        self.assertNotIn("[subject:", MyResources.read_searchbar(self.driver))
        MyResources.search_type(self.driver, "All")

        self.assertNotIn("[type:", MyResources.read_searchbar(self.driver))
        self.assertNotIn("[author:", MyResources.read_searchbar(self.driver))
        self.assertNotIn("[subject:", MyResources.read_searchbar(self.driver))

    def test_B_000019(self):
        """
        Create a new resources label and verify it can be added to existing
        resources on the My Resources page
        """
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_my_resources(self.driver)
        MyResources.create_label(self.driver, "Test")
        MyResources.toggle_label(self.driver, "Test")
        self.assertTrue(MyResources.check_label_applied(self.driver))
        MyResources.toggle_label(self.driver, "Test")
        self.assertFalse(MyResources.check_label_applied(self.driver))
        MyResources.delete_label(self.driver)

    def hold_test_B_000021(self):  # BROKEN DUE TO HYDROSHARE JS FRAMEWORK USE
        """
        Confirm the ability to upload a CV file within the profile interface
        """
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_profile(self.driver)
        Profile.to_editor(self.driver)
        Profile.upload_cv(
            self.driver,
            "https://www.bu.edu/careers/files/2012/08/Resume-Guide-2012.pdf",
        )
        Profile.save_changes(self.driver)
        num_windows_now = len(self.driver.window_handles)
        Profile.view_cv(self.driver)
        External.to_file(self.driver, num_windows_now, "cv-test")
        self.assertTrue("cv-test" in TestSystem.title(self.driver))
        External.switch_old_page(self.driver)
        External.close_new_page(self.driver)
        Profile.to_editor(self.driver)
        Profile.delete_cv(self.driver)

    def hold_test_B_000022(self):  # BROKEN DUE TO HYDROSHARE JS FRAMEWORK USE
        """
        Confirm profile image upload and removal works, within the profile page
        """
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_profile(self.driver)
        Profile.to_editor(self.driver)
        urlretrieve(
            "http://www.bu.edu/emd/files/2017/03/rhett_alone1.jpg", "profile.jpg"
        )
        cwd = os.getcwd()
        profile_img_path = os.path.join(cwd, "profile.jpg")
        Profile.add_photo(self.driver, profile_img_path)
        Profile.save_changes(self.driver)
        self.assertTrue(Profile.confirm_photo_uploaded(self.driver, "profile"))
        os.remove(profile_img_path)
        Profile.to_editor(self.driver)
        Profile.remove_photo(self.driver)
        self.assertFalse(Profile.confirm_photo_uploaded(self.driver, "profile"))

    def test_B_000023(self):
        """
        Ensure that the user links within a resource landing page redirect to
        the associated user landing page, and that the contribution counts in
        the resulting page are summed correctly
        """
        LandingPage.to_discover(self.driver)
        Discover.add_filters(self.driver, owner="Castronova, Anthony")
        Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
        Discover.to_last_updated_profile(self.driver)
        Profile.view_contributions(self.driver)
        resource_types_count = Profile.get_resource_type_count(self.driver)
        contribution_counts = []
        contributions_list_length = Profile.get_contributions_list_length(self.driver)
        for i in range(0, resource_types_count):
            Profile.view_contribution_type(self.driver, i)
            contribution_counts.append(
                Profile.get_contribution_type_count(self.driver, i)
            )
        self.assertEqual(sum(contribution_counts[1:]), contributions_list_length)
        self.assertEqual(
            contribution_counts[0],  # count for "All"
            sum(contribution_counts[1:]),  # count for the rest
        )

    def test_B_000024(self):
        """Verify the ability to extend metadata on resource landing pages"""
        name_ex = "name_ex"
        value_ex = "value_ex"
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Test Metadata")
        NewResource.create(self.driver)
        Resource.view(self.driver)
        Resource.edit(self.driver)
        Resource.add_metadata(self.driver, name_ex, value_ex)
        Resource.exists_name(self.driver, name_ex)
        Resource.exists_value(self.driver, value_ex)

    def test_B_000026(self):
        """Confirm that the home page slider is functional"""
        images = [
            'background-image: url("/static/img/home-page/carousel/bg1.jpg");',
            'background-image: url("/static/img/home-page/carousel/bg2.JPG");',
            'background-image: url("/static/img/home-page/carousel/bg3.jpg");',
        ]
        LandingPage.scroll_to_button(self.driver)
        LandingPage.scroll_to_top(self.driver)
        for i in range(0, 5):
            LandingPage.slide_hero_left(self.driver)
            self.assertTrue(LandingPage.hero_has_valid_img(self.driver, images))

    def test_B_000027(self):
        """
        Confirm that the MyResources and Discover pages have the same labels and
        resources listed in their legends
        """
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_my_resources(self.driver)
        my_resource_legend = MyResources.legend_text(self.driver)
        MyResources.to_discover(self.driver)
        discover_legend = Discover.legend_text(self.driver)
        self.assertEqual(my_resource_legend, discover_legend)

    def test_B_000028(self):
        """
        Checks that the each social media account is accessible from
        the links in the footer
        """
        socials = ["twitter", "facebook", "youtube", "github", "linkedin"]
        expected_links = {
            "facebook": "https://www.facebook.com/pages/CUAHSI-Consortium-"
            "of-Universities-for-the-Advancement-of-Hydrologic-"
            "Science-Inc/179921902590",
            "twitter": "http://twitter.com/cuahsi",
            "youtube": "https://www.youtube.com/user/CUAHSI",
            "github": "http://github.com/hydroshare",
            "linkedin": "https://www.linkedin.com/company/2632114",
        }
        for social in socials:
            self.assertEqual(
                expected_links[social],
                LandingPage.get_social_link(self.driver, social),
            )

    def test_B_000029(self):
        """Commenting requires a login, and redirect works as expected"""
        LandingPage.to_discover(self.driver)
        Discover.search(self.driver, "DeBuhr")
        Discover.add_filters(self.driver, owner="DeBuhr, Neal")
        Discover.to_resource(
            self.driver, "Beaver Divide Air Temperature - Further Development"
        )
        initial_comment_count = Resource.get_comment_count(self.driver)
        Resource.add_comment(self.driver, "Test Comment")
        self.assertIn("Please log in", Login.get_notification(self.driver))
        Login.login(self.driver, USERNAME, PASSWORD)
        Resource.add_comment(self.driver, "Test Comment")
        final_comment_count = Resource.get_comment_count(self.driver)
        self.assertTrue(initial_comment_count < final_comment_count)

    def test_B_000031(self):
        """Confirm that resources can be accessed from the sitemap links"""
        LandingPage.to_sitemap(self.driver)
        SiteMap.select_resource(self.driver, "Beaver Divide Air Temperature - Demo")
        self.assertIn(
            "Beaver Divide Air Temperature - Demo", TestSystem.title(self.driver)
        )
        TestSystem.back(self.driver)
        SiteMap.select_resource(self.driver, "Beaver Divide Air Temperature - Demo")
        self.assertIn(
            "Beaver Divide Air Temperature - Demo", TestSystem.title(self.driver)
        )
        TestSystem.back(self.driver)

    def test_B_000032(self):
        """Confirm that the hydroshare footer version number matches up with the
        latest version number in GitHub"""
        displayed_release_version = LandingPage.get_version(self.driver)
        expected_release_version = LandingPage.get_latest_release(
            GITHUB_ORG, GITHUB_REPO
        )
        self.assertEqual(expected_release_version, displayed_release_version)

    def test_B_000033(self):
        """Ensure Discover page refresh clears all filters"""
        LandingPage.to_discover(self.driver)
        Discover.add_filters(
            self.driver,
            author="Myers, Jessie",
            contributor="Cox, Chris",
            owner="Christopher, Adrian",
            subject="USACE Corps Water Management System (CWMS)",
            availability="public",
        )
        TestSystem.refresh(self.driver)
        TestSystem.wait(3)
        self.assertFalse(Discover.is_selected(self.driver, author="Myers, Jessie"))
        self.assertFalse(Discover.is_selected(self.driver, contributor="Cox, Chris"))
        self.assertFalse(Discover.is_selected(self.driver, owner="Christopher, Adrian"))
        self.assertFalse(
            Discover.is_selected(
                self.driver, subject="USACE Corps Water Management System (CWMS)"
            )
        )
        self.assertFalse(Discover.is_selected(self.driver, availability="public"))

    def test_B_000034(self):
        """Basic navigation to home/dashboard"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.toggle_get_started(self.driver)
        visibility = [Home.is_get_started_showing(self.driver)]
        Home.toggle_get_started(self.driver)
        visibility += [Home.is_get_started_showing(self.driver)]
        Home.to_home(self.driver)
        self.assertNotEqual(visibility[0], visibility[1])

    def test_B_000035(self):
        """Ensure registration prompts for Organization entry"""
        LandingPage.to_registration(self.driver)
        Registration.signup_user(
            self.driver,
            first_name="Jane",
            last_name="Doe",
            email="jane.doe.123@example.com",
            username="jdoe123",
            password="mypass",
        )
        error_text = Registration.check_error(self.driver)
        self.assertIn("Organization", error_text)

    def test_B_000036(self):
        """Ensure Correct Web apps show in Open With"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "ToolResource")
        NewResource.configure(self.driver, "TEST Web App")
        NewResource.create(self.driver)
        WebApp.support_resource_type(self.driver, "CompositeResource")
        WebApp.set_app_launching_url(self.driver, "https://www.hydroshare.org")
        WebApp.view(self.driver)
        WebApp.add_to_open_with(self.driver)
        WebApp.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "TEST Web App Composite")
        NewResource.create(self.driver)
        Resource.view(self.driver)
        Resource.open_with_by_title(self.driver, "TEST Web App")

    def test_B_000038(self):
        """Ensure invalid logins generate a helpful error message"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, "Invalid", "Invalid")
        self.assertIn("username", Login.get_login_error(self.driver))
        self.assertIn("password", Login.get_login_error(self.driver))
        Login.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.toggle_get_started(self.driver)
        Home.toggle_get_started(self.driver)

    def test_B_000039(self):
        """Ensure pre-login My Resources redirects to My Resources after login"""
        LandingPage.to_my_resources(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        MyResources.enter_search(self.driver, "Search bar text")

    def test_B_000040(self):
        """Ensure invalid login messages are identical"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, "Invalid")
        self.assertIn(
            "Invalid username/email and password", Login.get_login_error(self.driver)
        )
        Login.to_login(self.driver)
        Login.login(self.driver, "Invalid", PASSWORD)
        self.assertIn(
            "Invalid username/email and password", Login.get_login_error(self.driver)
        )
        Login.to_login(self.driver)
        Login.login(self.driver, "Invalid", "Invalid")
        self.assertIn(
            "Invalid username/email and password", Login.get_login_error(self.driver)
        )
        Login.to_login(self.driver)

    def test_B_000041(self):
        """Update profile About information"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_profile(self.driver)
        Profile.to_editor(self.driver)
        Profile.update_about(
            self.driver, "// TODO My Profile Description", "United States", "New York"
        )
        Profile.save_changes(self.driver)

    def test_B_000046(self):
        """Ensure clicking the Hydroshare logo links back to the home page"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_profile(self.driver)
        Profile.to_landing_page(self.driver)
        LandingPage.slide_hero_right(self.driver)

    def test_B_000047(self):
        """Ensure DEBUG=false for production hydroshare.org"""
        TestSystem.to_url(
            self.driver, "https://www.hydroshare.org/landingPageDoesNotExist/"
        )
        LandingPage.to_landing_page(self.driver)

    def test_B_000048(self):
        """Ensure pre-login My Groups redirects to My Groups after login"""
        LandingPage.to_collaborate(self.driver)
        Collaborate.to_groups(self.driver)
        Groups.to_my_groups(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        self.assertEqual("My Groups", Groups.get_title(self.driver))

    def test_B_000049(self):
        """Ensure user can logout after logging in"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.logout(self.driver)
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.logout(self.driver)

    def test_B_000050(self):
        """Ensure the support email mailto is in the site footer"""
        self.assertEqual(
            "mailto:help@cuahsi.org", LandingPage.get_support_email(self.driver)
        )

    def test_B_000051(self):
        """Ensure all Getting Started links open correctly, and in the same tab"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        for row in [1, 2]:
            for column in [1, 2, 3]:
                Home.check_getting_started_link(self.driver, row, column)
                Hydroshare.to_landing_page(self.driver)
                TestSystem.wait()
                TestSystem.back(self.driver)
                TestSystem.wait()
                TestSystem.back(self.driver)

    def test_B_000052(self):
        """Verify Recently Visited resources and authors link to valid pages"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        recent_activity_len = Home.get_recent_activity_length(self.driver)
        for i in range(1, recent_activity_len + 1):
            link_title, resource_title = Home.check_recent_activity_resource(
                self.driver, i
            )
            self.assertEqual(link_title, resource_title)
        for i in range(1, recent_activity_len + 1):
            link_author, profile_author = Home.check_recent_activity_author(
                self.driver, i
            )
            for word in [profile_author.split(" ")[0], profile_author.split(" ")[-1]]:
                self.assertIn(word, link_author)

    def test_B_000053(self):
        """Ensure private resources are not shown for anonymous viewers on the contributions profile page"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_profile(self.driver)
        Profile.view_contributions(self.driver)
        initial_count = Profile.get_contribution_type_count(self.driver, 0)
        Profile.to_home(self.driver)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Private Contributions Test Resource")
        NewResource.create(self.driver)
        NewResource.to_profile(self.driver)
        Profile.view_contributions(self.driver)
        incremented_count = Profile.get_contribution_type_count(self.driver, 0)
        self.assertTrue(initial_count + 1 == incremented_count)
        Resource.logout(self.driver)
        TestSystem.to_url(self.driver, BASE_URL + "/user/3887/")
        Profile.view_contributions(self.driver)
        public_count = Profile.get_contribution_type_count(self.driver, 0)
        self.assertTrue(public_count < initial_count)

    def test_B_000055(self):
        """Verify featured apps featured on the dashboard link correctly"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        # JupyterHub
        Home.to_app(self.driver, "Featured", 1)
        self.assertIn("JupyterHub", TestSystem.title(self.driver))
        External.switch_old_page(self.driver)
        External.close_new_page(self.driver)
        # MATLAB Online
        Home.to_app(self.driver, "Featured", 2)
        External.switch_old_page(self.driver)
        External.close_new_page(self.driver)

    def hold_test_B_000056(self):
        """Verify featured apps featured on the dashboard link correctly"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        # JupyterHub
        Home.to_app(self.driver, "Featured", 1)
        self.assertIn("JupyterHub", TestSystem.title(self.driver))
        External.switch_old_page(self.driver)
        External.close_new_page(self.driver)
        # MATLAB Online
        Home.to_app(self.driver, "Featured", 2)
        Login.login(self.driver, USERNAME, PASSWORD)
        TestSystem.wait(30)
        MatlabOnline.authorize(self.driver)
        TestSystem.wait(30)
        self.assertIn("MATLAB Online", TestSystem.title(self.driver))
        External.switch_old_page(self.driver)
        External.close_new_page(self.driver)

    def test_B_000057(self):
        """Verify CUAHSI apps mentioned on the dashboard link correctly"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        cuahsi_apps = ["HydroClient", "HydroServerTools"]
        for i in range(0, 2):
            Home.to_app(self.driver, "CUAHSI", i + 1)
            self.assertIn(cuahsi_apps[i], TestSystem.title(self.driver))
            External.switch_old_page(self.driver)
            External.close_new_page(self.driver)

    def test_B_000058(self):
        """Confirm My Resources table title and author links redirect to reasonable pages"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Linking Test Resource")
        NewResource.create(self.driver)
        Resource.to_my_resources(self.driver)
        MyResources.to_resource_from_table(self.driver, 1)
        self.assertIn("Linking Test Resource", TestSystem.title(self.driver))
        TestSystem.back(self.driver)
        MyResources.to_author_from_table(self.driver, 1)
        self.assertIn("User profile", TestSystem.title(self.driver))
        TestSystem.back(self.driver)

    def test_B_000059(self):
        """Confirm favorite star/unstar/filter works on MyResources"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Favorite Resource Test")
        NewResource.create(self.driver)
        Resource.to_my_resources(self.driver)
        MyResources.favorite_resource(self.driver, 1)
        # "Owned by me filter", which is default checked
        MyResources.filter_table(self.driver, "owned")
        # Should still be visible, because it is favorited
        MyResources.favorite_resource(self.driver, 1)
        MyResources.filter_table(self.driver, "owned")

    def test_B_000060(self):
        """Ensure new resources are default private"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Private Test Resource")
        NewResource.create(self.driver)
        Resource.to_my_resources(self.driver)
        resource_href = MyResources.get_resource_link(self.driver, 1)
        Resource.logout(self.driver)
        TestSystem.to_url(self.driver, resource_href)
        self.assertFalse(Resource.has_visible_forms(self.driver))
        Home.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        TestSystem.to_url(self.driver, resource_href)
        self.assertIn("Private Test Resource", TestSystem.title(self.driver))

    def test_B_000064(self):
        """Ensure title renders properly for a sample of resources"""
        Home.to_sitemap(self.driver)
        links = SiteMap.get_resource_list(self.driver)
        print(len(links))
        for i in range(0, len(links), 761):
            SiteMap.select_resource_by_index(self.driver, i)
            self.assertTrue(len(Resource.get_title(self.driver)) > 0)
            print(Resource.get_title(self.driver))
            TestSystem.back(self.driver)

    def test_B_000073(self):
        """Adding and removing a resource reference works properly"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Resource Reference Test")
        NewResource.create(self.driver)
        Resource.view(self.driver)
        Resource.edit(self.driver)
        Resource.add_reference(self.driver, "First Principles")
        Resource.delete_reference(self.driver)
        Resource.add_reference(self.driver, "First Principles")
        Resource.delete_reference(self.driver)

    def test_B_000075(self):
        """Confirm making a resource public requires the prerequisite metadata to be filled out
        and that the notice about this stays visible in view and edit modes"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Making Resource Public Test")
        NewResource.create(self.driver)
        Resource.view(self.driver)
        Resource.edit(self.driver)
        Resource.populate_abstract(self.driver, "// TODO Abstract")
        Resource.view(self.driver)
        Resource.edit(self.driver)
        Resource.is_visible_public_resource_notice(self.driver)
        Resource.add_subject_keyword(self.driver, "keyphrase multiple words")
        Resource.view(self.driver)
        Resource.is_visible_public_resource_notice(self.driver)

    def test_B_000085(self):
        """Copy a resource"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_discover(self.driver)
        Discover.add_filters(
            self.driver,
            author="Castronova, Anthony",
            resource_type="Composite",
            availability=["discoverable", "public"],
        )
        Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
        Discover.clear_notifications(self.driver)
        Resource.copy_resource(self.driver)
        TestSystem.wait(20)
        Resource.use_notification_link(self.driver, 1)
        Resource.edit(self.driver)
        Resource.view(self.driver)
        self.assertTrue(
            "Beaver Divide Air Temperature" in Resource.get_title(self.driver)
        )

    def test_B_000086(self):
        """Confirm basic resource versioning"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_discover(self.driver)
        Discover.add_filters(
            self.driver,
            author="Castronova, Anthony",
            resource_type="Composite",
            availability=["discoverable", "public"],
        )
        Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
        Discover.clear_notifications(self.driver)
        Resource.copy_resource(self.driver)
        TestSystem.wait(20)
        Resource.use_notification_link(self.driver, 1)
        Resource.create_version(self.driver)
        TestSystem.wait(20)
        Resource.use_notification_link(self.driver, 1)
        Resource.edit(self.driver)
        Resource.view(self.driver)
        TestSystem.back(self.driver)
        try:
            Resource.edit(self.driver)
            # Old resource should no longer be editable
            self.assertTrue(False)
        except:
            TestSystem.wait(1)

    def test_B_000087(self):
        """Validate version rollback, through resource deletion"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_discover(self.driver)
        Discover.add_filters(
            self.driver,
            author="Castronova, Anthony",
            resource_type="Composite",
            availability=["discoverable", "public"],
        )
        Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
        Discover.clear_notifications(self.driver)
        Resource.copy_resource(self.driver)
        TestSystem.wait(20)
        Resource.use_notification_link(self.driver, 1)
        resource_copy = TestSystem.current_url(self.driver)
        Resource.create_version(self.driver)
        TestSystem.wait(20)
        Resource.use_notification_link(self.driver, 1)
        Resource.delete_resource(self.driver)
        TestSystem.wait(20)
        TestSystem.refresh(self.driver)
        self.assertIn("My Resources", TestSystem.title(self.driver))
        MyResources.to_resource_from_table(self.driver, 1)
        self.assertIn("Beaver Divide Air Temperature", TestSystem.title(self.driver))
        # Now editable old version
        try:
            Resource.edit(self.driver)
        except:
            self.assertTrue(False)

    def test_B_000088(self):
        """Confirm My Resources lists the latest resource version"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_discover(self.driver)
        Discover.add_filters(
            self.driver,
            author="Castronova, Anthony",
            resource_type="Composite",
            availability=["discoverable", "public"],
        )
        Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
        Discover.clear_notifications(self.driver)
        Resource.copy_resource(self.driver)
        TestSystem.wait(20)
        Resource.use_notification_link(self.driver, 1)
        Resource.edit(self.driver)
        Resource.set_title(self.driver, "Old Version - Test")
        Resource.view(self.driver)
        Resource.create_version(self.driver)
        TestSystem.wait(20)
        Resource.use_notification_link(self.driver, 1)
        Resource.edit(self.driver)
        Resource.set_title(self.driver, "New Version - Test")
        Resource.view(self.driver)
        Resource.to_my_resources(self.driver)
        MyResources.to_resource_from_table(self.driver, 1)
        TestSystem.wait()
        self.assertEqual(Resource.get_title(self.driver), "New Version - Test")
        Resource.delete_resource(self.driver)
        TestSystem.wait(20)
        Resource.to_my_resources(self.driver)
        MyResources.to_resource_from_table(self.driver, 1)
        TestSystem.wait()
        self.assertEqual(Resource.get_title(self.driver), "Old Version - Test")
        try:
            Resource.edit(self.driver)
        except:
            # Old resource version should be editable, after the newer one is deleted
            self.assertTrue(False)

    def test_B_000089(self):
        """Confirm core resource sharing (viewer) functionality"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Sharing Resource Test")
        NewResource.create(self.driver)
        Resource.view(self.driver)
        Resource.grant_viewer(self.driver, "selenium-user2")
        users_with_access = Resource.get_user_access_count(self.driver)
        resource_url = TestSystem.current_url(self.driver)
        self.assertEqual(users_with_access, 2)
        Resource.logout(self.driver)
        LandingPage.to_login(self.driver)
        Login.login(self.driver, "selenium-user2", "abc123")
        self.driver.get(resource_url)
        self.assertEqual(Resource.get_title(self.driver), "Sharing Resource Test")

    def test_B_000091(self):
        """Confirm editor sharing"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Editor Resource Test")
        NewResource.create(self.driver)
        Resource.view(self.driver)
        Resource.grant_editor(self.driver, "selenium-user3")
        users_with_access = Resource.get_user_access_count(self.driver)
        resource_url = TestSystem.current_url(self.driver)
        self.assertEqual(users_with_access, 2)
        Resource.logout(self.driver)
        LandingPage.to_login(self.driver)
        Login.login(self.driver, "selenium-user3", "abc123")
        self.driver.get(resource_url)
        Resource.edit(self.driver)
        Resource.view(self.driver)
        self.assertEqual(Resource.get_title(self.driver), "Editor Resource Test")

    def test_B_000092(self):
        """Confirm owner sharing"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Owner Resource Test")
        NewResource.create(self.driver)
        Resource.view(self.driver)
        Resource.grant_owner(self.driver, "selenium-user4")
        users_with_access = Resource.get_user_access_count(self.driver)
        resource_url = TestSystem.current_url(self.driver)
        self.assertEqual(users_with_access, 2)
        Resource.logout(self.driver)
        LandingPage.to_login(self.driver)
        Login.login(self.driver, "selenium-user4", "abc123")
        self.driver.get(resource_url)
        Resource.delete_resource(self.driver)
        TestSystem.wait(20)
        self.driver.get(resource_url)
        TestSystem.refresh(self.driver)
        self.assertIn("Page not found", TestSystem.title(self.driver))

    def test_B_000094(self):
        """Confirm sharable functionality with a share chain"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Sharable Chain Resource Test")
        NewResource.create(self.driver)
        Resource.view(self.driver)
        Resource.grant_editor(self.driver, "selenium-user5")
        users_with_access = Resource.get_user_access_count(self.driver)
        resource_url = TestSystem.current_url(self.driver)
        self.assertEqual(users_with_access, 2)
        Resource.logout(self.driver)
        LandingPage.to_login(self.driver)
        Login.login(self.driver, "selenium-user5", "abc123")
        self.driver.get(resource_url)
        Resource.edit(self.driver)
        Resource.view(self.driver)
        Resource.grant_editor(self.driver, "selenium-user6")
        users_with_access = Resource.get_user_access_count(self.driver)
        resource_url = TestSystem.current_url(self.driver)
        self.assertEqual(users_with_access, 3)
        Resource.logout(self.driver)
        LandingPage.to_login(self.driver)
        Login.login(self.driver, "selenium-user6", "abc123")
        self.driver.get(resource_url)
        Resource.edit(self.driver)
        Resource.view(self.driver)
        self.assertEqual(
            Resource.get_title(self.driver), "Sharable Chain Resource Test"
        )

    def test_B_000095(self):
        """Confirm the ability to block sharable functionality with the sharable setting"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Sharable Chain Resource Test")
        NewResource.create(self.driver)
        Resource.view(self.driver)
        Resource.grant_editor(self.driver, "selenium-user5")
        Resource.toggle_sharable(self.driver)
        users_with_access = Resource.get_user_access_count(self.driver)
        resource_url = TestSystem.current_url(self.driver)
        self.assertEqual(users_with_access, 2)
        Resource.logout(self.driver)
        LandingPage.to_login(self.driver)
        Login.login(self.driver, "selenium-user5", "abc123")
        self.driver.get(resource_url)
        Resource.edit(self.driver)
        Resource.view(self.driver)
        try:
            Resource.grant_editor(self.driver, "selenium-user6")
            self.assertTrue(False)  # Selenium-User5 should not be able to share
        except:
            TestSystem.wait(1)

    def test_B_000096(self):
        """Update profile contact information"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_profile(self.driver)
        Profile.to_editor(self.driver)
        Profile.update_contact(
            self.driver,
            phone1="555-555-5555",
            phone2="555-555-5555",
            email="jim@example.com",
            website="example.com",
        )
        Profile.save_changes(self.driver)

    def test_B_000097(self):
        """Update profile name matches logout interface name"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_profile(self.driver)
        self.assertEqual(
            Profile.get_logged_in_name(self.driver), Profile.get_name(self.driver)
        )

    def test_B_000098(self):
        """Update profile email matches logout interface name"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_profile(self.driver)
        self.assertEqual(
            Profile.get_logged_in_name(self.driver), Profile.get_name(self.driver)
        )
        Profile.to_editor(self.driver)
        self.assertEqual(
            Profile.get_logged_in_email(self.driver), Profile.get_email(self.driver)
        )

    def test_B_000099(self):
        """Ensure the total for each author matches the total when the author filter is applied in Discover"""
        LandingPage.to_discover(self.driver)
        for i in range(1, 20, 4):
            Discover.toggle_author_filter_by_index(self.driver, i)
            filter_count = Discover.get_author_resource_count_by_index(self.driver, i)
            table_count = Discover.count_results_in_table(self.driver)
            Discover.toggle_author_filter_by_index(self.driver, i)
            self.assertEqual(filter_count, table_count)

    def test_B_000100(self):
        """Ensure the total for each contributor matches the total when the contributor filter is applied in Discover"""
        LandingPage.to_discover(self.driver)
        for i in range(2, 20, 4):
            Discover.toggle_contributor_filter_by_index(self.driver, i)
            filter_count = Discover.get_contributor_resource_count_by_index(
                self.driver, i
            )
            table_count = Discover.count_results_in_table(self.driver)
            Discover.toggle_contributor_filter_by_index(self.driver, i)
            self.assertEqual(filter_count, table_count)

    def test_B_000101(self):
        """Ensure the total for each owner matches the total when the owner filter is applied in Discover"""
        LandingPage.to_discover(self.driver)
        for i in range(3, 20, 4):
            Discover.toggle_owner_filter_by_index(self.driver, i)
            filter_count = Discover.get_owner_resource_count_by_index(self.driver, i)
            table_count = Discover.count_results_in_table(self.driver)
            Discover.toggle_owner_filter_by_index(self.driver, i)
            self.assertEqual(filter_count, table_count)

    def test_B_000102(self):
        """Confirm dates are formatted consistently across resources in the results table"""
        LandingPage.to_discover(self.driver)
        Discover.uses_consistent_date_formatting(self.driver)

    def test_B_000103(self):
        """Ensure resource logos are consistent within each resource type"""
        LandingPage.to_discover(self.driver)
        for i in range(3, Discover.get_count_of_types(self.driver), 7):
            Discover.toggle_type_filter_by_index(self.driver, i)
            self.assertTrue(Discover.uses_consistent_icon(self.driver))
            Discover.toggle_type_filter_by_index(self.driver, i)

    def test_B_000105(self):
        """Ensure the total for each resource type matches the total when the resource type filter is applied in Discover"""
        LandingPage.to_discover(self.driver)
        for i in range(4, Discover.get_count_of_types(self.driver), 3):
            Discover.toggle_type_filter_by_index(self.driver, i)
            filter_count = Discover.get_type_resource_count_by_index(self.driver, i)
            table_count = Discover.count_results_in_table(self.driver)
            Discover.toggle_type_filter_by_index(self.driver, i)
            self.assertEqual(filter_count, table_count)

    def test_B_000106(self):
        """Ensure the listed first author in the Discover page is listed as an author on the resource page"""
        LandingPage.to_discover(self.driver)
        # Get a pseudo-random sample by taking the first result of a few random string searches
        search_strings = [
            "Berlin",
            "CUAHSI",
            "99",
            "Estuary",
            "New York",
            "Ice",
            "Antarctica",
            "Phosphorus",
            "Leak",
            "Database",
        ]
        for search_string in search_strings:
            Discover.search(self.driver, search_string)
            first_author = Discover.get_first_author_by_resource_index(self.driver, 1)
            Discover.to_resource_by_index(self.driver, 1)  # first row, second column
            authors_csv = ", ".join(Resource.get_authors(self.driver))
            for name_part in first_author.replace(",", "").split(" "):
                self.assertIn(name_part, authors_csv)
            External.switch_old_page(self.driver)
            External.close_new_page(self.driver)

    def test_B_000109(self):
        """
        Confirms Beaver Divide Air Temperature resource landing page is
        online via navigation and title check, then downloads the BagIt
        archive and confirms the BagIt file size matches expectation
        """
        LandingPage.to_discover(self.driver)
        Discover.search(
            self.driver,
            "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
        )
        Discover.to_resource(
            self.driver,
            "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
        )
        Resource.download_bagit(self.driver)
        TestSystem.wait()
        TestSystem.to_url(self.driver, "chrome://downloads")
        Downloads.check_successful_download(self.driver)

    def test_B_000110(self):
        """
        Confirms file downloads within a resource are successful
        """
        LandingPage.to_discover(self.driver)
        Discover.search(
            self.driver,
            "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
        )
        Discover.to_resource(
            self.driver,
            "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
        )
        Resource.download_file_by_index(self.driver, 2)
        TestSystem.wait(10)
        TestSystem.to_url(self.driver, "chrome://downloads")
        Downloads.check_successful_download(self.driver)

    def test_B_000111(self):
        """
        Confirms file zip downloads within a resource are successful
        """
        LandingPage.to_discover(self.driver)
        Discover.search(
            self.driver,
            "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
        )
        Discover.to_resource(
            self.driver,
            "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
        )
        Resource.download_file_zip_by_index(self.driver, 3)
        TestSystem.wait(10)
        TestSystem.to_url(self.driver, "chrome://downloads")
        Downloads.check_successful_download(self.driver)

    def test_B_000112(self):
        """
        Confirms the resource file download links are valid
        """
        LandingPage.to_discover(self.driver)
        Discover.search(
            self.driver,
            "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
        )
        Discover.to_resource(
            self.driver,
            "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
        )
        file_download_link = Resource.get_file_download_link_by_index(self.driver, 1)
        TestSystem.to_url(self.driver, file_download_link)
        TestSystem.wait(10)
        TestSystem.to_url(self.driver, "chrome://downloads")
        Downloads.check_successful_download(self.driver)

    def test_B_000113(self):
        """
        Download and upload a 541 MB file from the API, then download it from the GUI
        """
        urlretrieve(
            BASE_URL
            + "/resource/a7b99c31adfe4f56899bef1a6700f9cf/data/contents/1m_snowOff_filter_SHD.zip",
            "1m_snowOff_filter_SHD.zip",
        )
        r = requests.post(
            BASE_URL + "/hsapi/resource/",
            auth=(USERNAME, PASSWORD),
            data={
                "title": "Automated Test Resource CUAHSI QA",
                "abstract": "This is a test resource for QA purposes.",
                "keywords": ["test", "QA", "CUAHSI"],
            },
        )
        resource_id = r.json()["resource_id"]
        files = {"file": open("1m_snowOff_filter_SHD.zip", "rb")}
        r = requests.post(
            BASE_URL + "/hsapi/resource/{}/files/".format(resource_id),
            auth=(USERNAME, PASSWORD),
            files=files,
        )
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        TestSystem.to_url(self.driver, BASE_URL + "/resource/{}/".format(resource_id))
        Resource.download_bagit(self.driver)
        TestSystem.wait(10)
        self.assertTrue(Downloads.check_successful_download_new_tab(self.driver))

    def test_B_000115(self):
        """Confirms password reset is not confirmed unless submit is clicked"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_profile(self.driver)
        Profile.to_editor(self.driver)
        Profile.queue_password_change(self.driver, PASSWORD, PASSWORD + "test")
        Home.logout(self.driver)
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD + "test")
        self.assertIn(
            "Invalid username/email and password", Login.get_login_error(self.driver)
        )

    def test_B_000117(self):
        """Create a discoverable resource"""
        urlretrieve(
            BASE_URL
            + "/resource/a7b99c31adfe4f56899bef1a6700f9cf/data/contents/1m_snowOff_filter_SHD.zip",
            "1m_snowOff_filter_SHD.zip",
        )
        r = requests.post(
            BASE_URL + "/hsapi/resource/",
            auth=(USERNAME, PASSWORD),
            data={
                "title": "Discoverable Resource CUAHSI QA",
                "abstract": "This is a test resource for QA purposes.",
                "keywords": ["test", "QA", "CUAHSI"],
            },
        )
        resource_id = r.json()["resource_id"]
        files = {"file": open("1m_snowOff_filter_SHD.zip", "rb")}
        r = requests.post(
            BASE_URL + "/hsapi/resource/{}/files/".format(resource_id),
            auth=(USERNAME, PASSWORD),
            files=files,
        )
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        TestSystem.to_url(self.driver, BASE_URL + "/resource/{}/".format(resource_id))
        Resource.edit(self.driver)
        Resource.make_discoverable(self.driver)
        Resource.logout(self.driver)
        LandingPage.to_discover(self.driver)
        Discover.add_filters(
            self.driver,
            availability=["discoverable"],
        )
        Discover.to_resource(self.driver, "Discoverable Resource CUAHSI QA")

    def test_B_000118(self):
        """Confirm the addition and deletion of metadata works for both point and box coverage"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Spatial Coverage Test")
        NewResource.create(self.driver)
        Resource.set_spatial_coverage_box(self.driver, 44, 43, 42, 41)
        Resource.delete_spatial_coverage(self.driver)
        TestSystem.wait()
        Resource.set_spatial_coverage_point(self.driver, 42, 42)
        Resource.delete_spatial_coverage(self.driver)

    def test_B_000119(self):
        """Comfirm a warning message when making a resource no longer public-compatible"""
        urlretrieve(
            BASE_URL
            + "/resource/a7b99c31adfe4f56899bef1a6700f9cf/data/contents/1m_snowOff_filter_SHD.zip",
            "1m_snowOff_filter_SHD.zip",
        )
        r = requests.post(
            BASE_URL + "/hsapi/resource/",
            auth=(USERNAME, PASSWORD),
            data={
                "title": "Discoverable Resource CUAHSI QA",
                "abstract": "This is a test resource for QA purposes.",
                "keywords": ["test", "QA", "CUAHSI"],
            },
        )
        resource_id = r.json()["resource_id"]
        files = {"file": open("1m_snowOff_filter_SHD.zip", "rb")}
        r = requests.post(
            BASE_URL + "/hsapi/resource/{}/files/".format(resource_id),
            auth=(USERNAME, PASSWORD),
            files=files,
        )
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        TestSystem.to_url(self.driver, BASE_URL + "/resource/{}/".format(resource_id))
        Resource.edit(self.driver)
        Resource.populate_abstract(self.driver, "// TODO Abstract")
        Resource.add_subject_keyword(self.driver, "keyphrase multiple words")
        Resource.make_public(self.driver)
        Resource.view(self.driver)
        self.assertEqual(Resource.get_sharing_status(self.driver), "Public")
        Resource.edit(self.driver)
        Resource.delete_file_by_index(self.driver, 1)
        TestSystem.wait(10)
        Resource.view(self.driver)
        self.assertEqual(Resource.get_sharing_status(self.driver), "Private")

    def test_B_000120(self):
        """
        Confirm app tool image by URL for .svg file
        """
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "ToolResource")
        NewResource.configure(self.driver, "Web App (TEST 120)")
        NewResource.create(self.driver)

        img_url = "https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg"
        WebApp.add_photo_by_url(self.driver, img_url)
        self.assertTrue(WebApp.confirm_photo_uploaded(self.driver))

    def test_B_000121(self):
        """
        Confirm remove app tool image for .ico
        """
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "ToolResource")
        NewResource.configure(self.driver, "Web App (TEST 121)")
        NewResource.create(self.driver)
        img_url = "https://duckduckgo.com/favicon.ico"
        WebApp.add_photo_by_url(self.driver, img_url)
        TestSystem.wait()
        self.assertTrue(WebApp.confirm_photo_uploaded(self.driver))
        WebApp.remove_photo(self.driver)
        TestSystem.wait()
        self.assertFalse(WebApp.confirm_photo_uploaded(self.driver))

    def test_B_000122(self):
        """
        Confirms zip and unzip folder within a resource is successful
        """
        folder_name = "test_folder"
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Zip folder test (TEST 122)")
        NewResource.create(self.driver)
        Resource.create_folder(self.driver, folder_name)
        folder_index = Resource.get_file_index_by_name(self.driver, folder_name)
        Resource.zip_folder_by_index(self.driver, folder_index)
        TestSystem.wait()
        zip_index = Resource.get_file_index_by_name(self.driver, folder_name + ".zip")
        Resource.unzip_folder_by_index(self.driver, zip_index)
        Resource.wait_on_task_completion(self.driver, 1, 30)

    def test_B_000123(self):
        """Create a resource and unzip a large file in the dropzone"""
        folder_name = "1m_snowOff_filter_SHD.zip"
        r = requests.post(
            BASE_URL + "/hsapi/resource/",
            auth=(USERNAME, PASSWORD),
            data={
                "title": "Large Zip folder test QA",
                "abstract": "This is a test resource for QA purposes.",
                "keywords": ["test", "QA", "CUAHSI"],
            },
        )

        # get a large zip that we can test with
        if not os.path.exists(folder_name):
            if "localhost" in BASE_URL:
                # local instance might not have the Beaver Divide so get it from Beta
                urlretrieve(
                    "https://beta.hydroshare.org/resource/a7b99c31adfe4f56899bef1a6700f9cf/data/contents/"
                    + folder_name,
                    folder_name,
                )
            else:
                urlretrieve(
                    BASE_URL
                    + "/resource/a7b99c31adfe4f56899bef1a6700f9cf/data/contents/"
                    + folder_name,
                    folder_name,
                )

        resource_id = r.json()["resource_id"]
        files = {"file": open(folder_name, "rb")}
        r = requests.post(
            BASE_URL + "/hsapi/resource/{}/files/".format(resource_id),
            auth=(USERNAME, PASSWORD),
            files=files,
        )
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        TestSystem.to_url(self.driver, BASE_URL + "/resource/{}/".format(resource_id))
        Resource.edit(self.driver)
        zip_index = Resource.get_file_index_by_name(self.driver, folder_name)
        Resource.unzip_folder_by_index(self.driver, zip_index)
        Resource.wait_on_task_completion(self.driver, 1, 30)
        unzip_index = Resource.get_file_index_by_name(self.driver, folder_name)
        self.assertGreaterEqual(unzip_index, 1)

    def test_B_000124(self):
        """Confirm that duplicate authors are not permitted on a resource"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Duplicate Author (TEST 124)")
        NewResource.create(self.driver)
        Resource.add_dup_authors(self.driver, "CZO")
        error_text = Resource.check_author_warning(self.driver)
        self.assertIn("author", error_text)

    def test_B_000125(self):
        """Confirm that HTML injection is not possible for resource labels"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.to_my_resources(self.driver)
        MyResources.create_label(self.driver, "<span>Span</span>")
        self.assertTrue(MyResources.check_html_injection_error(self.driver))

    def test_B_000126(self):
        """Ensure cancelled metadata key:value pairs are cleared"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Cancelled Metadata Test")
        NewResource.create(self.driver)
        Resource.prepare_metadata(self.driver, "Key", "Value")
        Resource.cancel_metadata(self.driver)
        self.assertTrue(Resource.check_residual_metadata(self.driver))

    def test_B_000127(self):
        """Ensure non-Hydroshare authors are shown normally on the resource landing page"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Non-Hydroshare Author Test")
        NewResource.create(self.driver)
        Resource.add_other_author(self.driver, "Other Person")
        Resource.delete_author(self.driver, 1)
        Resource.view(self.driver)
        self.assertEqual(["Other Person"], Resource.get_authors(self.driver))

    def test_B_000128(self):
        """Add a similar to relationship between resources"""
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        Home.create_resource(self.driver, "CompositeResource")
        NewResource.configure(self.driver, "Similar Resource One")
        NewResource.create(self.driver)
        Resource.add_similar_to(self.driver, "google.com")
        Resource.view(self.driver)

hold_test_B_000021()

Confirm the ability to upload a CV file within the profile interface

Source code in hydroshare/hydroshare.py
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
def hold_test_B_000021(self):  # BROKEN DUE TO HYDROSHARE JS FRAMEWORK USE
    """
    Confirm the ability to upload a CV file within the profile interface
    """
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_profile(self.driver)
    Profile.to_editor(self.driver)
    Profile.upload_cv(
        self.driver,
        "https://www.bu.edu/careers/files/2012/08/Resume-Guide-2012.pdf",
    )
    Profile.save_changes(self.driver)
    num_windows_now = len(self.driver.window_handles)
    Profile.view_cv(self.driver)
    External.to_file(self.driver, num_windows_now, "cv-test")
    self.assertTrue("cv-test" in TestSystem.title(self.driver))
    External.switch_old_page(self.driver)
    External.close_new_page(self.driver)
    Profile.to_editor(self.driver)
    Profile.delete_cv(self.driver)

hold_test_B_000022()

Confirm profile image upload and removal works, within the profile page

Source code in hydroshare/hydroshare.py
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
def hold_test_B_000022(self):  # BROKEN DUE TO HYDROSHARE JS FRAMEWORK USE
    """
    Confirm profile image upload and removal works, within the profile page
    """
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_profile(self.driver)
    Profile.to_editor(self.driver)
    urlretrieve(
        "http://www.bu.edu/emd/files/2017/03/rhett_alone1.jpg", "profile.jpg"
    )
    cwd = os.getcwd()
    profile_img_path = os.path.join(cwd, "profile.jpg")
    Profile.add_photo(self.driver, profile_img_path)
    Profile.save_changes(self.driver)
    self.assertTrue(Profile.confirm_photo_uploaded(self.driver, "profile"))
    os.remove(profile_img_path)
    Profile.to_editor(self.driver)
    Profile.remove_photo(self.driver)
    self.assertFalse(Profile.confirm_photo_uploaded(self.driver, "profile"))

hold_test_B_000056()

Verify featured apps featured on the dashboard link correctly

Source code in hydroshare/hydroshare.py
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
def hold_test_B_000056(self):
    """Verify featured apps featured on the dashboard link correctly"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    # JupyterHub
    Home.to_app(self.driver, "Featured", 1)
    self.assertIn("JupyterHub", TestSystem.title(self.driver))
    External.switch_old_page(self.driver)
    External.close_new_page(self.driver)
    # MATLAB Online
    Home.to_app(self.driver, "Featured", 2)
    Login.login(self.driver, USERNAME, PASSWORD)
    TestSystem.wait(30)
    MatlabOnline.authorize(self.driver)
    TestSystem.wait(30)
    self.assertIn("MATLAB Online", TestSystem.title(self.driver))
    External.switch_old_page(self.driver)
    External.close_new_page(self.driver)

test_B_000001()

When creating a resource, ensure all resource types have a "Cancel" button available, so that they are not forced to finish creating a resource if they don't actually want one or if they made a mistake

Source code in hydroshare/hydroshare.py
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
def test_B_000001(self):
    """
    When creating a resource, ensure all resource types have a "Cancel"
    button available, so that they are not forced to finish creating a resource
    if they don't actually want one or if they made a mistake
    """
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    resource_types = [
        "CompositeResource",
        "CollectionResource",
        "ToolResource",
    ]
    for resource_type in resource_types:
        Home.create_resource(self.driver, resource_type)
        NewResource.configure(self.driver, "TEST TITLE")
        NewResource.cancel(self.driver)

test_B_000003()

Confirms the Beaver Divide Air Temperature example resource landing page is online via navigation and title check, then downloads the BagIt archive to make sure it downloads successfully

Source code in hydroshare/hydroshare.py
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
def test_B_000003(self):
    """
    Confirms the Beaver Divide Air Temperature example resource landing page is
    online via navigation and title check, then downloads the BagIt
    archive to make sure it downloads successfully
    """
    LandingPage.to_discover(self.driver)
    Discover.add_filters(
        self.driver,
        author="Castronova, Anthony",
        resource_type="Composite",
        availability=["discoverable", "public"],
    )
    Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
    Resource.download_bagit(self.driver)
    self.assertTrue(Downloads.check_successful_download_new_tab(self.driver))

test_B_000005()

Confirms user passwords can be changed, and then changed back to the original value, using the Profile interface

Source code in hydroshare/hydroshare.py
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
def test_B_000005(self):
    """
    Confirms user passwords can be changed, and then changed back
    to the original value, using the Profile interface
    """
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_profile(self.driver)
    Profile.to_editor(self.driver)
    Profile.reset_password(self.driver, PASSWORD, PASSWORD + "test")
    Profile.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD + "test")
    Home.to_profile(self.driver)
    Profile.to_editor(self.driver)
    Profile.reset_password(self.driver, PASSWORD + "test", PASSWORD)
    Profile.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)

test_B_000006()

Confirms the sorting behavior on the Discover page (both sort direction and sort field) functions correctly, as evaluated by a few of the first rows being ordered correctly

Source code in hydroshare/hydroshare.py
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
def test_B_000006(self):
    """
    Confirms the sorting behavior on the Discover page (both sort
    direction and sort field) functions correctly, as evaluated by a few
    of the first rows being ordered correctly
    """
    LandingPage.to_discover(self.driver)
    Discover.add_filters(
        self.driver,
        availability=["published"],
    )  # remove once long delay issue is fixed
    orderings = [
        {
            "name": "First Author",
            "column": 3,
        },
        {
            "name": "Date Created",
            "column": 4,
        },
        {
            "name": "Last Modified",
            "column": 5,
        },
    ]
    for ordering in orderings:
        Discover.set_sort(self.driver, ordering["column"])
        TestSystem.wait()  # remove once long delay issue is fixed
        self.assertTrue(
            Discover.check_sorting_multi(self.driver, ordering["name"], "Ascending")
        )
        Discover.set_sort(self.driver, ordering["column"])
        TestSystem.wait()  # remove once long delay issue is fixed
        self.assertTrue(
            Discover.check_sorting_multi(
                self.driver, ordering["name"], "Descending"
            )
        )

test_B_000007()

Confirms all apps have an associated resource page which is correctly linked and correctly listed within the app info on the apps page

Source code in hydroshare/hydroshare.py
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
def test_B_000007(self):
    """
    Confirms all apps have an associated resource page which is
    correctly linked and correctly listed within the app info on the
    apps page
    """
    TestSystem.to_url(self.driver, BASE_URL + "/apps/")
    apps_count = Apps.get_count(self.driver)
    for i in range(1, apps_count + 1):  # xpath start at 1
        app_name = Apps.get_title(self.driver, i)
        Apps.show_info(self.driver, i)
        Apps.to_resource(self.driver, i)
        resource_title = Resource.get_title(self.driver)
        self.assertIn(app_name, resource_title)
        TestSystem.back(self.driver)

test_B_000008()

Checks all HydroShare Help links lead to valid pages and that the topic title words come up in the associated help page

Source code in hydroshare/hydroshare.py
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
def test_B_000008(self):
    """
    Checks all HydroShare Help links lead to valid pages
    and that the topic title words come up in the associated help page
    """
    LandingPage.to_help(self.driver)
    core_count = Help.get_core_count(self.driver)
    core_topics = [
        Help.get_core_topic(self.driver, i + 1) for i in range(0, core_count)
    ][
        :-3
    ]  # Last three topics include mailto: contact emails
    for ind, core_topic in enumerate(core_topics, 1):  # xpath ind start at 1
        Help.open_core(self.driver, ind)
        words_string = re.sub("[^A-Za-z]", " ", core_topic)
        matches = [
            word in HelpArticle.get_title(self.driver)
            for word in words_string.split(" ")
        ]
        self.assertTrue(True in matches)
        HelpArticle.to_help_breadcrumb(self.driver)

test_B_000009()

Confirms the basic get methods within hydroshare api do not return errors. These basic get methods are accessible from the Swagger UI and use just a resource id required parameter

Source code in hydroshare/hydroshare.py
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
def test_B_000009(self):
    """
    Confirms the basic get methods within hydroshare api do not return
    errors.  These basic get methods are accessible from the Swagger UI and
    use just a resource id required parameter
    """
    resource_id = "54ae2ade31f646d097d78ef0695bb36c"
    endpoints = [
        {"id": "operations-resource-resource_read", "resource_param_ind": 1},
        {
            "id": "operations-resource-resource_file_list_list",
            "resource_param_ind": 3,
        },
        {
            "id": "operations-resource-resource_files_list",
            "resource_param_ind": 3,
        },
        {"id": "operations-resource-resource_map_list", "resource_param_ind": 1},
        {
            "id": "operations-resource-resource_scimeta_list",
            "resource_param_ind": 1,
        },
        {
            "id": "operations-resource-resource_scimeta_elements_read",
            "resource_param_ind": 1,
        },
        {
            "id": "operations-resource-resource_sysmeta_list",
            "resource_param_ind": 1,
        },
    ]

    TestSystem.to_url(self.driver, "{}/hsapi/".format(BASE_URL))
    for endpoint in endpoints:
        API.toggle_endpoint(self.driver, endpoint["id"])
        API.try_endpoint(self.driver)
        API.set_parameter(self.driver, endpoint["resource_param_ind"], resource_id)
        API.execute_request(self.driver)
        response_code = API.get_response_code(self.driver)
        self.assertEqual(response_code, "200")
        API.toggle_endpoint(self.driver, endpoint["id"])

test_B_000010()

Confirms the basic get methods within hydroshare api, which require no parameters, can be ran through the Swagger UI

Source code in hydroshare/hydroshare.py
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
def test_B_000010(self):
    """
    Confirms the basic get methods within hydroshare api, which require
    no parameters, can be ran through the Swagger UI
    """
    endpoints = [
        "operations-resource-resource_content_types_list",
        "operations-resource-resource_types_list",
        "operations-user-user_list",
        "operations-userInfo-userInfo_list",
    ]
    TestSystem.to_url(self.driver, "{}/hsapi/".format(BASE_URL))
    for endpoint in endpoints:
        API.toggle_endpoint(self.driver, endpoint)
        API.try_endpoint(self.driver)
        API.execute_request(self.driver)
        response_code = API.get_response_code(self.driver)
        self.assertEqual(response_code, "200")
        API.toggle_endpoint(self.driver, endpoint)

test_B_000011()

Check Hydroshare About policy pages to confirm link titles, content titles, and page titles all align

Source code in hydroshare/hydroshare.py
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
def test_B_000011(self):
    """
    Check Hydroshare About policy pages to confirm link titles, content titles, and page titles all align
    """
    LandingPage.to_about(self.driver)
    About.toggle_tree(self.driver)
    About.toggle_tree(self.driver)
    About.expand_tree_top(self.driver, "Policies")
    policies = [
        "HydroShare Publication Agreement",
        "Quota",
        "Statement of Privacy",
        "Terms of Use",
    ]
    for policy in policies:
        About.open_policy(self.driver, policy)
        article_title = About.get_title(self.driver)
        webpage_title = TestSystem.title(self.driver)
        self.assertIn(policy, article_title)
        self.assertIn(policy, webpage_title)

test_B_000012()

Confirm footer links redirect to valid pages and are available at the bottom of a sample of pages

Source code in hydroshare/hydroshare.py
282
283
284
285
286
287
288
289
290
291
292
293
294
def test_B_000012(self):
    """
    Confirm footer links redirect to valid pages and are available
    at the bottom of a sample of pages
    """
    LandingPage.to_terms(self.driver)
    terms_title = HelpArticle.get_title(self.driver)
    self.assertIn("terms of use", terms_title.lower())
    HelpArticle.to_privacy(self.driver)
    privacy_title = HelpArticle.get_title(self.driver)
    self.assertIn("statement of privacy", privacy_title.lower())
    HelpArticle.to_sitemap(self.driver)
    self.assertNotIn("Page not found", TestSystem.title(self.driver))

test_B_000013()

Confirms clean removal, then readdition, of user organizations using the user profile interface

Source code in hydroshare/hydroshare.py
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
def test_B_000013(self):
    """
    Confirms clean removal, then readdition, of user organizations using
    the user profile interface
    """
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_profile(self.driver)
    Profile.to_editor(self.driver)
    Profile.delete_organization(self.driver, 2)
    Profile.delete_organization(self.driver, 1)
    Profile.add_organization(self.driver, "Freie Universität Berlin")
    Profile.add_organization(self.driver, "Agricultural University of Warsaw")
    Profile.save_changes(self.driver)
    page_tip = Profile.page_tip.get_text(self.driver)
    self.assertEqual(
        "Your profile has been successfully updated.",
        page_tip,
    )

test_B_000014()

Confirms ability to create HydroShare groups through the standard GUI workflow

Source code in hydroshare/hydroshare.py
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
def test_B_000014(self):
    """
    Confirms ability to create HydroShare groups through the standard
    GUI workflow
    """
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_collaborate(self.driver)
    Collaborate.to_groups(self.driver)
    group_name = "QA Test Group {}".format(random.randint(1, 1000000))
    Groups.create_group(
        self.driver,
        name=group_name,
        purpose="1230!@#$%^&*()-=_+<{[QA TEST]}>.,/",
        about="Über Die Gruppe",
        privacy="private",
    )
    new_group_name = Group.check_title(self.driver)
    self.assertEqual(group_name, new_group_name)

test_B_000015()

Confirms the resource landing page "Open With" works, in the case of JupyterHub

Source code in hydroshare/hydroshare.py
336
337
338
339
340
341
342
343
344
345
def test_B_000015(self):
    """
    Confirms the resource landing page "Open With" works, in the case of JupyterHub
    """
    LandingPage.to_discover(self.driver)
    Discover.add_filters(self.driver, owner="Castronova, Anthony")
    Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
    Resource.open_with_jupyterhub(self.driver)
    webpage_title = TestSystem.title(self.driver)
    self.assertNotIn("Page not found", webpage_title)

test_B_000016()

Create a basic resource without any files and confirm that the resulting resource landing page is OK

Source code in hydroshare/hydroshare.py
347
348
349
350
351
352
353
354
355
356
357
358
359
def test_B_000016(self):
    """
    Create a basic resource without any files and confirm that the resulting
    resource landing page is OK
    """
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Test Resource")
    NewResource.create(self.driver)
    Resource.view(self.driver)
    resource_title = Resource.get_title(self.driver)
    self.assertEqual("Test Resource", resource_title)

test_B_000017()

Confirm resource type filters can be applied in My Resources

Source code in hydroshare/hydroshare.py
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
def test_B_000017(self):
    """
    Confirm resource type filters can be applied in My Resources
    """
    options = [
        "Collection",
        "Composite Resource",
        "Generic",
        "Geographic Feature",
        "Geographic Raster",
        "HIS Referenced",
        "Model Instance",
        "Model Program",
        "MODFLOW",
        "Multidimensional",
        "Script Resource",
        "Swat Model Instance",
        "Time Series",
        "Web App",
    ]
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_my_resources(self.driver)
    MyResources.search_resource_type(self.driver)
    for option in options:
        MyResources.search_type(self.driver, option)
        page_title = TestSystem.title(self.driver)
        self.assertIn("My Resources", page_title)

test_B_000018()

Use My Resources search bar filters and non-ASCII characters, in order to verify filter usability for non-English resources

Source code in hydroshare/hydroshare.py
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
def test_B_000018(self):
    """
    Use My Resources search bar filters and non-ASCII characters, in
    order to verify filter usability for non-English resources
    """
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_my_resources(self.driver)
    MyResources.search_resource_type(self.driver)

    self.assertNotIn("[type:", MyResources.read_searchbar(self.driver))
    MyResources.search_type(self.driver, "Web App")
    self.assertIn("[type:", MyResources.read_searchbar(self.driver))
    self.assertNotIn("[author:", MyResources.read_searchbar(self.driver))
    MyResources.search_author(self.driver, "Über")
    self.assertIn("[author:Über", MyResources.read_searchbar(self.driver))
    self.assertNotIn("[subject:", MyResources.read_searchbar(self.driver))
    MyResources.search_subject(self.driver, "Über")
    self.assertIn("[subject:Über", MyResources.read_searchbar(self.driver))

    self.assertIn("[type:", MyResources.read_searchbar(self.driver))
    self.assertIn("[author:Über", MyResources.read_searchbar(self.driver))
    self.assertIn("[subject:Über", MyResources.read_searchbar(self.driver))

    MyResources.clear_search(self.driver)

    self.assertNotIn("[type:", MyResources.read_searchbar(self.driver))
    self.assertNotIn("[author:", MyResources.read_searchbar(self.driver))
    self.assertNotIn("[subject:", MyResources.read_searchbar(self.driver))

    MyResources.search_resource_type(self.driver)
    MyResources.search_type(self.driver, "Web App")
    MyResources.search_author(self.driver, "Über")
    MyResources.search_subject(self.driver, "Über")
    MyResources.clear_author_search(self.driver)
    self.assertNotIn("[author:", MyResources.read_searchbar(self.driver))
    MyResources.clear_subject_search(self.driver)
    self.assertNotIn("[subject:", MyResources.read_searchbar(self.driver))
    MyResources.search_type(self.driver, "All")

    self.assertNotIn("[type:", MyResources.read_searchbar(self.driver))
    self.assertNotIn("[author:", MyResources.read_searchbar(self.driver))
    self.assertNotIn("[subject:", MyResources.read_searchbar(self.driver))

test_B_000019()

Create a new resources label and verify it can be added to existing resources on the My Resources page

Source code in hydroshare/hydroshare.py
434
435
436
437
438
439
440
441
442
443
444
445
446
447
def test_B_000019(self):
    """
    Create a new resources label and verify it can be added to existing
    resources on the My Resources page
    """
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_my_resources(self.driver)
    MyResources.create_label(self.driver, "Test")
    MyResources.toggle_label(self.driver, "Test")
    self.assertTrue(MyResources.check_label_applied(self.driver))
    MyResources.toggle_label(self.driver, "Test")
    self.assertFalse(MyResources.check_label_applied(self.driver))
    MyResources.delete_label(self.driver)

test_B_000023()

Ensure that the user links within a resource landing page redirect to the associated user landing page, and that the contribution counts in the resulting page are summed correctly

Source code in hydroshare/hydroshare.py
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
def test_B_000023(self):
    """
    Ensure that the user links within a resource landing page redirect to
    the associated user landing page, and that the contribution counts in
    the resulting page are summed correctly
    """
    LandingPage.to_discover(self.driver)
    Discover.add_filters(self.driver, owner="Castronova, Anthony")
    Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
    Discover.to_last_updated_profile(self.driver)
    Profile.view_contributions(self.driver)
    resource_types_count = Profile.get_resource_type_count(self.driver)
    contribution_counts = []
    contributions_list_length = Profile.get_contributions_list_length(self.driver)
    for i in range(0, resource_types_count):
        Profile.view_contribution_type(self.driver, i)
        contribution_counts.append(
            Profile.get_contribution_type_count(self.driver, i)
        )
    self.assertEqual(sum(contribution_counts[1:]), contributions_list_length)
    self.assertEqual(
        contribution_counts[0],  # count for "All"
        sum(contribution_counts[1:]),  # count for the rest
    )

test_B_000024()

Verify the ability to extend metadata on resource landing pages

Source code in hydroshare/hydroshare.py
517
518
519
520
521
522
523
524
525
526
527
528
529
530
def test_B_000024(self):
    """Verify the ability to extend metadata on resource landing pages"""
    name_ex = "name_ex"
    value_ex = "value_ex"
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Test Metadata")
    NewResource.create(self.driver)
    Resource.view(self.driver)
    Resource.edit(self.driver)
    Resource.add_metadata(self.driver, name_ex, value_ex)
    Resource.exists_name(self.driver, name_ex)
    Resource.exists_value(self.driver, value_ex)

test_B_000026()

Confirm that the home page slider is functional

Source code in hydroshare/hydroshare.py
532
533
534
535
536
537
538
539
540
541
542
543
def test_B_000026(self):
    """Confirm that the home page slider is functional"""
    images = [
        'background-image: url("/static/img/home-page/carousel/bg1.jpg");',
        'background-image: url("/static/img/home-page/carousel/bg2.JPG");',
        'background-image: url("/static/img/home-page/carousel/bg3.jpg");',
    ]
    LandingPage.scroll_to_button(self.driver)
    LandingPage.scroll_to_top(self.driver)
    for i in range(0, 5):
        LandingPage.slide_hero_left(self.driver)
        self.assertTrue(LandingPage.hero_has_valid_img(self.driver, images))

test_B_000027()

Confirm that the MyResources and Discover pages have the same labels and resources listed in their legends

Source code in hydroshare/hydroshare.py
545
546
547
548
549
550
551
552
553
554
555
556
def test_B_000027(self):
    """
    Confirm that the MyResources and Discover pages have the same labels and
    resources listed in their legends
    """
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_my_resources(self.driver)
    my_resource_legend = MyResources.legend_text(self.driver)
    MyResources.to_discover(self.driver)
    discover_legend = Discover.legend_text(self.driver)
    self.assertEqual(my_resource_legend, discover_legend)

test_B_000028()

Checks that the each social media account is accessible from the links in the footer

Source code in hydroshare/hydroshare.py
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
def test_B_000028(self):
    """
    Checks that the each social media account is accessible from
    the links in the footer
    """
    socials = ["twitter", "facebook", "youtube", "github", "linkedin"]
    expected_links = {
        "facebook": "https://www.facebook.com/pages/CUAHSI-Consortium-"
        "of-Universities-for-the-Advancement-of-Hydrologic-"
        "Science-Inc/179921902590",
        "twitter": "http://twitter.com/cuahsi",
        "youtube": "https://www.youtube.com/user/CUAHSI",
        "github": "http://github.com/hydroshare",
        "linkedin": "https://www.linkedin.com/company/2632114",
    }
    for social in socials:
        self.assertEqual(
            expected_links[social],
            LandingPage.get_social_link(self.driver, social),
        )

test_B_000029()

Commenting requires a login, and redirect works as expected

Source code in hydroshare/hydroshare.py
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
def test_B_000029(self):
    """Commenting requires a login, and redirect works as expected"""
    LandingPage.to_discover(self.driver)
    Discover.search(self.driver, "DeBuhr")
    Discover.add_filters(self.driver, owner="DeBuhr, Neal")
    Discover.to_resource(
        self.driver, "Beaver Divide Air Temperature - Further Development"
    )
    initial_comment_count = Resource.get_comment_count(self.driver)
    Resource.add_comment(self.driver, "Test Comment")
    self.assertIn("Please log in", Login.get_notification(self.driver))
    Login.login(self.driver, USERNAME, PASSWORD)
    Resource.add_comment(self.driver, "Test Comment")
    final_comment_count = Resource.get_comment_count(self.driver)
    self.assertTrue(initial_comment_count < final_comment_count)

test_B_000031()

Confirm that resources can be accessed from the sitemap links

Source code in hydroshare/hydroshare.py
595
596
597
598
599
600
601
602
603
604
605
606
607
def test_B_000031(self):
    """Confirm that resources can be accessed from the sitemap links"""
    LandingPage.to_sitemap(self.driver)
    SiteMap.select_resource(self.driver, "Beaver Divide Air Temperature - Demo")
    self.assertIn(
        "Beaver Divide Air Temperature - Demo", TestSystem.title(self.driver)
    )
    TestSystem.back(self.driver)
    SiteMap.select_resource(self.driver, "Beaver Divide Air Temperature - Demo")
    self.assertIn(
        "Beaver Divide Air Temperature - Demo", TestSystem.title(self.driver)
    )
    TestSystem.back(self.driver)

test_B_000032()

Confirm that the hydroshare footer version number matches up with the latest version number in GitHub

Source code in hydroshare/hydroshare.py
609
610
611
612
613
614
615
616
def test_B_000032(self):
    """Confirm that the hydroshare footer version number matches up with the
    latest version number in GitHub"""
    displayed_release_version = LandingPage.get_version(self.driver)
    expected_release_version = LandingPage.get_latest_release(
        GITHUB_ORG, GITHUB_REPO
    )
    self.assertEqual(expected_release_version, displayed_release_version)

test_B_000033()

Ensure Discover page refresh clears all filters

Source code in hydroshare/hydroshare.py
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
def test_B_000033(self):
    """Ensure Discover page refresh clears all filters"""
    LandingPage.to_discover(self.driver)
    Discover.add_filters(
        self.driver,
        author="Myers, Jessie",
        contributor="Cox, Chris",
        owner="Christopher, Adrian",
        subject="USACE Corps Water Management System (CWMS)",
        availability="public",
    )
    TestSystem.refresh(self.driver)
    TestSystem.wait(3)
    self.assertFalse(Discover.is_selected(self.driver, author="Myers, Jessie"))
    self.assertFalse(Discover.is_selected(self.driver, contributor="Cox, Chris"))
    self.assertFalse(Discover.is_selected(self.driver, owner="Christopher, Adrian"))
    self.assertFalse(
        Discover.is_selected(
            self.driver, subject="USACE Corps Water Management System (CWMS)"
        )
    )
    self.assertFalse(Discover.is_selected(self.driver, availability="public"))

test_B_000034()

Basic navigation to home/dashboard

Source code in hydroshare/hydroshare.py
641
642
643
644
645
646
647
648
649
650
def test_B_000034(self):
    """Basic navigation to home/dashboard"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.toggle_get_started(self.driver)
    visibility = [Home.is_get_started_showing(self.driver)]
    Home.toggle_get_started(self.driver)
    visibility += [Home.is_get_started_showing(self.driver)]
    Home.to_home(self.driver)
    self.assertNotEqual(visibility[0], visibility[1])

test_B_000035()

Ensure registration prompts for Organization entry

Source code in hydroshare/hydroshare.py
652
653
654
655
656
657
658
659
660
661
662
663
664
def test_B_000035(self):
    """Ensure registration prompts for Organization entry"""
    LandingPage.to_registration(self.driver)
    Registration.signup_user(
        self.driver,
        first_name="Jane",
        last_name="Doe",
        email="jane.doe.123@example.com",
        username="jdoe123",
        password="mypass",
    )
    error_text = Registration.check_error(self.driver)
    self.assertIn("Organization", error_text)

test_B_000036()

Ensure Correct Web apps show in Open With

Source code in hydroshare/hydroshare.py
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
def test_B_000036(self):
    """Ensure Correct Web apps show in Open With"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "ToolResource")
    NewResource.configure(self.driver, "TEST Web App")
    NewResource.create(self.driver)
    WebApp.support_resource_type(self.driver, "CompositeResource")
    WebApp.set_app_launching_url(self.driver, "https://www.hydroshare.org")
    WebApp.view(self.driver)
    WebApp.add_to_open_with(self.driver)
    WebApp.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "TEST Web App Composite")
    NewResource.create(self.driver)
    Resource.view(self.driver)
    Resource.open_with_by_title(self.driver, "TEST Web App")

test_B_000038()

Ensure invalid logins generate a helpful error message

Source code in hydroshare/hydroshare.py
683
684
685
686
687
688
689
690
691
692
def test_B_000038(self):
    """Ensure invalid logins generate a helpful error message"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, "Invalid", "Invalid")
    self.assertIn("username", Login.get_login_error(self.driver))
    self.assertIn("password", Login.get_login_error(self.driver))
    Login.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.toggle_get_started(self.driver)
    Home.toggle_get_started(self.driver)

test_B_000039()

Ensure pre-login My Resources redirects to My Resources after login

Source code in hydroshare/hydroshare.py
694
695
696
697
698
def test_B_000039(self):
    """Ensure pre-login My Resources redirects to My Resources after login"""
    LandingPage.to_my_resources(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    MyResources.enter_search(self.driver, "Search bar text")

test_B_000040()

Ensure invalid login messages are identical

Source code in hydroshare/hydroshare.py
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
def test_B_000040(self):
    """Ensure invalid login messages are identical"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, "Invalid")
    self.assertIn(
        "Invalid username/email and password", Login.get_login_error(self.driver)
    )
    Login.to_login(self.driver)
    Login.login(self.driver, "Invalid", PASSWORD)
    self.assertIn(
        "Invalid username/email and password", Login.get_login_error(self.driver)
    )
    Login.to_login(self.driver)
    Login.login(self.driver, "Invalid", "Invalid")
    self.assertIn(
        "Invalid username/email and password", Login.get_login_error(self.driver)
    )
    Login.to_login(self.driver)

test_B_000041()

Update profile About information

Source code in hydroshare/hydroshare.py
719
720
721
722
723
724
725
726
727
728
def test_B_000041(self):
    """Update profile About information"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_profile(self.driver)
    Profile.to_editor(self.driver)
    Profile.update_about(
        self.driver, "// TODO My Profile Description", "United States", "New York"
    )
    Profile.save_changes(self.driver)

test_B_000046()

Ensure clicking the Hydroshare logo links back to the home page

Source code in hydroshare/hydroshare.py
730
731
732
733
734
735
736
def test_B_000046(self):
    """Ensure clicking the Hydroshare logo links back to the home page"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_profile(self.driver)
    Profile.to_landing_page(self.driver)
    LandingPage.slide_hero_right(self.driver)

test_B_000047()

Ensure DEBUG=false for production hydroshare.org

Source code in hydroshare/hydroshare.py
738
739
740
741
742
743
def test_B_000047(self):
    """Ensure DEBUG=false for production hydroshare.org"""
    TestSystem.to_url(
        self.driver, "https://www.hydroshare.org/landingPageDoesNotExist/"
    )
    LandingPage.to_landing_page(self.driver)

test_B_000048()

Ensure pre-login My Groups redirects to My Groups after login

Source code in hydroshare/hydroshare.py
745
746
747
748
749
750
751
def test_B_000048(self):
    """Ensure pre-login My Groups redirects to My Groups after login"""
    LandingPage.to_collaborate(self.driver)
    Collaborate.to_groups(self.driver)
    Groups.to_my_groups(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    self.assertEqual("My Groups", Groups.get_title(self.driver))

test_B_000049()

Ensure user can logout after logging in

Source code in hydroshare/hydroshare.py
753
754
755
756
757
758
759
760
def test_B_000049(self):
    """Ensure user can logout after logging in"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.logout(self.driver)
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.logout(self.driver)

test_B_000050()

Ensure the support email mailto is in the site footer

Source code in hydroshare/hydroshare.py
762
763
764
765
766
def test_B_000050(self):
    """Ensure the support email mailto is in the site footer"""
    self.assertEqual(
        "mailto:help@cuahsi.org", LandingPage.get_support_email(self.driver)
    )

test_B_000051()

Ensure all Getting Started links open correctly, and in the same tab

Source code in hydroshare/hydroshare.py
768
769
770
771
772
773
774
775
776
777
778
779
def test_B_000051(self):
    """Ensure all Getting Started links open correctly, and in the same tab"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    for row in [1, 2]:
        for column in [1, 2, 3]:
            Home.check_getting_started_link(self.driver, row, column)
            Hydroshare.to_landing_page(self.driver)
            TestSystem.wait()
            TestSystem.back(self.driver)
            TestSystem.wait()
            TestSystem.back(self.driver)

test_B_000052()

Verify Recently Visited resources and authors link to valid pages

Source code in hydroshare/hydroshare.py
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
def test_B_000052(self):
    """Verify Recently Visited resources and authors link to valid pages"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    recent_activity_len = Home.get_recent_activity_length(self.driver)
    for i in range(1, recent_activity_len + 1):
        link_title, resource_title = Home.check_recent_activity_resource(
            self.driver, i
        )
        self.assertEqual(link_title, resource_title)
    for i in range(1, recent_activity_len + 1):
        link_author, profile_author = Home.check_recent_activity_author(
            self.driver, i
        )
        for word in [profile_author.split(" ")[0], profile_author.split(" ")[-1]]:
            self.assertIn(word, link_author)

test_B_000053()

Ensure private resources are not shown for anonymous viewers on the contributions profile page

Source code in hydroshare/hydroshare.py
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
def test_B_000053(self):
    """Ensure private resources are not shown for anonymous viewers on the contributions profile page"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_profile(self.driver)
    Profile.view_contributions(self.driver)
    initial_count = Profile.get_contribution_type_count(self.driver, 0)
    Profile.to_home(self.driver)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Private Contributions Test Resource")
    NewResource.create(self.driver)
    NewResource.to_profile(self.driver)
    Profile.view_contributions(self.driver)
    incremented_count = Profile.get_contribution_type_count(self.driver, 0)
    self.assertTrue(initial_count + 1 == incremented_count)
    Resource.logout(self.driver)
    TestSystem.to_url(self.driver, BASE_URL + "/user/3887/")
    Profile.view_contributions(self.driver)
    public_count = Profile.get_contribution_type_count(self.driver, 0)
    self.assertTrue(public_count < initial_count)

test_B_000055()

Verify featured apps featured on the dashboard link correctly

Source code in hydroshare/hydroshare.py
819
820
821
822
823
824
825
826
827
828
829
830
831
def test_B_000055(self):
    """Verify featured apps featured on the dashboard link correctly"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    # JupyterHub
    Home.to_app(self.driver, "Featured", 1)
    self.assertIn("JupyterHub", TestSystem.title(self.driver))
    External.switch_old_page(self.driver)
    External.close_new_page(self.driver)
    # MATLAB Online
    Home.to_app(self.driver, "Featured", 2)
    External.switch_old_page(self.driver)
    External.close_new_page(self.driver)

test_B_000057()

Verify CUAHSI apps mentioned on the dashboard link correctly

Source code in hydroshare/hydroshare.py
852
853
854
855
856
857
858
859
860
861
def test_B_000057(self):
    """Verify CUAHSI apps mentioned on the dashboard link correctly"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    cuahsi_apps = ["HydroClient", "HydroServerTools"]
    for i in range(0, 2):
        Home.to_app(self.driver, "CUAHSI", i + 1)
        self.assertIn(cuahsi_apps[i], TestSystem.title(self.driver))
        External.switch_old_page(self.driver)
        External.close_new_page(self.driver)

test_B_000058()

Confirm My Resources table title and author links redirect to reasonable pages

Source code in hydroshare/hydroshare.py
863
864
865
866
867
868
869
870
871
872
873
874
875
876
def test_B_000058(self):
    """Confirm My Resources table title and author links redirect to reasonable pages"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Linking Test Resource")
    NewResource.create(self.driver)
    Resource.to_my_resources(self.driver)
    MyResources.to_resource_from_table(self.driver, 1)
    self.assertIn("Linking Test Resource", TestSystem.title(self.driver))
    TestSystem.back(self.driver)
    MyResources.to_author_from_table(self.driver, 1)
    self.assertIn("User profile", TestSystem.title(self.driver))
    TestSystem.back(self.driver)

test_B_000059()

Confirm favorite star/unstar/filter works on MyResources

Source code in hydroshare/hydroshare.py
878
879
880
881
882
883
884
885
886
887
888
889
890
891
def test_B_000059(self):
    """Confirm favorite star/unstar/filter works on MyResources"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Favorite Resource Test")
    NewResource.create(self.driver)
    Resource.to_my_resources(self.driver)
    MyResources.favorite_resource(self.driver, 1)
    # "Owned by me filter", which is default checked
    MyResources.filter_table(self.driver, "owned")
    # Should still be visible, because it is favorited
    MyResources.favorite_resource(self.driver, 1)
    MyResources.filter_table(self.driver, "owned")

test_B_000060()

Ensure new resources are default private

Source code in hydroshare/hydroshare.py
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
def test_B_000060(self):
    """Ensure new resources are default private"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Private Test Resource")
    NewResource.create(self.driver)
    Resource.to_my_resources(self.driver)
    resource_href = MyResources.get_resource_link(self.driver, 1)
    Resource.logout(self.driver)
    TestSystem.to_url(self.driver, resource_href)
    self.assertFalse(Resource.has_visible_forms(self.driver))
    Home.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    TestSystem.to_url(self.driver, resource_href)
    self.assertIn("Private Test Resource", TestSystem.title(self.driver))

test_B_000064()

Ensure title renders properly for a sample of resources

Source code in hydroshare/hydroshare.py
910
911
912
913
914
915
916
917
918
919
def test_B_000064(self):
    """Ensure title renders properly for a sample of resources"""
    Home.to_sitemap(self.driver)
    links = SiteMap.get_resource_list(self.driver)
    print(len(links))
    for i in range(0, len(links), 761):
        SiteMap.select_resource_by_index(self.driver, i)
        self.assertTrue(len(Resource.get_title(self.driver)) > 0)
        print(Resource.get_title(self.driver))
        TestSystem.back(self.driver)

test_B_000073()

Adding and removing a resource reference works properly

Source code in hydroshare/hydroshare.py
921
922
923
924
925
926
927
928
929
930
931
932
933
def test_B_000073(self):
    """Adding and removing a resource reference works properly"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Resource Reference Test")
    NewResource.create(self.driver)
    Resource.view(self.driver)
    Resource.edit(self.driver)
    Resource.add_reference(self.driver, "First Principles")
    Resource.delete_reference(self.driver)
    Resource.add_reference(self.driver, "First Principles")
    Resource.delete_reference(self.driver)

test_B_000075()

Confirm making a resource public requires the prerequisite metadata to be filled out and that the notice about this stays visible in view and edit modes

Source code in hydroshare/hydroshare.py
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
def test_B_000075(self):
    """Confirm making a resource public requires the prerequisite metadata to be filled out
    and that the notice about this stays visible in view and edit modes"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Making Resource Public Test")
    NewResource.create(self.driver)
    Resource.view(self.driver)
    Resource.edit(self.driver)
    Resource.populate_abstract(self.driver, "// TODO Abstract")
    Resource.view(self.driver)
    Resource.edit(self.driver)
    Resource.is_visible_public_resource_notice(self.driver)
    Resource.add_subject_keyword(self.driver, "keyphrase multiple words")
    Resource.view(self.driver)
    Resource.is_visible_public_resource_notice(self.driver)

test_B_000085()

Copy a resource

Source code in hydroshare/hydroshare.py
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
def test_B_000085(self):
    """Copy a resource"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_discover(self.driver)
    Discover.add_filters(
        self.driver,
        author="Castronova, Anthony",
        resource_type="Composite",
        availability=["discoverable", "public"],
    )
    Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
    Discover.clear_notifications(self.driver)
    Resource.copy_resource(self.driver)
    TestSystem.wait(20)
    Resource.use_notification_link(self.driver, 1)
    Resource.edit(self.driver)
    Resource.view(self.driver)
    self.assertTrue(
        "Beaver Divide Air Temperature" in Resource.get_title(self.driver)
    )

test_B_000086()

Confirm basic resource versioning

Source code in hydroshare/hydroshare.py
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
def test_B_000086(self):
    """Confirm basic resource versioning"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_discover(self.driver)
    Discover.add_filters(
        self.driver,
        author="Castronova, Anthony",
        resource_type="Composite",
        availability=["discoverable", "public"],
    )
    Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
    Discover.clear_notifications(self.driver)
    Resource.copy_resource(self.driver)
    TestSystem.wait(20)
    Resource.use_notification_link(self.driver, 1)
    Resource.create_version(self.driver)
    TestSystem.wait(20)
    Resource.use_notification_link(self.driver, 1)
    Resource.edit(self.driver)
    Resource.view(self.driver)
    TestSystem.back(self.driver)
    try:
        Resource.edit(self.driver)
        # Old resource should no longer be editable
        self.assertTrue(False)
    except:
        TestSystem.wait(1)

test_B_000087()

Validate version rollback, through resource deletion

Source code in hydroshare/hydroshare.py
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
def test_B_000087(self):
    """Validate version rollback, through resource deletion"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_discover(self.driver)
    Discover.add_filters(
        self.driver,
        author="Castronova, Anthony",
        resource_type="Composite",
        availability=["discoverable", "public"],
    )
    Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
    Discover.clear_notifications(self.driver)
    Resource.copy_resource(self.driver)
    TestSystem.wait(20)
    Resource.use_notification_link(self.driver, 1)
    resource_copy = TestSystem.current_url(self.driver)
    Resource.create_version(self.driver)
    TestSystem.wait(20)
    Resource.use_notification_link(self.driver, 1)
    Resource.delete_resource(self.driver)
    TestSystem.wait(20)
    TestSystem.refresh(self.driver)
    self.assertIn("My Resources", TestSystem.title(self.driver))
    MyResources.to_resource_from_table(self.driver, 1)
    self.assertIn("Beaver Divide Air Temperature", TestSystem.title(self.driver))
    # Now editable old version
    try:
        Resource.edit(self.driver)
    except:
        self.assertTrue(False)

test_B_000088()

Confirm My Resources lists the latest resource version

Source code in hydroshare/hydroshare.py
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
def test_B_000088(self):
    """Confirm My Resources lists the latest resource version"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_discover(self.driver)
    Discover.add_filters(
        self.driver,
        author="Castronova, Anthony",
        resource_type="Composite",
        availability=["discoverable", "public"],
    )
    Discover.to_resource(self.driver, "Beaver Divide Air Temperature")
    Discover.clear_notifications(self.driver)
    Resource.copy_resource(self.driver)
    TestSystem.wait(20)
    Resource.use_notification_link(self.driver, 1)
    Resource.edit(self.driver)
    Resource.set_title(self.driver, "Old Version - Test")
    Resource.view(self.driver)
    Resource.create_version(self.driver)
    TestSystem.wait(20)
    Resource.use_notification_link(self.driver, 1)
    Resource.edit(self.driver)
    Resource.set_title(self.driver, "New Version - Test")
    Resource.view(self.driver)
    Resource.to_my_resources(self.driver)
    MyResources.to_resource_from_table(self.driver, 1)
    TestSystem.wait()
    self.assertEqual(Resource.get_title(self.driver), "New Version - Test")
    Resource.delete_resource(self.driver)
    TestSystem.wait(20)
    Resource.to_my_resources(self.driver)
    MyResources.to_resource_from_table(self.driver, 1)
    TestSystem.wait()
    self.assertEqual(Resource.get_title(self.driver), "Old Version - Test")
    try:
        Resource.edit(self.driver)
    except:
        # Old resource version should be editable, after the newer one is deleted
        self.assertTrue(False)

test_B_000089()

Confirm core resource sharing (viewer) functionality

Source code in hydroshare/hydroshare.py
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
def test_B_000089(self):
    """Confirm core resource sharing (viewer) functionality"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Sharing Resource Test")
    NewResource.create(self.driver)
    Resource.view(self.driver)
    Resource.grant_viewer(self.driver, "selenium-user2")
    users_with_access = Resource.get_user_access_count(self.driver)
    resource_url = TestSystem.current_url(self.driver)
    self.assertEqual(users_with_access, 2)
    Resource.logout(self.driver)
    LandingPage.to_login(self.driver)
    Login.login(self.driver, "selenium-user2", "abc123")
    self.driver.get(resource_url)
    self.assertEqual(Resource.get_title(self.driver), "Sharing Resource Test")

test_B_000091()

Confirm editor sharing

Source code in hydroshare/hydroshare.py
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
def test_B_000091(self):
    """Confirm editor sharing"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Editor Resource Test")
    NewResource.create(self.driver)
    Resource.view(self.driver)
    Resource.grant_editor(self.driver, "selenium-user3")
    users_with_access = Resource.get_user_access_count(self.driver)
    resource_url = TestSystem.current_url(self.driver)
    self.assertEqual(users_with_access, 2)
    Resource.logout(self.driver)
    LandingPage.to_login(self.driver)
    Login.login(self.driver, "selenium-user3", "abc123")
    self.driver.get(resource_url)
    Resource.edit(self.driver)
    Resource.view(self.driver)
    self.assertEqual(Resource.get_title(self.driver), "Editor Resource Test")

test_B_000092()

Confirm owner sharing

Source code in hydroshare/hydroshare.py
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
def test_B_000092(self):
    """Confirm owner sharing"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Owner Resource Test")
    NewResource.create(self.driver)
    Resource.view(self.driver)
    Resource.grant_owner(self.driver, "selenium-user4")
    users_with_access = Resource.get_user_access_count(self.driver)
    resource_url = TestSystem.current_url(self.driver)
    self.assertEqual(users_with_access, 2)
    Resource.logout(self.driver)
    LandingPage.to_login(self.driver)
    Login.login(self.driver, "selenium-user4", "abc123")
    self.driver.get(resource_url)
    Resource.delete_resource(self.driver)
    TestSystem.wait(20)
    self.driver.get(resource_url)
    TestSystem.refresh(self.driver)
    self.assertIn("Page not found", TestSystem.title(self.driver))

test_B_000094()

Confirm sharable functionality with a share chain

Source code in hydroshare/hydroshare.py
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
def test_B_000094(self):
    """Confirm sharable functionality with a share chain"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Sharable Chain Resource Test")
    NewResource.create(self.driver)
    Resource.view(self.driver)
    Resource.grant_editor(self.driver, "selenium-user5")
    users_with_access = Resource.get_user_access_count(self.driver)
    resource_url = TestSystem.current_url(self.driver)
    self.assertEqual(users_with_access, 2)
    Resource.logout(self.driver)
    LandingPage.to_login(self.driver)
    Login.login(self.driver, "selenium-user5", "abc123")
    self.driver.get(resource_url)
    Resource.edit(self.driver)
    Resource.view(self.driver)
    Resource.grant_editor(self.driver, "selenium-user6")
    users_with_access = Resource.get_user_access_count(self.driver)
    resource_url = TestSystem.current_url(self.driver)
    self.assertEqual(users_with_access, 3)
    Resource.logout(self.driver)
    LandingPage.to_login(self.driver)
    Login.login(self.driver, "selenium-user6", "abc123")
    self.driver.get(resource_url)
    Resource.edit(self.driver)
    Resource.view(self.driver)
    self.assertEqual(
        Resource.get_title(self.driver), "Sharable Chain Resource Test"
    )

test_B_000095()

Confirm the ability to block sharable functionality with the sharable setting

Source code in hydroshare/hydroshare.py
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
def test_B_000095(self):
    """Confirm the ability to block sharable functionality with the sharable setting"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Sharable Chain Resource Test")
    NewResource.create(self.driver)
    Resource.view(self.driver)
    Resource.grant_editor(self.driver, "selenium-user5")
    Resource.toggle_sharable(self.driver)
    users_with_access = Resource.get_user_access_count(self.driver)
    resource_url = TestSystem.current_url(self.driver)
    self.assertEqual(users_with_access, 2)
    Resource.logout(self.driver)
    LandingPage.to_login(self.driver)
    Login.login(self.driver, "selenium-user5", "abc123")
    self.driver.get(resource_url)
    Resource.edit(self.driver)
    Resource.view(self.driver)
    try:
        Resource.grant_editor(self.driver, "selenium-user6")
        self.assertTrue(False)  # Selenium-User5 should not be able to share
    except:
        TestSystem.wait(1)

test_B_000096()

Update profile contact information

Source code in hydroshare/hydroshare.py
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
def test_B_000096(self):
    """Update profile contact information"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_profile(self.driver)
    Profile.to_editor(self.driver)
    Profile.update_contact(
        self.driver,
        phone1="555-555-5555",
        phone2="555-555-5555",
        email="jim@example.com",
        website="example.com",
    )
    Profile.save_changes(self.driver)

test_B_000097()

Update profile name matches logout interface name

Source code in hydroshare/hydroshare.py
1209
1210
1211
1212
1213
1214
1215
1216
def test_B_000097(self):
    """Update profile name matches logout interface name"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_profile(self.driver)
    self.assertEqual(
        Profile.get_logged_in_name(self.driver), Profile.get_name(self.driver)
    )

test_B_000098()

Update profile email matches logout interface name

Source code in hydroshare/hydroshare.py
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
def test_B_000098(self):
    """Update profile email matches logout interface name"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_profile(self.driver)
    self.assertEqual(
        Profile.get_logged_in_name(self.driver), Profile.get_name(self.driver)
    )
    Profile.to_editor(self.driver)
    self.assertEqual(
        Profile.get_logged_in_email(self.driver), Profile.get_email(self.driver)
    )

test_B_000099()

Ensure the total for each author matches the total when the author filter is applied in Discover

Source code in hydroshare/hydroshare.py
1231
1232
1233
1234
1235
1236
1237
1238
1239
def test_B_000099(self):
    """Ensure the total for each author matches the total when the author filter is applied in Discover"""
    LandingPage.to_discover(self.driver)
    for i in range(1, 20, 4):
        Discover.toggle_author_filter_by_index(self.driver, i)
        filter_count = Discover.get_author_resource_count_by_index(self.driver, i)
        table_count = Discover.count_results_in_table(self.driver)
        Discover.toggle_author_filter_by_index(self.driver, i)
        self.assertEqual(filter_count, table_count)

test_B_000100()

Ensure the total for each contributor matches the total when the contributor filter is applied in Discover

Source code in hydroshare/hydroshare.py
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
def test_B_000100(self):
    """Ensure the total for each contributor matches the total when the contributor filter is applied in Discover"""
    LandingPage.to_discover(self.driver)
    for i in range(2, 20, 4):
        Discover.toggle_contributor_filter_by_index(self.driver, i)
        filter_count = Discover.get_contributor_resource_count_by_index(
            self.driver, i
        )
        table_count = Discover.count_results_in_table(self.driver)
        Discover.toggle_contributor_filter_by_index(self.driver, i)
        self.assertEqual(filter_count, table_count)

test_B_000101()

Ensure the total for each owner matches the total when the owner filter is applied in Discover

Source code in hydroshare/hydroshare.py
1253
1254
1255
1256
1257
1258
1259
1260
1261
def test_B_000101(self):
    """Ensure the total for each owner matches the total when the owner filter is applied in Discover"""
    LandingPage.to_discover(self.driver)
    for i in range(3, 20, 4):
        Discover.toggle_owner_filter_by_index(self.driver, i)
        filter_count = Discover.get_owner_resource_count_by_index(self.driver, i)
        table_count = Discover.count_results_in_table(self.driver)
        Discover.toggle_owner_filter_by_index(self.driver, i)
        self.assertEqual(filter_count, table_count)

test_B_000102()

Confirm dates are formatted consistently across resources in the results table

Source code in hydroshare/hydroshare.py
1263
1264
1265
1266
def test_B_000102(self):
    """Confirm dates are formatted consistently across resources in the results table"""
    LandingPage.to_discover(self.driver)
    Discover.uses_consistent_date_formatting(self.driver)

test_B_000103()

Ensure resource logos are consistent within each resource type

Source code in hydroshare/hydroshare.py
1268
1269
1270
1271
1272
1273
1274
def test_B_000103(self):
    """Ensure resource logos are consistent within each resource type"""
    LandingPage.to_discover(self.driver)
    for i in range(3, Discover.get_count_of_types(self.driver), 7):
        Discover.toggle_type_filter_by_index(self.driver, i)
        self.assertTrue(Discover.uses_consistent_icon(self.driver))
        Discover.toggle_type_filter_by_index(self.driver, i)

test_B_000105()

Ensure the total for each resource type matches the total when the resource type filter is applied in Discover

Source code in hydroshare/hydroshare.py
1276
1277
1278
1279
1280
1281
1282
1283
1284
def test_B_000105(self):
    """Ensure the total for each resource type matches the total when the resource type filter is applied in Discover"""
    LandingPage.to_discover(self.driver)
    for i in range(4, Discover.get_count_of_types(self.driver), 3):
        Discover.toggle_type_filter_by_index(self.driver, i)
        filter_count = Discover.get_type_resource_count_by_index(self.driver, i)
        table_count = Discover.count_results_in_table(self.driver)
        Discover.toggle_type_filter_by_index(self.driver, i)
        self.assertEqual(filter_count, table_count)

test_B_000106()

Ensure the listed first author in the Discover page is listed as an author on the resource page

Source code in hydroshare/hydroshare.py
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
def test_B_000106(self):
    """Ensure the listed first author in the Discover page is listed as an author on the resource page"""
    LandingPage.to_discover(self.driver)
    # Get a pseudo-random sample by taking the first result of a few random string searches
    search_strings = [
        "Berlin",
        "CUAHSI",
        "99",
        "Estuary",
        "New York",
        "Ice",
        "Antarctica",
        "Phosphorus",
        "Leak",
        "Database",
    ]
    for search_string in search_strings:
        Discover.search(self.driver, search_string)
        first_author = Discover.get_first_author_by_resource_index(self.driver, 1)
        Discover.to_resource_by_index(self.driver, 1)  # first row, second column
        authors_csv = ", ".join(Resource.get_authors(self.driver))
        for name_part in first_author.replace(",", "").split(" "):
            self.assertIn(name_part, authors_csv)
        External.switch_old_page(self.driver)
        External.close_new_page(self.driver)

test_B_000109()

Confirms Beaver Divide Air Temperature resource landing page is online via navigation and title check, then downloads the BagIt archive and confirms the BagIt file size matches expectation

Source code in hydroshare/hydroshare.py
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
def test_B_000109(self):
    """
    Confirms Beaver Divide Air Temperature resource landing page is
    online via navigation and title check, then downloads the BagIt
    archive and confirms the BagIt file size matches expectation
    """
    LandingPage.to_discover(self.driver)
    Discover.search(
        self.driver,
        "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
    )
    Discover.to_resource(
        self.driver,
        "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
    )
    Resource.download_bagit(self.driver)
    TestSystem.wait()
    TestSystem.to_url(self.driver, "chrome://downloads")
    Downloads.check_successful_download(self.driver)

test_B_000110()

Confirms file downloads within a resource are successful

Source code in hydroshare/hydroshare.py
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
def test_B_000110(self):
    """
    Confirms file downloads within a resource are successful
    """
    LandingPage.to_discover(self.driver)
    Discover.search(
        self.driver,
        "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
    )
    Discover.to_resource(
        self.driver,
        "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
    )
    Resource.download_file_by_index(self.driver, 2)
    TestSystem.wait(10)
    TestSystem.to_url(self.driver, "chrome://downloads")
    Downloads.check_successful_download(self.driver)

test_B_000111()

Confirms file zip downloads within a resource are successful

Source code in hydroshare/hydroshare.py
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
def test_B_000111(self):
    """
    Confirms file zip downloads within a resource are successful
    """
    LandingPage.to_discover(self.driver)
    Discover.search(
        self.driver,
        "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
    )
    Discover.to_resource(
        self.driver,
        "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
    )
    Resource.download_file_zip_by_index(self.driver, 3)
    TestSystem.wait(10)
    TestSystem.to_url(self.driver, "chrome://downloads")
    Downloads.check_successful_download(self.driver)

test_B_000112()

Confirms the resource file download links are valid

Source code in hydroshare/hydroshare.py
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
def test_B_000112(self):
    """
    Confirms the resource file download links are valid
    """
    LandingPage.to_discover(self.driver)
    Discover.search(
        self.driver,
        "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
    )
    Discover.to_resource(
        self.driver,
        "Waterhackweek 2019 Cyberseminar: Jupyter notebooks and workflows on Hydroshare",
    )
    file_download_link = Resource.get_file_download_link_by_index(self.driver, 1)
    TestSystem.to_url(self.driver, file_download_link)
    TestSystem.wait(10)
    TestSystem.to_url(self.driver, "chrome://downloads")
    Downloads.check_successful_download(self.driver)

test_B_000113()

Download and upload a 541 MB file from the API, then download it from the GUI

Source code in hydroshare/hydroshare.py
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
def test_B_000113(self):
    """
    Download and upload a 541 MB file from the API, then download it from the GUI
    """
    urlretrieve(
        BASE_URL
        + "/resource/a7b99c31adfe4f56899bef1a6700f9cf/data/contents/1m_snowOff_filter_SHD.zip",
        "1m_snowOff_filter_SHD.zip",
    )
    r = requests.post(
        BASE_URL + "/hsapi/resource/",
        auth=(USERNAME, PASSWORD),
        data={
            "title": "Automated Test Resource CUAHSI QA",
            "abstract": "This is a test resource for QA purposes.",
            "keywords": ["test", "QA", "CUAHSI"],
        },
    )
    resource_id = r.json()["resource_id"]
    files = {"file": open("1m_snowOff_filter_SHD.zip", "rb")}
    r = requests.post(
        BASE_URL + "/hsapi/resource/{}/files/".format(resource_id),
        auth=(USERNAME, PASSWORD),
        files=files,
    )
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    TestSystem.to_url(self.driver, BASE_URL + "/resource/{}/".format(resource_id))
    Resource.download_bagit(self.driver)
    TestSystem.wait(10)
    self.assertTrue(Downloads.check_successful_download_new_tab(self.driver))

test_B_000115()

Confirms password reset is not confirmed unless submit is clicked

Source code in hydroshare/hydroshare.py
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
def test_B_000115(self):
    """Confirms password reset is not confirmed unless submit is clicked"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_profile(self.driver)
    Profile.to_editor(self.driver)
    Profile.queue_password_change(self.driver, PASSWORD, PASSWORD + "test")
    Home.logout(self.driver)
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD + "test")
    self.assertIn(
        "Invalid username/email and password", Login.get_login_error(self.driver)
    )

test_B_000117()

Create a discoverable resource

Source code in hydroshare/hydroshare.py
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
def test_B_000117(self):
    """Create a discoverable resource"""
    urlretrieve(
        BASE_URL
        + "/resource/a7b99c31adfe4f56899bef1a6700f9cf/data/contents/1m_snowOff_filter_SHD.zip",
        "1m_snowOff_filter_SHD.zip",
    )
    r = requests.post(
        BASE_URL + "/hsapi/resource/",
        auth=(USERNAME, PASSWORD),
        data={
            "title": "Discoverable Resource CUAHSI QA",
            "abstract": "This is a test resource for QA purposes.",
            "keywords": ["test", "QA", "CUAHSI"],
        },
    )
    resource_id = r.json()["resource_id"]
    files = {"file": open("1m_snowOff_filter_SHD.zip", "rb")}
    r = requests.post(
        BASE_URL + "/hsapi/resource/{}/files/".format(resource_id),
        auth=(USERNAME, PASSWORD),
        files=files,
    )
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    TestSystem.to_url(self.driver, BASE_URL + "/resource/{}/".format(resource_id))
    Resource.edit(self.driver)
    Resource.make_discoverable(self.driver)
    Resource.logout(self.driver)
    LandingPage.to_discover(self.driver)
    Discover.add_filters(
        self.driver,
        availability=["discoverable"],
    )
    Discover.to_resource(self.driver, "Discoverable Resource CUAHSI QA")

test_B_000118()

Confirm the addition and deletion of metadata works for both point and box coverage

Source code in hydroshare/hydroshare.py
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
def test_B_000118(self):
    """Confirm the addition and deletion of metadata works for both point and box coverage"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Spatial Coverage Test")
    NewResource.create(self.driver)
    Resource.set_spatial_coverage_box(self.driver, 44, 43, 42, 41)
    Resource.delete_spatial_coverage(self.driver)
    TestSystem.wait()
    Resource.set_spatial_coverage_point(self.driver, 42, 42)
    Resource.delete_spatial_coverage(self.driver)

test_B_000119()

Comfirm a warning message when making a resource no longer public-compatible

Source code in hydroshare/hydroshare.py
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
def test_B_000119(self):
    """Comfirm a warning message when making a resource no longer public-compatible"""
    urlretrieve(
        BASE_URL
        + "/resource/a7b99c31adfe4f56899bef1a6700f9cf/data/contents/1m_snowOff_filter_SHD.zip",
        "1m_snowOff_filter_SHD.zip",
    )
    r = requests.post(
        BASE_URL + "/hsapi/resource/",
        auth=(USERNAME, PASSWORD),
        data={
            "title": "Discoverable Resource CUAHSI QA",
            "abstract": "This is a test resource for QA purposes.",
            "keywords": ["test", "QA", "CUAHSI"],
        },
    )
    resource_id = r.json()["resource_id"]
    files = {"file": open("1m_snowOff_filter_SHD.zip", "rb")}
    r = requests.post(
        BASE_URL + "/hsapi/resource/{}/files/".format(resource_id),
        auth=(USERNAME, PASSWORD),
        files=files,
    )
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    TestSystem.to_url(self.driver, BASE_URL + "/resource/{}/".format(resource_id))
    Resource.edit(self.driver)
    Resource.populate_abstract(self.driver, "// TODO Abstract")
    Resource.add_subject_keyword(self.driver, "keyphrase multiple words")
    Resource.make_public(self.driver)
    Resource.view(self.driver)
    self.assertEqual(Resource.get_sharing_status(self.driver), "Public")
    Resource.edit(self.driver)
    Resource.delete_file_by_index(self.driver, 1)
    TestSystem.wait(10)
    Resource.view(self.driver)
    self.assertEqual(Resource.get_sharing_status(self.driver), "Private")

test_B_000120()

Confirm app tool image by URL for .svg file

Source code in hydroshare/hydroshare.py
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
def test_B_000120(self):
    """
    Confirm app tool image by URL for .svg file
    """
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "ToolResource")
    NewResource.configure(self.driver, "Web App (TEST 120)")
    NewResource.create(self.driver)

    img_url = "https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg"
    WebApp.add_photo_by_url(self.driver, img_url)
    self.assertTrue(WebApp.confirm_photo_uploaded(self.driver))

test_B_000121()

Confirm remove app tool image for .ico

Source code in hydroshare/hydroshare.py
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
def test_B_000121(self):
    """
    Confirm remove app tool image for .ico
    """
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "ToolResource")
    NewResource.configure(self.driver, "Web App (TEST 121)")
    NewResource.create(self.driver)
    img_url = "https://duckduckgo.com/favicon.ico"
    WebApp.add_photo_by_url(self.driver, img_url)
    TestSystem.wait()
    self.assertTrue(WebApp.confirm_photo_uploaded(self.driver))
    WebApp.remove_photo(self.driver)
    TestSystem.wait()
    self.assertFalse(WebApp.confirm_photo_uploaded(self.driver))

test_B_000122()

Confirms zip and unzip folder within a resource is successful

Source code in hydroshare/hydroshare.py
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
def test_B_000122(self):
    """
    Confirms zip and unzip folder within a resource is successful
    """
    folder_name = "test_folder"
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Zip folder test (TEST 122)")
    NewResource.create(self.driver)
    Resource.create_folder(self.driver, folder_name)
    folder_index = Resource.get_file_index_by_name(self.driver, folder_name)
    Resource.zip_folder_by_index(self.driver, folder_index)
    TestSystem.wait()
    zip_index = Resource.get_file_index_by_name(self.driver, folder_name + ".zip")
    Resource.unzip_folder_by_index(self.driver, zip_index)
    Resource.wait_on_task_completion(self.driver, 1, 30)

test_B_000123()

Create a resource and unzip a large file in the dropzone

Source code in hydroshare/hydroshare.py
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
def test_B_000123(self):
    """Create a resource and unzip a large file in the dropzone"""
    folder_name = "1m_snowOff_filter_SHD.zip"
    r = requests.post(
        BASE_URL + "/hsapi/resource/",
        auth=(USERNAME, PASSWORD),
        data={
            "title": "Large Zip folder test QA",
            "abstract": "This is a test resource for QA purposes.",
            "keywords": ["test", "QA", "CUAHSI"],
        },
    )

    # get a large zip that we can test with
    if not os.path.exists(folder_name):
        if "localhost" in BASE_URL:
            # local instance might not have the Beaver Divide so get it from Beta
            urlretrieve(
                "https://beta.hydroshare.org/resource/a7b99c31adfe4f56899bef1a6700f9cf/data/contents/"
                + folder_name,
                folder_name,
            )
        else:
            urlretrieve(
                BASE_URL
                + "/resource/a7b99c31adfe4f56899bef1a6700f9cf/data/contents/"
                + folder_name,
                folder_name,
            )

    resource_id = r.json()["resource_id"]
    files = {"file": open(folder_name, "rb")}
    r = requests.post(
        BASE_URL + "/hsapi/resource/{}/files/".format(resource_id),
        auth=(USERNAME, PASSWORD),
        files=files,
    )
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    TestSystem.to_url(self.driver, BASE_URL + "/resource/{}/".format(resource_id))
    Resource.edit(self.driver)
    zip_index = Resource.get_file_index_by_name(self.driver, folder_name)
    Resource.unzip_folder_by_index(self.driver, zip_index)
    Resource.wait_on_task_completion(self.driver, 1, 30)
    unzip_index = Resource.get_file_index_by_name(self.driver, folder_name)
    self.assertGreaterEqual(unzip_index, 1)

test_B_000124()

Confirm that duplicate authors are not permitted on a resource

Source code in hydroshare/hydroshare.py
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
def test_B_000124(self):
    """Confirm that duplicate authors are not permitted on a resource"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Duplicate Author (TEST 124)")
    NewResource.create(self.driver)
    Resource.add_dup_authors(self.driver, "CZO")
    error_text = Resource.check_author_warning(self.driver)
    self.assertIn("author", error_text)

test_B_000125()

Confirm that HTML injection is not possible for resource labels

Source code in hydroshare/hydroshare.py
1627
1628
1629
1630
1631
1632
1633
def test_B_000125(self):
    """Confirm that HTML injection is not possible for resource labels"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.to_my_resources(self.driver)
    MyResources.create_label(self.driver, "<span>Span</span>")
    self.assertTrue(MyResources.check_html_injection_error(self.driver))

test_B_000126()

Ensure cancelled metadata key:value pairs are cleared

Source code in hydroshare/hydroshare.py
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
def test_B_000126(self):
    """Ensure cancelled metadata key:value pairs are cleared"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Cancelled Metadata Test")
    NewResource.create(self.driver)
    Resource.prepare_metadata(self.driver, "Key", "Value")
    Resource.cancel_metadata(self.driver)
    self.assertTrue(Resource.check_residual_metadata(self.driver))

test_B_000127()

Ensure non-Hydroshare authors are shown normally on the resource landing page

Source code in hydroshare/hydroshare.py
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
def test_B_000127(self):
    """Ensure non-Hydroshare authors are shown normally on the resource landing page"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Non-Hydroshare Author Test")
    NewResource.create(self.driver)
    Resource.add_other_author(self.driver, "Other Person")
    Resource.delete_author(self.driver, 1)
    Resource.view(self.driver)
    self.assertEqual(["Other Person"], Resource.get_authors(self.driver))

test_B_000128()

Add a similar to relationship between resources

Source code in hydroshare/hydroshare.py
1658
1659
1660
1661
1662
1663
1664
1665
1666
def test_B_000128(self):
    """Add a similar to relationship between resources"""
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    Home.create_resource(self.driver, "CompositeResource")
    NewResource.configure(self.driver, "Similar Resource One")
    NewResource.create(self.driver)
    Resource.add_similar_to(self.driver, "google.com")
    Resource.view(self.driver)

JupyterhubTestSuite

Bases: HydroshareTestSuite

Python unittest setup for jupyterhub testing

Source code in hydroshare/hydroshare.py
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
class JupyterhubTestSuite(HydroshareTestSuite):
    """Python unittest setup for jupyterhub testing"""

    def setUp(self):
        super(JupyterhubTestSuite, self).setUp()
        self.driver.get(BASE_URL)

    def test_000001(self):
        """Spawn and interact with a server"""
        TestSystem.to_url(self.driver, "https://jupyter-edu.cuahsi.org/hub/login")
        # JupyterHub.agree_to_terms_of_use(self.driver)
        JupyterHub.to_hs_login(self.driver)
        Login.login(self.driver, "selenium-user1", "abc123")
        TestSystem.wait(3)
        JupyterHub.authorize_jupyterhub(self.driver)
        # JupyterHub.select_minimal_spawner(self.driver)
        # JupyterHub.select_scientific_spawner(self.driver)
        # JupyterHub.select_r_scientific_spawner(self.driver)
        JupyterHubNotebooks.wait_on_server_creation(self.driver)
        if not JupyterHubNotebooks.is_spawner_set(self.driver):
            JupyterHubNotebooks.select_notebook_spawner(self.driver)
        JupyterHubNotebook.save_notebook(self.driver)
        TestSystem.wait(5)

test_000001()

Spawn and interact with a server

Source code in hydroshare/hydroshare.py
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
def test_000001(self):
    """Spawn and interact with a server"""
    TestSystem.to_url(self.driver, "https://jupyter-edu.cuahsi.org/hub/login")
    # JupyterHub.agree_to_terms_of_use(self.driver)
    JupyterHub.to_hs_login(self.driver)
    Login.login(self.driver, "selenium-user1", "abc123")
    TestSystem.wait(3)
    JupyterHub.authorize_jupyterhub(self.driver)
    # JupyterHub.select_minimal_spawner(self.driver)
    # JupyterHub.select_scientific_spawner(self.driver)
    # JupyterHub.select_r_scientific_spawner(self.driver)
    JupyterHubNotebooks.wait_on_server_creation(self.driver)
    if not JupyterHubNotebooks.is_spawner_set(self.driver):
        JupyterHubNotebooks.select_notebook_spawner(self.driver)
    JupyterHubNotebook.save_notebook(self.driver)
    TestSystem.wait(5)

PerformanceTestSuite

Bases: BaseTestSuite

Python unittest setup for smoke tests

Source code in hydroshare/hydroshare.py
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
class PerformanceTestSuite(BaseTestSuite):
    """Python unittest setup for smoke tests"""

    def setUp(self):
        super(PerformanceTestSuite, self).setUp()

    def test_D_000000(self):
        """
        Anonymously download a BagIt, straight from the resource landing page
        """
        resource = super(PerformanceTestSuite, self).getResourceId()
        TestSystem.to_url(self.driver, BASE_URL + "/resource/{}/".format(resource))
        Resource.download_bagit(self.driver)
        TestSystem.wait()
        Resource.wait_on_task_completion(self.driver, 1, 300)
        Resource.use_notification_link(self.driver, 1)
        TestSystem.to_url(self.driver, "chrome://downloads")
        self.assertTrue(Downloads.check_successful_download(self.driver))

    def test_D_000001(self):
        """
        Login, then download a BagIt, straight from the resource landing page
        """
        resource = super(PerformanceTestSuite, self).getResourceId()
        TestSystem.to_url(self.driver, BASE_URL)
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        TestSystem.to_url(self.driver, BASE_URL + "/resource/{}/".format(resource))
        Resource.download_bagit(self.driver)
        TestSystem.wait()
        Resource.wait_on_task_completion(self.driver, 1, 300)
        Resource.use_notification_link(self.driver, 1)
        TestSystem.to_url(self.driver, "chrome://downloads")
        self.assertTrue(Downloads.check_successful_download_new_tab(self.driver))

    def test_D_000002(self):
        """
        Make a set of test resources public
        """
        TestSystem.to_url(self.driver, BASE_URL)
        LandingPage.to_login(self.driver)
        Login.login(self.driver, USERNAME, PASSWORD)
        resource_ids = [
            # Copy resource IDs here
        ]
        for resource_id in resource_ids:
            TestSystem.to_url(
                self.driver, BASE_URL + "/resource/{}/".format(resource_id)
            )
            Resource.edit(self.driver)
            Resource.make_public(self.driver)

test_D_000000()

Anonymously download a BagIt, straight from the resource landing page

Source code in hydroshare/hydroshare.py
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
def test_D_000000(self):
    """
    Anonymously download a BagIt, straight from the resource landing page
    """
    resource = super(PerformanceTestSuite, self).getResourceId()
    TestSystem.to_url(self.driver, BASE_URL + "/resource/{}/".format(resource))
    Resource.download_bagit(self.driver)
    TestSystem.wait()
    Resource.wait_on_task_completion(self.driver, 1, 300)
    Resource.use_notification_link(self.driver, 1)
    TestSystem.to_url(self.driver, "chrome://downloads")
    self.assertTrue(Downloads.check_successful_download(self.driver))

test_D_000001()

Login, then download a BagIt, straight from the resource landing page

Source code in hydroshare/hydroshare.py
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
def test_D_000001(self):
    """
    Login, then download a BagIt, straight from the resource landing page
    """
    resource = super(PerformanceTestSuite, self).getResourceId()
    TestSystem.to_url(self.driver, BASE_URL)
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    TestSystem.to_url(self.driver, BASE_URL + "/resource/{}/".format(resource))
    Resource.download_bagit(self.driver)
    TestSystem.wait()
    Resource.wait_on_task_completion(self.driver, 1, 300)
    Resource.use_notification_link(self.driver, 1)
    TestSystem.to_url(self.driver, "chrome://downloads")
    self.assertTrue(Downloads.check_successful_download_new_tab(self.driver))

test_D_000002()

Make a set of test resources public

Source code in hydroshare/hydroshare.py
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
def test_D_000002(self):
    """
    Make a set of test resources public
    """
    TestSystem.to_url(self.driver, BASE_URL)
    LandingPage.to_login(self.driver)
    Login.login(self.driver, USERNAME, PASSWORD)
    resource_ids = [
        # Copy resource IDs here
    ]
    for resource_id in resource_ids:
        TestSystem.to_url(
            self.driver, BASE_URL + "/resource/{}/".format(resource_id)
        )
        Resource.edit(self.driver)
        Resource.make_public(self.driver)