@@ -12,16 +12,14 @@ test("home page loads", async ({ page }) => {
1212
1313test ( "blank text updates with formatted output" , async ( { page } ) => {
1414 await page . getByLabel ( "Keybinds" ) . waitFor ( ) ;
15- const textbox = page . getByRole ( "textbox" ) . nth ( 1 ) ;
16- await textbox . click ( ) ;
15+ const textbox = page . locator ( "#wysiwyg-box>[role=textbox]" ) . first ( ) ;
1716 await textbox . fill ( "lorem ipsum" ) ;
1817 const output = page . locator ( "#outputbox" ) . first ( ) ;
1918 await expect ( output ) . toHaveText ( `"lorem ipsum"` ) ;
2019} ) ;
2120
2221test ( "the bold button should work" , async ( { page } ) => {
23- const textbox = page . getByRole ( "textbox" ) . nth ( 1 ) ;
24- await textbox . click ( ) ;
22+ const textbox = page . locator ( "#wysiwyg-box>[role=textbox]" ) . first ( ) ;
2523 await textbox . fill ( "lorem ipsum" ) ;
2624 await textbox . selectText ( ) ;
2725 let button = page . getByRole ( "button" , { name : "Bold " } ) ;
@@ -34,8 +32,7 @@ test("the bold button should work", async ({ page }) => {
3432} ) ;
3533
3634test ( "the italic button should work" , async ( { page } ) => {
37- const textbox = page . getByRole ( "textbox" ) . nth ( 1 ) ;
38- await textbox . click ( ) ;
35+ const textbox = page . locator ( "#wysiwyg-box>[role=textbox]" ) . first ( ) ;
3936 await textbox . fill ( "lorem ipsum" ) ;
4037 await textbox . selectText ( ) ;
4138 let button = page . getByRole ( "button" , { name : "Italic " } ) ;
@@ -48,8 +45,7 @@ test("the italic button should work", async ({ page }) => {
4845} ) ;
4946
5047test ( "the strikethrough button should work" , async ( { page } ) => {
51- const textbox = page . getByRole ( "textbox" ) . nth ( 1 ) ;
52- await textbox . click ( ) ;
48+ const textbox = page . locator ( "#wysiwyg-box>[role=textbox]" ) . first ( ) ;
5349 await textbox . fill ( "lorem ipsum" ) ;
5450 await textbox . selectText ( ) ;
5551 let button = page . getByRole ( "button" , { name : "Strikethrough " } ) ;
@@ -62,8 +58,7 @@ test("the strikethrough button should work", async ({ page }) => {
6258} ) ;
6359
6460test ( "the underline button should work" , async ( { page } ) => {
65- const textbox = page . getByRole ( "textbox" ) . nth ( 1 ) ;
66- await textbox . click ( ) ;
61+ const textbox = page . locator ( "#wysiwyg-box>[role=textbox]" ) . first ( ) ;
6762 await textbox . fill ( "lorem ipsum" ) ;
6863 await textbox . selectText ( ) ;
6964 let button = page . getByRole ( "button" , { name : "Underline " } ) ;
@@ -76,11 +71,27 @@ test("the underline button should work", async ({ page }) => {
7671} ) ;
7772
7873test ( "the obfuscation button should work" , async ( { page } ) => {
79- const textbox = page . getByRole ( "textbox" ) . nth ( 1 ) ;
80- await textbox . click ( ) ;
74+ const textbox = page . locator ( "#wysiwyg-box>[role=textbox]" ) . first ( ) ;
8175 await textbox . fill ( "lorem ipsum" ) ;
8276 await textbox . selectText ( ) ;
8377 let button = page . getByRole ( "button" , { name : "Obfuscated " } ) ;
8478 await button . click ( ) ;
8579 expect ( await textbox . locator ( "p>span.obfuscated" ) . count ( ) ) . toBeGreaterThan ( 0 ) ;
8680} ) ;
81+
82+ test ( "the shadow color button should work" , async ( { page } ) => {
83+ const textbox = page . locator ( "#wysiwyg-box>[role=textbox]" ) . first ( ) ;
84+ await textbox . fill ( "lorem ipsum" ) ;
85+ await textbox . selectText ( ) ;
86+ let button = page . getByRole ( "button" , { name : "Shadow Color" } ) ;
87+ await button . click ( ) ;
88+ const colorInput = page . locator ( 'input[aria-label="hex color"]' ) ;
89+ await colorInput . fill ( "#ff0000" ) ;
90+ await colorInput . press ( "Enter" ) ;
91+ expect (
92+ await textbox . locator ( 'p>span[style*="text-shadow"]' ) . count ( ) ,
93+ ) . toBeGreaterThan ( 0 ) ;
94+ await expect (
95+ textbox . locator ( 'p>span[style*="text-shadow"]' ) . first ( ) ,
96+ ) . toHaveAttribute ( "style" , "text-shadow: rgb(255, 0, 0) 2px 2px 0px;" ) ;
97+ } ) ;
0 commit comments