Skip to content

Commit

Permalink
Revert of adding the word CSS style at the end of the assertion that …
Browse files Browse the repository at this point in the history
…the element contains a specific CSS style #168
  • Loading branch information
TasneemNatshah committed Aug 17, 2024
1 parent 6e1908f commit 7065d1e
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions tests/step-definitions/webship.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,20 +696,7 @@ Then(/^(I|we)* should not see (a|an) "([^"]*)?" element by( its)*( "([^"]*)?")*
* Example: Then the "body" element should contain "color:white;"
*
*/
Then(/^the "([^"]*)?" element should contain "([^"]*)?"$/, function (attrValue, elementCss) {

const hasASpace = attrValue.indexOf(' ');

var selector = '';
if((attrValue.startsWith('#') || attrValue.startsWith('.')) && hasASpace == -1){
selector = attrValue;
}
else if (hasASpace == -1){
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
}
else if (hasASpace > -1){
selector ='[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
}
Then(/^the "([^"]*)?" element should contain "([^"]*)?"$/, function (selector, elementCss) {

elementCss = elementCss.replace(";", '');
const cssPropertyArr = elementCss.split(":");
Expand All @@ -728,20 +715,7 @@ Then(/^the "([^"]*)?" element should contain "([^"]*)?"$/, function (attrValue,
* Example: Then the "#uname" element should not contain "border:solid 5px red;"
* Example: Then the "pword" element should not contain "font-size: 26px;"
*/
Then(/^the "([^"]*)?" element should not contain "([^"]*)?"$/, function (attrValue, elementCss) {

const hasASpace = attrValue.indexOf(' ');

var selector = '';
if((attrValue.startsWith('#') || attrValue.startsWith('.')) && hasASpace == -1){
selector = attrValue;
}
else if (hasASpace == -1){
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
}
else if (hasASpace > -1){
selector ='[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
}
Then(/^the "([^"]*)?" element should not contain "([^"]*)?"$/, function (selector, elementCss) {

elementCss = elementCss.replace(";", '');
const cssPropertyArr = elementCss.split(":");
Expand Down

0 comments on commit 7065d1e

Please sign in to comment.