unfinished: new feature: for loop
This commit is contained in:
@@ -1479,8 +1479,8 @@ class Download: public Command {
|
|||||||
}
|
}
|
||||||
QString description() const {
|
QString description() const {
|
||||||
return
|
return
|
||||||
tag()+" <filename>"
|
tag()+" <filename>\n"
|
||||||
"<command-to-start-download>"
|
" <command-to-start-download>"
|
||||||
"\n\n"
|
"\n\n"
|
||||||
"Set download file before loading a download link or clicking on a "
|
"Set download file before loading a download link or clicking on a "
|
||||||
"download button. The next line must be exactly one command that "
|
"download button. The next line must be exactly one command that "
|
||||||
@@ -1652,9 +1652,11 @@ class Set: public Command {
|
|||||||
_next->execute(script, frame);
|
_next->execute(script, frame);
|
||||||
script->set(script->replacevars(_name),
|
script->set(script->replacevars(_name),
|
||||||
script->replacevars(_next->result()));
|
script->replacevars(_next->result()));
|
||||||
|
log(_name+"='"+_next->result().replace("\\", "\\\\").replace("'", "\\'")+"'");
|
||||||
} else {
|
} else {
|
||||||
script->set(script->replacevars(_name),
|
script->set(script->replacevars(_name),
|
||||||
script->replacevars(_value));
|
script->replacevars(_value));
|
||||||
|
log(_name+"='"+_value.replace("\\", "\\\\").replace("'", "\\'")+"'");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1768,7 +1770,7 @@ class ClientCertificate: public Command {
|
|||||||
}
|
}
|
||||||
QString description() const {
|
QString description() const {
|
||||||
return
|
return
|
||||||
tag()+" <certfile.pem> <keyfile.key> <keypassword>"
|
tag()+" <certfile.pem> <keyfile.pem> <keypassword>"
|
||||||
"\n\n"
|
"\n\n"
|
||||||
"Load a client certificate to authenticate on SSL connections. "
|
"Load a client certificate to authenticate on SSL connections. "
|
||||||
"The password for the keyfile should not contain spaces. "
|
"The password for the keyfile should not contain spaces. "
|
||||||
@@ -1938,7 +1940,7 @@ class Function: public Command {
|
|||||||
tag()+" <name> [<var1>, <var2>, <...>]\n"
|
tag()+" <name> [<var1>, <var2>, <...>]\n"
|
||||||
" <command1>\n"
|
" <command1>\n"
|
||||||
" <command2>\n"
|
" <command2>\n"
|
||||||
" <...>\n"
|
" <...>"
|
||||||
"\n\n"
|
"\n\n"
|
||||||
"Define a function with arguments. The arguments are treated like"
|
"Define a function with arguments. The arguments are treated like"
|
||||||
" local variables. In a sequence of scripts within the same testrun,"
|
" local variables. In a sequence of scripts within the same testrun,"
|
||||||
@@ -2219,6 +2221,40 @@ class Check: public Command {
|
|||||||
std::shared_ptr<Command> _next;
|
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:
|
/* Template:
|
||||||
class : public Command {
|
class : public Command {
|
||||||
public:
|
public:
|
||||||
|
@@ -224,13 +224,16 @@ class NetworkAccessManager: public QNetworkAccessManager {
|
|||||||
//log(__PRETTY_FUNCTION__);
|
//log(__PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
void sslErrorsLog(const QList<QSslError>& errors) {
|
void sslErrorsLog(const QList<QSslError>& errors) {
|
||||||
Q_FOREACH(const QSslError& error, errors)
|
Q_FOREACH(const QSslError& error, errors) {
|
||||||
log("**** SSL-Error: "+error.errorString()+"\n"+
|
log("**** SSL-Error: "+error.errorString());
|
||||||
" Certificate: "+error.certificate().toText());
|
}
|
||||||
//QNetworkReply* reply(dynamic_cast<QNetworkReply*>(QObject::sender()));
|
QNetworkReply* reply(dynamic_cast<QNetworkReply*>(QObject::sender()));
|
||||||
|
log("#### Ignoring SSL Errors 1");
|
||||||
|
reply->ignoreSslErrors();
|
||||||
}
|
}
|
||||||
void sslErrorsLog(QNetworkReply*, const QList<QSslError>&) {
|
void sslErrorsLog(QNetworkReply* reply, const QList<QSslError>&) {
|
||||||
//log(__PRETTY_FUNCTION__);
|
log("#### Ignoring SSL Errors 2");
|
||||||
|
reply->ignoreSslErrors();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user