2023-10-15 20:37:03 +02:00
|
|
|
import { create, isVisible, text } from 'ember-cli-page-object';
|
2018-12-29 20:35:04 +01:00
|
|
|
import { currentURL } from '@ember/test-helpers';
|
2017-08-26 02:14:09 +02:00
|
|
|
|
2023-10-15 20:37:03 +02:00
|
|
|
const urlMatches = function (regExp) {
|
|
|
|
return function () {
|
2017-08-26 02:14:09 +02:00
|
|
|
return regExp.test(currentURL());
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const definition = {
|
|
|
|
showsExpirationWarning: isVisible('.expiration-warning'),
|
2019-06-07 11:22:13 +02:00
|
|
|
url: text('.poll-link .link code'),
|
2023-10-15 20:37:03 +02:00
|
|
|
urlIsValid: urlMatches(
|
|
|
|
/^\/poll\/[a-zA-Z0-9]{10}\/participation\?encryptionKey=[a-zA-Z0-9]{40}$/
|
|
|
|
),
|
2017-08-26 02:14:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export default create(definition);
|