show test result as check mark or cross
This commit is contained in:
@@ -222,14 +222,14 @@ class Command: public QObject {
|
|||||||
res += value.mid(start, m.capturedStart()-start);
|
res += value.mid(start, m.capturedStart()-start);
|
||||||
value.remove(0, m.capturedEnd());
|
value.remove(0, m.capturedEnd());
|
||||||
if (keepDelimiters && m.capturedLength()) res+=m.captured().mid(start).trimmed();
|
if (keepDelimiters && m.capturedLength()) res+=m.captured().mid(start).trimmed();
|
||||||
std::cout<<"REMOVE: \""<<m.captured()<<"\" 0 - "<<(m.capturedEnd()+start)
|
// std::cout<<"REMOVE: \""<<m.captured()<<"\" 0 - "<<(m.capturedEnd()+start)
|
||||||
<<" start="<<start<<" pos="<<pos<<std::endl
|
// <<" start="<<start<<" pos="<<pos<<std::endl
|
||||||
<<"REMAINING: \""<<value<<"\""<<std::endl;
|
// <<"REMAINING: \""<<value<<"\""<<std::endl;
|
||||||
}
|
|
||||||
std::cout<<"FOUND"<<std::endl;
|
|
||||||
Q_FOREACH(QString tag, res) {
|
|
||||||
std::cout<<" - \""<<tag<<"\""<<std::endl;
|
|
||||||
}
|
}
|
||||||
|
// std::cout<<"FOUND"<<std::endl;
|
||||||
|
// Q_FOREACH(QString tag, res) {
|
||||||
|
// std::cout<<" - \""<<tag<<"\""<<std::endl;
|
||||||
|
// }
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
QStringList commaSeparatedList(QString value) {
|
QStringList commaSeparatedList(QString value) {
|
||||||
|
@@ -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
|
||||||
|
120
src/testgui.ui
120
src/testgui.ui
@@ -434,11 +434,79 @@ this.dispatchEvent(evObj);</string>
|
|||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>82</height>
|
<height>28</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QStackedWidget" name="_status">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="page_6"/>
|
||||||
|
<widget class="QWidget" name="page_5">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_9">
|
||||||
|
<item row="0" column="0" alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><div style="font-size: xx-large">⌛</div></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_3">
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0" alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><div style="font-size: xx-large; color: green">✔</div></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_4">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_8">
|
||||||
|
<item row="0" column="0" alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><div style="font-size: xx-large; color: red">✘</div></string>
|
||||||
|
</property>
|
||||||
|
<property name="scaledContents">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -616,21 +684,33 @@ this.dispatchEvent(evObj);</string>
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Open ...</string>
|
<string>Open ...</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+O</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="_actionSaveAs">
|
<action name="_actionSaveAs">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Save As ...</string>
|
<string>Save As ...</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Shift+S</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="_actionQuit">
|
<action name="_actionQuit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Quit</string>
|
<string>Quit</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Q</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="_actionRun">
|
<action name="_actionRun">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Run</string>
|
<string>Run</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+R</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="_actionRunLine">
|
<action name="_actionRunLine">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -660,6 +740,9 @@ this.dispatchEvent(evObj);</string>
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Save</string>
|
<string>Save</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+S</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="_actionRevertToSaved">
|
<action name="_actionRevertToSaved">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
@@ -668,6 +751,9 @@ this.dispatchEvent(evObj);</string>
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Revert to saved</string>
|
<string>Revert to saved</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+R</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="_actionOpenSetupScript">
|
<action name="_actionOpenSetupScript">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -966,5 +1052,37 @@ this.dispatchEvent(evObj);</string>
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>_actionQuit</sender>
|
||||||
|
<signal>triggered()</signal>
|
||||||
|
<receiver>TestGUI</receiver>
|
||||||
|
<slot>close()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>-1</x>
|
||||||
|
<y>-1</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>443</x>
|
||||||
|
<y>589</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>_actionRun</sender>
|
||||||
|
<signal>triggered()</signal>
|
||||||
|
<receiver>_run</receiver>
|
||||||
|
<slot>click()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>-1</x>
|
||||||
|
<y>-1</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>299</x>
|
||||||
|
<y>90</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
Reference in New Issue
Block a user