Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F1262435
todo.test.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
todo.test.ts
View Options
import
assert
from
"assert"
;
import
{
Browser
,
BrowserContext
,
Page
}
from
"@playwright/test"
;
import
ADMIN_CREDENTIALS
from
"../default-admin-credentials.js"
;
import
{
getBrowser
}
from
"../test_utils/browser-creator.js"
;
import
{
LONG_TEST_TIMEOUT
,
VERY_LONG_TEST_TIMEOUT
}
from
"../test_utils/webhint.js"
;
import
{
withProdApp
}
from
"../test_utils/with-prod-app.js"
;
import
{
SignInURL
,
TodoURL
}
from
"./urls.js"
;
describe
(
"Todo webhint"
,
()
=>
{
it
(
"doesn't crash"
,
async
function
()
{
return
withProdApp
(
async
({
rest_api
})
=>
{
await
assert
.
rejects
(
async
()
=>
{
await
rest_api
.
get
(
TodoURL
);
},
{
name
:
"Error"
}
);
});
},
VERY_LONG_TEST_TIMEOUT
);
});
describe
(
"Todo"
,
function
()
{
let
page
:
Page
;
let
browser
:
Browser
;
let
context
:
BrowserContext
;
const
username
=
ADMIN_CREDENTIALS
.
username
;
const
password
=
ADMIN_CREDENTIALS
.
password
;
beforeEach
(
async
()
=>
{
browser
=
await
getBrowser
();
context
=
await
browser
.
newContext
();
page
=
await
context
.
newPage
();
});
afterEach
(
async
()
=>
{
await
context
.
close
();
});
describe
(
"todo test"
,
()
=>
{
it
(
"create and delete task"
,
async
function
()
{
await
withProdApp
(
async
({
base_url
})
=>
{
await
page
.
goto
(
base_url
);
await
page
.
getByRole
(
"link"
,
{
name
:
"Sign in"
}).
click
();
await
page
.
getByPlaceholder
(
"text"
).
click
();
await
page
.
getByPlaceholder
(
"text"
).
fill
(
username
);
await
page
.
getByPlaceholder
(
"text"
).
press
(
"Tab"
);
await
page
.
getByPlaceholder
(
"password"
).
fill
(
password
);
await
page
.
getByPlaceholder
(
"password"
).
press
(
"Enter"
);
await
page
.
getByRole
(
"link"
,
{
name
:
"To do app"
}).
click
();
await
page
.
getByPlaceholder
(
"Write an Matrix bot"
).
click
();
await
page
.
getByPlaceholder
(
"Write an Matrix bot"
)
.
fill
(
"randomtasdk"
);
await
page
.
getByRole
(
"button"
,
{
name
:
"Wyślij"
}).
click
();
await
page
.
waitForSelector
(
".form-message.form-message--success"
);
await
page
.
locator
(
"turbo-frame"
).
getByRole
(
"checkbox"
).
check
();
await
page
.
locator
(
"turbo-frame"
).
getByRole
(
"checkbox"
).
uncheck
();
await
page
.
locator
(
"turbo-frame"
)
.
getByRole
(
"button"
,
{
name
:
"Delete"
})
.
click
();
await
page
.
getByRole
(
"link"
,
{
name
:
"Logout"
}).
click
();
await
page
.
waitForSelector
(
`a[href="
${
SignInURL
}
"]`
);
});
},
VERY_LONG_TEST_TIMEOUT
);
});
describe
(
"can access test"
,
()
=>
{
it
(
"access url"
,
async
function
()
{
await
withProdApp
(
async
({
base_url
})
=>
{
await
page
.
goto
(
base_url
);
try
{
await
page
.
waitForSelector
(
`a[href="
${
SignInURL
}
"]`
);
await
page
.
goto
(
base_url
+
TodoURL
);
await
page
.
waitForSelector
(
'body:has-text("no access")'
);
}
catch
(
error
)
{
console
.
error
(
error
);
}
});
},
LONG_TEST_TIMEOUT
);
});
});
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Fri, Jan 24, 03:46 (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
601538
Default Alt Text
todo.test.ts (2 KB)
Attached To
Mode
rPHOTOAPP photo-app-demo
Attached
Detach File
Event Timeline
Log In to Comment