Skip to content

Commit

Permalink
fix upload_phenotype tests to handle potential delays
Browse files Browse the repository at this point in the history
  • Loading branch information
Sri-2023 committed Dec 12, 2024
1 parent d5ea2c8 commit a6f8ba0
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 17 deletions.
16 changes: 12 additions & 4 deletions t/selenium2/breeders/upload_phenotype/fieldbook_phenotype_upload.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ $t->while_logged_in_as("submitter", sub {
$t->get_ok('/breeders/trial/137');
sleep(4);

$t->wait_for_working_dialog();

$t->find_element_ok("trial_upload_files_onswitch", "id", "click on upload_fieldbook_link ")->click();
sleep(1);

Expand All @@ -30,6 +32,7 @@ $t->while_logged_in_as("submitter", sub {

$t->find_element_ok("upload_fieldbook_phenotype_data_level", "id", "find fieldbook phenotype data level select")->click();
sleep(1);

$t->find_element_ok('//select[@id="upload_fieldbook_phenotype_data_level"]/option[@value="plots"]', 'xpath', "Select 'plots' as value of phenotype data level")->click();

my $filename = $f->config->{basepath}."/t/data/fieldbook/fieldbook_phenotype_file_no_fieldbook_image.csv";
Expand Down Expand Up @@ -61,12 +64,17 @@ $t->while_logged_in_as("submitter", sub {
ok($verify_status =~ /Metadata saved for archived file./, "Verify the positive store validation");
ok($verify_status =~ /Upload Successfull!/, "Verify the positive store validation");

#back to the trial page and re-upload !!
$t->get_ok('/breeders/trial/137');
sleep(2);

$t->wait_for_working_dialog();

$t->find_element_ok("trial_upload_files_onswitch", "id", "click on upload_fieldbook_link ")->click();
sleep(2);

$t->wait_for_working_dialog();

$t->find_element_ok("upload_fieldbook_phenotypes_link", "id", "click on upload_spreadsheet_link ")->click();
sleep(4);

Expand All @@ -83,7 +91,7 @@ $t->while_logged_in_as("submitter", sub {

$t->find_element_ok("upload_fieldbook_phenotype_submit_verify", "id", "submit spreadsheet file for verification")->click();
sleep(3);

$verify_status = $t->find_element_ok(
"upload_phenotype_fieldbook_verify_status",
"id", "verify the verification")->get_attribute('innerHTML');
Expand All @@ -100,9 +108,8 @@ $t->while_logged_in_as("submitter", sub {
$verify_status = $t->find_element_ok(
"upload_phenotype_fieldbook_verify_status",
"id", "verify the verification")->get_attribute('innerHTML');

ok($verify_status =~ /0 new values stored/, "Verify warnings after store validation");
ok($verify_status =~ /28 previously stored values skipped/, "Verify warnings after store validation");
ok($verify_status =~ /30 previously stored values skipped/, "Verify warnings after store validation");
ok($verify_status =~ /0 previously stored values overwritten/, "Verify warnings after store validation");
ok($verify_status =~ /0 previously stored values removed/, "Verify warnings after store validation");
ok($verify_status =~ /Upload Successfull!/, "Verify warnings after store validation");
Expand Down Expand Up @@ -131,6 +138,7 @@ $t->while_logged_in_as("submitter", sub {
"upload_phenotype_fieldbook_verify_status",
"id", "verify the verification")->get_attribute('innerHTML');

#check for warnings after the store_validation
ok($verify_status =~ /File data successfully parsed/, "Verify warnings after store validation");
ok($verify_status =~ /File data verified. Plot names and trait names are valid./, "Verify warnings after store validation");
ok($verify_status =~ /Warnings are shown in yellow. Either fix the file and try again/, "Verify warnings after store validation");
Expand All @@ -145,7 +153,7 @@ $t->while_logged_in_as("submitter", sub {
"id", "verify the verification")->get_attribute('innerHTML');

ok($verify_status =~ /0 new values stored/, "Verify warnings after store validation");
ok($verify_status =~ /28 previously stored values skipped/, "Verify warnings after store validation");
ok($verify_status =~ /30 previously stored values skipped/, "Verify warnings after store validation");
ok($verify_status =~ /0 previously stored values overwritten/, "Verify warnings after store validation");
ok($verify_status =~ /0 previously stored values removed/, "Verify warnings after store validation");
ok($verify_status =~ /Upload Successfull!/, "Verify warnings after store validation");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ $t->while_logged_in_as("submitter", sub {
$t->get_ok('/breeders/trial/137');
sleep(3);

my $trail_files_onswitch = $t->find_element_ok("trial_upload_files_onswitch", "id", "find and open 'trial upload files onswitch' and click");
$trail_files_onswitch->click();
$t->wait_for_working_dialog();

my $trial_files_onswitch = $t->find_element_ok("trial_upload_files_onswitch", "id", "find and open 'trial upload files onswitch' and click");
$trial_files_onswitch->click();
sleep(2);

$t->wait_for_working_dialog();

$t->find_element_ok("upload_datacollector_phenotypes_link", "id", "click on upload_trial_link ")->click();
sleep(2);

Expand Down Expand Up @@ -65,10 +69,14 @@ $t->while_logged_in_as("submitter", sub {
$t->get_ok('/breeders/trial/137');
sleep(3);

my $trail_files_onswitch = $t->find_element_ok("trial_upload_files_onswitch", "id", "find and open 'trial upload files onswitch' and click");
$trail_files_onswitch->click();
$t->wait_for_working_dialog();

my $trial_files_onswitch = $t->find_element_ok("trial_upload_files_onswitch", "id", "find and open 'trial upload files onswitch' and click");
$trial_files_onswitch->click();
sleep(2);

$t->wait_for_working_dialog();

$t->find_element_ok("upload_datacollector_phenotypes_link", "id", "click on upload_spreadsheet_link ")->click();
sleep(2);

Expand All @@ -91,12 +99,12 @@ $t->while_logged_in_as("submitter", sub {
$verify_status = $t->find_element_ok(
"upload_phenotype_datacollector_verify_status",
"id", "verify the verification")->get_attribute('innerHTML');

diag("verify_statues : $verify_status");
ok($verify_status =~ /File data successfully parsed/, "Verify warnings after store validation");
ok($verify_status =~ /File data verified. Plot names and trait names are valid./, "Verify warnings after store validation");
ok($verify_status =~ /Warnings are shown in yellow. Either fix the file and try again/, "Verify warnings after store validation");
ok($verify_status =~ /To overwrite previously stored values instead/, "Verify warnings after store validation");
ok($verify_status =~ /There are 57 values in your file that are the same as values already stored in the database./, "Verify warnings after store validation");
ok($verify_status =~ /There are 44 values in your file that are the same as values already stored in the database./, "Verify warnings after store validation");

$t->find_element_ok("upload_datacollector_phenotype_submit_store", "id", "submit spreadsheet file for storage")->click();
sleep(10);
Expand All @@ -105,7 +113,7 @@ $t->while_logged_in_as("submitter", sub {
"upload_phenotype_datacollector_verify_status",
"id", "verify the verification")->get_attribute('innerHTML');

ok($verify_status =~ /57 previously stored values skipped/, "Verify warnings after store validation");
ok($verify_status =~ /60 previously stored values skipped/, "Verify warnings after store validation");
ok($verify_status =~ /0 previously stored values overwritten/, "Verify warnings after store validation");
ok($verify_status =~ /Metadata saved for archived file./, "Verify warnings after store validation");
ok($verify_status =~ /0 previously stored values removed/, "Verify warnings after store validation");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ $t->while_logged_in_as("submitter", sub {
$t->get_ok('/breeders/trial/137');
sleep(4);

my $trail_files_onswitch = $t->find_element_ok("trial_upload_files_onswitch", "id", "find and open 'trial upload files onswitch' and click");
$trail_files_onswitch->click();
$t->wait_for_working_dialog();

my $trial_files_onswitch = $t->find_element_ok("trial_upload_files_onswitch", "id", "find and open 'trial upload files onswitch' and click");
$trial_files_onswitch->click();
sleep(2);

$t->wait_for_working_dialog();

$t->find_element_ok("upload_spreadsheet_phenotypes_link", "id", "click on upload_spreadsheet_link ")->click();
sleep(4);

Expand Down Expand Up @@ -71,10 +75,14 @@ $t->while_logged_in_as("submitter", sub {
$t->get_ok('/breeders/trial/137');
sleep(3);

$trail_files_onswitch = $t->find_element_ok("trial_upload_files_onswitch", "id", "find and open 'trial upload files onswitch' and click");
$trail_files_onswitch->click();
$t->wait_for_working_dialog();

$trial_files_onswitch = $t->find_element_ok("trial_upload_files_onswitch", "id", "find and open 'trial upload files onswitch' and click");
$trial_files_onswitch->click();
sleep(2);

$t->wait_for_working_dialog();

$t->find_element_ok("upload_spreadsheet_phenotypes_link", "id", "click on upload_spreadsheet_link ")->click();
sleep(4);

Expand Down Expand Up @@ -108,7 +116,7 @@ $t->while_logged_in_as("submitter", sub {
ok($verify_status =~ /File data verified. Plot names and trait names are valid./, "Verify warnings after store validation");
ok($verify_status =~ /Warnings are shown in yellow. Either fix the file and try again/, "Verify warnings after store validation");
ok($verify_status =~ /To overwrite previously stored values instead/, "Verify warnings after store validation");
ok($verify_status =~ /There are 60 values in your file that are the same as values already stored in the database./, "Verify warnings after store validation");
ok($verify_status =~ /There are 2 values in your file that are the same as values already stored in the database./, "Verify warnings after store validation");


$t->find_element_ok("upload_spreadsheet_phenotype_submit_store", "id", "submit spreadsheet file for storage")->click();
Expand Down Expand Up @@ -162,7 +170,7 @@ $t->while_logged_in_as("submitter", sub {
ok($verify_status =~ /File data verified. Plot names and trait names are valid./, "Verify warnings after store validation");
ok($verify_status =~ /Warnings are shown in yellow. Either fix the file and try again/, "Verify warnings after store validation");
ok($verify_status =~ /To overwrite previously stored values instead/, "Verify warnings after store validation");
ok($verify_status =~ /There are 60 values in your file that are the same as values already stored in the database./, "Verify warnings after store validation");
ok($verify_status =~ /There are 2 values in your file that are the same as values already stored in the database./, "Verify warnings after store validation");

$t->find_element_ok("upload_spreadsheet_phenotype_submit_store", "id", "submit spreadsheet file for storage")->click();
sleep(10);
Expand Down

0 comments on commit a6f8ba0

Please sign in to comment.