Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automated_testing_kit
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
automated_testing_kit
Commits
8c8e11b9
Commit
8c8e11b9
authored
4 months ago
by
ilyaukin
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3389608
: Add a test for a home page search
parent
41916e8b
Branches
1.0.x
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Resolve #3389608 "Search"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
data/search.json
+8
-0
8 additions, 0 deletions
data/search.json
playwright/e2e/atk_search/atk_search.spec.js
+51
-0
51 additions, 0 deletions
playwright/e2e/atk_search/atk_search.spec.js
with
59 additions
and
0 deletions
data/search.json
0 → 100644
+
8
−
0
View file @
8c8e11b9
[
{
"keyword"
:
"dammit"
,
"results"
:
[
"Futurama"
]
}
]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
playwright/e2e/atk_search/atk_search.spec.js
0 → 100644
+
51
−
0
View file @
8c8e11b9
/**
* atk_search.spec.js
*
* Search tests.
*
*/
/** ESLint directives */
/* eslint-disable import/first */
import
*
as
atkCommands
from
'
../support/atk_commands
'
;
import
*
as
atkUtilities
from
'
../support/atk_utilities
'
;
// Set up Playwright.
const
{
test
,
expect
}
=
require
(
'
@playwright/test
'
);
import
playwrightConfig
from
'
../../playwright.config
'
;
const
baseUrl
=
playwrightConfig
.
use
.
baseURL
;
// Import ATK Configuration.
import
atkConfig
from
'
../../playwright.atk.config
'
;
// Search keywords and expected results.
// Adjust for your site.
import
searchData
from
'
../data/search.json
'
;
test
.
describe
(
'
Search tests.
'
,
()
=>
{
test
(
'
(ATK-PW-1160) Search content by a keyword. @ATK-PW-1160 @search @content
'
,
async
({
page
})
=>
{
await
page
.
goto
(
baseUrl
);
for
(
let
item
of
searchData
)
{
await
page
.
getByRole
(
"
button
"
,
{
name
:
"
Search Form
"
}).
click
();
const
keyInput
=
page
.
locator
(
'
input:focus
'
);
await
keyInput
.
fill
(
item
.
keyword
);
await
keyInput
.
press
(
"
Enter
"
);
// Wait for search result to be shown.
await
expect
(
page
.
getByText
(
'
Search results
'
)).
toBeVisible
();
// Check that expected items are shown.
for
(
let
result
of
item
.
results
)
{
await
expect
(
page
.
getByText
(
result
)).
toBeVisible
();
}
// Check that the search keyword is highlighted in the text.
await
expect
(
page
.
locator
(
`xpath=//strong[.="
${
item
.
keyword
}
"]`
).
first
()).
toBeVisible
();
}
});
});
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