unfinished: new feature: for loop
This commit is contained in:
@@ -1479,8 +1479,8 @@ class Download: public Command {
|
||||
}
|
||||
QString description() const {
|
||||
return
|
||||
tag()+" <filename>"
|
||||
"<command-to-start-download>"
|
||||
tag()+" <filename>\n"
|
||||
" <command-to-start-download>"
|
||||
"\n\n"
|
||||
"Set download file before loading a download link or clicking on a "
|
||||
"download button. The next line must be exactly one command that "
|
||||
@@ -1652,9 +1652,11 @@ class Set: public Command {
|
||||
_next->execute(script, frame);
|
||||
script->set(script->replacevars(_name),
|
||||
script->replacevars(_next->result()));
|
||||
log(_name+"='"+_next->result().replace("\\", "\\\\").replace("'", "\\'")+"'");
|
||||
} else {
|
||||
script->set(script->replacevars(_name),
|
||||
script->replacevars(_value));
|
||||
log(_name+"='"+_value.replace("\\", "\\\\").replace("'", "\\'")+"'");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1768,7 +1770,7 @@ class ClientCertificate: public Command {
|
||||
}
|
||||
QString description() const {
|
||||
return
|
||||
tag()+" <certfile.pem> <keyfile.key> <keypassword>"
|
||||
tag()+" <certfile.pem> <keyfile.pem> <keypassword>"
|
||||
"\n\n"
|
||||
"Load a client certificate to authenticate on SSL connections. "
|
||||
"The password for the keyfile should not contain spaces. "
|
||||
@@ -1938,7 +1940,7 @@ class Function: public Command {
|
||||
tag()+" <name> [<var1>, <var2>, <...>]\n"
|
||||
" <command1>\n"
|
||||
" <command2>\n"
|
||||
" <...>\n"
|
||||
" <...>"
|
||||
"\n\n"
|
||||
"Define a function with arguments. The arguments are treated like"
|
||||
" local variables. In a sequence of scripts within the same testrun,"
|
||||
@@ -2219,6 +2221,40 @@ class Check: public Command {
|
||||
std::shared_ptr<Command> _next;
|
||||
};
|
||||
|
||||
class For: public Command {
|
||||
public:
|
||||
QString tag() const {
|
||||
return "for";
|
||||
}
|
||||
QString description() const {
|
||||
return
|
||||
tag()+" <variable> -> <val1>, <val2>, <...>\n"
|
||||
" <command1>\n"
|
||||
" <command2>\n"
|
||||
" <...>"
|
||||
"\n\n"
|
||||
"Executes the given commands with the variable set to the specifier values,"
|
||||
"repeated once per given value. Without values, it is simply a no operation.\n\n";
|
||||
"If you quote the values, then quote all values with the same"
|
||||
" quotes. If you need a comma within a value, you must quote.";
|
||||
}
|
||||
QString command() const {
|
||||
return tag()+" "+_variable+" "+_vals.join(" ");
|
||||
}
|
||||
std::shared_ptr<Command> parse(Script*, QString args,
|
||||
QStringList&, QString, int, int) {
|
||||
std::shared_ptr<For> cmd(new For());
|
||||
if (!args.size()) throw BadArgument(tag()+" requires a <variable>");
|
||||
QStringList allargs(args.split("->"));
|
||||
...
|
||||
return cmd;
|
||||
}
|
||||
bool execute(Script* script, QWebFrame* frame) {
|
||||
Logger log(this, script);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/* Template:
|
||||
class : public Command {
|
||||
public:
|
||||
|
@@ -224,13 +224,16 @@ class NetworkAccessManager: public QNetworkAccessManager {
|
||||
//log(__PRETTY_FUNCTION__);
|
||||
}
|
||||
void sslErrorsLog(const QList<QSslError>& errors) {
|
||||
Q_FOREACH(const QSslError& error, errors)
|
||||
log("**** SSL-Error: "+error.errorString()+"\n"+
|
||||
" Certificate: "+error.certificate().toText());
|
||||
//QNetworkReply* reply(dynamic_cast<QNetworkReply*>(QObject::sender()));
|
||||
Q_FOREACH(const QSslError& error, errors) {
|
||||
log("**** SSL-Error: "+error.errorString());
|
||||
}
|
||||
QNetworkReply* reply(dynamic_cast<QNetworkReply*>(QObject::sender()));
|
||||
log("#### Ignoring SSL Errors 1");
|
||||
reply->ignoreSslErrors();
|
||||
}
|
||||
void sslErrorsLog(QNetworkReply*, const QList<QSslError>&) {
|
||||
//log(__PRETTY_FUNCTION__);
|
||||
void sslErrorsLog(QNetworkReply* reply, const QList<QSslError>&) {
|
||||
log("#### Ignoring SSL Errors 2");
|
||||
reply->ignoreSslErrors();
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user