diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6a11290d6..1c94ca76a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,76 +34,6 @@ jobs: - name: 'Run the unit tests' run: prove -lrs -j4 t - webdriver_tests: - name: 'Webdriver Tests for ${{ matrix.browser.name }}' - runs-on: '${{ matrix.browser.os }}' - timeout-minutes: 30 - - strategy: - fail-fast: false - matrix: - browser: - - name: 'Chromium' - command: 'chromedriver --port=4444 &' - os: 'ubuntu-22.04' - - name: 'Firefox' - command: 'MOZ_HEADLESS=1 geckodriver --log warn &' - os: 'ubuntu-22.04' - - services: - postgres: - image: postgres - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgrespassword - POSTGRES_DB: postgres - ports: - - 5432:5432 - - env: - GADS_USERNAME: 'test@example.com' - GADS_PASSWORD: 'xyz123' - - steps: - - name: 'Check out the GADS code' - uses: 'actions/checkout@v4' - - name: 'Install Non-CPAN dependencies' - run: | - sudo apt-get update - sudo apt-get install cpanminus liblua5.3-dev - # Avoid "Install CPAN dependencies" needing to compile so much - sudo apt-get install libdatetime-format-sqlite-perl libtest-most-perl libdatetime-set-perl libdbix-class-schema-loader-perl - - name: 'Build cpanfile' - run: | - perl bin/output_cpanfile > cpanfile - ( cd webdriver && perl ../bin/output_cpanfile ) >> cpanfile - - name: 'Install CPAN dependencies' - uses: 'perl-actions/install-with-cpanm@v1' - with: - cpanfile: 'cpanfile' - - name: 'Set up credentials for psql' - # See https://wiki.postgresql.org/wiki/Pgpass - run: | - echo '*:*:*:postgres:postgrespassword' > ~/.pgpass - chmod 600 ~/.pgpass - - name: 'create uploads directory' - run: | - mkdir -p /tmp/uploads - chmod 777 /tmp/uploads - - name: 'Start the application' - env: - DANCER_CONFDIR: 'webdriver' - PGDATABASE: 'postgres' - PGHOST: 'localhost' - PGUSER: 'postgres' - run: | - ./bin/setup_database - perl bin/app.pl & - - name: 'Run the Webdriver implementation' - run: '${{ matrix.browser.command }}' - - name: 'Run the Webdriver tests' - run: prove -lmrsv webdriver/t - cypress_tests: name: 'Cypress Tests for ${{ matrix.browser.name }}' runs-on: '${{ matrix.browser.os }}' diff --git a/Makefile.PL b/Makefile.PL index 5275d1d94..8ef715c58 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,6 +1,7 @@ use strict; use warnings; use ExtUtils::MakeMaker; +use File::Find; # Normalize version strings like 6.30_02 to 6.3002, # so that we can do numerical comparisons on it. @@ -56,8 +57,6 @@ our %prereq_pm = ( 'Session::Token' => 0, 'Starman' => 0, 'String::CamelCase' => 0, - 'Test::MockTime' => 0, - 'Test::More' => '1.302112', 'Text::Autoformat' => 0, 'Text::CSV::Encoded' => 0, 'Text::Markdown' => 0, @@ -69,8 +68,33 @@ our %prereq_pm = ( 'YAML' => 0, ); +our %test_pm = ( + 'Test::MockTime' => 0, + 'Test::More' => '1.302112', +); + return 1 if caller(); +sub pre_build { + die "yarn is not installed. Please install yarn to build this project.\n" if(!`which yarn`); + + print `yarn`; + print `yarn build --no-watch`; +} + +sub post_build { + print `make manifest`; + open(my $fs, ">>MANIFEST"); + find sub { + my $item = $File::Find::name; + return unless $item =~ /\.sql$/gi; + print $fs $item . "\n"; + }, ("share"); + close $fs; +} + +pre_build(); + WriteMakefile( NAME => 'GADS', AUTHOR => q{Ctrl O }, @@ -81,6 +105,9 @@ WriteMakefile( : ()), PL_FILES => {}, PREREQ_PM => \%prereq_pm, + TEST_REQUIRES => \%test_pm, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'GADS-*' }, ); + +post_build(); diff --git a/bin/seed-database.pl b/bin/seed-database.pl index 4913c942a..97422f715 100755 --- a/bin/seed-database.pl +++ b/bin/seed-database.pl @@ -61,6 +61,7 @@ my $migration = DBIx::Class::Migration->new( schema_class => 'GADS::Schema', + target_dir => "$FindBin::Bin/../share", schema_args => [{ user => $dbic->{user}, password => $dbic->{password}, diff --git a/dpkg/control b/dpkg/control new file mode 100644 index 000000000..241af1b88 --- /dev/null +++ b/dpkg/control @@ -0,0 +1,70 @@ +Package: GADS +Version: %version% +Section: database +Priority: optional +Architecture: amd64 +Depends: libalgorithm-dependency-perl (>= 0), + libcgi-deurl-xs-perl (>= 0), + libcrypt-urandom-perl (>= 0), + libctrlo-crypt-xkcdpassword-perl (>= 0), + libctrlo-pdf-perl (>= 0.06), + libdancer2-perl (>= 0.300001), + libdancer2-plugin-auth-extensible-perl (>= 0.601), + libdancer2-plugin-auth-extensible-provider-dbic-perl (>= 0.623), + libdancer2-plugin-dbic-perl (>= 0.0013), + libdancer2-plugin-logreport-perl (>= 1.10), + libdata-compare-perl (>= 0), + libdate-holidays-gb-perl (>= 0), + libdatetime-perl (>= 0), + libdatetime-event-random-perl (>= 0), + libdatetime-format-cldr-perl (>= 0), + libdatetime-format-datemanip-perl (>= 0), + libdatetime-format-iso8601-perl (>= 0), + libdatetime-format-sqlite-perl (>= 0), + libdatetime-format-strptime-perl (>= 0), + libdatetime-set-perl (>= 0), + libdbd-pg-perl (>= 0), + libdbix-class-helpers-perl (>= 0), + libdbix-class-migration-perl (>= 0), + libdbix-class-perl (>= 0), + libfile-bom-perl (>= 0), + libfile-libmagic-perl (>= 0), + libhtml-fromtext-perl (>= 0), + libhtml-scrubber-perl (>= 0), + libinline-lua-perl (>= 0.16), + liblist-compare-perl (>= 0), + liblist-moreutils-perl (>= 0), + libscalar-list-utils-perl (>= 1.45), + liblog-log4perl-perl (>= 0), + liblog-report-perl (>= 1.28), + libmail-message-perl (>= 0), + libmail-transport-perl (>= 0), + libmath-random-isaac-xs-perl (>= 0), + libmath-round-perl (>= 0), + libmoox-singleton-perl (>= 0), + libmoox-types-mooselike-datetime-perl (>= 0), + libnamespace-clean-perl (>= 0), + libnet-oauth2-authorizationserver-perl (>= 0), + libnet-saml2-perl (>= 0), + libplack-perl (>= 1.0047), + libpdf-table-perl (>= 1.006), + libsession-token-perl (>= 0), + starman (>= 0), + libstring-camelcase-perl (>= 0), + libtext-autoformat-perl (>= 0), + libtext-csv-encoded-perl (>= 0), + libtext-markdown-perl (>= 0), + libtie-cache-perl (>= 0), + libtree-dagnode-perl (>= 0), + liburl-encode-perl (>= 0), + libwww-form-urlencoded-xs-perl (>= 0), + libwww-mechanize-chrome-perl (>= 0), + libyaml-perl (>= 0), + postfix (>=0), + libdancer2-plugin-logreport-perl (>= 0) +Recommends: postgresql (>= 0) +Maintainer: CtrlO Ltd +Description: Globally Accessible Data Store (GADS) is a web application for storing and sharing data across an organisation. + It provides a simple interface for creating and managing data, as well as powerful features for sharing and collaborating on data with others. + GADS is built using the Dancer2 web framework and is designed to be easy to use and extendable. +Vcs-Git: https://github.com/ctrlo/GADS.git diff --git a/dpkg/package.sh b/dpkg/package.sh new file mode 100755 index 000000000..9e3ff2f73 --- /dev/null +++ b/dpkg/package.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +set -e + +version=$(sed -n "s/.*\$VERSION *= *['\"]*\([^'\"]*\).*/\1/p" ./lib/GADS.pm) + +echo "Building scripts for GADS version $version" + +yarn --frozen-lockfile +npx update-browserslist-db@latest +NODE_ENV=production yarn webpack +git checkout ./public/js/fengari-web.js + +echo "Building GADS version $version" + +mkdir -p GADS-$version/srv/GADS +mkdir -p GADS-$version/DEBIAN + +echo "Copying files..." +cp -r bin environments lib public share views config.yml-example GADS-$version/srv/GADS/ +sed "s/%version%/$version/g" dpkg/control > GADS-$version/DEBIAN/control +if [ -f dpkg/postrm ]; then + cp dpkg/postrm GADS-$version/DEBIAN/postrm +fi +if [ -f dpkg/postinst ]; then + cp dpkg/postinst GADS-$version/DEBIAN/postinst +fi + +echo "Building package..." +cd GADS-$version +dpkg-deb --build . ../GADS-$version.deb + +echo "Package built: GADS-$version.deb" + +echo "Cleaning up..." +cd .. +rm -rf GADS-$version + +echo "Done." diff --git a/lib/GADS.pm b/lib/GADS.pm index 9592bb03b..86e169565 100644 --- a/lib/GADS.pm +++ b/lib/GADS.pm @@ -116,7 +116,7 @@ tie %{schema->storage->dbh->{CachedKids}}, 'Tie::Cache', 100; # required for that) GADS::DB->setup(schema); -our $VERSION = '0.1'; +our $VERSION = '2.8.0'; # set serializer => 'JSON'; set behind_proxy => config->{behind_proxy}; # XXX Why doesn't this work in config file diff --git a/webdriver/Makefile.PL b/webdriver/Makefile.PL deleted file mode 100644 index 7db7a2b60..000000000 --- a/webdriver/Makefile.PL +++ /dev/null @@ -1,18 +0,0 @@ -use strict; -use warnings; -use ExtUtils::MakeMaker; - -our %prereq_pm = ( - 'List::Util' => '1.56', - 'Moo' => 0, - 'Test::More' => 0, - 'Test2::API' => 0, - 'Test2::Tools::Compare' => 0, - 'WebDriver::Tiny' => '0.102', -); - -return 1 if caller(); - -WriteMakefile( - PREREQ_PM => \%prereq_pm, -); diff --git a/webdriver/README.md b/webdriver/README.md deleted file mode 100644 index 7edb8d8fc..000000000 --- a/webdriver/README.md +++ /dev/null @@ -1,50 +0,0 @@ -GADS WebDriver Integration Tests -================================ - -The test suite contained with the `webdriver` directory of GADS provides -WebDriver integration tests for the entire application. - -# Preparation - -``` -# Install the required CPAN modules -cd webdriver; cpan . - -# Run geckodriver (or similar for your browser, perhaps chromedriver) -geckodriver - -# Run the application -perl bin/app.pl -``` - -# Environment - -These tests rely on several environment variables: - -## Required Environment Variables - -* `GADS_USERNAME` defines the username to log in with -* `GADS_PASSWORD` defines the password to log in with - -## Optional Environment Variables - -* `GADS_HOME` defines the URL of a running application to test against - (defaults to `http://localhost:3000`) - -## geckodriver Environment Variables - -To run these tests with geckodriver in headless mode, without a browser -window appearing, set `MOZ_HEADLESS=1`. - -# Run Tests - -``` -prove -r webdriver/t -``` - -# Write Tests - -The `webdriver/t/lib/GADSDriver.pm` library provides a GADS-specific -wrapper around `WebDriver::Tiny`. The -`webdriver/t/lib/Test/GADSDriver.pm` contains GADS-specific reusable -test code. diff --git a/webdriver/t/create_view.t b/webdriver/t/create_view.t deleted file mode 100644 index 714d99a79..000000000 --- a/webdriver/t/create_view.t +++ /dev/null @@ -1,317 +0,0 @@ -#!perl - -use v5.24.0; -use warnings; -no warnings 'qw'; - -=head1 NAME - -create_view.t - Test creating a view and retrieving records - -=head1 SEE ALSO - -L<< Test::GADSDriver >> - -=cut - -use lib 'webdriver/t/lib'; - -use Test::GADSDriver (); -use Test::More 'no_plan'; - -my $group_name = "TESTGROUPWD $$"; -my $table_name = "TESTWD $$"; -my $text_field_name = "MytestName"; -my $int_field_name = "MytestInt"; -my $view_name = 'Less than 100'; -my @record = ( - { - name => 'One hundred and twenty three', - fields => [ 'One hundred and twenty three', 123 ], - }, - { - name => 'Twenty four', - fields => [ 'Twenty four', 24 ], - }, -); - -my $gads = Test::GADSDriver->new; - -$gads->go_to_url('/'); - -$gads->submit_login_form_ok; - -# Create a new group -$gads->navigate_ok( - 'Navigate to the add a group page', - [ qw( .nav__link--groups [href$="/group_add/"] ) ], -); -$gads->assert_on_add_a_group_page; - -$gads->submit_add_a_group_form_ok( 'Add a group', $group_name ); -$gads->assert_success_present('A success message is visible after adding a group'); -#$gads->assert_error_absent('No error message is visible after adding a group'); - -# Add the user to the new group -$gads->navigate_ok( - 'Navigate to the manage users page', - [ qw( .nav__link--users [href$="/user_overview/"] ) ], -); -$gads->assert_on_manage_users_page; - -$gads->select_current_user_to_edit_ok('Edit the logged in user'); -$gads->assert_on_edit_user_page; - -$gads->assign_current_user_to_group_ok( - 'Assign the logged in user to the group', $group_name ); -$gads->assert_success_present( - 'A success message is visible after adding the user to a group' ); -#$gads->assert_error_absent( -# 'No error message is visible after adding the user to a group' ); - -# Create a new table -$gads->navigate_ok( - 'Navigate to the table setup modal', - [ qw( .nav__link--tables [data-target='#newTableModal' ) ], -); -$gads->assert_on_add_a_table_page; - -$gads->submit_add_a_table_form_ok( 'Add a table to create the view on', - { name => $table_name, group_name => $group_name } ); -#$gads->assert_error_absent('No error message is visible after adding a table'); - -$gads->select_table_to_edit_ok( 'Prepare to add fields to the new table', - $table_name ); -$gads->assert_on_manage_this_table_page; - -# Add fields to the new table -$gads->follow_link_ok( undef, 'Fields' ); -$gads->assert_on_manage_fields_page; -$gads->follow_link_ok( undef, 'Add a field' ); -$gads->assert_on_add_a_field_page; - -SKIP: { -skip 'Currently failing due to UI changes'; -$gads->submit_add_a_field_form_ok( - 'Add a text field to the new table', - { name => $text_field_name, type => 'Text', group_name => $group_name }, -); - -$gads->assert_success_present('A success message is visible after adding a field'); -$gads->assert_error_absent('No error message is visible after adding a field'); -$gads->follow_link_ok( undef, 'Add a field' ); -$gads->assert_on_add_a_field_page; - -$gads->submit_add_a_field_form_ok( - 'Add an integer field to the new table', - { name => $int_field_name, type => 'Integer', group_name => $group_name }, -); - -$gads->assert_success_present('The integer field was added successfully'); -$gads->assert_on_manage_fields_page( - 'On the manage fields page after adding two fields' ); -$gads->assert_field_exists( undef, { name => $text_field_name, type => 'Text' } ); -$gads->assert_field_exists( undef, { name => $int_field_name, type => 'Integer' } ); - -# Create records in the table -$gads->navigate_ok( - 'Navigate to the new record page', - [ qw( .dropdown-records .record-add ) ], -); -$gads->assert_on_new_record_page; -$gads->assert_new_record_fields( - "The new record page only shows the two fields", - [ - { - label => "${text_field_name}*", - type => 'string', - }, - { - label => "${int_field_name}*", - type => 'intgr', - }, - ], -); -$gads->submit_new_record_form_ok( - 'Create the first new record', - $record[0]{fields}, -); -$gads->assert_success_present('The first record was added successfully'); -$gads->assert_error_absent( - 'No error message is visible after adding the first record' ); -$gads->assert_on_see_records_page; - -$gads->navigate_ok( - 'Navigate to the new record page again', - [ qw( .dropdown-records .record-add ) ], -); -$gads->assert_on_new_record_page; -$gads->submit_new_record_form_ok( - 'Create the second new record', - $record[1]{fields}, -); -$gads->assert_success_present('The second record was added successfully'); -$gads->assert_error_absent( - 'No error message is visible after adding the second record' ); -$gads->assert_on_see_records_page; -$gads->assert_records_shown( - 'The see records page shows the added records', - [ - { - $text_field_name => 'One hundred and twenty three', - $int_field_name => 123, - }, - { - $text_field_name => 'Twenty four', - $int_field_name => 24, - }, - ], -); - -$gads->navigate_ok( - 'Navigate to the add a view page', - [ qw( [aria-controls~="menu_view"] .view-add ) ], -); -$gads->assert_on_add_a_view_page; - -$gads->submit_add_a_view_form_ok( - name => $view_name, - fields => [ $text_field_name, $int_field_name ], - filters => { - condition => 'AND', - rules => [ - { - field => $text_field_name, - operator => 'begins with', - value => 'T', - }, - { - field => $int_field_name, - operator => 'less', - value => 100, - }, - ], - }, -); - -$gads->assert_on_see_records_page( 'Showing the view', $view_name ); -$gads->assert_success_present('The view was added successfully'); -$gads->assert_records_shown( - 'The view only shows the expected record', - [ - { - $text_field_name => 'Twenty four', - $int_field_name => 24, - }, - ], -); - -# Tidy up: remove the view created earlier -$gads->navigate_ok( - 'Navigate to the edit current view page', - [ qw( [aria-controls~="menu_view"] .view-edit ) ], -); -$gads->delete_current_view_ok; - -$gads->assert_on_see_records_page('Back on the see records page'); -$gads->assert_success_present('The view was deleted successfully'); - -# Tidy up: remove the records created earlier -$gads->select_record_to_view_ok( - 'Select the first record created', $record[0]{name} ); -$gads->assert_on_view_record_page; -$gads->assert_record_has_fields( - 'Viewing the first record created', - { - $text_field_name => 'One hundred and twenty three', - $int_field_name => 123, - }, -); - -$gads->delete_viewed_record_ok('Delete the first record created'); - -$gads->assert_success_present('The first record was deleted successfully'); -$gads->assert_on_see_records_page; -$gads->assert_records_shown( - 'Only the second record is shown after deleting the first', - [ - { - $text_field_name => 'Twenty four', - $int_field_name => 24, - }, - ], -); - -$gads->select_record_to_view_ok( - 'Select the second record created', $record[1]{name} ); -$gads->assert_on_view_record_page; - -$gads->delete_viewed_record_ok('Delete the second record created'); - -$gads->assert_success_present('The second record was deleted successfully'); -$gads->assert_on_see_records_page; - -$gads->purge_deleted_records_ok; -$gads->assert_success_present('The deleted records were purged successfully'); - -# Tidy up: remove the table created earlier -$gads->navigate_ok( - 'Navigate to the manage tables page', - [ qw( .table-editor .tables-manage ) ], -); -$gads->assert_on_manage_tables_page; - -$gads->select_table_to_edit_ok( 'Select the table created', - $table_name ); -$gads->assert_on_manage_this_table_page; - -$gads->follow_link_ok( undef, 'Manage fields' ); -$gads->assert_on_manage_fields_page; -$gads->select_field_to_edit_ok( 'Select the text field created', - $text_field_name ); -$gads->assert_on_edit_field_page( - 'On the Edit field page before deleting the text field'); -$gads->confirm_deletion_ok('Delete the text field created'); -$gads->assert_on_manage_fields_page( - 'On the manage fields page after deleting the first field' ); -$gads->select_field_to_edit_ok( 'Select the integer field created', - $int_field_name ); -$gads->assert_on_edit_field_page( - 'On the Edit field page before deleting the integer field'); -$gads->confirm_deletion_ok('Delete the integer field created'); -$gads->assert_on_manage_fields_page( - 'On the manage fields page after deleting fields' ); -} # End of SKIP: block - -$gads->navigate_ok( - 'Navigate back to the manage tables page', - [ ".nav__link--tables" ], -); -$gads->assert_on_manage_tables_page; - -$gads->select_table_to_edit_ok( 'Select the table created again', - $table_name ); -$gads->assert_on_manage_this_table_page; - -$gads->confirm_deletion_ok('Delete the table created'); -$gads->assert_success_present; -#$gads->assert_error_absent; - -$gads->assert_on_manage_tables_page( - 'On the manage tables page after deleting a table' ); -$gads->assert_table_not_listed( 'The deleted table is not listed', - $table_name ); - -# Tidy up: remove the group created earlier -$gads->navigate_ok( - 'Navigate to the manage groups page', - [ '.nav__link--groups' ], -); -$gads->assert_on_manage_groups_page; - -$gads->select_group_to_edit_ok( 'Select the group created', $group_name); -$gads->confirm_deletion_ok('Delete the group created'); -$gads->assert_success_present; -#$gads->assert_error_absent; - -done_testing(); diff --git a/webdriver/t/lib/GADSDriver.pm b/webdriver/t/lib/GADSDriver.pm deleted file mode 100644 index 8b48b52d4..000000000 --- a/webdriver/t/lib/GADSDriver.pm +++ /dev/null @@ -1,136 +0,0 @@ -package GADSDriver; - -use v5.24.0; -use Moo; - -use WebDriver::Tiny (); - -=head1 NAME - -GADSDriver - GADS-specific wrapper for WebDriver::Tiny - -=head1 SYNOPSIS - - use GADSDriver (); - my $gads = GADSDriver->new(...); - ...; - my $webdriver = $gads->webdriver; - -=head1 METHODS - -=head2 new - -A standard L<< Moo >> constructor which takes the following attributes, -all of which also provide read-only accessor methods: - -=head3 home - -The URL of the applications home page. Defaults to the C<< GADS_HOME >> -environment variable. - -=cut - -has home => ( - is => 'ro', - default => \&_default_home, -); - -sub _default_home { - my $home = $ENV{GADS_HOME} // 'http://localhost:3000'; - $home =~ s{ (?<= / > $ ) }{}x; - return $home; -} - -=head3 username - -The username of an existing account to log in to GADS with. Defaults to -the C<< GADS_USERNAME >> environment variable. - -=cut - -has username => ( - is => 'ro', - default => \&_default_username, -); - -sub _default_username { - return $ENV{GADS_USERNAME} // die "Missing GADS_USERNAME"; -} - -=head3 password - -The password for the existing GADS account. Defaults to the C<< -GADS_PASSWORD >> environment variable. - -=cut - -has password => ( - is => 'ro', - default => \&_default_password, -); - -sub _default_password { - return $ENV{GADS_PASSWORD} // die "Missing GADS_PASSWORD"; -} - -=head3 webdriver - -An object which supports the interface used by L<< WebDriver::Tiny >>. -Defaults to using an object of that class that connects to port 4444. - -=cut - -has webdriver => ( - is => 'ro', - default => sub { - WebDriver::Tiny->new( - port => 4444, - capabilities => { - 'goog:chromeOptions' => { args => ['--headless'] }, - }, - ); - }, -); - -=head2 type_into_field - -Find an element specified by a CSS selector contained in the first -argument, and enter a value specified by the second argument into that -field. - -=cut - -sub type_into_field { - my ( $self, $selector, $value ) = @_; - my $webdriver = $self->webdriver; - - my $field_el = $webdriver->find( $selector, dies => 0, tries => 20 ); - if ( 0 == $field_el->size ) { - return undef; - } - else { - $field_el->send_keys( $value ); - return $self; - } -} - -=head2 go_to_url - -Takes one argument, a URL to load relative to the application's root URL. - -=cut - -sub go_to_url { - my ( $self, $url ) = @_; - - return $self->webdriver->get( $self->home . $url ); -} - -1; -__END__ - -=head1 SEE ALSO - -L<< Test::GADSDriver >> - -=cut diff --git a/webdriver/t/login.t b/webdriver/t/login.t deleted file mode 100644 index 32c467d61..000000000 --- a/webdriver/t/login.t +++ /dev/null @@ -1,38 +0,0 @@ -#!perl - -use v5.24.0; -use warnings; - -=head1 NAME - -login.t - Test the login form - -=head1 SEE ALSO - -L<< Test::GADSDriver >> - -=cut - -use lib 'webdriver/t/lib'; - -use Test::GADSDriver (); -use Test::More 'no_plan'; - -my $gads = Test::GADSDriver->new; - -$gads->go_to_url('/'); -$gads->assert_on_login_page; -$gads->assert_error_absent; - -$gads->submit_login_form_ok( 'Submit the login form with a bad password', - { password => 'thisisnotmypassword' } ); -$gads->assert_on_login_page('The login page is visible after a bad login'); -$gads->assert_error_present; - -$gads->submit_login_form_ok; -$gads->assert_navigation_present( - 'The site navigation is visible after logging in' ); -$gads->assert_error_absent('No error message is visible after logging in'); -$gads->assert_success_absent('No success message is visible after logging in'); - -done_testing();