From 92da6df5ab66d0263d7b497531672453fb820013 Mon Sep 17 00:00:00 2001 From: An Phan Date: Wed, 23 Nov 2016 23:57:41 +0800 Subject: [PATCH] Add Profile screen e2e test --- .../main-wrapper/main-content/profile.vue | 14 ++++---- tests/e2e/ProfileScreenTest.php | 33 +++++++++++++++++++ tests/e2e/WebDriverShortcuts.php | 2 -- 3 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 tests/e2e/ProfileScreenTest.php diff --git a/resources/assets/js/components/main-wrapper/main-content/profile.vue b/resources/assets/js/components/main-wrapper/main-content/profile.vue index 4ac82a5b..aaf6925c 100644 --- a/resources/assets/js/components/main-wrapper/main-content/profile.vue +++ b/resources/assets/js/components/main-wrapper/main-content/profile.vue @@ -8,12 +8,12 @@
- +
- +
@@ -24,30 +24,30 @@
- +
- +
- +
diff --git a/tests/e2e/ProfileScreenTest.php b/tests/e2e/ProfileScreenTest.php new file mode 100644 index 00000000..636bb639 --- /dev/null +++ b/tests/e2e/ProfileScreenTest.php @@ -0,0 +1,33 @@ +loginAndWait(); + $this->click('a.view-profile'); + $this->see('#profileWrapper'); + // Now we change some user profile details + $this->typeIn('#profileWrapper input[name="name"]', 'Mr Bar'); + $this->typeIn('#profileWrapper input[name="email"]', 'bar@koel.net'); + $this->enter(); + $this->see('.sweet-alert'); + // Dismiss the alert first + $this->press(WebDriverKeys::ESCAPE); + $this->notSee('.sweet-alert'); + + $avatar = $this->el('a.view-profile img'); + // Expect the Gravatar to be updated + static::assertEquals('https://www.gravatar.com/avatar/36df72b4484fed183fad058f30b55d21?s=256', $avatar->getAttribute('src')); + // Check "Confirm Closing" and validate its functionality + $this->click('#profileWrapper input[name="confirmClosing"]'); + $this->refresh(); + $this->waitUntil(WebDriverExpectedCondition::alertIsPresent()); + $this->driver->switchTo()->alert()->accept(); + } +} diff --git a/tests/e2e/WebDriverShortcuts.php b/tests/e2e/WebDriverShortcuts.php index c11f8d56..cb80bf7a 100644 --- a/tests/e2e/WebDriverShortcuts.php +++ b/tests/e2e/WebDriverShortcuts.php @@ -133,6 +133,4 @@ trait WebDriverShortcuts { return $this->driver->navigate()->refresh(); } - - }