Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
varbase
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
varbase
Commits
0d65b5ff
Commit
0d65b5ff
authored
3 years ago
by
Rajab Natshah
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3205085
: Add a tag release-varbase workflow job for the CircleCI automated testing pipelines
parent
9674e2a1
No related branches found
Branches containing commit
Tags
3.0.0-rc1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/features/bootstrap/VarbaseContext.php
+48
-12
48 additions, 12 deletions
tests/features/bootstrap/VarbaseContext.php
with
48 additions
and
12 deletions
tests/features/bootstrap/VarbaseContext.php
+
48
−
12
View file @
0d65b5ff
...
...
@@ -3,6 +3,7 @@
use
WebDriver\Exception
;
use
Drupal\DrupalExtension\Context\RawDrupalContext
;
use
Behat\Behat\Context\SnippetAcceptingContext
;
use
Behat\Mink\Exception\ElementHtmlException
;
/**
* Defines application features from the specific context.
...
...
@@ -86,12 +87,17 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
$this
->
getSession
()
->
visit
(
$this
->
locatePath
(
'/user/login'
));
$page
=
$this
->
getSession
()
->
getPage
();
$page
->
findField
(
'edit-name'
);
$page
->
findField
(
'edit-pass'
);
$page
->
fillField
(
'edit-name'
,
$username
);
$page
->
fillField
(
'edit-pass'
,
$password
);
$submit
=
$page
->
findButton
(
'op'
);
$submit
->
click
();
$username_in_page
=
$this
->
matchingElementAfterWait
(
'css'
,
'[data-drupal-selector="edit-name"]'
);
$password_in_page
=
$this
->
matchingElementAfterWait
(
'css'
,
'[data-drupal-selector="edit-pass"]'
);
$submit_in_page
=
$this
->
matchingElementAfterWait
(
'css'
,
'[data-drupal-selector="edit-submit"]'
);
if
(
$username_in_page
&&
$password_in_page
&&
$submit_in_page
)
{
$page
->
fillField
(
'name'
,
$username
);
$page
->
fillField
(
'pass'
,
$password
);
$submit
=
$page
->
findButton
(
'op'
);
$submit
->
click
();
}
}
else
{
throw
new
\Exception
(
"The '
$username
' user name is wrong or it was not listed in the list of default testing users."
);
...
...
@@ -116,12 +122,16 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
// Login with the.
$this
->
getSession
()
->
visit
(
$this
->
locatePath
(
'/user/login'
));
$page
=
$this
->
getSession
()
->
getPage
();
$page
->
findField
(
'edit-name'
);
$page
->
findField
(
'edit-pass'
);
$page
->
fillField
(
'edit-name'
,
$username
);
$page
->
fillField
(
'edit-pass'
,
$password
);
$submit
=
$page
->
findButton
(
'op'
);
$submit
->
click
();
$username_in_page
=
$this
->
matchingElementAfterWait
(
'css'
,
'[data-drupal-selector="edit-name"]'
);
$password_in_page
=
$this
->
matchingElementAfterWait
(
'css'
,
'[data-drupal-selector="edit-pass"]'
);
$submit_in_page
=
$this
->
matchingElementAfterWait
(
'css'
,
'[data-drupal-selector="edit-submit"]'
);
if
(
$username_in_page
&&
$password_in_page
&&
$submit_in_page
)
{
$page
->
fillField
(
'name'
,
$username
);
$page
->
fillField
(
'pass'
,
$password
);
$submit
=
$page
->
findButton
(
'op'
);
$submit
->
click
();
}
}
/**
...
...
@@ -1650,6 +1660,32 @@ JS;
$this
->
getSession
()
->
getPage
()
->
find
(
'xpath'
,
'//*[contains(@class, "paragraphs-add-dialog") and contains(@class, "ui-dialog-content")]//*[contains(@name, "'
.
$value
.
'")]'
)
->
click
();
}
/**
* Matching element exists on the page after a wait.
*
* @param string $selector_type
* The element selector type (css, xpath).
* @param string|array $selector
* The element selector.
* @param int $timeout
* (optional) Timeout in milliseconds, defaults to 10000.
*/
public
function
matchingElementAfterWait
(
$selector_type
,
$selector
,
$timeout
=
10000
)
{
$start
=
microtime
(
TRUE
);
$end
=
$start
+
(
$timeout
/
1000
);
$page
=
$this
->
getSession
()
->
getPage
();
do
{
$node
=
$page
->
find
(
$selector_type
,
$selector
);
if
(
empty
(
$node
))
{
return
FALSE
;
}
usleep
(
100000
);
}
while
(
microtime
(
TRUE
)
<
$end
);
return
TRUE
;
}
/**
* Accept Alerts Before going to the next step.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment