|
|
@ -45,6 +45,7 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI { |
|
|
|
menuViews->addAction(_sourceDock->toggleViewAction()); |
|
|
|
menuViews->addAction(_sourceDock->toggleViewAction()); |
|
|
|
menuViews->addAction(_executeDock->toggleViewAction()); |
|
|
|
menuViews->addAction(_executeDock->toggleViewAction()); |
|
|
|
_progress->hide(); |
|
|
|
_progress->hide(); |
|
|
|
|
|
|
|
_status->setCurrentIndex(STATUS_NONE); |
|
|
|
QSettings settings("mrw", "webtester"); |
|
|
|
QSettings settings("mrw", "webtester"); |
|
|
|
restoreGeometry(settings.value("geometry").toByteArray()); |
|
|
|
restoreGeometry(settings.value("geometry").toByteArray()); |
|
|
|
restoreState(settings.value("windowstate").toByteArray()); |
|
|
|
restoreState(settings.value("windowstate").toByteArray()); |
|
|
@ -80,20 +81,24 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI { |
|
|
|
QString name(QFileDialog::getOpenFileName(this, tr("Open Test Script"))); |
|
|
|
QString name(QFileDialog::getOpenFileName(this, tr("Open Test Script"))); |
|
|
|
if (name.isEmpty()) return; |
|
|
|
if (name.isEmpty()) return; |
|
|
|
loadFile(name); |
|
|
|
loadFile(name); |
|
|
|
|
|
|
|
_status->setCurrentIndex(STATUS_NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
void on__actionOpenSetupScript_triggered() { |
|
|
|
void on__actionOpenSetupScript_triggered() { |
|
|
|
QString name(QFileDialog::getOpenFileName(this, tr("Open Setup Script"))); |
|
|
|
QString name(QFileDialog::getOpenFileName(this, tr("Open Setup Script"))); |
|
|
|
if (name.isEmpty()) return; |
|
|
|
if (name.isEmpty()) return; |
|
|
|
loadSetup(name); |
|
|
|
loadSetup(name); |
|
|
|
|
|
|
|
_status->setCurrentIndex(STATUS_NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
void on__actionRevertToSaved_triggered() { |
|
|
|
void on__actionRevertToSaved_triggered() { |
|
|
|
loadFile(_filename); |
|
|
|
loadFile(_filename); |
|
|
|
|
|
|
|
_status->setCurrentIndex(STATUS_NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
void on__actionSaveAs_triggered() { |
|
|
|
void on__actionSaveAs_triggered() { |
|
|
|
QString name(QFileDialog::getSaveFileName(this, tr("Save Test Script"))); |
|
|
|
QString name(QFileDialog::getSaveFileName(this, tr("Save Test Script"))); |
|
|
|
if (name.isEmpty()) return; |
|
|
|
if (name.isEmpty()) return; |
|
|
|
_filename = name; |
|
|
|
_filename = name; |
|
|
|
on__actionSave_triggered(); |
|
|
|
on__actionSave_triggered(); |
|
|
|
|
|
|
|
_status->setCurrentIndex(STATUS_NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
void on__actionSave_triggered() { |
|
|
|
void on__actionSave_triggered() { |
|
|
|
QFile file(_filename); |
|
|
|
QFile file(_filename); |
|
|
@ -113,6 +118,7 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI { |
|
|
|
"Cannot write test script to file %1.") |
|
|
|
"Cannot write test script to file %1.") |
|
|
|
.arg(_filename).arg(x.what())); |
|
|
|
.arg(_filename).arg(x.what())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
_status->setCurrentIndex(STATUS_NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
void on__actionClear_triggered() { |
|
|
|
void on__actionClear_triggered() { |
|
|
|
_testscript->clear(); |
|
|
|
_testscript->clear(); |
|
|
@ -120,10 +126,12 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI { |
|
|
|
_filename.clear(); |
|
|
|
_filename.clear(); |
|
|
|
_actionSave->setEnabled(false); |
|
|
|
_actionSave->setEnabled(false); |
|
|
|
_actionRevertToSaved->setEnabled(false); |
|
|
|
_actionRevertToSaved->setEnabled(false); |
|
|
|
|
|
|
|
_status->setCurrentIndex(STATUS_NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
void on__run_clicked() { |
|
|
|
void on__run_clicked() { |
|
|
|
_progress->reset(); |
|
|
|
_progress->reset(); |
|
|
|
_progress->show(); |
|
|
|
_progress->show(); |
|
|
|
|
|
|
|
_status->setCurrentIndex(STATUS_RUNNING); |
|
|
|
bool oldRecordState(_record->isChecked()); |
|
|
|
bool oldRecordState(_record->isChecked()); |
|
|
|
_record->setChecked(false); |
|
|
|
_record->setChecked(false); |
|
|
|
_record->setEnabled(false); |
|
|
|
_record->setEnabled(false); |
|
|
@ -145,10 +153,9 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI { |
|
|
|
script.parse(text.split('\n'), "script"); |
|
|
|
script.parse(text.split('\n'), "script"); |
|
|
|
script.run(_web->page()->mainFrame(), testsuites, QString(), |
|
|
|
script.run(_web->page()->mainFrame(), testsuites, QString(), |
|
|
|
_screenshots->isChecked()); |
|
|
|
_screenshots->isChecked()); |
|
|
|
|
|
|
|
_status->setCurrentIndex(STATUS_SUCCESS); |
|
|
|
} catch (std::exception &x) { |
|
|
|
} catch (std::exception &x) { |
|
|
|
QMessageBox::critical(this, tr("Script Failed"), |
|
|
|
_status->setCurrentIndex(STATUS_ERROR); |
|
|
|
tr("Script failed with message:\n%1") |
|
|
|
|
|
|
|
.arg(x.what())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
_run->setEnabled(true); |
|
|
|
_run->setEnabled(true); |
|
|
|
_record->setEnabled(true); |
|
|
|
_record->setEnabled(true); |
|
|
@ -844,6 +851,12 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI { |
|
|
|
URL_VIEW = 0, |
|
|
|
URL_VIEW = 0, |
|
|
|
PROGRESS_VIEW |
|
|
|
PROGRESS_VIEW |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
enum RunStatus { |
|
|
|
|
|
|
|
STATUS_NONE = 0, |
|
|
|
|
|
|
|
STATUS_RUNNING, |
|
|
|
|
|
|
|
STATUS_SUCCESS, |
|
|
|
|
|
|
|
STATUS_ERROR |
|
|
|
|
|
|
|
}; |
|
|
|
private: |
|
|
|
private: |
|
|
|
QString _filename; |
|
|
|
QString _filename; |
|
|
|
QWebElement _lastFocused; // cache for last focussed element
|
|
|
|
QWebElement _lastFocused; // cache for last focussed element
|
|
|
|